Archived

This topic is now archived and is closed to further replies.

Guest Anonymous Poster

d3dim directional lights question

Recommended Posts

Do other types of lights work correctly? If they do then you just have something for the directional light setup wrong. If not then something else is wrong. Put your code up somewhere so i can take a look at it.

Josh

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
what does the d3dlight7 dvDirection property do for directional lights? it doesn't seem to be doing anything for me. everything looks the same when the x y and z and different and not zero.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
its the like the d3dim lights sample
this is in b/w beginscene and endscene

LONG fTimeKey = timeGetTime();
FLOAT x = sinf( fTimeKey*2.000f );
FLOAT y = sinf( fTimeKey*2.246f );
FLOAT z = sinf( fTimeKey*2.640f );

// Set up the light structure
D3DLIGHT7 light;
ZeroMemory( &light, sizeof(light) );
light.dltType = D3DLIGHT_DIRECTIONAL;
light.dcvDiffuse.r = 0.5f + 0.5f * x;
light.dcvDiffuse.g = 0.5f + 0.5f * y;
light.dcvDiffuse.b = 0.5f + 0.5f * z;
light.dvDirection = D3DVECTOR( x, y, z );

pd3dDevice->SetLight( 0, &light );
pd3dDevice->LightEnable( 0, TRUE );

Share this post


Link to post
Share on other sites