Kohi Game Engine
geometry_3d.h File Reference
#include "math_types.h"

Go to the source code of this file.

Data Structures

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
 

Typedefs

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
 

Enumerations

enum  raycast_hit_type { RAYCAST_HIT_TYPE_OBB , RAYCAST_HIT_TYPE_SURFACE }
 

Functions

KAPI ray ray_create (vec3 position, vec3 direction)
 
KAPI ray ray_from_screen (vec2 screen_pos, rect_2d viewport_rect, vec3 origin, mat4 view, mat4 projection)
 
KAPI b8 raycast_aabb (extents_3d bb_extents, const ray *r, vec3 *out_point)
 
KAPI b8 raycast_oriented_extents (extents_3d bb_extents, mat4 model, const ray *r, f32 *out_dist)
 
KAPI b8 raycast_plane_3d (const ray *r, const plane_3d *p, vec3 *out_point, f32 *out_distance)
 
KAPI b8 raycast_disc_3d (const ray *r, vec3 center, vec3 normal, f32 outer_radius, f32 inner_radius, vec3 *out_point, f32 *out_distance)
 

Typedef Documentation

◆ 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.

◆ raycast_hit

typedef struct raycast_hit raycast_hit

◆ raycast_hit_type

◆ raycast_result

Enumeration Type Documentation

◆ raycast_hit_type

Enumerator
RAYCAST_HIT_TYPE_OBB 
RAYCAST_HIT_TYPE_SURFACE 

Function Documentation

◆ ray_create()

KAPI ray ray_create ( vec3  position,
vec3  direction 
)

◆ ray_from_screen()

KAPI ray ray_from_screen ( vec2  screen_pos,
rect_2d  viewport_rect,
vec3  origin,
mat4  view,
mat4  projection 
)

◆ raycast_aabb()

KAPI b8 raycast_aabb ( extents_3d  bb_extents,
const ray r,
vec3 out_point 
)

◆ raycast_disc_3d()

KAPI b8 raycast_disc_3d ( const ray r,
vec3  center,
vec3  normal,
f32  outer_radius,
f32  inner_radius,
vec3 out_point,
f32 out_distance 
)

◆ raycast_oriented_extents()

KAPI b8 raycast_oriented_extents ( extents_3d  bb_extents,
mat4  model,
const ray r,
f32 out_dist 
)

◆ raycast_plane_3d()

KAPI b8 raycast_plane_3d ( const ray r,
const plane_3d p,
vec3 out_point,
f32 out_distance 
)