Kohi Game Engine
math_types.h File Reference

Contains various math types required for the engine. More...

#include "defines.h"

Go to the source code of this file.

Data Structures

union  vec2_u
 A 2-element vector. More...
 
union  uvec2_u
 A 2-element vector of unsigned ints. More...
 
union  ivec2_u
 A 2-element vector of signed ints. More...
 
union  vec3_u
 A 3-element vector. More...
 
union  uvec3_u
 A 3-element vector of unsigned ints. More...
 
union  ivec3_u
 A 3-element vector of signed ints. More...
 
union  vec4_u
 A 4-element vector. More...
 
union  uvec4_u
 A 4-element vector of unsigned ints. More...
 
union  ivec4_u
 A 4-element vector of signed ints. More...
 
union  mat3_u
 A 3x3 matrix. More...
 
union  mat4_u
 a 4x4 matrix, typically used to represent object transformations. More...
 
struct  extents_2d
 Represents the extents of a 2d object. More...
 
struct  extents_3d
 Represents the extents of a 3d object. More...
 
struct  obb
 
struct  vertex_3d
 Represents a single vertex in 3D space. More...
 
struct  skinned_vertex_3d
 Represents a single skinned vertex in 3D space. More...
 
struct  vertex_2d
 Represents a single vertex in 2D space. More...
 
struct  position_vertex_3d
 
struct  colour_vertex_3d
 Represents a single vertex in 3D space with position and colour data only. More...
 
struct  plane_3d
 
struct  kfrustum
 
union  vec2i_t
 A 2-element integer-based vector. More...
 
union  vec3i_t
 A 3-element integer-based vector. More...
 
union  vec4i_t
 A 4-element integer-based vector. More...
 
struct  triangle
 
struct  ray
 Represents a line which starts at an origin and proceed infinitely in the given direction. Typically used for hit tests, picking, etc. More...
 
struct  raycast_hit
 
struct  raycast_result
 
struct  ksphere
 

Macros

#define KFRUSTUM_SIDE_COUNT   6
 

Typedefs

typedef enum axis_3d axis_3d
 
typedef union vec2_u vec2
 A 2-element vector. More...
 
typedef union uvec2_u uvec2
 A 2-element vector of unsigned ints. More...
 
typedef union ivec2_u ivec2
 A 2-element vector of signed ints. More...
 
typedef union vec3_u vec3
 A 3-element vector. More...
 
typedef union uvec3_u uvec3
 A 3-element vector of unsigned ints. More...
 
typedef union ivec3_u ivec3
 A 3-element vector of signed ints. More...
 
typedef union vec4_u vec4
 A 4-element vector. More...
 
typedef vec4 quat
 A quaternion, used to represent rotational orientation. More...
 
typedef vec4 rect_2d
 A 2d rectangle. More...
 
typedef union uvec4_u uvec4
 A 4-element vector of unsigned ints. More...
 
typedef union ivec4_u ivec4
 A 4-element vector of signed ints. More...
 
typedef union mat3_u mat3
 A 3x3 matrix. More...
 
typedef union mat4_u mat4
 a 4x4 matrix, typically used to represent object transformations. More...
 
typedef struct extents_2d extents_2d
 Represents the extents of a 2d object. More...
 
typedef struct extents_3d extents_3d
 Represents the extents of a 3d object. More...
 
typedef extents_3d aabb
 Axis-aligned bounding box. More...
 
typedef struct obb obb
 
typedef struct vertex_3d vertex_3d
 Represents a single vertex in 3D space. More...
 
typedef struct skinned_vertex_3d skinned_vertex_3d
 Represents a single skinned vertex in 3D space. More...
 
typedef struct vertex_2d vertex_2d
 Represents a single vertex in 2D space. More...
 
typedef struct position_vertex_3d position_vertex_3d
 
typedef struct colour_vertex_3d colour_vertex_3d
 Represents a single vertex in 3D space with position and colour data only. More...
 
typedef struct plane_3d plane_3d
 
typedef enum kfrustum_side kfrustum_side
 
typedef struct kfrustum kfrustum
 
typedef union vec2i_t vec2i
 A 2-element integer-based vector. More...
 
typedef union vec3i_t vec3i
 A 3-element integer-based vector. More...
 
typedef union vec4i_t vec4i
 A 4-element integer-based vector. More...
 
typedef vec4i rect_2di
 
typedef struct triangle triangle
 
typedef enum ray_flag_bits ray_flag_bits
 
typedef u32 ray_flags
 
typedef struct ray ray
 Represents a line which starts at an origin and proceed infinitely in the given direction. Typically used for hit tests, picking, etc. More...
 
typedef enum raycast_hit_type raycast_hit_type
 
typedef struct raycast_hit raycast_hit
 
typedef struct raycast_result raycast_result
 
typedef struct ksphere ksphere
 

Enumerations

enum  axis_3d {
  AXIS_X = 0 , AXIS_Y = 1 , AXIS_Z = 2 , AXIS_XY ,
  AXIS_XZ , AXIS_YX , AXIS_YZ , AXIS_ZX ,
  AXIS_ZY
}
 
