Untitled
Loading...
Searching...
No Matches
init.h File Reference

Important globals for the entire engine and initialization functions that are mainly called on engine start. More...

#include <SDL2/SDL.h>
#include <GL/glew.h>
#include "core/engine_types.h"
#include <stdbool.h>

Go to the source code of this file.

Functions

void allocate_main_fbo ()
 Allocates the main FBO, changes if MSAA is enabled.
void change_fbo_resolution (Framebuffer *fbo, int w, int h, bool skip_depth)
 Changes Framebuffer's resolution, and deletes the old textures.
void GPU_upload_scene_data ()
 Uploads current Globals and SceneData structures to the GPU for baking SSBOs.
void GPU_init_cluster_aabbs ()
 Initializes AABBs on the GPU for clustered forward shading.
AssetInstance * init_new_asset_instance (const char *asset_name, vec3 tr, vec4 rot, vec3 scale)
 Initializes and spawns a new AssetInstance based on an Asset name, and places the AssetInstance.model at a certain transformation.
void destroy_asset_instance (uint32_t id)
 Destroys and frees an AssetInstance.
void init_default_textures ()
 Initializes dummy default textures inside of Globals.images that are used as fallback for empty Materials.
Material * init_new_material (const char *filename)
 Expands Globals.materials and initializes a material to default.
Mesh * retrieve_mesh_by_name (const char *asset_name, const char *mesh_name)
 Searches Globals.assets for a certain Mesh.
void init_mesh (Mesh *mesh)
 Initializes a static or dynamic Mesh.
void allocate_gbuffer_msaa ()
 Allocated a gbuffer with multisampled textures.
void allocate_gbuffer ()
 Allocates a gbuffer without multisampled textures.
bool init (SDL_Window **window, SDL_GLContext *context)
 Initializes the engine, including SDL, OpenGL, GLEW, Nuklear, and engine-specific systems.

Variables

const char menu_names [][256]
 The array for all editor menu names (to avoid Nuklear hashing problems).
AudioEmitter * FOOTSTEP_EMITTER
AudioEmitter AUDIO_EMITTERS [MAX_AUDIO_EMITTERS]
vec4 SSAO_KERNEL [16]
mat4 UNJITTERED_PROJ
mat4 UNJITTERED_PROJ_INV
vec2 JITTER_OFFSET
uint32_t TEXT_INDEX_COUNT
uint32_t PP_SHADER_VERSIONS
char asset_dir [256]
char rprobe_dir [256]
Triangle * mesh_tris
DrawCommand DRAW_COMMANDS [MAX_DRAW_COMMANDS]
int draw_command_count
DrawCommand SHADOW_DRAW_COMMANDS [MAX_DRAW_COMMANDS]
int shadow_draw_command_count
Light default_light
Important Runtime Variables

Variables that control player state and delta time.

float dt
 The 1.0f/60 simulation timestep.
float frame_time
 The actual frame time in s.
float time
 The frame time but wrapping at 1.0.
int running
 The variable that tracks if we need to exit main().
int LMB_HELD
 If the left mouse button is held.
int MOUSE_X
int MOUSE_Y
 Mouse position.
vec3 CAM_POS
 Shorthand variable for the camera position.
bool draw_dirty
 If we need to reupload and resort transforms in create_and_sort_draw_commands() and upload_instance_data().
double time_since_last_render
 The time since the last render (while running physics updates).
Player player
 The Player data.
vec3 spawn_point
 Spawn point.
int current_frame
int master_frame
GLsync RENDER_FENCE [BUFFER_FRAMES]
const vec3 left_leg_offset
const vec3 right_leg_offset
bool right_leg_moving
bool NUKLEAR_HOVERED
EditorSettings EDITOR_SETTINGS
size_t meshes_in_frame [MAX_MESH_NODES]
size_t meshes_this_frame
int DIRECTIONAL_LIGHT_COUNT
int PERFORMANCE_OVERLAY_TEXT_BOX_START
int PERFORMANCE_OVERLAY_MENU
struct nk_context * NK_CTX
 Nuklear context handle used for Editor UI.
SDL_Window * window
FileDirectoryRegistries

All of the registries used for parsing working directories.

FileDirectoryRegistry scene_registry
FileDirectoryRegistry lightmap_registry
FileDirectoryRegistry light_registry
FileDirectoryRegistry sound_registry
FileDirectoryRegistry aportal_registry
FileDirectoryRegistry rprobe_registry
FileDirectoryRegistry lprobe_registry
FileDirectoryRegistry aprobe_registry
FileDirectoryRegistry scene_apv_registry
FileDirectoryRegistry ui_registry
Workspaces

Stack workspaces currently for EPA and ASTAR.

AStarWorkspace AW
EPAWorkspace * EW [8]
AudioProbe Related Variables

Parts of the path traced AudioProbe pipeline.

SDL_AudioDeviceID SDL_AUDIO_DEVICE
ma_engine AUDIO_ENGINE
AudioScratchBuffers AUDIO_SCRATCH
float * STATIC_HRTF_LEFT [SH_MAX]
float * STATIC_HRTF_RIGHT [SH_MAX]
int HRTF_LENGTH
ConvolverNode CONVOLVER_NODE
int DEBUG_APROBE_RAY_COUNT
int DEBUG_CURRENT_APROBE
HRTFThreadData HRTF_TD
float BAND_IMPULSES [AUDIO_NUM_BANDS][AUDIO_KERNEL_SIZE]
Resolutions

Resolutions for Framebuffers.

int SCREEN_WIDTH
int SCREEN_HEIGHT
int RENDER_WIDTH
int RENDER_HEIGHT
int BLOOM_WIDTH
int BLOOM_HEIGHT
int DOF_WIDTH
int DOF_HEIGHT
int SSR_WIDTH
int SSR_HEIGHT
int SSAO_WIDTH
int SSAO_HEIGHT
UBOs
See also
init().
GLuint CAM_UBO
GLuint RENDER_UBO
GLuint LIGHT_CAM_UBO
GLuint RPROBE_UBO
GLuint PROBE_VOLUME_UBO
GLuint SSAO_KERNEL_UBO
VBOs, VAOs, and EBOs
See also
init().
GLuint CONVOLVE_TRIANGLE_VBO
GLuint CONVOLVE_TRIANGLE_VAO
GLuint SKY_VAO
GLuint SKY_VBO
GLuint INSTANCE_VBO
GLuint WIREFRAME_VBO
GLuint WIREFRAME_VAO
GLuint FS_VAO
GLuint MAIN_VBO
GLuint MAIN_EBO
GLuint MAIN_VAO
GLuint SHADOW_INSTANCE_VBO
GLuint SHADOW_VAO
Framebuffer TEXT_FBO
GLuint TEXT_VAO
GLuint TEXT_VBO
GLuint TEXT_EBO
GLuint UI_VAO
GLuint UI_VBO
GLuint UI_INSTANCE_VBO
GLuint LIGHTMAP_VAO
GLuint LIGHTMAP_VBO
Global Textures
See also
init().
GLuint RPROBE_BACK_TEXTURE
GLuint SSAO_NOISE_TEXTURE
GLuint FBM_TEXTURE
GLuint SOBEL_TEXTURE [2]
GLuint HISTORY_TEXTURE [2]
GLuint LIGHTMAP_POS_TEXTURE
GLuint LIGHTMAP_NORM_TEXTURE
GLuint LIGHTMAP_ID_TEXTURE
GLuint DIRECTIONAL_MAP_TEXTURE
GLuint RPROBE_CUBE_MAP_ARRAY
GLuint RPROBE_DEPTH_TEXTURE
GLuint TEMP_RPROBE_CUBE_MAP
GLuint LPV_TEXTURE
GLuint LIGHTMAP_PING
GLuint LIGHTMAP_PONG
GLuint BLENDED_RPROBE_CUBE_MAP
GLuint COLOR_GRADE_LUT
GLuint BRDF_LUT
GLuint SKYBOX
Dummy Textures
See also
init().
int DEFAULT_DIFFUSE
int DEFAULT_NORMAL
int DEFAULT_ARM
int DEFAULT_EMISSIVE
int DEFAULT_DISPLACEMENT
int DUMMY_LIGHTMAP
Global Shaders
See also
SHADERS_INIT().
Todo
remove SSR
ShaderProgram LIGHTMAP_SHADER
 light/lightmap.vert light/lightmap.frag
GLuint LIGHTMAP_BOUNCE_SHADER
 light/lightmap_bounce.comp
GLuint LIGHTMAP_DENOISE_SHADER
 light/lightmap_denoise.comp
GLuint LIGHTMAP_DILATE_SHADER
 light/lightmap_dilate.comp
GLuint DIRECTIONAL_MAP_NORMALIZE_SHADER
 light/directional_map_normalize.comp
