Documentation ¶
Overview ¶
Package camera contain common camera types used for rendering 3D scenes.
Index ¶
- type Camera
- func (cam *Camera) GetCamera() *Camera
- func (cam *Camera) Initialize()
- func (cam *Camera) LookAt(target *math32.Vector3)
- func (cam *Camera) Project(v *math32.Vector3) *math32.Vector3
- func (cam *Camera) SetPosition(x, y, z float32)
- func (cam *Camera) SetPositionVec(vpos *math32.Vector3)
- func (cam *Camera) SetRaycaster(rc *core.Raycaster, x, y float32)
- func (cam *Camera) SetUp(up *math32.Vector3)
- func (cam *Camera) Target() math32.Vector3
- func (cam *Camera) Unproject(v *math32.Vector3) *math32.Vector3
- func (cam *Camera) Up() math32.Vector3
- func (cam *Camera) ViewMatrix(m *math32.Matrix4)
- func (cam *Camera) WorldDirection(result *math32.Vector3)
- type ICamera
- type Orthographic
- type Perspective
- func (cam Perspective) Aspect() float32
- func (cam *Perspective) Far() float32
- func (cam *Perspective) Fov() float32
- func (cam *Perspective) Near() float32
- func (cam *Perspective) ProjMatrix(m *math32.Matrix4)
- func (cam *Perspective) Project(v *math32.Vector3) *math32.Vector3
- func (cam *Perspective) SetAspect(aspect float32)
- func (cam *Perspective) SetFov(fov float32)
- func (cam *Perspective) SetRaycaster(rc *core.Raycaster, sx, sy float32)
- func (cam *Perspective) Unproject(v *math32.Vector3) *math32.Vector3
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Camera ¶
Camera is the base camera which is normally embedded in other camera types
func (*Camera) Initialize ¶
func (cam *Camera) Initialize()
Initialize initializes the base camera. It is used by other camera types which embed this base camera
func (*Camera) Project ¶
Project satisfies the ICamera interface and must be implemented for specific camera types.
func (*Camera) SetPosition ¶
SetPosition sets this camera world position This method overrides the Node method to update the camera quaternion, because changing the camera position may change its rotation
func (*Camera) SetPositionVec ¶
SetPositionVec sets this node position from the specified vector pointer This method overrides the Node method to update the camera quaternion, because changing the camera position may change its rotation
func (*Camera) SetRaycaster ¶
SetRaycaster satisfies the ICamera interface and must be implemented for specific camera types.
func (*Camera) Unproject ¶
Unproject satisfies the ICamera interface and must be implemented for specific camera types.
func (*Camera) ViewMatrix ¶
ViewMatrix returns the current view matrix of this camera
func (*Camera) WorldDirection ¶
WorldDirection updates the specified vector with the current world direction the camera is pointed
type ICamera ¶
type ICamera interface { GetCamera() *Camera ViewMatrix(*math32.Matrix4) ProjMatrix(*math32.Matrix4) Project(*math32.Vector3) *math32.Vector3 Unproject(*math32.Vector3) *math32.Vector3 SetRaycaster(rc *core.Raycaster, x, y float32) }
ICamera is interface for all camera types
type Orthographic ¶
type Orthographic struct { Camera // Embedded camera // contains filtered or unexported fields }
Orthographic is
func NewOrthographic ¶
func NewOrthographic(left, right, top, bottom, near, far float32) *Orthographic
NewOrthographic creates and returns a pointer to a new orthographic camera with the specified parameters.
func (*Orthographic) Planes ¶
func (cam *Orthographic) Planes() (left, right, top, bottom, near, far float32)
Planes returns the coordinates of the camera planes
func (*Orthographic) ProjMatrix ¶
func (cam *Orthographic) ProjMatrix(m *math32.Matrix4)
ProjMatrix satisfies the ICamera interface
func (*Orthographic) SetZoom ¶
func (cam *Orthographic) SetZoom(zoom float32)
SetZoom sets the zoom factor of the camera
func (*Orthographic) Zoom ¶
func (cam *Orthographic) Zoom() float32
Zoom returns the zoom factor of the camera
type Perspective ¶
type Perspective struct { Camera // Embedded camera // contains filtered or unexported fields }
func NewPerspective ¶
func NewPerspective(fov, aspect, near, far float32) *Perspective
NewPerspective creates and returns a pointer to a new perspective camera with the specified parameters.
func (Perspective) Aspect ¶
func (cam Perspective) Aspect() float32
Aspect returns the current camera aspect ratio
func (*Perspective) Far ¶
func (cam *Perspective) Far() float32
Far returns the current camera far plane Z coordinate
func (*Perspective) Fov ¶
func (cam *Perspective) Fov() float32
Fov returns the current camera FOV (field of view) in degrees
func (*Perspective) Near ¶
func (cam *Perspective) Near() float32
Near returns the current camera near plane Z coordinate
func (*Perspective) ProjMatrix ¶
func (cam *Perspective) ProjMatrix(m *math32.Matrix4)
ProjMatrix satisfies the ICamera interface
func (*Perspective) Project ¶
func (cam *Perspective) Project(v *math32.Vector3) *math32.Vector3
Project transforms the specified position from world coordinates to this camera projected coordinates.
func (*Perspective) SetAspect ¶
func (cam *Perspective) SetAspect(aspect float32)
SetAspect sets the camera aspect ratio (width/height)
func (*Perspective) SetFov ¶
func (cam *Perspective) SetFov(fov float32)
SetFov sets the camera field of view in degrees
func (*Perspective) SetRaycaster ¶
func (cam *Perspective) SetRaycaster(rc *core.Raycaster, sx, sy float32)
SetRaycaster sets the specified raycaster with this camera position in world coordinates pointing to the direction defined by the specified coordinates unprojected using this camera.