Documentation
¶
Overview ¶
Package camera contains virtual cameras and associated controls.
Index ¶
- Constants
- type Axis
- type Camera
- func (c *Camera) Aspect() float32
- func (c *Camera) Axis() Axis
- func (c *Camera) Far() float32
- func (c *Camera) Fov() float32
- func (c *Camera) Near() float32
- func (c *Camera) ProjMatrix(m *math32.Matrix4)
- func (c *Camera) Project(v *math32.Vector3) *math32.Vector3
- func (c *Camera) Projection() Projection
- func (c *Camera) SetAspect(aspect float32)
- func (c *Camera) SetAxis(axis Axis)
- func (c *Camera) SetFar(far float32)
- func (c *Camera) SetFov(fov float32)
- func (c *Camera) SetNear(near float32)
- func (c *Camera) SetProjection(proj Projection)
- func (c *Camera) SetSize(size float32)
- func (c *Camera) Size() float32
- func (c *Camera) Unproject(v *math32.Vector3) *math32.Vector3
- func (c *Camera) UpdateFov(targetDist float32)
- func (c *Camera) UpdateSize(targetDist float32)
- func (c *Camera) ViewMatrix(m *math32.Matrix4)
- type Projection
Constants ¶
const ( Vertical = Axis(iota) Horizontal )
The two possible camera axes.
const ( Perspective = Projection(iota) Orthographic )
The possible camera projections.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Camera ¶
Camera represents a virtual camera, which specifies how to project a 3D scene onto an image.
func New ¶
New creates and returns a new perspective camera with the specified aspect ratio and default parameters.
func NewOrthographic ¶
NewOrthographic creates and returns a new orthographic camera with the specified parameters.
func NewPerspective ¶
NewPerspective creates and returns a new perspective camera with the specified parameters.
func (*Camera) ProjMatrix ¶
ProjMatrix returns the projection matrix of the camera.
func (*Camera) Project ¶
Project transforms the specified position from world coordinates to this camera projected coordinates.
func (*Camera) Projection ¶
func (c *Camera) Projection() Projection
Projection returns the projection method used by the camera.
func (*Camera) SetFov ¶
SetFov sets the perspective field-of-view in degrees along the reference axis.
func (*Camera) SetProjection ¶
func (c *Camera) SetProjection(proj Projection)
SetProjection sets the projection method used by the camera.
func (*Camera) Unproject ¶
Unproject transforms the specified position from camera projected coordinates to world coordinates.
func (*Camera) UpdateFov ¶
UpdateFov updates the field-of-view such that the frustum matches the orthographic size at the depth specified by targetDist.
func (*Camera) UpdateSize ¶
UpdateSize updates the orthographic size to match the current field-of-view frustum at the depth specified by targetDist.
func (*Camera) ViewMatrix ¶
ViewMatrix returns the view matrix of the camera.