GLuint PROBE_BAKE_SHADER
 light/probe_bake.comp
GLuint PROBE_UNPACK_SHADER
 light/probe_unpack.comp
GLuint AUDIO_PROBE_BAKE_SHADER
 audio/audio_probe_bake.comp
GLuint INIT_CLUSTER_AABBS_SHADER
 render/init_cluster_aabbs.comp
ShaderProgram CULL_CLUSTERS_SHADER
 render/cull_clusters.comp
ShaderProgram CULL_DRAW_CALLS_SHADER
 render/cull_draw_calls.comp
ShaderProgram INDIRECT_PREFIX_SHADER
 render/indirect_prefix.comp
ShaderProgram ELEMENTS_PREFIX_SHADER
 render/elements_prefix.comp
ShaderProgram CULL_POINT_LIGHT_SHADOWS_SHADER
 render/cull_point_light_shadows.comp
ShaderProgram SKY_SHADER
 render/sky.vert render/sky.frag
ShaderProgram SHADOW_MAP_SHADER
 render/shadow.vert render/shadow.frag
ShaderProgram POINT_LIGHT_SHADOW_SHADER
 render/point_light_shadows.vert render/point_light_shadows.geom render/point_light_shadows.frag
ShaderProgram DEPTH_PRE_PASS_SHADER [GBUFFER_VERSIONS]
 render/depth_pre_pass.vert render/depth_pre_pass.frag
ShaderProgram DEPTH_PRE_PASS_SHADER_MSAA [GBUFFER_VERSIONS]
 render/depth_pre_pass_no_gbuffer.vert render/depth_pre_pass_no_gbuffer.frag
ShaderProgram DEPTH_DOWNSAMPLE_SHADER
 render/depth_downsample.frag
ShaderProgram SSAO_SHADER
 render/ssao.frag
ShaderProgram SSAO_BLUR_SHADER
 render/ssao_blur.frag
ShaderProgram DYNAMIC_SHADER [32]
 render/dynamic.vert render/dynamic.frag
ShaderProgram SSR_SHADER
ShaderProgram SSR_BLUR_SHADER
ShaderProgram SSR_HISTORY_SHADER
ShaderProgram COC_SHADER
 render/coc.frag
ShaderProgram BOKEH_SHADER
 render/bokeh.frag
ShaderProgram BLOOM_SHADER
 render/bloom.frag
ShaderProgram BLOOM_BLUR_SHADER
 render/bloom_blur.frag
ShaderProgram FOCAL_DISTANCE_SHADER
 render/focal_distance.comp
ShaderProgram BLOOM_DOWNSCALE_SHADER
 render/bloom_downscale.frag
ShaderProgram BLOOM_UPSCALE_SHADER
 render/bloom_upscale.frag
ShaderProgram WIREFRAME_SHADER
 render/wireframe.vert render/wireframe.frag
ShaderProgram BRDF_SHADER
 utilities/brdf.frag
ShaderProgram TEXT_SHADER
 ui/text.vert ui/text.frag
ShaderProgram UI_SHADER
 ui/ui.vert ui/ui.frag
ShaderProgram POSTPROCESS_SHADER [128]
 render/postprocess.vert render/postprocess.frag
FBOs
See also
init().
GLuint BRDF_FBO
GLuint RPROBE_BACK_FBO
GLuint SOBEL_FBO [2]
GLuint HISTORY_FBO [2]
GLuint LIGHTMAP_FBO
GLuint RPROBE_FBO
Framebuffer TAA_FBO [2]
Framebuffer POINT_LIGHT_SHADOWS_FBO
Framebuffer GBUFFER_FBO
Framebuffer GBUFFER_RESOLVE_FBO
Framebuffer SSR_FBO
Framebuffer SSR_BLUR_FBO
Framebuffer SSAO_FBO
Framebuffer SSAO_BLUR_FBO
Framebuffer COC_FBO
Framebuffer BOKEH_FBO
Framebuffer SHADOW_MAP_FBO
Framebuffer MAIN_FBO
Framebuffer MAIN_RESOLVE_FBO
Framebuffer BLOOM_PYRAMID [6]
Framebuffer DEPTH_DOWNSAMPLE_FBO
Baking SSBOs
See also
init().
GLuint LIGHT_SSBO
GLuint MESH_LIGHT_SSBO
GLuint LIGHTMAP_SSBO
GLuint VERTEX_SSBO
 Vertices: vec4 (x, y, z, padding) or just float arrays.
GLuint TRI_SSBO
 Indices (Tris): uvec3 for triangle lookups.
GLuint MESH_SSBO
 Instances (Transforms): Needs the Model Matrix, Inverse Model Matrix (crucial for transforming rays into local mesh space), and the underlying Mesh ID.
GLuint MESH_BVH_SSBO
 Mesh BVH Nodes: Flattened array of nodes.
GLuint SCENE_BVH_SSBO
 Scene BVH Nodes (TLAS): Same structure as above, but pointing to instances instead of triangles.
GLuint MATERIAL_SSBO
 Material Data: Roughness, emission multipliers, albedo colors for each instance.
GLuint PROBE_SSBO
Rendering SSBOs
See also
init().
GLuint RPROBE_SSBO
GLuint JOINT_SSBO
GLuint CLUSTER_AABB_SSBO
GLuint GLOBAL_LIGHT_INDICES_SSBO
GLuint CLUSTER_SSBO
GLuint MESH_NODE_SSBO
GLuint GLOBAL_INSTANCE_SSBO
GLuint INDIRECT_ARRAYS_COMMAND_BUFFER
GLuint INDIRECT_ARRAYS_COMMAND_BUFFER_OUT
GLuint INDIRECT_ELEMENTS_COMMAND_BUFFER
GLuint INDIRECT_ELEMENTS_COMMAND_BUFFER_OUT
GLuint INSTANCE_SSBO
GLuint TEXT_BOX_SSBO
GLuint UI_SSBO
GPU Scratch Buffers

The temp GPU data for lightmap baking.

See also
init().
VertexData VERTEX_DATA
TriData TRI_DATA
MeshData MESH_DATA
BVHGPU MESH_BVH_DATA
BVHGPU SCENE_BVH_DATA
LightmapSSBO LIGHTMAP_DATA
MaterialData MATERIAL_DATA
Persistent Buffer Pointers

Pointers to persistent OpenGL GPU-side buffers, some of which are triple buffered and require pointer arithmetic.

See also
init().
size_t cam_ubo_padded
uint8_t * cam_ubo_ptr
size_t light_cam_ubo_padded
uint8_t * light_cam_ubo_ptr
size_t rprobe_ubo_padded
uint8_t * rprobe_ubo_ptr
size_t probe_volume_ubo_padded
uint8_t * probe_volume_ubo_ptr
size_t light_ssbo_size
uint8_t * light_ssbo_ptr
size_t mesh_light_ssbo_size
uint8_t * mesh_light_ssbo_ptr
size_t joint_ssbo_size
uint8_t * joint_ssbo_ptr
size_t instance_vbo_size
uint8_t * instance_vbo_ptr
uint8_t * shadow_instance_vbo_ptr
size_t mesh_node_ssbo_size
uint8_t * mesh_node_ssbo_ptr
uint8_t * indirect_arrays_ptr
uint8_t * indirect_arrays_out_ptr
uint8_t * indirect_elements_ptr
uint8_t * indirect_elements_out_ptr
uint8_t * visible_indices_ptr
size_t instance_ssbo_size
uint8_t * instance_ssbo_ptr
size_t text_box_ssbo_size
uint8_t * text_box_ssbo_ptr
size_t ui_ssbo_size
uint8_t * ui_ssbo_ptr
size_t text_vbo_size
uint8_t * text_vbo_ptr
size_t ui_vbo_size
uint8_t * ui_vbo_ptr
size_t ui_instance_vbo_size
uint8_t * ui_instance_vbo_ptr

Debug Draw Buffers

Pushed to each frame for wireframes and debug information.

See also
render().
#define DEBUG_LINES_MAX   500000
DebugVertex DEBUG_FACES [1024][3]
int DEBUG_FACE_COUNT
DebugVertex DEBUG_POINTS [1024]
int DEBUG_POINT_COUNT
DebugVertex DEBUG_LINES [500000]
int DEBUG_LINE_COUNT

Performance Queries

GLQuery results that are pushed to performance overlay.

See also
update_performance_overlay().
#define QUERY_FRAMES   3
GLuint main_queries [3]
GLuint pl_queries [3]
GLuint sm_queries [3]
GLuint render_queries [3]
GLuint gbuffer_queries [3]
GLuint dof_queries [3]
GLuint ssao_queries [3]
GLuint taa_queries [3]
GLuint ssr_queries [3]
GLuint bloom_queries [3]
GLuint cull_queries [3]
int current_query_frame

Stack Arrays

Stack arrays for components and engine structures that use a free list to manage destruction and lifetime.

#define MAX_ENTITIES   256
#define MAX_ASSET_INSTANCES   256
#define MAX_PHYSICS_COMPONENTS   256
#define MAX_MANIFOLDS   64
 The maximum amount of Manifolds in MANIFOLDS.
#define MAX_ANIMATION_COMPONENTS   256
Entity ENTITIES [256]
AssetInstance ASSET_INSTANCES [256]
PhysicsComponent PHYSICS_COMPONENTS [256]
Manifold MANIFOLDS [64]
AnimationComponent ANIMATION_COMPONENTS [256]

Detailed Description

Important globals for the entire engine and initialization functions that are mainly called on engine start.

Definition in file init.h.

Macro Definition Documentation

◆ DEBUG_LINES_MAX

#define DEBUG_LINES_MAX   500000

Definition at line 347 of file init.h.

Referenced by init(), render(), and render_probe_volume().

◆ QUERY_FRAMES

#define QUERY_FRAMES   3

Definition at line 362 of file init.h.

Referenced by main().

◆ MAX_ENTITIES

#define MAX_ENTITIES   256

Definition at line 439 of file init.h.

Referenced by create_entity(), init_globals(), main(), scene_load(), scene_save(), and update_entities().

◆ MAX_ASSET_INSTANCES

◆ MAX_PHYSICS_COMPONENTS

#define MAX_PHYSICS_COMPONENTS   256

◆ MAX_MANIFOLDS

#define MAX_MANIFOLDS   64

The maximum amount of Manifolds in MANIFOLDS.

Definition at line 448 of file init.h.

Referenced by create_new_manifold(), find_manifold_for_pair(), init_globals(), and update_physics_components().

◆ MAX_ANIMATION_COMPONENTS

#define MAX_ANIMATION_COMPONENTS   256

Function Documentation

◆ allocate_main_fbo()

◆ change_fbo_resolution()

void change_fbo_resolution ( Framebuffer * fbo,
int w,
int h,
bool skip_depth )

Changes Framebuffer's resolution, and deletes the old textures.

Parameters
fboThe Framebuffer that changes.
wThe width.
hThe height.
skip_depthIf depth texture needs to also change.

Definition at line 1361 of file init.c.

References change_fbo_resolution(), Framebuffer::depth_texture, Framebuffer::fbo, generate_gl_texture(), Framebuffer::h, GLTexture::h, GLTexture::i, init_fbo(), Framebuffer::texture, Framebuffer::texture_count, Framebuffer::w, and GLTexture::w.

Referenced by change_bloom_res(), change_dof_res(), change_fbo_resolution(), change_render_resolution(), and change_ssao_res().

◆ GPU_upload_scene_data()

◆ GPU_init_cluster_aabbs()

void GPU_init_cluster_aabbs ( )

Initializes AABBs on the GPU for clustered forward shading.

Definition at line 778 of file init.c.

References GPU_init_cluster_aabbs(), GRID_X, GRID_Y, GRID_Z, INIT_CLUSTER_AABBS_SHADER, RENDER_HEIGHT, RENDER_WIDTH, VIEW_FAR, and VIEW_NEAR.

Referenced by GPU_init_cluster_aabbs(), and main().

◆ init_new_asset_instance()

AssetInstance * init_new_asset_instance ( const char * asset_name,
vec3 tr,
vec4 rot,
vec3 scale )

Initializes and spawns a new AssetInstance based on an Asset name, and places the AssetInstance.model at a certain transformation.

Parameters
asset_nameThe name of the Asset.
trThe translation.
rotThe rotation.
scaleThe scale.

Definition at line 304 of file init.c.

References Asset::aabb, AssetInstance::aabb, GLTFSkin::animation_indices, Asset::asset_id, AssetInstance::asset_id, MeshNode::asset_instance, ASSET_INSTANCES, Globals::assets, CAST_VEC, MeshNode::child_count, MeshNode::children, compose_trs_from_vectors(), Vector::count, create_entity(), MeshNode::ent, GLTFSkin::final_mat, find_free_in_vector(), AssetInstance::first_skin, AssetInstance::free, GLTFSkin::free, MeshNode::free, GLOBALS, AssetInstance::id, GLTFSkin::id, MeshNode::id, init_new_asset_instance(), GLTFSkin::inverse_bind, GLTFSkin::joint_count, GLTFSkin::joints, MeshNode::local_id, MAX_ANIMATION_INDICES, MAX_ASSET_INSTANCES, Globals::mesh_nodes, AssetInstance::model, GLTFSkin::name, MeshNode::name, Asset::node_count, AssetInstance::node_count, AssetInstance::node_indices, Asset::nodes, MeshNode::parent, MeshNode::pc, MeshNode::physics_mode, retrieve_asset_by_name(), AssetInstance::rot, rot(), AssetInstance::scale, set_mn_components_to_children(), MeshNode::skin, Asset::skin_count, AssetInstance::skin_count, AssetInstance::skin_indices, Asset::skins, Globals::skins, MeshNode::skip_directional_uv_lighting, AssetInstance::tr, and MeshNode::uv_map.

Referenced by init_new_asset_instance(), main(), and render_main_menu().

◆ destroy_asset_instance()

◆ init_default_textures()

void init_default_textures ( )

◆ init_new_material()

Material * init_new_material ( const char * filename)

◆ retrieve_mesh_by_name()

Mesh * retrieve_mesh_by_name ( const char * asset_name,
const char * mesh_name )

Searches Globals.assets for a certain Mesh.

Parameters
asset_nameThe Asset name.
mesh_nameThe Mesh name.
Returns
Pointer to the Mesh.

Definition at line 242 of file init.c.

References Globals::assets, CAST_VEC, Vector::count, GLOBALS, Asset::mesh_indices, Globals::meshes, Mesh::name, Asset::path, and retrieve_mesh_by_name().

Referenced by retrieve_mesh_by_name().

◆ init_mesh()

◆ allocate_gbuffer_msaa()

◆ allocate_gbuffer()

◆ init()

bool init ( SDL_Window ** window,
SDL_GLContext * context )

Initializes the engine, including SDL, OpenGL, GLEW, Nuklear, and engine-specific systems.

Parameters
windowSDL Window.
contextSDL Context.

Definition at line 1987 of file init.c.

