camera

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Camera

type Camera struct {
	Type Type

	Pos     gglm.Vec3
	Forward gglm.Vec3
	WorldUp gglm.Vec3

	NearClip float32
	FarClip  float32

	// Perspective data
	Fov         float32
	AspectRatio float32

	// Ortho data
	Left, Right, Top, Bottom float32

	// Matrices
	ViewMat gglm.Mat4
	ProjMat gglm.Mat4
}

func NewOrthographic

func NewOrthographic(pos, forward, worldUp *gglm.Vec3, nearClip, farClip, left, right, top, bottom float32) Camera

func NewPerspective

func NewPerspective(pos, forward, worldUp *gglm.Vec3, nearClip, farClip, fovRadians, aspectRatio float32) Camera

func (*Camera) Update

func (c *Camera) Update()

Update recalculates view matrix and projection matrix. Should be called whenever a camera parameter changes

func (*Camera) UpdateRotation

func (c *Camera) UpdateRotation(pitch, yaw float32)

UpdateRotation calculates a new forward vector and then calls camera.Update()

type Type

type Type int32
const (
	Type_Unknown Type = iota
	Type_Perspective
	Type_Orthographic
)

Jump to

Keyboard shortcuts

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