|
|
Hello,
I have created a universe, the sun is at 0/0/0, and 30 planets rotating around it.
Now I added some DOT3-Bumpmapping, but I am not sure about the correct direction.
So is the following code correct, when 0/0/0 is the sun which is the light source, and planet is the current planet?
[code]
m_vLight.x := planet3d.x;
m_vLight.y := planet3d.y;
m_vLight.z := planet3d.z;
D3DXVec3Normalize(m_vLight, m_vLight);
dwFactor := VectortoRGBA(m_vLight, 0.0);
SetTexture(0, planet3d.bumptexture);
SetRenderState(D3DRS_TEXTUREFACTOR, dwFactor);
SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TFACTOR);
SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_DOTPRODUCT3);
[/code]
Thanks a lot,
Firle
|