(Hi! I havent programmed asm for maybe 5yrs, so im very rusty :)

Im writing a simple particle-system, where the particles has a starting and a ending color, and a lifetime.
Each color is 32bit, consisting of four 8bit components: ARGB (alpha,red,green,blue)
I then just interpolate between a startcolor and an endcolor like so:

deltacolor=(endColorRed-StartColorRed) /(frames alive)

Then each frame i want to add currentcolor=currentcolor+deltacolor
And then draw the article in that color.

Soo.. i found these simd? instructions
paddusb (add unsigned byte)
paddsb (add signed byte)

The thing is I want to add a colordelta, which are four packed signed bytes, to the four packed
unsigned bytes in currentcolor for each component, and also not let the color go past the ceiling (past 255).


I guess this would only add together two colors... but not a unsigned color and a signed colordelta
__asm
{
movd mm0,color
movd mm1,colordelta
paddusb mm0,mm1
movd color,mm0
emms
}

Anyone has some tips for me ?
Posted on 2003-11-18 10:17:23 by TechnoCore