Jump to content

  • Log In with Google      Sign In   
  • Create Account

coordinate system


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Jerry.Mouse   Members   -  Reputation: 106

Like
0Likes
Like

Posted 23 May 2014 - 08:44 AM

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. 
 
 
 
 
 
 
 
 
 
 
 
 

 

Attached Files



Sponsor:

#2 Buckeye   Crossbones+   -  Reputation: 6313

Like
3Likes
Like

Posted 23 May 2014 - 09:25 AM


+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, 23 May 2014 - 09:27 AM.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.


#3 Jerry.Mouse   Members   -  Reputation: 106

Like
0Likes
Like

Posted 23 May 2014 - 11:03 AM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS