Closed saedrna closed 2 years ago
I answered the question myself. Just do the following.
AppData
with coordinates in the world space.Im3d::Gizmo("Gizmo", xform)
with xform = translate(1100, 1100, 1100)
.vertexData
with 'uViewProjMatrix' set to the MVP matrix as proj x view x model
.
Currently, my scene has already been translated, scaled, and rotated and I want to place a gizmo in such a scene. For example, if my scene is a bounding box of size 2000, I already translate (1000, 1000, 1000) and scale (0.001, 0.001, 0.001) to the scene (get the
model
matrix), and view the scene from (0, 0, 5) to (0, 0, 0) (get theview
matrix) with a perspective camera (get the 'proj' matrix).How do I fill the
AppData
correctly? I can already calculate the camera position and direction and cursor origin and direction in world space. How can I place a gizmo at the location of the original (1100, 1100, 1100) coordinate? Thanks!