References allocate_gbuffer(), allocate_gbuffer_msaa(), allocate_main_fbo(), AUDIO_ENGINE, BAND_IMPULSES, ConvolverNode::base, bind_render_ssbos(), BLENDED_RPROBE_CUBE_MAP, BLOOM_HEIGHT, BLOOM_PYRAMID, BLOOM_WIDTH, BOKEH_FBO, BRDF_FBO, BRDF_LUT, BRDF_SHADER, BUFFER_FRAMES, CAM_UBO, cam_ubo_padded, cam_ubo_ptr, CLUSTER_AABB_SSBO, CLUSTER_SSBO, COC_FBO, COLOR_GRADE_LUT, CONVOLVE_TRIANGLE_VAO, CONVOLVE_TRIANGLE_VBO, CONVOLVER_NODE, DEBUG_LINES_MAX, DEFAULT_POINT_LIGHT_SHADOWS_SIZE, DEFAULT_SHADOW_MAP_SIZE, DEPTH_DOWNSAMPLE_FBO, DEPTH_MODE_HW, DEPTH_MODE_NONE, Framebuffer::depth_rbo, Framebuffer::depth_texture, DOF_HEIGHT, DOF_WIDTH, EDITOR_SETTINGS, FBM_TEXTURE, FBM_TEXTURE_SIZE, Framebuffer::fbo, FILE_DIR_REGISTRY_INIT(), FONTS_INIT(), FOOTSTEP_EMITTER, FS_VAO, GBUFFER_FBO, GBUFFER_RESOLVE_FBO, GLOBAL_INSTANCE_SSBO, GLOBAL_LIGHT_INDICES_SSBO, Framebuffer::h, HISTORY_FBO, HISTORY_TEXTURE, HRTF_TD, GLRenderbuffer::i, GLTexture::i, INDIRECT_ARRAYS_COMMAND_BUFFER, INDIRECT_ARRAYS_COMMAND_BUFFER_OUT, indirect_arrays_out_ptr, indirect_arrays_ptr, INDIRECT_ELEMENTS_COMMAND_BUFFER, INDIRECT_ELEMENTS_COMMAND_BUFFER_OUT, indirect_elements_out_ptr, indirect_elements_ptr, init(), init_action_callbacks(), init_audio_scratch_buffers(), init_band_kernels(), init_emitter(), init_fbo(), init_gl_texture(), init_globals(), init_hover_callbacks(), init_player(), init_sdl_audio(), init_vertex_layouts(), INSTANCE_SSBO, instance_ssbo_ptr, instance_ssbo_size, INSTANCE_VBO, instance_vbo_ptr, instance_vbo_size, HRTFThreadData::ir_swap_lock, JOINT_SSBO, joint_ssbo_ptr, joint_ssbo_size, LIGHT_CAM_UBO, light_cam_ubo_padded, light_cam_ubo_ptr, LIGHT_SSBO, light_ssbo_ptr, light_ssbo_size, LIGHTMAP_FBO, LIGHTMAP_HEIGHT, LIGHTMAP_ID_TEXTURE, LIGHTMAP_NORM_TEXTURE, LIGHTMAP_POS_TEXTURE, LIGHTMAP_SSBO, LIGHTMAP_VAO, LIGHTMAP_VBO, LIGHTMAP_WIDTH, load_3d_lut(), load_cubemap(), load_hrtf_from_binary(), ConvolverNode::lock, LPV_SLOTS, LPV_TEXTURE, MAIN_EBO, MAIN_FBO, MAIN_RESOLVE_FBO, MAIN_VAO, MAIN_VBO, MATERIAL_SSBO, MAX_DIRECTIONAL_LIGHTS, MAX_INSTANCES, MAX_JOINT_MATRICES, MAX_LIGHTS, MAX_LIGHTS_PER_CLUSTER, MAX_LIGHTS_PER_MESH, MAX_MESH_NODES, MAX_POINT_LIGHT_SHADOWS_CMA, MAX_RPROBE_MIPS, MAX_TEXT_BOX_CHARACTERS, MAX_TEXT_BOXES, MAX_UI_ELEMENTS, MESH_BVH_SSBO, MESH_LIGHT_SSBO, mesh_light_ssbo_ptr, mesh_light_ssbo_size, MESH_NODE_SSBO, mesh_node_ssbo_ptr, mesh_node_ssbo_size, MESH_SSBO, EditorSettings::MSAA, my_custom_node_vtable, NK_CTX, play_emitter(), POINT_LIGHT_SHADOWS_FBO, precompute_fbm_texture(), precompute_ssao_kernel(), PROBE_SSBO, PROBE_VOLUME_DEPTH_PADDED, PROBE_VOLUME_HEIGHT, PROBE_VOLUME_UBO, probe_volume_ubo_padded, probe_volume_ubo_ptr, PROBE_VOLUME_WIDTH, ShaderProgram::program, rand(), Framebuffer::rbo_count, RENDER_HEIGHT, RENDER_UBO, RENDER_WIDTH, RPROBE_BACK_FBO, RPROBE_BACK_TEXTURE, RPROBE_CUBE_MAP_ARRAY, RPROBE_DEPTH_TEXTURE, RPROBE_FBO, RPROBE_HEIGHT, RPROBE_SSBO, RPROBE_UBO, rprobe_ubo_padded, rprobe_ubo_ptr, RPROBE_WIDTH, SCENE_BVH_SSBO, SCREEN_HEIGHT, SCREEN_WIDTH, SDL_AUDIO_DEVICE, SH_MAX, SHADERS_INIT(), SHADOW_MAP_FBO, SKY_VAO, SKY_VBO, SKYBOX, SOBEL_FBO, SOBEL_TEXTURE, SSAO_BLUR_FBO, SSAO_FBO, SSAO_HEIGHT, SSAO_KERNEL, SSAO_KERNEL_SIZE, SSAO_KERNEL_UBO, SSAO_NOISE_TEXTURE, SSAO_WIDTH, SSR_BLUR_FBO, SSR_FBO, SSR_HEIGHT, SSR_WIDTH, STATES_INIT(), TAA_FBO, TEMP_RPROBE_CUBE_MAP, TEXT_BOX_SSBO, text_box_ssbo_ptr, text_box_ssbo_size, TEXT_EBO, TEXT_FBO, TEXT_HEIGHT, TEXT_VAO, TEXT_VBO, text_vbo_size, TEXT_WIDTH, Framebuffer::texture, Framebuffer::texture_count, TOTAL_CLUSTERS, TRI_SSBO, UI_INIT(), UI_INSTANCE_VBO, ui_instance_vbo_ptr, ui_instance_vbo_size, UI_SSBO, ui_ssbo_ptr, ui_ssbo_size, UI_VAO, UI_VBO, ui_vbo_ptr, ui_vbo_size, UNDO_INIT(), VERTEX_SSBO, Framebuffer::w, window, WIREFRAME_VAO, and WIREFRAME_VBO.

Referenced by init(), and main().

Variable Documentation

◆ dt

◆ frame_time

float frame_time
extern

The actual frame time in s.

Definition at line 300 of file main.c.

Referenced by main(), and render().

◆ time

float time
extern

The frame time but wrapping at 1.0.

Definition at line 320 of file main.c.

Referenced by bind_dynamic_shader(), main(), play_animation(), render(), render_entity_menu(), render_to_cubemap_face(), and update_performance_overlay().

◆ running

int running
extern

The variable that tracks if we need to exit main().

Definition at line 317 of file main.c.

Referenced by main(), process_input(), and process_sdl_event().

◆ LMB_HELD

int LMB_HELD
extern

If the left mouse button is held.

Definition at line 51 of file main.c.

Referenced by handle_held_events(), and process_sdl_event().

◆ MOUSE_X

◆ MOUSE_Y

int MOUSE_Y

Mouse position.

Definition at line 25 of file init.h.

◆ CAM_POS

vec3 CAM_POS
extern

Shorthand variable for the camera position.

Definition at line 205 of file main.c.

Referenced by determine_closest_rprobes(), main(), and process_sdl_event().

◆ draw_dirty

bool draw_dirty
extern

◆ time_since_last_render

double time_since_last_render
extern

The time since the last render (while running physics updates).

Computes the dot product or discrete sum over an array range.

The time since the last render (while running physics updates).

\[S = \sum_{i=0}^{N-1} x[i] \cdot w[i] \]

Applies an impulse response filter via discrete convolution.

\[(x * h)[n] = \sum_{m=-\infty}^{\infty} x[m] \, h[n - m] \]

Evaluates the rendering equation for global illumination.

\[L_o(x, \omega_o) = L_e(x, \omega_o) + \int_{\Omega} f_r(x, \omega_i, \omega_o) L_i(x, \omega_i) (\omega_i \cdot n) \, d\omega_i \]

Computes Schlick's approximation for Fresnel reflectance.

\begin{eqnarray*}F(\theta) &=& F_0 + (1 - F_0)(1 - \cos\theta)^5 \\ \text{where } \cos\theta &=& \max(0, \omega_h \cdot v) \end{eqnarray*}

Definition at line 505 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ player

◆ spawn_point

vec3 spawn_point
extern

Spawn point.

Todo
encapsulate.

Definition at line 289 of file main.c.

Referenced by init_player(), and process_input().

◆ current_frame

◆ master_frame

int master_frame
extern

Definition at line 21 of file render.c.

Referenced by render(), update_camera(), and write_point_light_shadows().

◆ RENDER_FENCE

GLsync RENDER_FENCE[BUFFER_FRAMES]
extern

Definition at line 293 of file main.c.

Referenced by render().

◆ left_leg_offset

const vec3 left_leg_offset
extern

Definition at line 391 of file main.c.

Referenced by update_skeleton().

◆ right_leg_offset

const vec3 right_leg_offset
extern

Definition at line 392 of file main.c.

Referenced by update_skeleton().

◆ right_leg_moving

bool right_leg_moving
extern

Definition at line 298 of file main.c.

◆ NUKLEAR_HOVERED

◆ EDITOR_SETTINGS

◆ meshes_in_frame

size_t meshes_in_frame[MAX_MESH_NODES]
extern

Definition at line 26 of file render.c.

◆ meshes_this_frame

size_t meshes_this_frame
extern

Definition at line 27 of file render.c.

◆ DIRECTIONAL_LIGHT_COUNT

int DIRECTIONAL_LIGHT_COUNT
extern

Definition at line 324 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ PERFORMANCE_OVERLAY_TEXT_BOX_START

int PERFORMANCE_OVERLAY_TEXT_BOX_START
extern

◆ PERFORMANCE_OVERLAY_MENU

int PERFORMANCE_OVERLAY_MENU
extern

◆ NK_CTX

◆ window

◆ AW

AStarWorkspace AW
extern

Definition at line 75 of file main.c.

Referenced by init_globals(), and pathfind_audio_occlusion().

◆ EW

◆ SDL_AUDIO_DEVICE

SDL_AudioDeviceID SDL_AUDIO_DEVICE
extern

Definition at line 263 of file main.c.

Referenced by init(), init_sdl_audio(), and main().

◆ AUDIO_ENGINE

ma_engine AUDIO_ENGINE
extern

Definition at line 66 of file main.c.

