Documentation
¶
Index ¶
- Variables
- func PlaneIntercept(groundNormal, rayOrigin, rayDirection mgl32.Vec3) mgl32.Vec3
- func PlaneIntercept2(groundOrigin, groundNormal, rayOrigin, rayDirection mgl32.Vec3) mgl32.Vec3
- func ProjectPlane(v1, v2 mgl32.Vec3) mgl32.Vec3
- type Camera
- func (c *Camera) Dump()
- func (c *Camera) ForwardsVector() mgl32.Vec3
- func (c *Camera) LeftEyeFrustrum() mgl32.Mat4
- func (c *Camera) LeftEyeViewMatrix() mgl32.Mat4
- func (c *Camera) LookAt(x, y, z float32)
- func (c *Camera) Move(direction int, amount float32)
- func (c *Camera) Reset()
- func (c *Camera) RightEyeFrustrum() mgl32.Mat4
- func (c *Camera) RightEyeViewMatrix() mgl32.Mat4
- func (c *Camera) RightWardsVector() mgl32.Vec3
- func (c *Camera) Rotate(x, y, z float32)
- func (c *Camera) RotationMatrix() mgl32.Mat4
- func (c *Camera) SetFocalLength(focalLength float32)
- func (c *Camera) SetGroundPlaneNormal(x, y, z float32)
- func (c *Camera) SetIPD(ipd float32)
- func (c *Camera) SetMode(mode int)
- func (c *Camera) SetPosition(x, y, z float32)
- func (c *Camera) SetUp(x, y, z float32)
- func (c *Camera) TargetPosition() mgl32.Vec3
- func (c *Camera) TargetVector() mgl32.Vec3
- func (c *Camera) Translate(x, y, z float32)
- func (c *Camera) UpwardsVector() mgl32.Vec3
- func (c *Camera) ViewMatrix() mgl32.Mat4
- func (c *Camera) WorldPosition() (float32, float32, float32)
Constants ¶
This section is empty.
Variables ¶
var PI = float32(3.1415927)
Functions ¶
func PlaneIntercept ¶
Find the point on the plane that the ray intercepts groundNormal is the normal of the plane rayOrigin is the origin of the ray rayDirection is the direction of the ray Returns the point on the plane that the ray intercepts
The plane is assumed to pass through the origin
func PlaneIntercept2 ¶
Find the point on the plane that the ray intercepts as for PlaneIntercept, but the plane is not assumed to pass through the origin
Types ¶
type Camera ¶
type Camera struct { Position mgl32.Vec3 //The position of the camera in world space Target mgl32.Vec3 //The target of the camera in world space. Note: not the focal point Up mgl32.Vec3 //The up vector of the camera Orientation mgl32.Quat //The orientation of the camera, quaternion Mode int //The mode of the camera. 1 - Museum mode, 2 - FPS mode, 3 - RTS mode GroundPlaneNormal mgl32.Vec3 //The normal of the ground plane IPD float32 //The inter-pupillary distance, in world space FocalLength float32 //The focal length of the camera, in world space Near float32 //The near clipping plane Far float32 //The far clipping plane Screenheight float32 //The height of the screen, in pixels Screenwidth float32 //The width of the screen, in pixels Aperture float32 //The aperture of the camera, in world space FOV float32 //The field of view of the camera, in degrees }
func (*Camera) ForwardsVector ¶
The forward unit vector of the camera, in world space
func (*Camera) LeftEyeFrustrum ¶
Calculate the frustrum matrix for the right eye
func (*Camera) LeftEyeViewMatrix ¶
Support 3D displays, by returning the view matrix for the left eye
func (*Camera) Move ¶
Move the camera, according to the parameter 0 - forward 1 - backward 2 - left 3 - right 4 - up 5 - down 6 - pitch up 7 - pitch down 8 - yaw left 9 - yaw right 10 - roll left 11 - roll right
func (*Camera) RightEyeFrustrum ¶
Calculate the frustrum matrix for the right eye
func (*Camera) RightEyeViewMatrix ¶
Support 3D displays, by returning the view matrix for the left eye
func (*Camera) RightWardsVector ¶
The right unit vector of the camera, in world space
func (*Camera) RotationMatrix ¶
Returns the rotation matrix of the camera. (the rotation part of the view matrix)
func (*Camera) SetFocalLength ¶
func (*Camera) SetGroundPlaneNormal ¶
Set the normal of the ground plane. This is used in RTS mode, and ignored in other modes.
func (*Camera) SetPosition ¶
Teleport to a position in world space
func (*Camera) TargetPosition ¶
The position of the target, in world space. This is not the object that the camera is following
func (*Camera) TargetVector ¶
Scenecam keeps an invisible target point to which the camera is always looking. Not normalised. This is the vector from the camera to the target. This is not the object that the camera is following
func (*Camera) UpwardsVector ¶
The up unit vector of the camera, in world space
func (*Camera) ViewMatrix ¶
Return the ViewMatrix for the camera. This is the matrix that transforms world space to camera space. It contains both the rotation and translation of the camera. It can be passed directly to OpenGL as the ViewMatrix, and used in GLSL shaders as the ViewMatrix.