camera

package
v0.0.0-...-c2c5ea0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2017 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package camera contain common camera types used for rendering 3D scenes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Camera

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

Camera is the base camera which is normally embedded in other camera types

func (*Camera) GetCamera

func (cam *Camera) GetCamera() *Camera

GetCamera satisfies the ICamera interface

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

func (cam *Camera) LookAt(target *math32.Vector3)

LookAt sets the camera target position

func (*Camera) Project

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

Project satisfies the ICamera interface and must be implemented for specific camera types.

func (*Camera) SetPosition

func (cam *Camera) SetPosition(x, y, z float32)

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

func (cam *Camera) SetPositionVec(vpos *math32.Vector3)

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

func (cam *Camera) SetRaycaster(rc *core.Raycaster, x, y float32)

SetRaycaster satisfies the ICamera interface and must be implemented for specific camera types.

func (*Camera) SetUp

func (cam *Camera) SetUp(up *math32.Vector3)

SetUp sets the camera up vector

func (*Camera) Target

func (cam *Camera) Target() math32.Vector3

Target get the current target position

func (*Camera) Unproject

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

Unproject satisfies the ICamera interface and must be implemented for specific camera types.

func (*Camera) Up

func (cam *Camera) Up() math32.Vector3

Up get the current up position

func (*Camera) ViewMatrix

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

ViewMatrix returns the current view matrix of this camera

func (*Camera) WorldDirection

func (cam *Camera) WorldDirection(result *math32.Vector3)

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.

func (*Perspective) Unproject

func (cam *Perspective) Unproject(v *math32.Vector3) *math32.Vector3

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

Directories

Path Synopsis
Package control implements controllers for cameras
Package control implements controllers for cameras

Jump to

Keyboard shortcuts

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