Sign in to follow this  
bitbuster

Setting diffuse color as RenderState or sthg. like that ?

Recommended Posts

Hi guys ! I have a damn problem: I have a lot of "billboard"/bitmap-graphics to draw in my game. I have a lot of frames of 2d-troopers running around, and i cache them in realtime into a texture when they are needed. Then when i want to display them i use calculate the right texture-coordinates to get the right part of the caching texture and simple draw a quad with DrawPrimitive. I also have a lot of smoke effects and stuff like that, that work the same way. So far so good. Applying a diffuse color to these objects (troopers, smoke particels, aso.) is no problem when I'm drawing it with DrawPrimitive only. But now i want to use vertex buffers to speed things up. These vertex buffers should ofcourse not include any color information, because the color should still be dynamically changable ? So is there any possibility to just define a FVF like the below one, filling vertex buffers at one initial time with vertices of that type, and then just switch diffuse color of it before DrawPrimitiveVB () ??
#define D3DFVF_SAVERTEX ( D3DFVF_XYZRHW | D3DFVF_TEX1 )

typedef struct  
{
    D3DVALUE    sx;             
    D3DVALUE    sy;
    D3DVALUE    sz;
    float	rhw;
    D3DVALUE    tu;             /* Texture coordinates */
    D3DVALUE    tv;
} D3DSAVERTEX;

ah yeah, here's a screen: Cheers, Roman

Share this post


Link to post
Share on other sites
Hmm. I'm not sure if I understand - is this for changing the trooper colors? I wonder if you couldn't use some quick way of operating on the textures themselves?
I remember from using diffuse materials from before, it seemed that diffuse color really only showed up if the texture was not used.
Sorry, I'm trying to be helpfull, but I'm dumb.

Share this post


Link to post
Share on other sites
Thanx, Admiral [smile][smile][smile]

renman29: Yeah i want the possibility to do a color modulation of the troopers, or whatever => e.g. i have a greyscale smoke particle - texture, and i want to render
it out modulated with RGBA(0,0,255,255) = blue only.

XiotexStudios: ahh, TFACTOR could work. i thought its just a float value to fade down colors. hmmm. have to try that....

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this