camera

package
v0.0.0-...-ce4c9c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2021 License: BSD-2-Clause Imports: 2 Imported by: 2

Documentation

Overview

Package camera contains virtual cameras and associated controls.

Index

Constants

View Source
const (
	Vertical = Axis(iota)
	Horizontal
)

The two possible camera axes.

View Source
const (
	Perspective = Projection(iota)
	Orthographic
)

The possible camera projections.

Variables

This section is empty.

Functions

This section is empty.

Types

type Axis

type Axis int

Axis represents a camera axis.

type Camera

type Camera struct {
	node.Node // Embedded Node
	// contains filtered or unexported fields
}

Camera represents a virtual camera, which specifies how to project a 3D scene onto an image.

func New

func New(aspect float32) *Camera

New creates and returns a new perspective camera with the specified aspect ratio and default parameters.

func NewOrthographic

func NewOrthographic(aspect, near, far, size float32, axis Axis) *Camera

NewOrthographic creates and returns a new orthographic camera with the specified parameters.

func NewPerspective

func NewPerspective(aspect, near, far, fov float32, axis Axis) *Camera

NewPerspective creates and returns a new perspective camera with the specified parameters.

func (*Camera) Aspect

func (c *Camera) Aspect() float32

Aspect returns the camera aspect ratio.

func (*Camera) Axis

func (c *Camera) Axis() Axis

Axis returns the reference axis associated with the camera size/fov.

func (*Camera) Far

func (c *Camera) Far() float32

Far returns the camera far plane Z coordinate.

func (*Camera) Fov

func (c *Camera) Fov() float32

Fov returns the perspective field-of-view in degrees along the reference axis.

func (*Camera) Near

func (c *Camera) Near() float32

Near returns the camera near plane Z coordinate.

func (*Camera) ProjMatrix

func (c *Camera) ProjMatrix(m *math32.Matrix4)

ProjMatrix returns the projection matrix of the camera.

func (*Camera) Project

func (c *Camera) Project(v *math32.Vector3) *math32.Vector3

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) SetAspect

func (c *Camera) SetAspect(aspect float32)

SetAspect sets the camera aspect ratio.

func (*Camera) SetAxis

func (c *Camera) SetAxis(axis Axis)

SetAxis sets the reference axis associated with the camera size/fov.

func (*Camera) SetFar

func (c *Camera) SetFar(far float32)

SetFar sets the camera far plane Z coordinate.

func (*Camera) SetFov

func (c *Camera) SetFov(fov float32)

SetFov sets the perspective field-of-view in degrees along the reference axis.

func (*Camera) SetNear

func (c *Camera) SetNear(near float32)

SetNear sets the camera near plane Z coordinate.

func (*Camera) SetProjection

func (c *Camera) SetProjection(proj Projection)

SetProjection sets the projection method used by the camera.

func (*Camera) SetSize

func (c *Camera) SetSize(size float32)

SetSize sets the orthographic view size along the camera's reference axis.

func (*Camera) Size

func (c *Camera) Size() float32

Size returns the orthographic view size along the camera's reference axis.

func (*Camera) Unproject

func (c *Camera) Unproject(v *math32.Vector3) *math32.Vector3

Unproject transforms the specified position from camera projected coordinates to world coordinates.

func (*Camera) UpdateFov

func (c *Camera) UpdateFov(targetDist float32)

UpdateFov updates the field-of-view such that the frustum matches the orthographic size at the depth specified by targetDist.

func (*Camera) UpdateSize

func (c *Camera) UpdateSize(targetDist float32)

UpdateSize updates the orthographic size to match the current field-of-view frustum at the depth specified by targetDist.

func (*Camera) ViewMatrix

func (c *Camera) ViewMatrix(m *math32.Matrix4)

ViewMatrix returns the view matrix of the camera.

type Projection

type Projection int

Projection represents a camera projection.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL