Documentation ¶
Overview ¶
Package camera provides implementations of different camera models.
Index ¶
- type FPS
- func Make(width, height int, pos mgl32.Vec3, speed, fov, near, far float32) FPS
- func MakeDefault(width, height int, pos mgl32.Vec3, speed float32) FPS
- func New(width, height int, pos mgl32.Vec3, speed, fov, near, far float32) *FPS
- func NewDefault(width, height int, pos mgl32.Vec3, speed float32) *FPS
- func (camera *FPS) GetOrtho() mgl32.Mat4
- func (camera *FPS) GetPerspective() mgl32.Mat4
- func (camera *FPS) GetPos() mgl32.Vec3
- func (camera *FPS) GetView() mgl32.Mat4
- func (camera *FPS) GetViewPerspective() mgl32.Mat4
- func (camera *FPS) OnCursorPosMove(x, y, dx, dy float64) bool
- func (camera *FPS) OnKeyPress(key, action, mods int) bool
- func (camera *FPS) OnMouseButtonPress(leftPressed, rightPressed bool) bool
- func (camera *FPS) OnMouseScroll(x, y float64) bool
- func (camera *FPS) Rotate(theta, phi float32)
- func (camera *FPS) SetPos(pos mgl32.Vec3)
- func (camera *FPS) Update()
- func (camera *FPS) Zoom(distance float32)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FPS ¶
type FPS struct { Pos mgl32.Vec3 Target mgl32.Vec3 Up mgl32.Vec3 Right mgl32.Vec3 Fov float32 Near float32 Far float32 // contains filtered or unexported fields }
FPS moves in the view direction while the viewing direction can be changed.
func Make ¶
Make creates a FPS with the viewport of width and height and a radius from the origin. It assumes a field of view of 45 degrees and a near and far plane at 0.1 and 100.0 respectively.
func MakeDefault ¶
MakeDefault creates a FPS camera with the viewport of width and height and a position. It assumes a field of view of 45 degrees and a near and far plane at 0.1 and 100.0 respectively.
func New ¶
New creates a reference to a FPS with the viewport of width and height and a radius from the origin. It assumes a field of view of 45 degrees and a near and far plane at 0.1 and 100.0 respectively.
func NewDefault ¶
NewDefault creates a reference to a FPS camera with the viewport of width and height and a position. It assumes a field of view of 45 degrees and a near and far plane at 0.1 and 100.0 respectively.
func (*FPS) GetPerspective ¶
GetPerspective returns the perspective projection of the camera.
func (*FPS) GetViewPerspective ¶
GetViewPerspective returns P*V.
func (*FPS) OnCursorPosMove ¶
OnCursorPosMove is a callback handler that is called every time the cursor moves.
func (*FPS) OnKeyPress ¶
OnKeyPress is a callback handler that is called every time a keyboard key is pressed.
func (*FPS) OnMouseButtonPress ¶
OnMouseButtonPress is a callback handler that is called every time a mouse button is pressed or released.
func (*FPS) OnMouseScroll ¶
OnMouseScroll is a callback handler that is called every time the mouse wheel moves.
func (*FPS) Rotate ¶
Rotate adds delta angles in degrees to the theta and phi angles. Where theta is the vertical angle and phi the horizontal angle.
func (*FPS) SetPos ¶
SetPos updates the target point of the camera. It requires to call Update to take effect.