orbit

package
v0.0.0-...-ce4c9c0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2021 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OrbitControl

type OrbitControl struct {
	dispatcher.Dispatcher // Embedded event dispatcher

	// Public properties
	MinDistance     float32 // Minimum distance from target (default is 1)
	MaxDistance     float32 // Maximum distance from target (default is infinity)
	MinPolarAngle   float32 // Minimum polar angle in radians (default is 0)
	MaxPolarAngle   float32 // Maximum polar angle in radians (default is Pi)
	MinAzimuthAngle float32 // Minimum azimuthal angle in radians (default is negative infinity)
	MaxAzimuthAngle float32 // Maximum azimuthal angle in radians (default is infinity)
	RotSpeed        float32 // Rotation speed factor (default is 1)
	ZoomSpeed       float32 // Zoom speed factor (default is 0.1)
	KeyRotSpeed     float32 // Rotation delta in radians used on each rotation key event (default is the equivalent of 15 degrees)
	KeyZoomSpeed    float32 // Zoom delta used on each zoom key event (default is 2)
	KeyPanSpeed     float32 // Pan delta used on each pan key event (default is 35)
	// contains filtered or unexported fields
}

OrbitControl is a camera controller that allows orbiting a target point while looking at it. It allows the user to rotate, zoom, and pan a 3D scene using the mouse or keyboard.

func NewOrbitControl

func NewOrbitControl(cam *camera.Camera) *OrbitControl

NewOrbitControl creates and returns a pointer to a new orbit control for the specified camera.

func (*OrbitControl) Dispose

func (oc *OrbitControl) Dispose()

Dispose unsubscribes from all events.

func (*OrbitControl) Enabled

func (oc *OrbitControl) Enabled() OrbitEnabled

Enabled returns the current OrbitEnabled bitmask.

func (*OrbitControl) Pan

func (oc *OrbitControl) Pan(deltaX, deltaY float32)

Pan pans the camera and target the specified amount on the plane perpendicular to the viewing direction.

func (*OrbitControl) Reset

func (oc *OrbitControl) Reset()

Reset resets the orbit control.

func (*OrbitControl) Rotate

func (oc *OrbitControl) Rotate(thetaDelta, phiDelta float32)

Rotate rotates the camera around the target by the specified angles.

func (*OrbitControl) SetEnabled

func (oc *OrbitControl) SetEnabled(bitmask OrbitEnabled)

SetEnabled sets the current OrbitEnabled bitmask.

func (*OrbitControl) SetTarget

func (oc *OrbitControl) SetTarget(v math32.Vector3)

Set camera orbit target Vector3

func (*OrbitControl) Target

func (oc *OrbitControl) Target() math32.Vector3

Target returns the current orbit target.

func (*OrbitControl) Zoom

func (oc *OrbitControl) Zoom(delta float32)

Zoom moves the camera closer or farther from the target the specified amount and also updates the camera's orthographic size to match.

type OrbitEnabled

type OrbitEnabled int

OrbitEnabled specifies which control types are enabled.

const (
	OrbitNone OrbitEnabled = 0x00
	OrbitRot  OrbitEnabled = 0x01
	OrbitZoom OrbitEnabled = 0x02
	OrbitPan  OrbitEnabled = 0x04
	OrbitKeys OrbitEnabled = 0x08
	OrbitAll  OrbitEnabled = 0xFF
)

The possible control types.

Jump to

Keyboard shortcuts

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