Referenced by audio_update(), init(), init_sdl_audio(), load_emitter(), and main().

◆ AUDIO_SCRATCH

◆ STATIC_HRTF_LEFT

float* STATIC_HRTF_LEFT[SH_MAX]
extern

Definition at line 69 of file main.c.

◆ STATIC_HRTF_RIGHT

float* STATIC_HRTF_RIGHT[SH_MAX]
extern

Definition at line 70 of file main.c.

◆ HRTF_LENGTH

int HRTF_LENGTH
extern

Definition at line 71 of file main.c.

Referenced by allocate_audio_scratch_hrtf(), and load_hrtf_from_binary().

◆ CONVOLVER_NODE

◆ DEBUG_APROBE_RAY_COUNT

int DEBUG_APROBE_RAY_COUNT
extern

Definition at line 52 of file main.c.

Referenced by main(), and process_probe_chunk().

◆ DEBUG_CURRENT_APROBE

int DEBUG_CURRENT_APROBE
extern

Definition at line 54 of file main.c.

Referenced by interpolate_nearest_aprobes(), and render_probe_volume().

◆ HRTF_TD

◆ BAND_IMPULSES

float BAND_IMPULSES[AUDIO_NUM_BANDS][AUDIO_KERNEL_SIZE]
extern

Definition at line 28 of file audio.c.

Referenced by init(), and process_probe_chunk().

◆ FOOTSTEP_EMITTER

AudioEmitter* FOOTSTEP_EMITTER
extern

Definition at line 149 of file main.c.

Referenced by init(), and update_leg().

◆ AUDIO_EMITTERS

◆ SSAO_KERNEL

vec4 SSAO_KERNEL[16]
extern

Definition at line 213 of file main.c.

Referenced by init(), and precompute_ssao_kernel().

◆ SCREEN_WIDTH

◆ SCREEN_HEIGHT

◆ RENDER_WIDTH

◆ RENDER_HEIGHT

◆ BLOOM_WIDTH

int BLOOM_WIDTH
extern

Definition at line 81 of file main.c.

Referenced by change_bloom_res(), execute_editor_settings_undo(), init(), and render_main_menu().

◆ BLOOM_HEIGHT

int BLOOM_HEIGHT
extern

Definition at line 82 of file main.c.

Referenced by change_bloom_res(), execute_editor_settings_undo(), init(), and render_main_menu().

◆ DOF_WIDTH

int DOF_WIDTH
extern

◆ DOF_HEIGHT

int DOF_HEIGHT
extern

◆ SSR_WIDTH

int SSR_WIDTH
extern

Definition at line 85 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ SSR_HEIGHT

int SSR_HEIGHT
extern

Definition at line 86 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ SSAO_WIDTH

int SSAO_WIDTH
extern

◆ SSAO_HEIGHT

int SSAO_HEIGHT
extern

◆ UNJITTERED_PROJ

mat4 UNJITTERED_PROJ
extern

Definition at line 179 of file main.c.

◆ UNJITTERED_PROJ_INV

mat4 UNJITTERED_PROJ_INV
extern

Definition at line 180 of file main.c.

◆ JITTER_OFFSET

vec2 JITTER_OFFSET
extern

Definition at line 181 of file main.c.

Referenced by render_to_cubemap_face(), and update_camera().

◆ TEXT_INDEX_COUNT

uint32_t TEXT_INDEX_COUNT
extern

Definition at line 16 of file fonts.c.

Referenced by add_all_text_boxes_to_draw_buffer(), and render().

◆ CAM_UBO

GLuint CAM_UBO
extern

Definition at line 135 of file main.c.

Referenced by init(), main(), and render_to_cubemap_face().

◆ RENDER_UBO

GLuint RENDER_UBO
extern

Definition at line 136 of file main.c.

Referenced by init().

◆ LIGHT_CAM_UBO

GLuint LIGHT_CAM_UBO
extern

Definition at line 137 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ RPROBE_UBO

GLuint RPROBE_UBO
extern

Definition at line 138 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ PROBE_VOLUME_UBO

GLuint PROBE_VOLUME_UBO
extern

Definition at line 140 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ SSAO_KERNEL_UBO

GLuint SSAO_KERNEL_UBO
extern

Definition at line 139 of file main.c.

Referenced by init().

◆ CONVOLVE_TRIANGLE_VBO

GLuint CONVOLVE_TRIANGLE_VBO
extern

Definition at line 233 of file main.c.

Referenced by init().

◆ CONVOLVE_TRIANGLE_VAO

GLuint CONVOLVE_TRIANGLE_VAO
extern

Definition at line 234 of file main.c.

Referenced by init().

◆ SKY_VAO

GLuint SKY_VAO
extern

Definition at line 303 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ SKY_VBO

GLuint SKY_VBO
extern

Definition at line 304 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ INSTANCE_VBO

GLuint INSTANCE_VBO
extern

◆ WIREFRAME_VBO

GLuint WIREFRAME_VBO
extern

Definition at line 242 of file main.c.

Referenced by init(), render(), and render_bvh().

◆ WIREFRAME_VAO

GLuint WIREFRAME_VAO
extern

Definition at line 243 of file main.c.

Referenced by init(), and render().

◆ FS_VAO

GLuint FS_VAO
extern

Definition at line 244 of file main.c.

Referenced by init().

◆ MAIN_VBO

GLuint MAIN_VBO
extern

◆ MAIN_EBO

GLuint MAIN_EBO
extern

◆ MAIN_VAO

GLuint MAIN_VAO
extern

◆ SHADOW_INSTANCE_VBO

GLuint SHADOW_INSTANCE_VBO
extern

Definition at line 240 of file main.c.

◆ SHADOW_VAO

GLuint SHADOW_VAO
extern

Definition at line 241 of file main.c.

◆ TEXT_FBO

Framebuffer TEXT_FBO
extern

Definition at line 103 of file main.c.

Referenced by init(), and render().

◆ TEXT_VAO

GLuint TEXT_VAO
extern

Definition at line 250 of file main.c.

Referenced by init(), and render().

◆ TEXT_VBO

GLuint TEXT_VBO
extern

Definition at line 251 of file main.c.

Referenced by add_all_text_boxes_to_draw_buffer(), init(), and render().

◆ TEXT_EBO

GLuint TEXT_EBO
extern

Definition at line 252 of file main.c.

Referenced by add_all_text_boxes_to_draw_buffer(), init(), and render().

◆ UI_VAO

GLuint UI_VAO
extern

Definition at line 254 of file main.c.

Referenced by init(), and render().

◆ UI_VBO

GLuint UI_VBO
extern

Definition at line 255 of file main.c.

Referenced by init().

◆ UI_INSTANCE_VBO

GLuint UI_INSTANCE_VBO
extern

Definition at line 256 of file main.c.

Referenced by init().

◆ LIGHTMAP_VAO

GLuint LIGHTMAP_VAO
extern

Definition at line 217 of file main.c.

Referenced by bake_lightmap(), and init().

◆ LIGHTMAP_VBO

GLuint LIGHTMAP_VBO
extern

Definition at line 218 of file main.c.

Referenced by bake_lightmap(), and init().

◆ RPROBE_BACK_TEXTURE

GLuint RPROBE_BACK_TEXTURE
extern

Definition at line 144 of file main.c.

Referenced by init().

◆ SSAO_NOISE_TEXTURE

GLuint SSAO_NOISE_TEXTURE
extern

Definition at line 176 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ FBM_TEXTURE

GLuint FBM_TEXTURE
extern

Definition at line 177 of file main.c.

Referenced by bind_dynamic_shader(), init(), precompute_fbm_texture(), and render().

◆ SOBEL_TEXTURE

GLuint SOBEL_TEXTURE[2]
extern

Definition at line 211 of file main.c.

Referenced by init().

◆ HISTORY_TEXTURE

GLuint HISTORY_TEXTURE[2]
extern

Definition at line 209 of file main.c.

Referenced by init(), and render().

◆ LIGHTMAP_POS_TEXTURE

GLuint LIGHTMAP_POS_TEXTURE
extern

Definition at line 219 of file main.c.

Referenced by bake_lightmap(), and init().

◆ LIGHTMAP_NORM_TEXTURE

GLuint LIGHTMAP_NORM_TEXTURE
extern

Definition at line 220 of file main.c.

Referenced by bake_lightmap(), and init().

◆ LIGHTMAP_ID_TEXTURE

GLuint LIGHTMAP_ID_TEXTURE
extern

Definition at line 221 of file main.c.

Referenced by bake_lightmap(), and init().

◆ DIRECTIONAL_MAP_TEXTURE

GLuint DIRECTIONAL_MAP_TEXTURE
extern

◆ RPROBE_CUBE_MAP_ARRAY

GLuint RPROBE_CUBE_MAP_ARRAY
extern

