I am currently developing my own 3DEngine and I use procedural textures. One of these textures uses that simple fire-effect. I think all of you know that. The texture is 8Bit (so Palettized). My question is:
How can optimize the routine below ??? It's more a less a Blur-Filter. Is it worth to do it in assembler or can you think of other optimisations ??
code:void C8BitTexture::Fire(int blurval){ long x,y; int color = 0; for (y=1;y for (x=1;x color = 0; color += (int)GetByte((y*width)+x); color += (int)GetByte(((y-1)*width)+x); color += (int)GetByte((y*width)+x+1); color += (int)GetByte(((y+1)*width)+x); color += (int)GetByte((y*width)+x-1); //If we divide by 5 and do not set color to 0 it gives a very //interesting effect color = color / blurval; if (color > palette.numColors) color = palette.numColors; SetPixel(x,y-1,color); } }}
Phillip
[This message has been edited by Phillip Schuster (edited November 08, 1999).]
[This message has been edited by Phillip Schuster (edited November 08, 1999).]
[This message has been edited by Phillip Schuster (edited November 08, 1999).]