Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTimeMillis ¶
func GetTimeMillis() int64
TODO: Why is this not in the standard time library? Am I missing something?
func IsPowerOfTwo ¶
func RoundUpToPowerOfTwo ¶
RoundUpToPowerOfTwo returns the smallest number that is >= n and also a power of two. If n is close to the max int value, unexpected behavior results are likely.
func SaveScreenshot ¶
SaveScreenshot reads pixel data from OpenGL buffers, so it must be run in the same main thread as the rest of OpenGL. TODO: write to file in a goroutine and return a (chan err), or just ignore slow errors. Handling errors that can be caught immediately is fine. Blocking while writing to file adds way too much delay.
func ScaleQuatRotation ¶
ScaleQuatRotation scales the provided rotation by the provided percentage. For example, if you have a quaternion representing a 90 degree rotation: mgl32.AnglesToQuat(mgl32.DegToRad(90), 0, 0, mgl32.ZYX) you could get a quaternion that rotates half as much with: ScaleQuatRotation(q, 0.5) Note that percentages above 1.0 will increase the provided rotation as expected, and negative percentages will reverse the rotation.
Sample usage to limit rotation based on a maximum amount per second:
rotationSpeed := mgl32.AnglesToQuat(0, 0, 2 * math.Pi, mgl32.XYZ) // Allow one full rotation per second. deltaTime := 0.016 // Time passed in the last frame is very small. rotation := util.ScaleQuatRotation(rotationSpeed, deltaTime) // rotationSpeed * time = rotation
Types ¶
This section is empty.
Directories
¶
Path | Synopsis |
---|---|
Package fps can be used to keep track of framerate and delta time.
|
Package fps can be used to keep track of framerate and delta time. |
glutil contains common functions to deal with OpenGl and WebGL, such as loading data into Buffers and Textures.
|
glutil contains common functions to deal with OpenGl and WebGL, such as loading data into Buffers and Textures. |