Definition at line 305 of file main.c.

Referenced by bake_reflection_probes(), bind_dynamic_shader(), init(), and reallocate_rprobe_array().

◆ RPROBE_DEPTH_TEXTURE

GLuint RPROBE_DEPTH_TEXTURE
extern

Definition at line 143 of file main.c.

Referenced by init().

◆ TEMP_RPROBE_CUBE_MAP

GLuint TEMP_RPROBE_CUBE_MAP
extern

Definition at line 232 of file main.c.

Referenced by init().

◆ LPV_TEXTURE

GLuint LPV_TEXTURE
extern

Definition at line 268 of file main.c.

Referenced by bind_dynamic_shader(), init(), and load_lighting_pv().

◆ LIGHTMAP_PING

GLuint LIGHTMAP_PING
extern

Definition at line 223 of file main.c.

◆ LIGHTMAP_PONG

GLuint LIGHTMAP_PONG
extern

Definition at line 224 of file main.c.

◆ BLENDED_RPROBE_CUBE_MAP

GLuint BLENDED_RPROBE_CUBE_MAP
extern

Definition at line 145 of file main.c.

Referenced by init().

◆ COLOR_GRADE_LUT

GLuint COLOR_GRADE_LUT
extern

Definition at line 146 of file main.c.

Referenced by init(), and render().

◆ BRDF_LUT

GLuint BRDF_LUT
extern

Definition at line 203 of file main.c.

Referenced by bind_dynamic_shader(), and init().

◆ SKYBOX

GLuint SKYBOX
extern

◆ DEFAULT_DIFFUSE

int DEFAULT_DIFFUSE
extern

Definition at line 196 of file main.c.

Referenced by bind_material(), init_default_textures(), init_globals(), and upload_material_data().

◆ DEFAULT_NORMAL

int DEFAULT_NORMAL
extern

Definition at line 197 of file main.c.

Referenced by bind_material(), init_default_textures(), init_globals(), and upload_material_data().

◆ DEFAULT_ARM

int DEFAULT_ARM
extern

◆ DEFAULT_EMISSIVE

int DEFAULT_EMISSIVE
extern

Definition at line 199 of file main.c.

Referenced by init_default_textures(), init_globals(), and upload_material_data().

◆ DEFAULT_DISPLACEMENT

int DEFAULT_DISPLACEMENT
extern

Definition at line 200 of file main.c.

◆ DUMMY_LIGHTMAP

int DUMMY_LIGHTMAP
extern

Definition at line 201 of file main.c.

Referenced by bind_dynamic_shader(), and init_default_textures().

◆ LIGHTMAP_SHADER

◆ LIGHTMAP_BOUNCE_SHADER

GLuint LIGHTMAP_BOUNCE_SHADER
extern

◆ LIGHTMAP_DENOISE_SHADER

GLuint LIGHTMAP_DENOISE_SHADER
extern

◆ LIGHTMAP_DILATE_SHADER

GLuint LIGHTMAP_DILATE_SHADER
extern

◆ DIRECTIONAL_MAP_NORMALIZE_SHADER

GLuint DIRECTIONAL_MAP_NORMALIZE_SHADER
extern

◆ PROBE_BAKE_SHADER

GLuint PROBE_BAKE_SHADER
extern

◆ PROBE_UNPACK_SHADER

GLuint PROBE_UNPACK_SHADER
extern

◆ AUDIO_PROBE_BAKE_SHADER

GLuint AUDIO_PROBE_BAKE_SHADER
extern

◆ INIT_CLUSTER_AABBS_SHADER

GLuint INIT_CLUSTER_AABBS_SHADER
extern

◆ CULL_CLUSTERS_SHADER

ShaderProgram CULL_CLUSTERS_SHADER
extern

◆ CULL_DRAW_CALLS_SHADER

ShaderProgram CULL_DRAW_CALLS_SHADER
extern

◆ INDIRECT_PREFIX_SHADER

◆ ELEMENTS_PREFIX_SHADER

◆ CULL_POINT_LIGHT_SHADOWS_SHADER

ShaderProgram CULL_POINT_LIGHT_SHADOWS_SHADER
extern

◆ SKY_SHADER

◆ SHADOW_MAP_SHADER

◆ POINT_LIGHT_SHADOW_SHADER

◆ DEPTH_PRE_PASS_SHADER

◆ DEPTH_PRE_PASS_SHADER_MSAA

◆ DEPTH_DOWNSAMPLE_SHADER

ShaderProgram DEPTH_DOWNSAMPLE_SHADER
extern

◆ SSAO_SHADER

ShaderProgram SSAO_SHADER
extern

◆ SSAO_BLUR_SHADER

ShaderProgram SSAO_BLUR_SHADER
extern

◆ DYNAMIC_SHADER

◆ SSR_SHADER

ShaderProgram SSR_SHADER
extern

Definition at line 107 of file main.c.

Referenced by init_globals(), render_to_cubemap_face(), and SHADERS_INIT().

◆ SSR_BLUR_SHADER

ShaderProgram SSR_BLUR_SHADER
extern

Definition at line 108 of file main.c.

Referenced by init_globals(), and SHADERS_INIT().

◆ SSR_HISTORY_SHADER

ShaderProgram SSR_HISTORY_SHADER
extern

Definition at line 109 of file main.c.

Referenced by render_to_cubemap_face(), and SHADERS_INIT().

◆ COC_SHADER

ShaderProgram COC_SHADER
extern

render/coc.frag

Definition at line 110 of file main.c.

Referenced by init_dof_shader(), render_to_cubemap_face(), and SHADERS_INIT().

◆ BOKEH_SHADER

ShaderProgram BOKEH_SHADER
extern

render/bokeh.frag

Definition at line 111 of file main.c.

Referenced by init_dof_shader(), render_to_cubemap_face(), and SHADERS_INIT().

◆ BLOOM_SHADER

ShaderProgram BLOOM_SHADER
extern

render/bloom.frag

Definition at line 112 of file main.c.

Referenced by init_bloom_shader(), render_to_cubemap_face(), and SHADERS_INIT().

◆ BLOOM_BLUR_SHADER

ShaderProgram BLOOM_BLUR_SHADER
extern

render/bloom_blur.frag

Definition at line 113 of file main.c.

Referenced by init_bloom_shader(), and SHADERS_INIT().

◆ FOCAL_DISTANCE_SHADER

ShaderProgram FOCAL_DISTANCE_SHADER
extern

◆ BLOOM_DOWNSCALE_SHADER

ShaderProgram BLOOM_DOWNSCALE_SHADER
extern

◆ BLOOM_UPSCALE_SHADER

ShaderProgram BLOOM_UPSCALE_SHADER
extern

◆ WIREFRAME_SHADER

ShaderProgram WIREFRAME_SHADER
extern

◆ BRDF_SHADER

ShaderProgram BRDF_SHADER
extern

utilities/brdf.frag

Definition at line 129 of file main.c.

Referenced by init(), init_brdf_shader(), and SHADERS_INIT().

◆ TEXT_SHADER

ShaderProgram TEXT_SHADER
extern

ui/text.vert ui/text.frag

Definition at line 131 of file main.c.

Referenced by init_globals(), init_text_shader(), render(), and SHADERS_INIT().

◆ UI_SHADER

ShaderProgram UI_SHADER
extern

ui/ui.vert ui/ui.frag

Definition at line 132 of file main.c.

Referenced by init_ui_shader(), render(), and SHADERS_INIT().

◆ POSTPROCESS_SHADER

ShaderProgram POSTPROCESS_SHADER[128]
extern

◆ PP_SHADER_VERSIONS

uint32_t PP_SHADER_VERSIONS
extern

Definition at line 272 of file main.c.

Referenced by init_postprocess_shader(), render(), and SHADERS_INIT().

◆ BRDF_FBO

GLuint BRDF_FBO
extern

Definition at line 185 of file main.c.

Referenced by init().

◆ RPROBE_BACK_FBO

GLuint RPROBE_BACK_FBO
extern

Definition at line 142 of file main.c.

Referenced by init().

◆ SOBEL_FBO

GLuint SOBEL_FBO[2]
extern

Definition at line 210 of file main.c.

Referenced by init().

◆ HISTORY_FBO

GLuint HISTORY_FBO[2]
extern

Definition at line 208 of file main.c.

Referenced by init().

◆ LIGHTMAP_FBO

GLuint LIGHTMAP_FBO
extern

Definition at line 216 of file main.c.

Referenced by bake_lightmap(), and init().

◆ RPROBE_FBO

GLuint RPROBE_FBO
extern

Definition at line 306 of file main.c.

Referenced by bake_reflection_probes(), and init().

◆ TAA_FBO

Framebuffer TAA_FBO[2]
extern

Definition at line 99 of file main.c.

