gfx

package
v0.0.0-...-0b38cba Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MoveDirection

type MoveDirection int

MoveDirection specifies camera move direction.

const (
	MoveForward MoveDirection = iota
	MoveBack
	MoveLeft
	MoveRight
)

Move constants.

type PerspectiveCamera

type PerspectiveCamera struct {
	// contains filtered or unexported fields
}

PerspectiveCamera is a camera that uses perspective projection.

func NewPerspectiveCamera

func NewPerspectiveCamera(eye, target, up mgl32.Vec3, fov, zoom, ratio float32) *PerspectiveCamera

NewPerspectiveCamera creates a new camera.

func (*PerspectiveCamera) DirAxis

func (c *PerspectiveCamera) DirAxis() mgl32.Vec3

DirAxis returns the direction axis.

func (*PerspectiveCamera) Move

func (c *PerspectiveCamera) Move(direction MoveDirection, amount float32)

Move the camera in the specified direction.

func (*PerspectiveCamera) PitchAxis

func (c *PerspectiveCamera) PitchAxis() mgl32.Vec3

PitchAxis returns the pitch axis.

func (*PerspectiveCamera) Projection

func (c *PerspectiveCamera) Projection() mgl32.Mat4

Projection returns the projection matrix.

func (*PerspectiveCamera) Roll

func (c *PerspectiveCamera) Roll(direction RollDirection, amount float32)

Roll camera left or right.

func (*PerspectiveCamera) Rotate

func (c *PerspectiveCamera) Rotate(direction RotateDirection, amount float32)

Rotate the camera in the specified direction.

func (*PerspectiveCamera) View

func (c *PerspectiveCamera) View() mgl32.Mat4

View returns the view matrix.

type Point3D

type Point3D mgl32.Vec3

Point3D is a point in 3D space.

func (Point3D) RotateAroundPoint

func (p Point3D) RotateAroundPoint(middle mgl32.Vec3, axis mgl32.Vec3, angle float32) mgl32.Vec3

RotateAroundPoint rotates point p around middle point with direction vector dir (must be unit vector) by an angle. Formula from here: https://sites.google.com/site/glennmurray/Home/rotation-matrices-and-formulas

type RollDirection

type RollDirection int

RollDirection specifies camera roll direction.

const (
	RollLeft RollDirection = iota
	RollRight
)

Roll constants.

type RotateDirection

type RotateDirection int

RotateDirection specifies camera rotation direction.

const (
	RotateUp RotateDirection = iota
	RotateDown
	RotateLeft
	RotateRight
)

Rotate constants.

type Vector3D

type Vector3D mgl32.Vec3

Vector3D is a 3D vector.

func (Vector3D) RotateAroundAxis

func (v Vector3D) RotateAroundAxis(axis mgl32.Vec3, angle float32) mgl32.Vec3

RotateAroundAxis rotates a vector around an axis by radians degrees using Rodrigues' rotation formula: https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula

Jump to

Keyboard shortcuts

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