Giter VIP home page Giter VIP logo

Comments (31)

CedricGuillemet avatar CedricGuillemet commented on August 15, 2024 1

from imguizmo.

CedricGuillemet avatar CedricGuillemet commented on August 15, 2024

Hi Khanldris, you have to call the method https://github.com/CedricGuillemet/ImGuizmo/blob/master/ImGuizmo.h#L172 to specify the view/projection and object matrices

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

I am having this issue too. I've passed in the view and projection matrices from the camera as well as the matrix of where I would like the gizmo to be drawn but nothing seems to draw on the ImGuizmo side.

from imguizmo.

CedricGuillemet avatar CedricGuillemet commented on August 15, 2024

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

It on an engine im working on, everything seems to work on the sample app provided. Excellent work on it by the way. It's very impressive! Here is the code I am calling ImGuizmo `// Start ImGui frame
ImGui_ImplDX11_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();
ImGuizmo::BeginFrame();

ImGuizmo::Enable(true);
//ImGuizmo::SetRect(0, 0, (float)windowWidth, (float)windowHeight);

ImGuizmo::SetDrawlist();
float * camview = editorCamera.GetViewMatAsFloatArr();
float * camProj = editorCamera.GetProjMatAsFloatArr();
ImGuizmo::Manipulate(camview, camProj, ImGuizmo::SCALE, ImGuizmo::LOCAL, pSelectedEntity->GetTransform().GetWorldMatAsFloatArr());`

from imguizmo.

CedricGuillemet avatar CedricGuillemet commented on August 15, 2024

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

It also in DirectX11 so the XMMATRIX need to be converted to a XMFLOAT4x4 thn to a float* to comply with the ImGuizmo::Minipulate()
`XMFLOAT4X4 temp;
XMStoreFloat4x4(&temp, GetViewMatrix());

float result[16] =
{
	temp._11, temp._21, temp._31, temp._41,
	temp._12, temp._22, temp._32, temp._42,
	temp._13, temp._23, temp._33, temp._43,
	temp._14, temp._24, temp._34, temp._44
};

return result;`

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

Also tried this as well and nothing
float result[16] = { temp._11, temp._12, temp._13, temp._14, temp._21, temp._22, temp._23, temp._24, temp._31, temp._32, temp._33, temp._34, temp._41, temp._42, temp._43, temp._44 };

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

Row and Column major didn't work is there something else I'm forgetting? Do I need to give the device context or anything? The first batch of code I posted was everything I have related to ImGuizmo calls.

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

Still nothing

from imguizmo.

CedricGuillemet avatar CedricGuillemet commented on August 15, 2024

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

ImGuizmoWindowInfo

from imguizmo.

CedricGuillemet avatar CedricGuillemet commented on August 15, 2024

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

ImGuizmoLocals

from imguizmo.

CedricGuillemet avatar CedricGuillemet commented on August 15, 2024

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

GraphicsLocals

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

Something must have gotten lost in the conversions?

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

When I go through line by line in the array assignments the data looks good though

from imguizmo.

CedricGuillemet avatar CedricGuillemet commented on August 15, 2024

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

I've moved all conversions to just before the ImGuizmo::Manipulate method and get this as a result. It looks like part of the translate tool but it can only be seen while the ImGui windows are over it and only at particular angles. I've also tried row major and column major forms for the camera view and projection as well as the model's world matrix

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

Capture

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

Did some more digging and using the IsOver will return true when I hover over an object that is supposed to have a guizmo. But it is not drawing.

from imguizmo.

CedricGuillemet avatar CedricGuillemet commented on August 15, 2024

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

It seems to be Here is an example of how I'm getting and storing them. It's done just before the Manipulate call and not in any other methods XMFLOAT4X4 camViewTemp; XMStoreFloat4x4(&camViewTemp, editorCamera.GetViewMatrix()); float camView[16] = { camViewTemp._11,camViewTemp._21, camViewTemp._31, camViewTemp._41, camViewTemp._12,camViewTemp._22, camViewTemp._32, camViewTemp._42, camViewTemp._13,camViewTemp._23, camViewTemp._33, camViewTemp._43, camViewTemp._14,camViewTemp._24, camViewTemp._34, camViewTemp._44 };

from imguizmo.

CedricGuillemet avatar CedricGuillemet commented on August 15, 2024

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

worldToPos

from imguizmo.

DontBelieveMe avatar DontBelieveMe commented on August 15, 2024

Hi, did you ever fix this, or even find out what the issue was @GCourtney27? I'm having the same problem with a DirectX11 renderer.

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

@DontBelieveMe I haven't taken a look at it in a while but I think it might have been a problem with the clear screen and draw order of ImGui and the rendering algorithm I was using. It also could have been I wasn't converting the XMMatrices to float* in the right way. I'll look at it again and get back to you.

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

@DontBelieveMe I finally had a chance to look at it and got it to show up on the screen. Using this code
ImGuizmo_DX_Code

That will give something like this notice the translate guizmo at the bottom :D
ImGuizmo_DX_InAction
You can grab the object and move it around the scene but if you let go he will snap back to where he started. I'm still working on that.
I believe the problem I was having was a mixture of trying to pass in the wrong matrices with the wrong data sizes and making copies of them. Eventually they just got corrupted. I think another important note was I was using the viewports with docking enabled when it wasn't working. With it enabled I think it was covering up what little guizmo was there to see (because it was stretched and morphed by the corrupted matrices). In the code I shared, viewports are off but docking is enabled. Also worth mentioning, I have rewritten my renderer with DirectX 12 so this is also a proof of concept that it works on that platform. Since no API calls are made I think it's safe to say this code will also run on DirectX 11 though I haven't tested that.

from imguizmo.

adv-sw avatar adv-sw commented on August 15, 2024

Issue is you're using OpenGL coord system (+X right, +Y up, -Z forward).
DirectX tends to use +Z forward.
Also if I remember the clip spaces are different so the projection transforms are different.
If you have a version that works with DirectX, that'd be appreciated & would save me a job :)

from imguizmo.

GCourtney27 avatar GCourtney27 commented on August 15, 2024

@adv-sw I have fixed it now. The problem was not using an OpenGL coordinate system it was because of how I was handling the matrices and passing them to ImGuizmo. The code posted above in the screenshot will get you up and running using the DirectX math library.

from imguizmo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.