Setting diffuse color as RenderState or sthg. like that ?

Started by
4 comments, last by bitbuster 17 years, 7 months ago
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
- www.sunage-the-game.com - - www.vertex4.com - Sauk says, 'Loading is fun...'
Advertisement
It looks beautiful [smile].

I'd like to hear what others have to say before I make my pledge.

Admiral
Ring3 Circus - Diary of a programmer, journal of a hacker.
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.
Blend with TFACTOR?
Byron Atkinson-JonesXiotex Studioswww.xiotex.com
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....
- www.sunage-the-game.com - - www.vertex4.com - Sauk says, 'Loading is fun...'
ok, yeah, worx.
Thanx guys [smile]
shame on me.
- www.sunage-the-game.com - - www.vertex4.com - Sauk says, 'Loading is fun...'

This topic is closed to new replies.

Advertisement