[Closed] vertex renderer in ortho view
hi, all. in how to … develop a vertex renderer, the code use viewport.getTm to transform the vertext from wolrd space to viewport space, but the docs says getTm only work good for non-ortho camera, what do I need to change?
thePos = (getVert theMesh v)* viewport.getTM()
screen_origin = mapScreenToView [0,0] (thePos.z) [width,height]
end_screen = mapScreenToView [width,height] (thePos.z) [width,height]
worldSize = screen_origin-end_screen
xAspect = width/(abs worldSize.x)
yAspect = height/(abs worldSize.y)
renderCoords = point2 (xAspect*(thePos.x- screen_origin.x)) (-(yAspect*(thePos.y-screen_origin.y)))
all help is appreciated.
I confused,do you mean thePos = (getVert theMesh v)* viewport.getTM()
no need any change,
If the viewport is a Camera, the viewport.getTM() returns the inverse of the camera’s transformation matrix. If the viewport is a Perspective or Ortho view, the matrix is already inverted
iaoai, thanks for your relpy.
I try the viewport.getTm to transform my vertext, it’s just work fine but the viewport scale seems a little diffrent from the camera setting, I have to multi ablout 1.9 both x and y to get the final vertex position. Is it the zoom problem?
The attachment describe the problem, thank you guys again.