Skip to content

Instantly share code, notes, and snippets.

@warrenm
Created November 22, 2019 20:45
Show Gist options
  • Save warrenm/011e7979e71b2a86328844a1b540195a to your computer and use it in GitHub Desktop.
Save warrenm/011e7979e71b2a86328844a1b540195a to your computer and use it in GitHub Desktop.
simd matrix utility prototypes for Obj-C
MBE_INLINE simd_float3 MBE_OVERLOAD project(simd_float3 object, simd_float4x4 model, simd_float4x4 projection, int *viewport);
MBE_INLINE simd_float3 MBE_OVERLOAD unproject(simd_float3 window, simd_float4x4 model, simd_float4x4 projection, int *viewport, bool *success);
MBE_INLINE float MBE_OVERLOAD distance(simd_float2, simd_float2);
MBE_INLINE simd_float2 MBE_OVERLOAD lerp(simd_float2, simd_float2, float);
MBE_INLINE simd_float2 MBE_OVERLOAD project(simd_float2, simd_float2);
MBE_INLINE float MBE_OVERLOAD distance(simd_float3, simd_float3);
MBE_INLINE simd_float3 MBE_OVERLOAD lerp(simd_float3, simd_float3, float);
MBE_INLINE simd_float3 MBE_OVERLOAD project(simd_float3, simd_float3);
MBE_INLINE float MBE_OVERLOAD distance(simd_float4, simd_float4);
MBE_INLINE simd_float4 MBE_OVERLOAD lerp(simd_float4, simd_float4, float);
MBE_INLINE simd_float4 MBE_OVERLOAD project(simd_float4, simd_float4);
MBE_INLINE simd_float3x3 MBE_OVERLOAD float3x3_scale(float x, float y, float z);
MBE_INLINE simd_float3x3 MBE_OVERLOAD float3x3_scale(float);
MBE_INLINE simd_float3x3 float3x3_rotation_quaternion(simd_quatf);
MBE_INLINE simd_float3x3 float3x3_rotation_axis_angle(float x, float y, float z, float radians);
MBE_INLINE simd_float3x3 float3x3_rotation_euler(float radiansX, float radiansY, float radiansZ);
MBE_INLINE simd_float3x3 float3x3_rotation_x(float radians);
MBE_INLINE simd_float3x3 float3x3_rotation_y(float radians);
MBE_INLINE simd_float3x3 float3x3_rotation_z(float radians);
MBE_INLINE simd_float2x2 MBE_OVERLOAD upper_left_2x2(simd_float3x3);
MBE_INLINE simd_float4x4 float4x4_translation(float, float, float);
MBE_INLINE simd_float4x4 MBE_OVERLOAD float4x4_scale(float x, float y, float z);
MBE_INLINE simd_float4x4 MBE_OVERLOAD float4x4_scale(float);
MBE_INLINE simd_float4x4 float4x4_rotation_quaternion(simd_quatf);
MBE_INLINE simd_float4x4 float4x4_rotation_axis_angle(float x, float y, float z, float radians);
MBE_INLINE simd_float4x4 float4x4_rotation_x(float radians);
MBE_INLINE simd_float4x4 float4x4_rotation_y(float radians);
MBE_INLINE simd_float4x4 float4x4_rotation_z(float radians);
MBE_INLINE simd_float4x4 float4x4_perspective_rh(float fovyRadians, float aspect, float nearZ, float farZ);
MBE_INLINE simd_float4x4 float4x4_frustum(float left, float right,
float bottom, float top,
float nearZ, float farZ);
MBE_INLINE simd_float4x4 float4x4_ortho_rh(float left, float right,
float bottom, float top,
float nearZ, float farZ);
MBE_INLINE simd_float4x4 float4x4_lookat_rh(float eyeX, float eyeY, float eyeZ,
float centerX, float centerY, float centerZ,
float upX, float upY, float upZ);
MBE_INLINE simd_float3x3 MBE_OVERLOAD upper_left_3x3(simd_float4x4);
MBE_INLINE simd_float2x2 MBE_OVERLOAD upper_left_2x2(simd_float4x4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment