Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging helpers for camera, axis etc #142

Closed
azul3d-bot opened this issue Mar 6, 2016 · 4 comments
Closed

Debugging helpers for camera, axis etc #142

azul3d-bot opened this issue Mar 6, 2016 · 4 comments

Comments

@azul3d-bot
Copy link

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:

@azul3d-bot
Copy link
Author

Comment by slimsag
Thursday Jan 15, 2015 at 12:15 GMT


Thank you for creating this. I agree that we should add some visual debugging features.

This would fit well into a azul3d.org/gfx.v2/debug package.

@azul3d-bot
Copy link
Author

Comment by oal
Thursday Jan 15, 2015 at 12:20 GMT


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.

Or do you have any other suggestions?

@azul3d-bot
Copy link
Author

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.

Near Far 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)

@slimsag
Copy link
Member

slimsag commented Mar 6, 2016

Fixed/merged as part of #1

@slimsag slimsag closed this as completed Mar 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants