Skip to main content
gamedev.net
🔒 Locked

weird lightning problem...

Started by Gilzu Jan 10, 2003 at 11:52 AM 2 replies 300+ views
Original Post
Gilzu
Gilzu
i''m writing my own mesh loading class, but have this weird problem: whenever i rotate my mesh, the directional light i''m using rotates with it! my code:
  
void CMeshLib::Render(float dx, float dy, float dz, float dr, float dp, float di)
{
	if (Loaded==false) {
		return;
	};

	D3DXMATRIX matWorld;  
	D3DXMatrixTranslation(&matWorld, dx, dy, dz);
	g_pd3dDevice->SetTransform(D3DTS_WORLD, &matWorld);
	D3DXMatrixRotationYawPitchRoll(&matWorld, D3DXToRadian(dr), D3DXToRadian(dp), D3DXToRadian(di));
	g_pd3dDevice->MultiplyTransform(D3DTS_WORLD, &(D3DMATRIX)matWorld);

        // and run the vertex buffer...

}
  
anybody have an idea whats the prob? 10x
Gil Zussman gil@gilzu.com http://www.gilzu.com
[email=gil@gilzu.com]Gil Zussman[/email]Check out Goose Chase, Coming this fall!http://www.gilzu.com
tok_junior
tok_junior
After a quick look, i can just say you should complete the matrix-calculation BEFORE you set the transformstate to it.
It prolly won''t help, but you might as well try it


--
MFC is sorta like the swedish police... It''''s full of crap, and nothing can communicate with anything else.
Gilzu
Gilzu
do you mean something like this?

  
D3DXMATRIX mat1, mat2, mat;
D3DXMatrixTranslation(&mat1, dx, dy, dz);
D3DXMatrixRotationYawPitchRoll(&mat2, D3DXToRadian(dr), D3DXToRadian(dp), D3DXToRadian(di));
D3DXMatrixMultiply(&mat,&mat2,&mat1);
g_pd3dDevice->SetTransform(D3DTS_WORLD, &mat);


doest work either.
i have a spinning model that the light spins with it,
but the other object have thir own lightning directions.

help?



Gil Zussman
gil@gilzu.com
http://www.gilzu.com
[email=gil@gilzu.com]Gil Zussman[/email]Check out Goose Chase, Coming this fall!http://www.gilzu.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.