Referenced by init(), render(), and render_to_cubemap_face().

◆ POINT_LIGHT_SHADOWS_FBO

Framebuffer POINT_LIGHT_SHADOWS_FBO
extern

Definition at line 307 of file main.c.

Referenced by bind_dynamic_shader(), init(), and write_point_light_shadows().

◆ GBUFFER_FBO

◆ GBUFFER_RESOLVE_FBO

◆ SSR_FBO

Framebuffer SSR_FBO
extern

Definition at line 95 of file main.c.

Referenced by bind_dynamic_shader(), init(), render(), and render_to_cubemap_face().

◆ SSR_BLUR_FBO

Framebuffer SSR_BLUR_FBO
extern

Definition at line 96 of file main.c.

Referenced by init().

◆ SSAO_FBO

Framebuffer SSAO_FBO
extern

Definition at line 97 of file main.c.

Referenced by change_ssao_res(), init(), render_main_menu(), and render_to_cubemap_face().

◆ SSAO_BLUR_FBO

Framebuffer SSAO_BLUR_FBO
extern

Definition at line 98 of file main.c.

Referenced by bind_dynamic_shader(), change_ssao_res(), init(), and render_to_cubemap_face().

◆ COC_FBO

Framebuffer COC_FBO
extern

Definition at line 100 of file main.c.

Referenced by change_dof_res(), init(), render(), render_main_menu(), and render_to_cubemap_face().

◆ BOKEH_FBO

Framebuffer BOKEH_FBO
extern

Definition at line 101 of file main.c.

Referenced by change_dof_res(), init(), render(), and render_to_cubemap_face().

◆ SHADOW_MAP_FBO

Framebuffer SHADOW_MAP_FBO
extern

Definition at line 92 of file main.c.

Referenced by bind_dynamic_shader(), init(), render_to_cubemap_face(), and update_light_camera().

◆ MAIN_FBO

◆ MAIN_RESOLVE_FBO

Framebuffer MAIN_RESOLVE_FBO
extern

◆ BLOOM_PYRAMID

Framebuffer BLOOM_PYRAMID[6]
extern

Definition at line 102 of file main.c.

Referenced by change_bloom_res(), init(), render(), render_main_menu(), and render_to_cubemap_face().

◆ DEPTH_DOWNSAMPLE_FBO

Framebuffer DEPTH_DOWNSAMPLE_FBO
extern

Definition at line 275 of file main.c.

Referenced by change_render_resolution(), init(), and render_to_cubemap_face().

◆ LIGHT_SSBO

GLuint LIGHT_SSBO
extern

Definition at line 150 of file main.c.

Referenced by init(), upload_bake_lights_gpu(), and upload_lights().

◆ MESH_LIGHT_SSBO

GLuint MESH_LIGHT_SSBO
extern

Definition at line 151 of file main.c.

Referenced by bind_render_ssbos(), determine_light_visibility_per_mesh(), and init().

◆ LIGHTMAP_SSBO

GLuint LIGHTMAP_SSBO
extern

Definition at line 153 of file main.c.

Referenced by add_all_meshes_to_buffer(), bind_render_ssbos(), and init().

◆ VERTEX_SSBO

GLuint VERTEX_SSBO
extern

Vertices: vec4 (x, y, z, padding) or just float arrays.

