camera

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Camera

type Camera struct {
	transform.Transform
	Projection matrix.Matrix
}

Camera contains all three major components of the 3D to 2D tranformation.

First, we transform object from world-space (the same space that the coordinates of face points are in after all their transforms are applied) to camera space. Typically, this will place all viewable objects into a cube with coordinates: x = -1 to 1, y = -1 to 1, z = 1 to 2

Second, we apply the projection transform to create perspective parallax and what not.

Finally, we rescale to the viewport size.

These three steps allow us to easily create shapes whose coordinates match up to screen coordinates in the z = 0 plane.

func CameraWithProjection

func CameraWithProjection(projection matrix.Matrix) Camera

Jump to

Keyboard shortcuts

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