Untitled
Toggle main menu visibility
Loading...
Searching...
No Matches
engine_utilities.h
Go to the documentation of this file.
1
#ifndef ENGINE_UTILITIES_H
2
#define ENGINE_UTILITIES_H
3
4
#include "
core/engine_types.h
"
5
#include "
utilities/mathf.h
"
6
#include "
utilities/utilities.h
"
7
8
static
inline
void
start_timer
(
Timer
* t) {
9
t->
start
= SDL_GetPerformanceCounter();
10
t->
freq
= SDL_GetPerformanceFrequency();
11
}
12
13
static
inline
double
end_timer
(
Timer
* t) {
14
Uint64 end = SDL_GetPerformanceCounter();
15
return
(
double
)(end - t->
start
) * 1000.0 / (
double
)t->
freq
;
16
}
17
bool
mn_inside_of_root_tree
(
MeshNode
* mns,
int
check_id,
int
id
);
18
static
inline
mat4
compose_trs_from_mesh_node
(
MeshNode
* mn) {
19
20
mat4
T =
mat4_translation
(mn->
translation
);
21
mat4
R =
mat4_from_quat
(mn->
rotation
);
22
mat4
S =
mat4_scale
(mn->
scale
);
23
24
return
m4_mul
(T,
m4_mul
(R, S));
25
}
26
27
static
inline
void
PV_step_size
(
ProbeVolume
* pv,
vec3
* step_x,
vec3
* step_y,
vec3
* step_z)
28
{
29
30
vec3
fwd;
vec3
right;
vec3
up;
31
OBB_vectors
(pv->
obb
.
rot
, &fwd, &right, &up);
32
33
float
dx = (pv->
obb
.
extents
.
x
* 2) / (pv->
resolution
.
x
-1);
34
float
dy = (pv->
obb
.
extents
.
y
* 2) / (pv->
resolution
.
y
-1);
35
float
dz = (pv->
obb
.
extents
.
z
* 2) / (pv->
resolution
.
z
-1);
36
37
*step_x =
vec3_scale
(fwd, dx);
38
*step_y =
vec3_scale
(right, dy);
39
*step_z =
vec3_scale
(up, dz);
40
41
}
42
MeshNode
*
get_root_node
(
MeshNode
* mns,
MeshNode
* mn);
43
44
45
#endif
engine_types.h
Engine specific types and defines.
mn_inside_of_root_tree
bool mn_inside_of_root_tree(MeshNode *mns, int check_id, int id)
Definition
engine_utilities.c:5
get_root_node
MeshNode * get_root_node(MeshNode *mns, MeshNode *mn)
Definition
engine_utilities.c:19
end_timer
double end_timer(Timer *t)
Definition
engine_utilities.h:13
compose_trs_from_mesh_node
mat4 compose_trs_from_mesh_node(MeshNode *mn)
Definition
engine_utilities.h:18
start_timer
void start_timer(Timer *t)
Definition
engine_utilities.h:8
PV_step_size
void PV_step_size(ProbeVolume *pv, vec3 *step_x, vec3 *step_y, vec3 *step_z)
Definition
engine_utilities.h:27
ProbeVolume::resolution
ivec3 resolution
The resolution in X, Y, Z.
Definition
engine_types.h:3079
ProbeVolume::obb
OBB obb
The OBB that defines the size.
Definition
engine_types.h:3078
ProbeVolume
The ProbeVolumes for APVs and LPVs, controlled by OBBs.
Definition
engine_types.h:3074
MeshNode::translation
vec3 translation
Definition
engine_types.h:2379
OBB::extents
vec3 extents
Definition
dynamic.frag:23
MeshNode::rotation
vec4 rotation
Definition
engine_types.h:2380
OBB::rot
mat3 rot
Definition
types.h:49
MeshNode::scale
vec3 scale
Definition
engine_types.h:2381
MeshNode
MeshNodes that describe the position of Meshes, GLTF nodes for GLTFAnimations, or hold references to ...
Definition
audio_probe_bake.comp:85
mathf.h
m4_mul
mat4 m4_mul(mat4 a, mat4 b)
Definition
mathf.h:401
vec3_scale
vec3 vec3_scale(vec3 a, float b)
Definition
mathf.h:248
vec3::x
float x
Definition
types.h:12
ivec3::y
int y
Definition
types.h:15
vec3::y
float y
Definition
types.h:12
ivec3::z
int z
Definition
types.h:15
Timer::start
uint64_t start
Definition
types.h:334
vec3::z
float z
Definition
types.h:12
ivec3::x
int x
Definition
types.h:15
Timer::freq
uint64_t freq
Definition
types.h:335
Timer
Definition
types.h:333
mat4
Definition
types.h:21
vec3
Definition
types.h:12
utilities.h
mat4_translation
mat4 mat4_translation(vec3 t)
Definition
utilities.h:445
mat4_from_quat
mat4 mat4_from_quat(vec4 q)
Definition
utilities.h:459
OBB_vectors
void OBB_vectors(mat3 rot, vec3 *fwd, vec3 *right, vec3 *up)
Definition
utilities.h:600
mat4_scale
mat4 mat4_scale(vec3 s)
Definition
utilities.h:452
src
utilities
engine_utilities.h
Generated by
1.18.0