Closed FSY1901 closed 2 years ago
Did you do the screen shots with an identity matrix for the cube?
Also, can you try to negate this value : https://github.com/CedricGuillemet/ImGuizmo/blob/a7ec0dd3b9e7dbd253c8ca891bbf621d82e3c804/ImGuizmo.cpp#L1038
Did you do the screen shots with an identity matrix for the cube?
No the cube is scaled and translated
Also, can you try to negate this value :
How would I do that?
If you meant that:
gContext.mReversed = !((nearPos.z/nearPos.w) > (farPos.z / farPos.w));
It didn't work.
Do you get a correct rotation gizmo when matrix is identity ?
Do you get a correct rotation gizmo when matrix is identity ?
No
can you try to use the view & projection matrix computation from the sample? I guess it's one of them that doesn't fit.
can you try to use the view & projection matrix computation from the sample? I guess it's one of them that doesn't fit.
My view & projection matrix are calculated with glm:
projection = glm::perspective(glm::radians(45.0f), (float)m_window.m_width / (float)m_window.m_height, 0.01f, 100.0f);
view = glm::lookAt(cameraPos, cameraPos + cameraFront, Up);
They have worked so far with everything. And I don't understand what you mean by:
can you try to use the view & projection matrix computation from the sample?
Do you mean the two functions from main.cpp?
yes, maybe they are different from glm, for some reason.
can you try to use the view & projection matrix computation from the sample? I guess it's one of them that doesn't fit.
So I did this and it looks like this:
float _pers[16];
Perspective(45.0f, (float)m_PanelSize.x / (float)m_PanelSize.y, 0.1f, 100.0f, _pers);
float _view[16] =
{ 1.f, 0.f, 0.f, 0.f,
0.f, 1.f, 0.f, 0.f,
0.f, 0.f, 1.f, 0.f,
0.f, 0.f, 0.f, 1.f };
float eye[] = {Camera::GetMain()->position.x, Camera::GetMain()->position.y , Camera::GetMain()->position.z };
glm::vec3 direction;
direction.x = Camera::GetMain()->rotation.x;
direction.y = Camera::GetMain()->rotation.y;
direction.z = Camera::GetMain()->rotation.z;
glm::vec3 front = glm::normalize(direction);
float at[3] = {
eye[0] + front.x,
eye[1] + front.y,
eye[2] + front.z
};
float up[3] = {0, 1, 0};
LookAt(eye, at, up, _view);
ImGuizmo::Manipulate(_view, _pers, (ImGuizmo::OPERATION)op, ImGuizmo::MODE::LOCAL, glm::value_ptr(transform));
The result is still not right. The gizmos are off and the rotation gizmo is still flipped. I did it this way because I didn't understand what CamDistance in main.cpp was. So, what did I do wrong here?
can you share your code on github? I can take a look
The code is already on Github. The Project is called 'FSY-Engine'. The code is in FSY/src/D FSY/Application/Application.cpp
Though I should warn you that the code isn't very clean as I'm still working on it. The part where i render the gizmos is in 'RenderUI()'.
can you share your code on github? I can take a look
Have you found anything?
not yet
OK I fixed it: In the function 'DrawRotationGizmo()' you calculate a float 'ng' like this:
float ng = angleStart + circleMul * ZPI * ((float)i / (float)halfCircleSegmentCount);
And basically for me it was just:
float ng = angleStart + -circleMul * ZPI * ((float)i / (float)halfCircleSegmentCount); //added a minus before circleMul
not yet
I don't know if you have seen it, but i fixed it(The comment above this one). I'm just telling you so you don't have to look for a fix.
Yes, I've seen the comment. Been busy lately :(
My Translation and Scaling Gizmos work fine and are oriented in the right way. My Rotation Gizmo works more or less but the orientation is messed up, as you can see below:
I have no idea what might be wrong because the other two gizmos are displayed correctly(I use OpenGL's right handed coordinate system):
What might be the Issue? Thanks in advance.