Jump to content
  • Advertisement
Sign in to follow this  

calculating clip planes from matrices

This topic is 4844 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 anyone see a problem with this? I'm suspecting maybe plain matrix4*vector4 multiplication doesn't transform planes correctly.
Vector4 p[6];
Matrix4 matWorld;
Matrix4 matView;
Matrix4 matProj;
Matrix4 z;
pDevice->GetTransform(D3DTS_WORLD,(struct D3DXMATRIX *)&matWorld);
pDevice->GetTransform(D3DTS_VIEW,(struct D3DXMATRIX *)&matView);
pDevice->GetTransform(D3DTS_PROJECTION,(struct D3DXMATRIX *)&matProj);	
//Plane equation: ax+by+cz+d>0
p[0]=z.Transform(Vector4(0.0f,0.0f,1.0f,0.0f)); 	//Front:	z>0
p[1]=z.Transform(Vector4(0.0f,0.0f,-1.0f,1.0f)); 	//Back:		z<1
p[2]=z.Transform(Vector4(1.0f,0.0f,0.0f,1.0f)); 	//Left:		x>-1
p[3]=z.Transform(Vector4(-1.0f,0.0f,0.0f,1.0f)); 	//Right:	x<1
p[4]=z.Transform(Vector4(0.0f,-1.0f,0.0f,1.0f)); 	//Top:		y<1
p[5]=z.Transform(Vector4(0.0f,1.0f,0.0f,1.0f)); 	//Bottom:	y>-1

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!