Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

How to change from left to right handed coordinate system? #2642

Closed
ChrisDenham opened this issue Jun 5, 2020 · 4 comments · Fixed by #2643
Closed

How to change from left to right handed coordinate system? #2642

ChrisDenham opened this issue Jun 5, 2020 · 4 comments · Fixed by #2643

Comments

@ChrisDenham
Copy link
Contributor

Is there a "proper" way to switch Urho3D to use a right handed coordinate system?
(As Urho defaults to a left handed system)

The reason I need this is for compatibility with a large system I am trying to adapt to use Urho3D for the 3D engine.

So far, I seem to have made good progress by misusing the Camera::SetFlipVertical function in both DX9 and OGL modes. However, this is not ideal because that seems to really be intended for internal use, plus in OGL I have to keep re-enabling it because Urho resets it to false after each frame. I think there are probably other things that will bite me for this kludge too.

I did wonder if setting a custom projection via Camera::SetProjection, but that seems to disable the automatic aspect ratio adjustment. So I wondered if there is something I'm missing that would help me here?

@eugeneko
Copy link
Contributor

eugeneko commented Jun 5, 2020

The simplest way to go is to tweak "flip vertical" so it's not reset after each frame.
This is basically the same thing as "custom projection", except it also properly handles culling.

@ChrisDenham
Copy link
Contributor Author

Good shout, thanks. Removing the reset seems to have fixed the issue. Although presumably when Urho makes use of it internally to fix render to texture issue difference between OGL and DX, that would need to be the inverse of whatever the setting set from outside?

@eugeneko
Copy link
Contributor

eugeneko commented Jun 5, 2020

Yes, OpenGL needs reverse camera orientation when rendering to texture. Should be easy to fix, can be merged into master.

@ChrisDenham
Copy link
Contributor Author

Ok, I'll try and submit a PR next week. Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants