You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was poking around a little after I created this issue, and for a camera helper, it'd be nice to have .Near(), .Far() and .Fov() (.FOV or .FieldOfView) on the gfx.Camera struct, so that the helper can be created after the camera perspective is set. Now it's just used for the transformation matrix, right?
Then the camera frustum helper could just read those values on the camera it's connected to, and update its vertices.
Comment by slimsag Thursday Jan 15, 2015 at 12:44 GMT
As of right now gfx.Camera is primarily just two components: a gfx.Object and a gfx.Mat4 projection matrix.
NearFar and FOV methods sound like good ideas to me, but we should be clear about what FOV returns for an orthographic camera, though (-1, 0 etc?).
The gfx.Camera.Object should be used to represent the visible portion of the camera, such that at some point a call to:
canvas.Draw(rect, cam.Object, cam2)
Would need be made. (cam2 is effectively the camera viewing the debug camera -- or nil for none).
Perhaps the best cleanest approach would be something like:
// DrawCamera draws the camera's viewing frustum to the canvas as a wire-frame.
func DrawCamera(c gfx.Canvas, cam gfx.Camera) {
....
// TODO: assign a shader and mesh with vertices to cam.Object.
....
}
We need not worry about performance for the initial impl, since it is primarily for debugging. In practice it would work like:
// Debug draw myCamera to myCanvas:
debug.DrawCamera(myCanvas, myCamera)
Issue by oal
Thursday Jan 15, 2015 at 08:35 GMT
Originally opened as azul3d-legacy/gfx#91
There should be a debugging package that can generate meshes for the camera frustum, axis, arrows etc.
Examples:
The text was updated successfully, but these errors were encountered: