Jump to content
  • Advertisement
Sign in to follow this  

Loading a mesh with normals

This topic is 4095 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does LoadMeshFromFileInMemory() loads it with the normal data as well ? I have a .x file with normals data but it doesn't seem to affect the mesh when I use lighting. What needs to be done ? thx.

Share this post

Link to post
Share on other sites
If the .X file contains normals, it will be loaded with normals. Are you sure everything else is correct?

Share this post

Link to post
Share on other sites
I tell you what. The object is rendered with the correct color but when I rotate it around the y axis its doesn't seem to be darker or lighter during the rotation.
the object is places at the origin 0,0,0 and the light (point light) is places at 0,0,-50. I set light data as follows:

m_Light.Type = D3DLIGHT_POINT;
m_Light.Diffuse.a = 1.0f;
m_Light.Diffuse.r = 1.0f;
m_Light.Diffuse.g = 1.0f;
m_Light.Diffuse.b = 1.0f;
m_Light.Ambient = m_Light.Diffuse;
m_Light.Position.x = 0.0f;
m_Light.Position.y = 0.0f;
m_Light.Position.z = -50.0f;
m_Light.Range = 100.0f;
m_Light.Falloff = 1.0f;
m_Light.Attenuation1 = 1.0f;

D3D9DEVICE()->SetLight(0, &m_Light);
D3D9DEVICE()->LightEnable( 0, true);
D3D9DEVICE()->SetRenderState(D3DRS_LIGHTING, true);
D3D9DEVICE()->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_XRGB(255, 255, 255));

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!