Dreambox C/C++ SDK v1.0.0
C/C++ SDK for creating Dreambox games
|
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | Vec2 |
A two-component vector. More... | |
struct | Vec3 |
A three-component vector. More... | |
struct | Vec4 |
A four-component vector. More... | |
struct | Quaternion |
A quaternion. More... | |
struct | Mat4 |
A 4x4 matrix. More... | |
Macros | |
#define | PI 3.14159265359f |
#define | DEG_2_RAD (PI / 180.0f) |
#define | RAD_2_DEG (180.0f / PI) |
#define | MAT4_IDENTITY |
#define | QUATERNION_IDENTITY (Quaternion) { 0.0f, 0.0f, 0.0f, 1.0f } |
Functions | |
float | vec2_length (Vec2 v) |
Get the length of a vector. More... | |
float | vec3_length (Vec3 v) |
Get the length of a vector. More... | |
float | vec2_lengthSq (Vec2 v) |
Get the squared length of a vector. More... | |
float | vec3_lengthSq (Vec3 v) |
Get the squared length of a vector. More... | |
float | vec2_distance (Vec2 lhs, Vec2 rhs) |
Get the distance between two vectors. More... | |
float | vec3_distance (Vec3 lhs, Vec3 rhs) |
Get the distance between two vectors. More... | |
float | vec2_distanceSq (Vec2 lhs, Vec2 rhs) |
Get the squared distance between two vectors. More... | |
float | vec3_distanceSq (Vec3 lhs, Vec3 rhs) |
Get the squared distance between two vectors. More... | |
float | clamp (float value, float min, float max) |
Clamp the value between a minimum and maximum. More... | |
float | lerp (float lhs, float rhs, float t) |
Linearly interpolate between two values. More... | |
Vec2 | vec2_lerp (Vec2 lhs, Vec2 rhs, float t) |
Linearly interpolate between two values. More... | |
Vec3 | vec3_lerp (Vec3 lhs, Vec3 rhs, float t) |
Linearly interpolate between two values. More... | |
Vec4 | vec4_lerp (Vec4 lhs, Vec4 rhs, float t) |
Linearly interpolate between two values. More... | |
Vec2 | vec2_mul (Vec2 lhs, Vec2 rhs) |
Componentwise-mutiply two vectors. More... | |
Vec3 | vec3_mul (Vec3 lhs, Vec3 rhs) |
Componentwise-mutiply two vectors. More... | |
Vec4 | vec4_mul (Vec4 lhs, Vec4 rhs) |
Componentwise-mutiply two vectors. More... | |
Vec2 | vec2_add (Vec2 lhs, Vec2 rhs) |
Add two vectors. More... | |
Vec3 | vec3_add (Vec3 lhs, Vec3 rhs) |
Add two vectors. More... | |
Vec4 | vec4_add (Vec4 lhs, Vec4 rhs) |
Add two vectors. More... | |
Vec2 | vec2_sub (Vec2 lhs, Vec2 rhs) |
Subtract two vectors. More... | |
Vec3 | vec3_sub (Vec3 lhs, Vec3 rhs) |
Subtract two vectors. More... | |
Vec4 | vec4_sub (Vec4 lhs, Vec4 rhs) |
Subtract two vectors. More... | |
Vec2 | vec2_div (Vec2 lhs, Vec2 rhs) |
Divide two vectors. More... | |
Vec3 | vec3_div (Vec3 lhs, Vec3 rhs) |
Divide two vectors. More... | |
Vec4 | vec4_div (Vec4 lhs, Vec4 rhs) |
Divide two vectors. More... | |
float | vec2_dot (Vec2 lhs, Vec2 rhs) |
Compute the dot product of the given vectors. More... | |
float | vec3_dot (Vec3 lhs, Vec3 rhs) |
Compute the dot product of the given vectors. More... | |
float | vec4_dot (Vec4 lhs, Vec4 rhs) |
Compute the dot product of the given vectors. More... | |
Vec3 | vec3_cross (Vec3 lhs, Vec3 rhs) |
Compute the cross product of the given vectors. More... | |
void | vec2_normalize (Vec2 *v) |
Normalize the given vector. More... | |
void | vec3_normalize (Vec3 *v) |
Normalize the given vector. More... | |
void | vec4_normalize (Vec4 *v) |
Normalize the given vector. More... | |
void | quat_normalize (Quaternion *q) |
Normalize the given quaternion. More... | |
void | quat_invert (Quaternion *q) |
Invert the given quaternion. More... | |
Vec3 | vec3_transformQuat (Quaternion q, Vec3 v) |
Rotate a vector by a quaternion. More... | |
Quaternion | quat_mul (Quaternion lhs, Quaternion rhs) |
Multiply two quaternions together. More... | |
Quaternion | quat_fromEuler (Vec3 eulerAngles) |
Construct a quaternion from rotation around each axis. More... | |
Vec4 | vec4_transform (Mat4 mat, Vec4 vec) |
Transform a single vector with a matrix without the aid of the SIMD matrix unit. More... | |
Mat4 | mat4_translate (Vec3 translation) |
Construct a matrix from the given translation. More... | |
Mat4 | mat4_scale (Vec3 scale) |
Construct a matrix from the given scale. More... | |
Mat4 | mat4_rotation (Quaternion rotation) |
Construct a matrix from the given rotation. More... | |
Mat4 | mat4_projectionOrtho (float left, float right, float top, float bottom, float near, float far) |
Construct an orthographic projection matrix. More... | |
Mat4 | mat4_projectionOrthoAspect (float aspectRatio, float scale, float near, float far) |
Construct an orthographic projection matrix. More... | |
Mat4 | mat4_projectionPerspective (float aspectRatio, float fieldOfView, float near, float far) |
Construct a perspective projection matrix. More... | |
Mat4 | mat4_mul (Mat4 lhs, Mat4 rhs) |
Multiply two matrices together manually without the aid of the SIMD matrix unit. More... | |
void | mat4_loadIdentitySIMD () |
Load identity matrix into the SIMD matrix register. More... | |
void | mat4_loadSIMD (const Mat4 *mat) |
Load a matrix into the SIMD matrix register. More... | |
void | mat4_storeSIMD (Mat4 *mat) |
Store the value in the SIMD matrix register to the given matrix. More... | |
void | mat4_mulSIMD (const Mat4 *mat) |
Multiply internal SIMD matrix register with the given matrix. More... | |
void | mat4_transformSIMD (const Vec4 *invec, Vec4 *outvec, uint32_t count, uint32_t stride) |
Transform a list of input Vec4s using the SIMD matrix unit. More... | |
#define MAT4_IDENTITY |
#define QUATERNION_IDENTITY (Quaternion) { 0.0f, 0.0f, 0.0f, 1.0f } |
float clamp | ( | float | value, |
float | min, | ||
float | max | ||
) |
Clamp the value between a minimum and maximum.
value | |
min | |
max |
float lerp | ( | float | lhs, |
float | rhs, | ||
float | t | ||
) |
Linearly interpolate between two values.
lhs | |
rhs | |
t |
void mat4_loadIdentitySIMD | ( | ) |
Load identity matrix into the SIMD matrix register.
void mat4_loadSIMD | ( | const Mat4 * | mat | ) |
Load a matrix into the SIMD matrix register.
mat | The matrix to load |
Multiply two matrices together manually without the aid of the SIMD matrix unit.
lhs | Matrix on the lefthand side |
rhs | Matrix on the righthand side |
void mat4_mulSIMD | ( | const Mat4 * | mat | ) |
Multiply internal SIMD matrix register with the given matrix.
mat | The matrix to multiply into the SIMD matrix register |
Mat4 mat4_projectionOrtho | ( | float | left, |
float | right, | ||
float | top, | ||
float | bottom, | ||
float | near, | ||
float | far | ||
) |
Construct an orthographic projection matrix.
left | The left side of the frustum |
right | The right side of the frustum |
top | The top side of the frustum |
bottom | The bottom side of the frustum |
near | The near clip distance |
far | The far clip distance |
Mat4 mat4_projectionOrthoAspect | ( | float | aspectRatio, |
float | scale, | ||
float | near, | ||
float | far | ||
) |
Construct an orthographic projection matrix.
aspectRatio | The aspect ratio of the frustum (width/height) |
scale | The height of the frustum |
near | The near clip distance |
far | The far clip distance |
Mat4 mat4_projectionPerspective | ( | float | aspectRatio, |
float | fieldOfView, | ||
float | near, | ||
float | far | ||
) |
Construct a perspective projection matrix.
aspectRatio | The aspect ratio of the frustum (width/height) |
fieldOfView | The vertical field of view in radians |
near | The near clip distance |
far | The far clip distance |
Mat4 mat4_rotation | ( | Quaternion | rotation | ) |
Construct a matrix from the given rotation.
rotation | The rotation |
Construct a matrix from the given scale.
scale | The scale |
void mat4_storeSIMD | ( | Mat4 * | mat | ) |
Store the value in the SIMD matrix register to the given matrix.
mat | The matrix to store the value into |
Transform a list of input Vec4s using the SIMD matrix unit.
invec | Pointer to list of input vectors to transform |
outvec | Pointer to list of output vectors to write |
count | Number of vectors to transform |
stride | Number of bytes between each vector (0 implies tightly packed array of Vec4) |
Construct a matrix from the given translation.
translation | The translation |
Quaternion quat_fromEuler | ( | Vec3 | eulerAngles | ) |
Construct a quaternion from rotation around each axis.
eulerAngles | Rotation around each axis in radians |
void quat_invert | ( | Quaternion * | q | ) |
Invert the given quaternion.
q | Pointer to the quaternion to invert |
Quaternion quat_mul | ( | Quaternion | lhs, |
Quaternion | rhs | ||
) |
Multiply two quaternions together.
lhs | Quaternion on the lefthand side |
rhs | Quaternion on the righthand side |
void quat_normalize | ( | Quaternion * | q | ) |
Normalize the given quaternion.
q | The quaternion to normalize |
Add two vectors.
lhs | |
rhs |
Get the distance between two vectors.
lhs | |
rhs |
Get the squared distance between two vectors.
lhs | |
rhs |
Divide two vectors.
lhs | |
rhs |
Compute the dot product of the given vectors.
lhs | The vector on the lefthand side |
rhs | The vector on the righthand side |
float vec2_length | ( | Vec2 | v | ) |
Get the length of a vector.
v |
float vec2_lengthSq | ( | Vec2 | v | ) |
Get the squared length of a vector.
v |
Linearly interpolate between two values.
lhs | |
rhs | |
t |
Componentwise-mutiply two vectors.
lhs | |
rhs |
void vec2_normalize | ( | Vec2 * | v | ) |
Normalize the given vector.
v | The vector to normalize |
Subtract two vectors.
lhs | |
rhs |
Add two vectors.
lhs | |
rhs |
Compute the cross product of the given vectors.
lhs | The vector on the lefthand side |
rhs | The vector on the righthand side |
Get the distance between two vectors.
lhs | |
rhs |
Get the squared distance between two vectors.
lhs | |
rhs |
Divide two vectors.
lhs | |
rhs |
Compute the dot product of the given vectors.
lhs | The vector on the lefthand side |
rhs | The vector on the righthand side |
float vec3_length | ( | Vec3 | v | ) |
Get the length of a vector.
v |
float vec3_lengthSq | ( | Vec3 | v | ) |
Get the squared length of a vector.
v |
Linearly interpolate between two values.
lhs | |
rhs | |
t |
Componentwise-mutiply two vectors.
lhs | |
rhs |
void vec3_normalize | ( | Vec3 * | v | ) |
Normalize the given vector.
v | The vector to normalize |
Subtract two vectors.
lhs | |
rhs |
Vec3 vec3_transformQuat | ( | Quaternion | q, |
Vec3 | v | ||
) |
Rotate a vector by a quaternion.
q | The quaternion representing a rotation |
v | The vector to rotate |
Add two vectors.
lhs | |
rhs |
Divide two vectors.
lhs | |
rhs |
Compute the dot product of the given vectors.
lhs | The vector on the lefthand side |
rhs | The vector on the righthand side |
Linearly interpolate between two values.
lhs | |
rhs | |
t |
Componentwise-mutiply two vectors.
lhs | |
rhs |
void vec4_normalize | ( | Vec4 * | v | ) |
Normalize the given vector.
v | The vector to normalize |
Subtract two vectors.
lhs | |
rhs |