(Don't forget you also need vertex Normals and UVs so your ray hits can sample textures!).

Definition at line 154 of file main.c.

Referenced by bind_baking_ssbos(), GPU_upload_scene_data(), and init().

◆ TRI_SSBO

GLuint TRI_SSBO
extern

Indices (Tris): uvec3 for triangle lookups.

Definition at line 155 of file main.c.

Referenced by bind_baking_ssbos(), GPU_upload_scene_data(), and init().

◆ MESH_SSBO

GLuint MESH_SSBO
extern

Instances (Transforms): Needs the Model Matrix, Inverse Model Matrix (crucial for transforming rays into local mesh space), and the underlying Mesh ID.

Definition at line 156 of file main.c.

Referenced by bind_baking_ssbos(), GPU_upload_scene_data(), and init().

◆ MESH_BVH_SSBO

GLuint MESH_BVH_SSBO
extern

Mesh BVH Nodes: Flattened array of nodes.

Must contain AABB min/max, left child index, right child index, and triangle count/offset.

Definition at line 157 of file main.c.

Referenced by bind_baking_ssbos(), GPU_upload_scene_data(), and init().

◆ SCENE_BVH_SSBO

GLuint SCENE_BVH_SSBO
extern

Scene BVH Nodes (TLAS): Same structure as above, but pointing to instances instead of triangles.

Definition at line 158 of file main.c.

Referenced by bind_baking_ssbos(), GPU_upload_scene_data(), and init().

◆ MATERIAL_SSBO

GLuint MATERIAL_SSBO
extern

Material Data: Roughness, emission multipliers, albedo colors for each instance.

Definition at line 152 of file main.c.

Referenced by bind_render_ssbos(), init(), and upload_material_data().

◆ PROBE_SSBO

GLuint PROBE_SSBO
extern

Definition at line 159 of file main.c.

Referenced by bake_lighting_probe_volume(), bind_baking_ssbos(), and init().

◆ RPROBE_SSBO

GLuint RPROBE_SSBO
extern

◆ JOINT_SSBO

GLuint JOINT_SSBO
extern

Definition at line 161 of file main.c.

Referenced by bind_render_ssbos(), init(), unbind_baking_ssbos(), and upload_joint_matrices().

◆ CLUSTER_AABB_SSBO

GLuint CLUSTER_AABB_SSBO
extern

Definition at line 162 of file main.c.

Referenced by bind_render_ssbos(), and init().

◆ GLOBAL_LIGHT_INDICES_SSBO

GLuint GLOBAL_LIGHT_INDICES_SSBO
extern

Definition at line 163 of file main.c.

Referenced by bind_render_ssbos(), and init().

◆ CLUSTER_SSBO

GLuint CLUSTER_SSBO
extern

Definition at line 164 of file main.c.

Referenced by bind_render_ssbos(), and init().

◆ MESH_NODE_SSBO

GLuint MESH_NODE_SSBO
extern

Definition at line 165 of file main.c.

Referenced by bind_render_ssbos(), init(), and upload_instance_data().

◆ GLOBAL_INSTANCE_SSBO

GLuint GLOBAL_INSTANCE_SSBO
extern

◆ INDIRECT_ARRAYS_COMMAND_BUFFER

GLuint INDIRECT_ARRAYS_COMMAND_BUFFER
extern

◆ INDIRECT_ARRAYS_COMMAND_BUFFER_OUT

GLuint INDIRECT_ARRAYS_COMMAND_BUFFER_OUT
extern

◆ INDIRECT_ELEMENTS_COMMAND_BUFFER

GLuint INDIRECT_ELEMENTS_COMMAND_BUFFER
extern

◆ INDIRECT_ELEMENTS_COMMAND_BUFFER_OUT

GLuint INDIRECT_ELEMENTS_COMMAND_BUFFER_OUT
extern

◆ INSTANCE_SSBO

GLuint INSTANCE_SSBO
extern

◆ TEXT_BOX_SSBO

GLuint TEXT_BOX_SSBO
extern

◆ UI_SSBO

GLuint UI_SSBO
extern

Definition at line 173 of file main.c.

Referenced by bind_render_ssbos(), GPU_upload_ui_elements(), and init().

◆ VERTEX_DATA

VertexData VERTEX_DATA
extern

Definition at line 187 of file main.c.

Referenced by GPU_upload_scene_data(), and init_globals().

◆ TRI_DATA

TriData TRI_DATA
extern

Definition at line 188 of file main.c.

Referenced by GPU_upload_scene_data(), and init_globals().

◆ MESH_DATA

MeshData MESH_DATA
extern

Definition at line 189 of file main.c.

Referenced by GPU_upload_scene_data(), and init_globals().

◆ MESH_BVH_DATA

BVHGPU MESH_BVH_DATA
extern

Definition at line 190 of file main.c.

Referenced by GPU_upload_scene_data(), and init_globals().

◆ SCENE_BVH_DATA

BVHGPU SCENE_BVH_DATA
extern

Definition at line 191 of file main.c.

Referenced by GPU_upload_scene_data(), and init_globals().

◆ LIGHTMAP_DATA

◆ MATERIAL_DATA

MaterialData MATERIAL_DATA
extern

Definition at line 194 of file main.c.

Referenced by upload_material_data().

◆ DEBUG_FACES

DebugVertex DEBUG_FACES[1024][3]
extern

Definition at line 277 of file main.c.

◆ DEBUG_FACE_COUNT

int DEBUG_FACE_COUNT
extern

Definition at line 278 of file main.c.

Referenced by main().

◆ DEBUG_POINTS

DebugVertex DEBUG_POINTS[1024]
extern

Definition at line 279 of file main.c.

◆ DEBUG_POINT_COUNT

int DEBUG_POINT_COUNT
extern

Definition at line 280 of file main.c.

Referenced by main().

◆ DEBUG_LINES

◆ DEBUG_LINE_COUNT

◆ main_queries

GLuint main_queries[3]
extern

Definition at line 506 of file main.c.

Referenced by main(), and render().

◆ pl_queries

GLuint pl_queries[3]
extern

Definition at line 507 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ sm_queries

GLuint sm_queries[3]
extern

Definition at line 508 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ render_queries

GLuint render_queries[3]
extern

Definition at line 509 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ gbuffer_queries

GLuint gbuffer_queries[3]
extern

Definition at line 511 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ dof_queries

GLuint dof_queries[3]
extern

Definition at line 512 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ ssao_queries

GLuint ssao_queries[3]
extern

Definition at line 513 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ taa_queries

GLuint taa_queries[3]
extern

Definition at line 514 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ ssr_queries

GLuint ssr_queries[3]
extern

Definition at line 515 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ bloom_queries

GLuint bloom_queries[3]
extern

Definition at line 516 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ cull_queries

GLuint cull_queries[3]
extern

Definition at line 510 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ current_query_frame

int current_query_frame
extern

Definition at line 517 of file main.c.

Referenced by main(), render(), and render_to_cubemap_face().

◆ asset_dir

char asset_dir[256]
extern

Definition at line 284 of file main.c.

Referenced by init_globals(), and render_main_menu().

◆ rprobe_dir

char rprobe_dir[256]
extern

Definition at line 285 of file main.c.

Referenced by init_globals(), and render_main_menu().

◆ mesh_tris

Triangle* mesh_tris
extern

◆ cam_ubo_padded

size_t cam_ubo_padded
extern

Definition at line 332 of file main.c.

Referenced by init(), main(), and render_to_cubemap_face().

◆ cam_ubo_ptr

uint8_t* cam_ubo_ptr
extern

Definition at line 333 of file main.c.

Referenced by init(), main(), and render_to_cubemap_face().

◆ light_cam_ubo_padded

size_t light_cam_ubo_padded
extern

Definition at line 335 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ light_cam_ubo_ptr

uint8_t* light_cam_ubo_ptr
extern

Definition at line 336 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ rprobe_ubo_padded

size_t rprobe_ubo_padded
extern

Definition at line 338 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ rprobe_ubo_ptr

uint8_t* rprobe_ubo_ptr
extern

Definition at line 339 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ probe_volume_ubo_padded

size_t probe_volume_ubo_padded
extern

Definition at line 341 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ probe_volume_ubo_ptr

uint8_t* probe_volume_ubo_ptr
extern

Definition at line 342 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ light_ssbo_size

size_t light_ssbo_size
extern

Definition at line 344 of file main.c.

Referenced by init(), upload_bake_lights_gpu(), and upload_lights().

◆ light_ssbo_ptr

uint8_t* light_ssbo_ptr
extern

Definition at line 345 of file main.c.

Referenced by init(), upload_bake_lights_gpu(), and upload_lights().

◆ mesh_light_ssbo_size

size_t mesh_light_ssbo_size
extern

Definition at line 347 of file main.c.

Referenced by determine_light_visibility_per_mesh(), and init().

◆ mesh_light_ssbo_ptr

uint8_t* mesh_light_ssbo_ptr
extern

Definition at line 348 of file main.c.

Referenced by determine_light_visibility_per_mesh(), and init().

◆ joint_ssbo_size

size_t joint_ssbo_size
extern

Definition at line 350 of file main.c.

Referenced by init(), and upload_joint_matrices().

◆ joint_ssbo_ptr

uint8_t* joint_ssbo_ptr
extern

Definition at line 351 of file main.c.

Referenced by init(), and upload_joint_matrices().

◆ instance_vbo_size

size_t instance_vbo_size
extern

Definition at line 353 of file main.c.

Referenced by init().

◆ instance_vbo_ptr

uint8_t* instance_vbo_ptr
extern

Definition at line 354 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ shadow_instance_vbo_ptr

uint8_t* shadow_instance_vbo_ptr
extern

Definition at line 356 of file main.c.

◆ mesh_node_ssbo_size

size_t mesh_node_ssbo_size
extern

Definition at line 358 of file main.c.

Referenced by init(), and upload_instance_data().

◆ mesh_node_ssbo_ptr

uint8_t* mesh_node_ssbo_ptr
extern

Definition at line 359 of file main.c.

Referenced by init(), and upload_instance_data().

◆ indirect_arrays_ptr

uint8_t* indirect_arrays_ptr
extern

Definition at line 361 of file main.c.

Referenced by init(), and upload_instance_data().

◆ indirect_arrays_out_ptr

uint8_t* indirect_arrays_out_ptr
extern

Definition at line 365 of file main.c.

Referenced by init().

◆ indirect_elements_ptr

uint8_t* indirect_elements_ptr
extern

Definition at line 367 of file main.c.

Referenced by init(), and upload_instance_data().

◆ indirect_elements_out_ptr

uint8_t* indirect_elements_out_ptr
extern

Definition at line 369 of file main.c.

Referenced by init().

◆ visible_indices_ptr

uint8_t* visible_indices_ptr
extern

Definition at line 363 of file main.c.

◆ instance_ssbo_size

size_t instance_ssbo_size
extern

Definition at line 374 of file main.c.

Referenced by init(), and upload_instances().

◆ instance_ssbo_ptr

uint8_t* instance_ssbo_ptr
extern

Definition at line 375 of file main.c.

Referenced by init(), and upload_instances().

◆ text_box_ssbo_size

size_t text_box_ssbo_size
extern

Definition at line 371 of file main.c.

Referenced by GPU_upload_ui_elements(), and init().

◆ text_box_ssbo_ptr

uint8_t* text_box_ssbo_ptr
extern

Definition at line 372 of file main.c.

Referenced by GPU_upload_ui_elements(), and init().

◆ ui_ssbo_size

size_t ui_ssbo_size
extern

Definition at line 379 of file main.c.

Referenced by GPU_upload_ui_elements(), and init().

◆ ui_ssbo_ptr

uint8_t* ui_ssbo_ptr
extern

Definition at line 380 of file main.c.

Referenced by GPU_upload_ui_elements(), and init().

◆ text_vbo_size

size_t text_vbo_size
extern

Definition at line 377 of file main.c.

Referenced by init().

◆ text_vbo_ptr

uint8_t* text_vbo_ptr
extern

◆ ui_vbo_size

size_t ui_vbo_size
extern

Definition at line 382 of file main.c.

Referenced by init().

◆ ui_vbo_ptr

uint8_t* ui_vbo_ptr
extern

Definition at line 383 of file main.c.

Referenced by init().

◆ ui_instance_vbo_size

size_t ui_instance_vbo_size
extern

Definition at line 385 of file main.c.

Referenced by GPU_upload_ui_elements(), and init().

◆ ui_instance_vbo_ptr

uint8_t* ui_instance_vbo_ptr
extern

Definition at line 386 of file main.c.

Referenced by GPU_upload_ui_elements(), and init().

◆ DRAW_COMMANDS

DrawCommand DRAW_COMMANDS[MAX_DRAW_COMMANDS]
extern

Definition at line 259 of file main.c.

Referenced by render_all_draw_commands(), render_to_cubemap_face(), and upload_instances().

◆ draw_command_count

int draw_command_count
extern

Definition at line 260 of file main.c.

Referenced by render_all_draw_commands(), render_to_cubemap_face(), and upload_instances().

◆ SHADOW_DRAW_COMMANDS

DrawCommand SHADOW_DRAW_COMMANDS[MAX_DRAW_COMMANDS]
extern

Definition at line 265 of file main.c.

◆ shadow_draw_command_count

int shadow_draw_command_count
extern

Definition at line 266 of file main.c.

◆ ENTITIES

◆ ASSET_INSTANCES

◆ PHYSICS_COMPONENTS

◆ MANIFOLDS

Manifold MANIFOLDS[64]
extern

◆ ANIMATION_COMPONENTS

AnimationComponent ANIMATION_COMPONENTS[256]
extern

◆ default_light

Light default_light
Initial value:
=
{
.light_type = POINT_LIGHT,
.cone_angle = 0,
.inner_angle = 0,
.outer_angle = 0,
.dir = (vec3){0,0,1},
.entity_id = 0,
.intensity = 1.0f,
.penumbra = 0,
.pos = (vec3){0,0,0},
.rgb = (vec3){1,1,1},
.area = (AABB){0},
}
@ POINT_LIGHT
Definition types.h:12

Definition at line 456 of file init.h.

Referenced by render_light_menu().