Documentation
¶
Index ¶
- type MoveDirection
- type PerspectiveCamera
- func (c *PerspectiveCamera) DirAxis() mgl32.Vec3
- func (c *PerspectiveCamera) Move(direction MoveDirection, amount float32)
- func (c *PerspectiveCamera) PitchAxis() mgl32.Vec3
- func (c *PerspectiveCamera) Projection() mgl32.Mat4
- func (c *PerspectiveCamera) Roll(direction RollDirection, amount float32)
- func (c *PerspectiveCamera) Rotate(direction RotateDirection, amount float32)
- func (c *PerspectiveCamera) View() mgl32.Mat4
- type Point3D
- type RollDirection
- type RotateDirection
- type Vector3D
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 ¶
Point3D is a point in 3D space.
func (Point3D) RotateAroundPoint ¶
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 ¶
Vector3D is a 3D vector.
func (Vector3D) RotateAroundAxis ¶
RotateAroundAxis rotates a vector around an axis by radians degrees using Rodrigues' rotation formula: https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula