Jump to content
  • Advertisement
Sign in to follow this  
Jerry.Mouse

coordinate system

This topic is 1583 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

Hello,

 

I have a small problem. I have a small triangle - see attachments "coordinatesystem.bmp":

 

  v[0].pose = SlimDX::Vector3( -0.5f, +0.0f, 0.0f );
    v[0].color = 0x000fff; //
 
  v[1].pose = SlimDX::Vector3( +2.5f, +0.0f, 0.0f );
    v[1].color = 0x000fff; //
 
  v[2].pose = SlimDX::Vector3( +0.0f, +1.5f, 0.0f );
    v[2].color = 0x000fff; // 
 
 
Unfortunately, this triangle is depicted reverse. +X axis is on the left side, -X axis in on the righ side, +Y is Top, -Y is bottom.
+Z heading to me, out of screen and -Z heading to screen. see the attachments. 
 
I am using only these commands:
 
sl_device->SetTransform( SlimDX::Direct3D9::TransformState::View, 
                                          SlimDX::Matrix::LookAtLH( SlimDX::Vector3( 0.0f,  0.0f, 15.0f ), // 
                                                                                    SlimDX::Vector3( 0.0f,  0.0f,  1.0f ), 
                                                                                    SlimDX::Vector3( 0.0f, +1.0f,  0.0f ) ) );
 
sl_device->SetTransform( SlimDX::Direct3D9::TransformState::Projection, 
                                          SlimDX::Matrix::PerspectiveFovLH( (float)Math::PI / 2, 1.76795f, 0.1f, 100.0f) );
 
 
 
If I use these commands:
 
sl_device->SetTransform( SlimDX::Direct3D9::TransformState::View, 
                                          SlimDX::Matrix::LookAtLH( SlimDX::Vector3( 0.0f,  0.0f, 15.0f ), // 
                                                                                    SlimDX::Vector3( 0.0f,  0.0f,  1.0f ), 
                                                                                    SlimDX::Vector3( 0.0f, +1.0f,  0.0f ) ) );
 
     sl_device->SetTransform( SlimDX::Direct3D9::TransformState::World, 
                              SlimDX::Matrix::Translation( 0.0f, 0.0f, 0.0f ) *
                              SlimDX::Matrix::RotationY( 0.785f ) *
                              SlimDX::Matrix::RotationX( 0.785f ) *
                              SlimDX::Matrix::RotationZ( 0.785f )  
                            );  
 
sl_device->SetTransform( SlimDX::Direct3D9::TransformState::Projection, 
                                          SlimDX::Matrix::PerspectiveFovLH( (float)Math::PI / 2, 1.76795f, 0.1f, 100.0f) );
 
 
 
Situation is identical  see attachments "coordinatesystem2.bmp"
 
I supposed that SlimDX uses left-hand coordinate system. It is: +X is on the right side, -X is on the left side,+Y is top, -Y bottom,
+Z headings to my LCD monitor and -Z heading to me. 
 
What is wrong ? I have somewhat reversed coordinate system. 
 
 
 
 
 
 
 
 
 
 
 
 

 

Share this post


Link to post
Share on other sites
Advertisement

+X axis is on the left side, -X axis in on the righ side, +Y is Top, -Y is bottom.
+Z heading to me, out of screen and -Z heading to screen

That's how you have the view matrix setup. Eyepoint along the +Z, looking at the origin. That puts the +X axis on the left in a LH system.

 

Try setting your view with Eye along -Z somewhere, looking at the origin.

 

EDIT: Not sure how you have your cullmode setup, but you have the vertices in ccw order.

Edited by Buckeye

Share this post


Link to post
Share on other sites

Thanks. It helped. 

 

this is correct: 

 

sl_device->SetRenderState( SlimDX::Direct3D9::RenderState::CullMode, SlimDX::Direct3D9::Cull::None ); 
sl_device->SetRenderState( SlimDX::Direct3D9::RenderState::Lighting, false ); 
 
sl_device->SetTransform( SlimDX::Direct3D9::TransformState::View, 
                                          SlimDX::Matrix::LookAtLH( SlimDX::Vector3( 0.0f,  0.0f, -15.0f ), // 
                                                                                    SlimDX::Vector3( 0.0f,  0.0f, +15.0f ), 
                                                                                    SlimDX::Vector3( 0.0f, +1.0f,  0.0f ) ) );
 
 
sl_device->SetTransform( SlimDX::Direct3D9::TransformState::World, 
                                          SlimDX::Matrix::Translation( 0.0f, 0.0f, 0.0f ) *
                                          SlimDX::Matrix::RotationY( +0.3f ) *
                                          SlimDX::Matrix::RotationX( -0.2f ) *
                                          SlimDX::Matrix::RotationZ( 0.0f )  
                                        );   
 
 

+X is on the right side, +Y is top, +Z is in LCD monitor.

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!