enum  kfrustum_side {
  KFRUSTUM_SIDE_TOP = 0 , KFRUSTUM_SIDE_BOTTOM = 1 , KFRUSTUM_SIDE_RIGHT = 2 , KFRUSTUM_SIDE_LEFT = 3 ,
  KFRUSTUM_SIDE_FAR = 4 , KFRUSTUM_SIDE_NEAR = 5
}
 
enum  ray_flag_bits { RAY_FLAG_NONE = 0 , RAY_FLAG_IGNORE_IF_INSIDE_BIT = 1 << 0 }
 
enum  raycast_hit_type { RAYCAST_HIT_TYPE_BVH_AABB , RAYCAST_HIT_TYPE_SURFACE , RAYCAST_HIT_TYPE_BVH_AABB_BASE_NODE }
 

Detailed Description

Contains various math types required for the engine.

Author
Travis Vroman (travi.nosp@m.s@ko.nosp@m.hieng.nosp@m.ine..nosp@m.com)
Version
1.0
Date
2022-01-10

Macro Definition Documentation

◆ KFRUSTUM_SIDE_COUNT

#define KFRUSTUM_SIDE_COUNT   6

Typedef Documentation

◆ aabb

typedef extents_3d aabb

Axis-aligned bounding box.

◆ axis_3d

typedef enum axis_3d axis_3d

◆ colour_vertex_3d

Represents a single vertex in 3D space with position and colour data only.

◆ extents_2d

typedef struct extents_2d extents_2d

Represents the extents of a 2d object.

◆ extents_3d

typedef struct extents_3d extents_3d

Represents the extents of a 3d object.

◆ ivec2

typedef union ivec2_u ivec2

A 2-element vector of signed ints.

◆ ivec3

typedef union ivec3_u ivec3

A 3-element vector of signed ints.

◆ ivec4

typedef union ivec4_u ivec4

A 4-element vector of signed ints.

◆ kfrustum

typedef struct kfrustum kfrustum

◆ kfrustum_side

◆ ksphere

typedef struct ksphere ksphere

◆ mat3

typedef union mat3_u mat3

A 3x3 matrix.

◆ mat4

typedef union mat4_u mat4

a 4x4 matrix, typically used to represent object transformations.

◆ obb

typedef struct obb obb

◆ plane_3d

typedef struct plane_3d plane_3d

◆ position_vertex_3d

Position-only 3d vertex.

◆ quat

typedef vec4 quat

A quaternion, used to represent rotational orientation.

◆ ray

typedef struct ray ray

Represents a line which starts at an origin and proceed infinitely in the given direction. Typically used for hit tests, picking, etc.

◆ ray_flag_bits

◆ ray_flags

typedef u32 ray_flags

◆ raycast_hit

typedef struct raycast_hit raycast_hit

◆ raycast_hit_type

◆ raycast_result

◆ rect_2d

typedef vec4 rect_2d

A 2d rectangle.

◆ rect_2di

typedef vec4i rect_2di

◆ skinned_vertex_3d

Represents a single skinned vertex in 3D space.

◆ triangle

typedef struct triangle triangle

◆ uvec2

typedef union uvec2_u uvec2

A 2-element vector of unsigned ints.

◆ uvec3

typedef union uvec3_u uvec3

A 3-element vector of unsigned ints.

◆ uvec4

typedef union uvec4_u uvec4

A 4-element vector of unsigned ints.

◆ vec2

typedef union vec2_u vec2

A 2-element vector.

◆ vec2i

typedef union vec2i_t vec2i

A 2-element integer-based vector.

◆ vec3

typedef union vec3_u vec3

A 3-element vector.

◆ vec3i

typedef union vec3i_t vec3i

A 3-element integer-based vector.

◆ vec4

typedef union vec4_u vec4

A 4-element vector.

◆ vec4i

typedef union vec4i_t vec4i

A 4-element integer-based vector.

◆ vertex_2d

typedef struct vertex_2d vertex_2d

Represents a single vertex in 2D space.

◆ vertex_3d

typedef struct vertex_3d vertex_3d

Represents a single vertex in 3D space.

Enumeration Type Documentation

◆ axis_3d

enum axis_3d
Enumerator
AXIS_X 
AXIS_Y 
AXIS_Z 
AXIS_XY 
AXIS_XZ 
AXIS_YX 
AXIS_YZ 
AXIS_ZX 
AXIS_ZY 

◆ kfrustum_side

Enumerator
KFRUSTUM_SIDE_TOP 
KFRUSTUM_SIDE_BOTTOM 
KFRUSTUM_SIDE_RIGHT 
KFRUSTUM_SIDE_LEFT 
KFRUSTUM_SIDE_FAR 
KFRUSTUM_SIDE_NEAR 

◆ ray_flag_bits

Enumerator
RAY_FLAG_NONE 
RAY_FLAG_IGNORE_IF_INSIDE_BIT 

◆ raycast_hit_type

Enumerator
RAYCAST_HIT_TYPE_BVH_AABB 
RAYCAST_HIT_TYPE_SURFACE 
RAYCAST_HIT_TYPE_BVH_AABB_BASE_NODE