Untitled
Loading...
Searching...
No Matches
main.c File Reference

Audio probe baking, portal creation, probe volumes, and emitter functions. More...

#include <GL/glew.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_events.h>
#include <SDL2/SDL_mouse.h>
#include <SDL2/SDL_render.h>
#include <SDL2/SDL_scancode.h>
#include <SDL2/SDL_timer.h>
#include <SDL2/SDL_video.h>
#include "SDL2/SDL_audio.h"
#include "SDL2/SDL_opengl.h"
#include "fftw3.h"
#include "load/init.h"
#include "core/input.h"
#include "render/render.h"
#include "core/camera.h"
#include "core/mesh.h"
#include "utilities/types.h"
#include "utilities/mathf.h"
#include "light/lightmap.h"
#include "load/load.h"
#include "utilities/utilities.h"
#include "utilities/engine_utilities.h"
#include "core/acceleration.h"
#include "ECS/entity.h"
#include "editor/editor.h"
#include "physics/physics.h"
#include "core/animation.h"
#include "load/gltf.h"
#include "ui/fonts.h"
#include "audio/audio.h"
#include "ui/ui.h"
#include <stdalign.h>
#include "audio/audio_ir.h"
#include "ui/ui_callbacks.h"
#include "stb/stb_image.h"
#include "stb/stb_image_write.h"
#include "nk_config.h"
#include "nuklear/nuklear.h"
#include "nuklear/nuklear_sdl_gl3.h"

Go to the source code of this file.

Macros

#define DEFAULT_WIDTH   1280
#define DEFAULT_HEIGHT   960
#define MAX_VERTEX_MEMORY   1024 * 1024
#define MAX_ELEMENT_MEMORY   512 * 1024

Functions

GLuint64 retrieve_gl_query (GLuint query)
int main (int argc, char *argv[])

Variables

int LMB_HELD = 0
 If the left mouse button is held.
int DEBUG_APROBE_RAY_COUNT = 0
int DEBUG_CURRENT_APROBE = 0
ma_engine AUDIO_ENGINE
AudioEmitter AUDIO_EMITTERS [1024]
float * STATIC_HRTF_LEFT [9] = {0}
float * STATIC_HRTF_RIGHT [9] = {0}
int HRTF_LENGTH = 0
ConvolverNode CONVOLVER_NODE = {0}
AudioScratchBuffers AUDIO_SCRATCH = {0}
HRTFThreadData HRTF_TD = {0}
AStarWorkspace AW = {0}
int SCREEN_WIDTH = 1280
int SCREEN_HEIGHT = 720
int RENDER_WIDTH = 1280
int RENDER_HEIGHT = 720
int BLOOM_WIDTH = 640
int BLOOM_HEIGHT = 480
int DOF_WIDTH = 640
int DOF_HEIGHT = 480
int SSR_WIDTH = 640
int SSR_HEIGHT = 480
int SSAO_WIDTH = 640
int SSAO_HEIGHT = 480
Framebuffer MAIN_FBO = {0}
Framebuffer MAIN_RESOLVE_FBO = {0}
Framebuffer SHADOW_MAP_FBO = {0}
Framebuffer GBUFFER_FBO = {0}
Framebuffer GBUFFER_RESOLVE_FBO = {0}
Framebuffer SSR_FBO = {0}
Framebuffer SSR_BLUR_FBO = {0}
Framebuffer SSAO_FBO = {0}
Framebuffer SSAO_BLUR_FBO = {0}
Framebuffer TAA_FBO [2] = {0}
Framebuffer COC_FBO = {0}
Framebuffer BOKEH_FBO = {0}
Framebuffer BLOOM_PYRAMID [6] = {0}
Framebuffer TEXT_FBO = {0}
ShaderProgram SSAO_SHADER = {0}
 render/ssao.frag
ShaderProgram SSAO_BLUR_SHADER = {0}
 render/ssao_blur.frag
ShaderProgram SSR_SHADER = {0}
ShaderProgram SSR_BLUR_SHADER = {0}
ShaderProgram SSR_HISTORY_SHADER = {0}
ShaderProgram COC_SHADER = {0}
 render/coc.frag
ShaderProgram BOKEH_SHADER = {0}
 render/bokeh.frag
ShaderProgram BLOOM_SHADER = {0}
 render/bloom.frag
ShaderProgram BLOOM_BLUR_SHADER = {0}
 render/bloom_blur.frag
ShaderProgram DYNAMIC_SHADER [32] = {0}
 render/dynamic.vert render/dynamic.frag
ShaderProgram SHADOW_MAP_SHADER = {0}
 render/shadow.vert render/shadow.frag
ShaderProgram DEPTH_PRE_PASS_SHADER [1] = {0}
 render/depth_pre_pass.vert render/depth_pre_pass.frag
ShaderProgram DEPTH_PRE_PASS_SHADER_MSAA [1] = {0}
 render/depth_pre_pass_no_gbuffer.vert render/depth_pre_pass_no_gbuffer.frag
ShaderProgram WIREFRAME_SHADER = {0}
 render/wireframe.vert render/wireframe.frag
ShaderProgram POSTPROCESS_SHADER [128] = {0}
 render/postprocess.vert render/postprocess.frag
ShaderProgram CULL_CLUSTERS_SHADER = {0}
 render/cull_clusters.comp
ShaderProgram CULL_DRAW_CALLS_SHADER = {0}
 render/cull_draw_calls.comp
ShaderProgram INDIRECT_PREFIX_SHADER = {0}
 render/indirect_prefix.comp
ShaderProgram ELEMENTS_PREFIX_SHADER = {0}
 render/elements_prefix.comp
ShaderProgram CULL_POINT_LIGHT_SHADOWS_SHADER = {0}
 render/cull_point_light_shadows.comp
ShaderProgram BLOOM_DOWNSCALE_SHADER = {0}
 render/bloom_downscale.frag
ShaderProgram BLOOM_UPSCALE_SHADER = {0}
 render/bloom_upscale.frag
ShaderProgram SKY_SHADER = {0}
 render/sky.vert render/sky.frag
ShaderProgram LIGHTMAP_SHADER = {0}
 light/lightmap.vert light/lightmap.frag
ShaderProgram BRDF_SHADER = {0}
 utilities/brdf.frag
ShaderProgram POINT_LIGHT_SHADOW_SHADER = {0}
 render/point_light_shadows.vert render/point_light_shadows.geom render/point_light_shadows.frag
ShaderProgram TEXT_SHADER = {0}
 ui/text.vert ui/text.frag
ShaderProgram UI_SHADER = {0}
 ui/ui.vert ui/ui.frag
ShaderProgram DEPTH_DOWNSAMPLE_SHADER = {0}
 render/depth_downsample.frag
GLuint CAM_UBO = 0
GLuint RENDER_UBO = 0
GLuint LIGHT_CAM_UBO = 0
GLuint RPROBE_UBO = 0
GLuint SSAO_KERNEL_UBO = 0
GLuint PROBE_VOLUME_UBO = 0
GLuint RPROBE_BACK_FBO = 0
GLuint RPROBE_DEPTH_TEXTURE = 0
GLuint RPROBE_BACK_TEXTURE = 0
GLuint BLENDED_RPROBE_CUBE_MAP = 0
GLuint COLOR_GRADE_LUT = 0
AudioEmitter * FOOTSTEP_EMITTER = NULL
GLuint LIGHT_SSBO = 0
GLuint MESH_LIGHT_SSBO = 0
GLuint MATERIAL_SSBO = 0
 Material Data: Roughness, emission multipliers, albedo colors for each instance.
GLuint LIGHTMAP_SSBO = 0
GLuint VERTEX_SSBO = 0
 Vertices: vec4 (x, y, z, padding) or just float arrays.
GLuint TRI_SSBO = 0
 Indices (Tris): uvec3 for triangle lookups.
GLuint MESH_SSBO = 0
 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 = 0
 Mesh BVH Nodes: Flattened array of nodes.
GLuint SCENE_BVH_SSBO = 0
 Scene BVH Nodes (TLAS): Same structure as above, but pointing to instances instead of triangles.
GLuint PROBE_SSBO = 0
GLuint RPROBE_SSBO = 0
GLuint JOINT_SSBO = 0
GLuint CLUSTER_AABB_SSBO = 0
GLuint GLOBAL_LIGHT_INDICES_SSBO = 0
GLuint CLUSTER_SSBO = 0
GLuint MESH_NODE_SSBO = 0
GLuint GLOBAL_INSTANCE_SSBO = 0
GLuint INDIRECT_ARRAYS_COMMAND_BUFFER = 0
GLuint INDIRECT_ARRAYS_COMMAND_BUFFER_OUT = 0
GLuint INDIRECT_ELEMENTS_COMMAND_BUFFER = 0
GLuint INDIRECT_ELEMENTS_COMMAND_BUFFER_OUT = 0
GLuint INSTANCE_SSBO = 0
GLuint TEXT_BOX_SSBO = 0
GLuint UI_SSBO = 0
GLuint SSAO_NOISE_FBO = 0
GLuint SSAO_NOISE_TEXTURE = 0
GLuint FBM_TEXTURE = 0
mat4 UNJITTERED_PROJ
mat4 UNJITTERED_PROJ_INV
vec2 JITTER_OFFSET
int MOUSE_X = 0
int MOUSE_Y = 0
GLuint BRDF_FBO = 0
VertexData VERTEX_DATA
TriData TRI_DATA
MeshData MESH_DATA
BVHGPU MESH_BVH_DATA
BVHGPU SCENE_BVH_DATA
LightmapSSBO LIGHTMAP_DATA
MaterialData MATERIAL_DATA
int DEFAULT_DIFFUSE = 0
int DEFAULT_NORMAL = 0
int DEFAULT_ARM = 0
int DEFAULT_EMISSIVE = 0
int DEFAULT_DISPLACEMENT = 0
int DUMMY_LIGHTMAP = 0
GLuint BRDF_LUT = 0
vec3 CAM_POS
 Shorthand variable for the camera position.
GLuint SHADOW_MAP_TEMP = 0
GLuint HISTORY_FBO [2] = {0}
GLuint HISTORY_TEXTURE [2] = {0}
GLuint SOBEL_FBO [2] = {0}
GLuint SOBEL_TEXTURE [2] = {0}
vec4 SSAO_KERNEL [16]
GLuint LIGHTMAP_FBO = 0
GLuint LIGHTMAP_VAO = 0
GLuint LIGHTMAP_VBO = 0
GLuint LIGHTMAP_POS_TEXTURE = 0
GLuint LIGHTMAP_NORM_TEXTURE = 0
GLuint LIGHTMAP_ID_TEXTURE = 0
GLuint DIRECTIONAL_MAP_TEXTURE = 0
GLuint LIGHTMAP_PING = 0
GLuint LIGHTMAP_PONG = 0
GLuint LIGHTMAP_BOUNCE_SHADER = 0
 light/lightmap_bounce.comp
GLuint LIGHTMAP_DENOISE_SHADER = 0
 light/lightmap_denoise.comp
GLuint LIGHTMAP_DILATE_SHADER = 0
 light/lightmap_dilate.comp
GLuint PROBE_BAKE_SHADER = 0
 light/probe_bake.comp
GLuint AUDIO_PROBE_BAKE_SHADER = 0
 audio/audio_probe_bake.comp
GLuint PROBE_UNPACK_SHADER = 0
 light/probe_unpack.comp
GLuint DIRECTIONAL_MAP_NORMALIZE_SHADER = 0
 light/directional_map_normalize.comp
GLuint TEMP_RPROBE_CUBE_MAP = 0
GLuint CONVOLVE_TRIANGLE_VBO = 0
GLuint CONVOLVE_TRIANGLE_VAO = 0
GLuint MAIN_VBO = 0
GLuint MAIN_EBO = 0
GLuint MAIN_VAO = 0
GLuint INSTANCE_VBO = 0
GLuint SHADOW_INSTANCE_VBO = 0
GLuint SHADOW_VAO = 0
GLuint WIREFRAME_VBO = 0
GLuint WIREFRAME_VAO = 0
GLuint FS_VAO = 0
int PERFORMANCE_OVERLAY_TEXT_BOX_START = 0
int PERFORMANCE_OVERLAY_MENU = 0
GLuint TEXT_VAO = 0
GLuint TEXT_VBO = 0
GLuint TEXT_EBO = 0
GLuint UI_VAO = 0
GLuint UI_VBO = 0
GLuint UI_INSTANCE_VBO = 0
DrawCommand DRAW_COMMANDS [512]
int draw_command_count
SDL_AudioDeviceID SDL_AUDIO_DEVICE
DrawCommand SHADOW_DRAW_COMMANDS [512]
int shadow_draw_command_count
GLuint LPV_TEXTURE
Manifold MANIFOLDS [MAX_MANIFOLDS]
uint32_t PP_SHADER_VERSIONS = 0
GLuint INIT_CLUSTER_AABBS_SHADER = 0
 render/init_cluster_aabbs.comp
Framebuffer DEPTH_DOWNSAMPLE_FBO = {0}
DebugVertex DEBUG_FACES [1024][3]
int DEBUG_FACE_COUNT
DebugVertex DEBUG_POINTS [1024]
int DEBUG_POINT_COUNT
DebugVertex DEBUG_LINES [DEBUG_LINES_MAX]
int DEBUG_LINE_COUNT
char asset_dir [256]
char rprobe_dir [256]
Player player = {0}
 The Player data.
vec3 spawn_point = {0, 0, 0}
 Spawn point.
EPAWorkspace * EW [8]
GLsync RENDER_FENCE [3]
vec3 left_hip_pos
vec3 right_hip_pos
bool right_leg_moving = false
float frame_time = 0
 The actual frame time in s.
GLuint SKYBOX = 0
GLuint SKY_VAO = 0
GLuint SKY_VBO = 0
GLuint RPROBE_CUBE_MAP_ARRAY = 0
GLuint RPROBE_FBO = 0
Framebuffer POINT_LIGHT_SHADOWS_FBO = {0}
ShaderProgram FOCAL_DISTANCE_SHADER = {0}
 render/focal_distance.comp
Globals GLOBALS = {0}
 Engine Globals.
Entity ENTITIES [MAX_ENTITIES]
AssetInstance ASSET_INSTANCES [MAX_ASSET_INSTANCES]
PhysicsComponent PHYSICS_COMPONENTS [MAX_PHYSICS_COMPONENTS]
AnimationComponent ANIMATION_COMPONENTS [MAX_ANIMATION_COMPONENTS]
int running = 0
 The variable that tracks if we need to exit main().
float dt = 0.0f
 The 1.0f/60 simulation timestep.
float time = 0
 The frame time but wrapping at 1.0.
Camera cam = {0}
 This is currently the player cam.
Camera LIGHT_CAM [4] = {0}
 DIRECTIONAL_LIGHT Cameras for shadowmaps
int DIRECTIONAL_LIGHT_COUNT = 0
struct nk_context * NK_CTX = NULL
 Nuklear context handle used for Editor UI.
bool NUKLEAR_HOVERED = false
EditorSettings EDITOR_SETTINGS = {0}
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 * visible_indices_ptr
uint8_t * indirect_arrays_out_ptr
uint8_t * indirect_elements_ptr
uint8_t * indirect_elements_out_ptr
size_t text_box_ssbo_size
uint8_t * text_box_ssbo_ptr
size_t instance_ssbo_size
uint8_t * instance_ssbo_ptr
size_t text_vbo_size
size_t ui_ssbo_size
uint8_t * ui_ssbo_ptr
size_t ui_vbo_size
uint8_t * ui_vbo_ptr
size_t ui_instance_vbo_size
uint8_t * ui_instance_vbo_ptr
bool draw_dirty
 If we need to reupload and resort transforms in create_and_sort_draw_commands() and upload_instance_data().
const vec3 left_leg_offset = {0, -0.1f, 0}
const vec3 right_leg_offset = {0, 0.1f, 0}
double time_since_last_render = 0.0
 Computes the dot product or discrete sum over an array range.
GLuint main_queries [QUERY_FRAMES]
GLuint pl_queries [QUERY_FRAMES]
GLuint sm_queries [QUERY_FRAMES]
GLuint render_queries [QUERY_FRAMES]
GLuint cull_queries [QUERY_FRAMES]
GLuint gbuffer_queries [QUERY_FRAMES]
GLuint dof_queries [QUERY_FRAMES]
GLuint ssao_queries [QUERY_FRAMES]
GLuint taa_queries [QUERY_FRAMES]
GLuint ssr_queries [QUERY_FRAMES]
GLuint bloom_queries [QUERY_FRAMES]
int current_query_frame = 1
SDL_Window * window = NULL

Detailed Description

Audio probe baking, portal creation, probe volumes, and emitter functions.

Definition in file main.c.

Macro Definition Documentation

◆ DEFAULT_WIDTH

#define DEFAULT_WIDTH   1280

Definition at line 41 of file main.c.

◆ DEFAULT_HEIGHT

#define DEFAULT_HEIGHT   960

Definition at line 42 of file main.c.

◆ MAX_VERTEX_MEMORY

#define MAX_VERTEX_MEMORY   1024 * 1024

Definition at line 61 of file main.c.

Referenced by main().

◆ MAX_ELEMENT_MEMORY

#define MAX_ELEMENT_MEMORY   512 * 1024

Definition at line 62 of file main.c.

Referenced by main().

Function Documentation

◆ retrieve_gl_query()

GLuint64 retrieve_gl_query ( GLuint query)

Definition at line 459 of file main.c.

References retrieve_gl_query().

Referenced by retrieve_gl_query().

◆ main()

int main ( int argc,
char * argv[] )

<Max amount of events to poll in one render step

<Max amount of events to poll in one render step

Definition at line 520 of file main.c.

References add_all_meshes_to_buffer(), add_all_text_boxes_to_draw_buffer(), AudioScratchBuffers::aprobe_mutex, SceneData::APV_FILE, AUDIO_ENGINE, AUDIO_SCRATCH, audio_update(), bloom_queries, cam, Camera::cam_data, CAM_POS, CamData::cam_pos, CAM_UBO, cam_ubo_padded, cam_ubo_ptr, CAST_VEC, check_audio_pv(), check_lighting_pv(), Vector::count, create_performance_overlay(), cull_queries, current_frame, current_query_frame, DEBUG_APROBE_RAY_COUNT, DEBUG_FACE_COUNT, DEBUG_LINE_COUNT, DEBUG_POINT_COUNT, delete_hrtf_worker_thread(), DIRECTIONAL_LIGHT, DIRECTIONAL_LIGHT_COUNT, dof_queries, draw_dirty, dt, EDITOR_SETTINGS, end_timer(), ENTITIES, frame_time, gbuffer_queries, GLOBALS, GPU_init_cluster_aabbs(), GPU_upload_scene_data(), handle_held_events(), HRTF_TD, init(), init_new_asset_instance(), init_scene_bvh(), Light::layer, LIGHT_CAM, Light::light_type, Globals::lights, load_gltf(), SceneData::LPV_FILE, main(), main_queries, MAX_ELEMENT_MEMORY, MAX_ENTITIES, MAX_NUKLEAR_EVENTS, MAX_SDL_EVENTS, MAX_VERTEX_MEMORY, Entity::mesh_node, MOUSE_X, MOUSE_Y, NK_CTX, Globals::noclip, pl_queries, player, PQUERY_MAX, process_input(), process_sdl_event(), QUERY_FRAMES, render(), render_editor_menu(), EditorSettings::render_framerate_target, render_queries, running, Globals::scene_data, SDL_AUDIO_DEVICE, Player::skeleton, sm_queries, ssao_queries, ssr_queries, start_timer(), taa_queries, time, time_since_last_render, update_animation_components(), update_audio_occlusion(), update_camera(), update_light_camera(), update_performance_overlay(), update_physics_components(), update_player_audio_probe(), update_ui_state(), upload_lights(), upload_material_data(), Globals::vertex_layouts, window, vec4::x, vec4::y, and vec4::z.

Variable Documentation

◆ LMB_HELD

int LMB_HELD = 0

If the left mouse button is held.

Definition at line 51 of file main.c.

Referenced by handle_held_events(), and process_sdl_event().

◆ DEBUG_APROBE_RAY_COUNT

int DEBUG_APROBE_RAY_COUNT = 0

Definition at line 52 of file main.c.

Referenced by main(), and process_probe_chunk().

◆ DEBUG_CURRENT_APROBE

int DEBUG_CURRENT_APROBE = 0

Definition at line 54 of file main.c.

Referenced by interpolate_nearest_aprobes(), and render_probe_volume().

◆ AUDIO_ENGINE

ma_engine AUDIO_ENGINE

Definition at line 66 of file main.c.

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

◆ AUDIO_EMITTERS

◆ STATIC_HRTF_LEFT

float* STATIC_HRTF_LEFT[9] = {0}

Definition at line 69 of file main.c.

◆ STATIC_HRTF_RIGHT

float* STATIC_HRTF_RIGHT[9] = {0}

Definition at line 70 of file main.c.

◆ HRTF_LENGTH

int HRTF_LENGTH = 0

Definition at line 71 of file main.c.

Referenced by allocate_audio_scratch_hrtf(), and load_hrtf_from_binary().

◆ CONVOLVER_NODE

◆ AUDIO_SCRATCH

◆ HRTF_TD

◆ AW

AStarWorkspace AW = {0}

Definition at line 75 of file main.c.

Referenced by init_globals(), and pathfind_audio_occlusion().

◆ SCREEN_WIDTH

◆ SCREEN_HEIGHT

◆ RENDER_WIDTH

◆ RENDER_HEIGHT

◆ BLOOM_WIDTH

int BLOOM_WIDTH = 640

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 = 480

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 = 640

◆ DOF_HEIGHT

int DOF_HEIGHT = 480

◆ SSR_WIDTH

int SSR_WIDTH = 640

Definition at line 85 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ SSR_HEIGHT

int SSR_HEIGHT = 480

Definition at line 86 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ SSAO_WIDTH

int SSAO_WIDTH = 640

◆ SSAO_HEIGHT

int SSAO_HEIGHT = 480

◆ MAIN_FBO

◆ MAIN_RESOLVE_FBO

Framebuffer MAIN_RESOLVE_FBO = {0}

◆ SHADOW_MAP_FBO

Framebuffer SHADOW_MAP_FBO = {0}

Definition at line 92 of file main.c.

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

◆ GBUFFER_FBO

◆ GBUFFER_RESOLVE_FBO

◆ SSR_FBO

Framebuffer SSR_FBO = {0}

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 = {0}

Definition at line 96 of file main.c.

Referenced by init().

◆ SSAO_FBO

Framebuffer SSAO_FBO = {0}

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 = {0}

Definition at line 98 of file main.c.

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

◆ TAA_FBO

Framebuffer TAA_FBO[2] = {0}

Definition at line 99 of file main.c.

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

◆ COC_FBO

Framebuffer COC_FBO = {0}

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 = {0}

Definition at line 101 of file main.c.

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

◆ BLOOM_PYRAMID

Framebuffer BLOOM_PYRAMID[6] = {0}

Definition at line 102 of file main.c.

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

◆ TEXT_FBO

Framebuffer TEXT_FBO = {0}

Definition at line 103 of file main.c.

Referenced by init(), and render().

◆ SSAO_SHADER

ShaderProgram SSAO_SHADER = {0}

◆ SSAO_BLUR_SHADER

ShaderProgram SSAO_BLUR_SHADER = {0}

◆ SSR_SHADER

ShaderProgram SSR_SHADER = {0}

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 = {0}

Definition at line 108 of file main.c.

Referenced by init_globals(), and SHADERS_INIT().

◆ SSR_HISTORY_SHADER

ShaderProgram SSR_HISTORY_SHADER = {0}

Definition at line 109 of file main.c.

Referenced by render_to_cubemap_face(), and SHADERS_INIT().

◆ COC_SHADER

ShaderProgram COC_SHADER = {0}

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 = {0}

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 = {0}

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 = {0}

render/bloom_blur.frag

Definition at line 113 of file main.c.

Referenced by init_bloom_shader(), and SHADERS_INIT().

◆ DYNAMIC_SHADER

◆ SHADOW_MAP_SHADER

◆ DEPTH_PRE_PASS_SHADER

◆ DEPTH_PRE_PASS_SHADER_MSAA

◆ WIREFRAME_SHADER

ShaderProgram WIREFRAME_SHADER = {0}

◆ POSTPROCESS_SHADER

ShaderProgram POSTPROCESS_SHADER[128] = {0}

◆ CULL_CLUSTERS_SHADER

ShaderProgram CULL_CLUSTERS_SHADER = {0}

◆ CULL_DRAW_CALLS_SHADER

ShaderProgram CULL_DRAW_CALLS_SHADER = {0}

◆ INDIRECT_PREFIX_SHADER

◆ ELEMENTS_PREFIX_SHADER

◆ CULL_POINT_LIGHT_SHADOWS_SHADER

ShaderProgram CULL_POINT_LIGHT_SHADOWS_SHADER = {0}

◆ BLOOM_DOWNSCALE_SHADER

ShaderProgram BLOOM_DOWNSCALE_SHADER = {0}

◆ BLOOM_UPSCALE_SHADER

ShaderProgram BLOOM_UPSCALE_SHADER = {0}

◆ SKY_SHADER

◆ LIGHTMAP_SHADER

◆ BRDF_SHADER

ShaderProgram BRDF_SHADER = {0}

utilities/brdf.frag

Definition at line 129 of file main.c.

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

◆ POINT_LIGHT_SHADOW_SHADER

◆ TEXT_SHADER

ShaderProgram TEXT_SHADER = {0}

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 = {0}

ui/ui.vert ui/ui.frag

Definition at line 132 of file main.c.

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

◆ DEPTH_DOWNSAMPLE_SHADER

ShaderProgram DEPTH_DOWNSAMPLE_SHADER = {0}

◆ CAM_UBO

GLuint CAM_UBO = 0

Definition at line 135 of file main.c.

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

◆ RENDER_UBO

GLuint RENDER_UBO = 0

Definition at line 136 of file main.c.

Referenced by init().

◆ LIGHT_CAM_UBO

GLuint LIGHT_CAM_UBO = 0

Definition at line 137 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ RPROBE_UBO

GLuint RPROBE_UBO = 0

Definition at line 138 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ SSAO_KERNEL_UBO

GLuint SSAO_KERNEL_UBO = 0

Definition at line 139 of file main.c.

Referenced by init().

◆ PROBE_VOLUME_UBO

GLuint PROBE_VOLUME_UBO = 0

Definition at line 140 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ RPROBE_BACK_FBO

GLuint RPROBE_BACK_FBO = 0

Definition at line 142 of file main.c.

Referenced by init().

◆ RPROBE_DEPTH_TEXTURE

GLuint RPROBE_DEPTH_TEXTURE = 0

Definition at line 143 of file main.c.

Referenced by init().

◆ RPROBE_BACK_TEXTURE

GLuint RPROBE_BACK_TEXTURE = 0

Definition at line 144 of file main.c.

Referenced by init().

◆ BLENDED_RPROBE_CUBE_MAP

GLuint BLENDED_RPROBE_CUBE_MAP = 0

Definition at line 145 of file main.c.

Referenced by init().

◆ COLOR_GRADE_LUT

GLuint COLOR_GRADE_LUT = 0

Definition at line 146 of file main.c.

Referenced by init(), and render().

◆ FOOTSTEP_EMITTER

AudioEmitter* FOOTSTEP_EMITTER = NULL

Definition at line 149 of file main.c.

Referenced by init(), and update_leg().

◆ LIGHT_SSBO

GLuint LIGHT_SSBO = 0

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 = 0

Definition at line 151 of file main.c.

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

◆ MATERIAL_SSBO

GLuint MATERIAL_SSBO = 0

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().

◆ LIGHTMAP_SSBO

GLuint LIGHTMAP_SSBO = 0

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 = 0

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 = 0

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 = 0

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 = 0

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 = 0

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().

◆ PROBE_SSBO

GLuint PROBE_SSBO = 0

Definition at line 159 of file main.c.

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

◆ RPROBE_SSBO

GLuint RPROBE_SSBO = 0

◆ JOINT_SSBO

GLuint JOINT_SSBO = 0

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 = 0

Definition at line 162 of file main.c.

Referenced by bind_render_ssbos(), and init().

◆ GLOBAL_LIGHT_INDICES_SSBO

GLuint GLOBAL_LIGHT_INDICES_SSBO = 0

Definition at line 163 of file main.c.

Referenced by bind_render_ssbos(), and init().

◆ CLUSTER_SSBO

GLuint CLUSTER_SSBO = 0

Definition at line 164 of file main.c.

Referenced by bind_render_ssbos(), and init().

◆ MESH_NODE_SSBO

GLuint MESH_NODE_SSBO = 0

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 = 0

◆ INDIRECT_ARRAYS_COMMAND_BUFFER

GLuint INDIRECT_ARRAYS_COMMAND_BUFFER = 0

◆ INDIRECT_ARRAYS_COMMAND_BUFFER_OUT

GLuint INDIRECT_ARRAYS_COMMAND_BUFFER_OUT = 0

◆ INDIRECT_ELEMENTS_COMMAND_BUFFER

GLuint INDIRECT_ELEMENTS_COMMAND_BUFFER = 0

◆ INDIRECT_ELEMENTS_COMMAND_BUFFER_OUT

GLuint INDIRECT_ELEMENTS_COMMAND_BUFFER_OUT = 0

◆ INSTANCE_SSBO

GLuint INSTANCE_SSBO = 0

◆ TEXT_BOX_SSBO

GLuint TEXT_BOX_SSBO = 0

◆ UI_SSBO

GLuint UI_SSBO = 0

Definition at line 173 of file main.c.

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

◆ SSAO_NOISE_FBO

GLuint SSAO_NOISE_FBO = 0

Definition at line 175 of file main.c.

◆ SSAO_NOISE_TEXTURE

GLuint SSAO_NOISE_TEXTURE = 0

Definition at line 176 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ FBM_TEXTURE

GLuint FBM_TEXTURE = 0

Definition at line 177 of file main.c.

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

◆ UNJITTERED_PROJ

mat4 UNJITTERED_PROJ

Definition at line 179 of file main.c.

◆ UNJITTERED_PROJ_INV

mat4 UNJITTERED_PROJ_INV

Definition at line 180 of file main.c.

◆ JITTER_OFFSET

vec2 JITTER_OFFSET

Definition at line 181 of file main.c.

Referenced by render_to_cubemap_face(), and update_camera().

◆ MOUSE_X

◆ MOUSE_Y

◆ BRDF_FBO

GLuint BRDF_FBO = 0

Definition at line 185 of file main.c.

Referenced by init().

◆ VERTEX_DATA

VertexData VERTEX_DATA

Definition at line 187 of file main.c.

Referenced by GPU_upload_scene_data(), and init_globals().

◆ TRI_DATA

TriData TRI_DATA

Definition at line 188 of file main.c.

Referenced by GPU_upload_scene_data(), and init_globals().

◆ MESH_DATA

MeshData MESH_DATA

Definition at line 189 of file main.c.

Referenced by GPU_upload_scene_data(), and init_globals().

◆ MESH_BVH_DATA

BVHGPU MESH_BVH_DATA

Definition at line 190 of file main.c.

Referenced by GPU_upload_scene_data(), and init_globals().

◆ SCENE_BVH_DATA

BVHGPU SCENE_BVH_DATA

Definition at line 191 of file main.c.

Referenced by GPU_upload_scene_data(), and init_globals().

◆ LIGHTMAP_DATA

◆ MATERIAL_DATA

MaterialData MATERIAL_DATA

Definition at line 194 of file main.c.

Referenced by upload_material_data().

◆ DEFAULT_DIFFUSE

int DEFAULT_DIFFUSE = 0

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 = 0

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 = 0

◆ DEFAULT_EMISSIVE

int DEFAULT_EMISSIVE = 0

Definition at line 199 of file main.c.

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

◆ DEFAULT_DISPLACEMENT

int DEFAULT_DISPLACEMENT = 0

Definition at line 200 of file main.c.

◆ DUMMY_LIGHTMAP

int DUMMY_LIGHTMAP = 0

Definition at line 201 of file main.c.

Referenced by bind_dynamic_shader(), and init_default_textures().

◆ BRDF_LUT

GLuint BRDF_LUT = 0

Definition at line 203 of file main.c.

Referenced by bind_dynamic_shader(), and init().

◆ CAM_POS

vec3 CAM_POS

Shorthand variable for the camera position.

Definition at line 205 of file main.c.

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

◆ SHADOW_MAP_TEMP

GLuint SHADOW_MAP_TEMP = 0

Definition at line 207 of file main.c.

◆ HISTORY_FBO

GLuint HISTORY_FBO[2] = {0}

Definition at line 208 of file main.c.

Referenced by init().

◆ HISTORY_TEXTURE

GLuint HISTORY_TEXTURE[2] = {0}

Definition at line 209 of file main.c.

Referenced by init(), and render().

◆ SOBEL_FBO

GLuint SOBEL_FBO[2] = {0}

Definition at line 210 of file main.c.

Referenced by init().

◆ SOBEL_TEXTURE

GLuint SOBEL_TEXTURE[2] = {0}

Definition at line 211 of file main.c.

Referenced by init().

◆ SSAO_KERNEL

vec4 SSAO_KERNEL[16]

Definition at line 213 of file main.c.

Referenced by init(), and precompute_ssao_kernel().

◆ LIGHTMAP_FBO

GLuint LIGHTMAP_FBO = 0

Definition at line 216 of file main.c.

Referenced by bake_lightmap(), and init().

◆ LIGHTMAP_VAO

GLuint LIGHTMAP_VAO = 0

Definition at line 217 of file main.c.

Referenced by bake_lightmap(), and init().

◆ LIGHTMAP_VBO

GLuint LIGHTMAP_VBO = 0

Definition at line 218 of file main.c.

Referenced by bake_lightmap(), and init().

◆ LIGHTMAP_POS_TEXTURE

GLuint LIGHTMAP_POS_TEXTURE = 0

Definition at line 219 of file main.c.

Referenced by bake_lightmap(), and init().

◆ LIGHTMAP_NORM_TEXTURE

GLuint LIGHTMAP_NORM_TEXTURE = 0

Definition at line 220 of file main.c.

Referenced by bake_lightmap(), and init().

◆ LIGHTMAP_ID_TEXTURE

GLuint LIGHTMAP_ID_TEXTURE = 0

Definition at line 221 of file main.c.

Referenced by bake_lightmap(), and init().

◆ DIRECTIONAL_MAP_TEXTURE

GLuint DIRECTIONAL_MAP_TEXTURE = 0

◆ LIGHTMAP_PING

GLuint LIGHTMAP_PING = 0

Definition at line 223 of file main.c.

◆ LIGHTMAP_PONG

GLuint LIGHTMAP_PONG = 0

Definition at line 224 of file main.c.

◆ LIGHTMAP_BOUNCE_SHADER

GLuint LIGHTMAP_BOUNCE_SHADER = 0

◆ LIGHTMAP_DENOISE_SHADER

GLuint LIGHTMAP_DENOISE_SHADER = 0

◆ LIGHTMAP_DILATE_SHADER

GLuint LIGHTMAP_DILATE_SHADER = 0

◆ PROBE_BAKE_SHADER

GLuint PROBE_BAKE_SHADER = 0

◆ AUDIO_PROBE_BAKE_SHADER

GLuint AUDIO_PROBE_BAKE_SHADER = 0

◆ PROBE_UNPACK_SHADER

GLuint PROBE_UNPACK_SHADER = 0

◆ DIRECTIONAL_MAP_NORMALIZE_SHADER

GLuint DIRECTIONAL_MAP_NORMALIZE_SHADER = 0

◆ TEMP_RPROBE_CUBE_MAP

GLuint TEMP_RPROBE_CUBE_MAP = 0

Definition at line 232 of file main.c.

Referenced by init().

◆ CONVOLVE_TRIANGLE_VBO

GLuint CONVOLVE_TRIANGLE_VBO = 0

Definition at line 233 of file main.c.

Referenced by init().

◆ CONVOLVE_TRIANGLE_VAO

GLuint CONVOLVE_TRIANGLE_VAO = 0

Definition at line 234 of file main.c.

Referenced by init().

◆ MAIN_VBO

GLuint MAIN_VBO = 0

◆ MAIN_EBO

GLuint MAIN_EBO = 0

◆ MAIN_VAO

GLuint MAIN_VAO = 0

◆ INSTANCE_VBO

GLuint INSTANCE_VBO = 0

◆ SHADOW_INSTANCE_VBO

GLuint SHADOW_INSTANCE_VBO = 0

Definition at line 240 of file main.c.

◆ SHADOW_VAO

GLuint SHADOW_VAO = 0

Definition at line 241 of file main.c.

◆ WIREFRAME_VBO

GLuint WIREFRAME_VBO = 0

Definition at line 242 of file main.c.

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

◆ WIREFRAME_VAO

GLuint WIREFRAME_VAO = 0

Definition at line 243 of file main.c.

Referenced by init(), and render().

◆ FS_VAO

GLuint FS_VAO = 0

Definition at line 244 of file main.c.

Referenced by init().

◆ PERFORMANCE_OVERLAY_TEXT_BOX_START

int PERFORMANCE_OVERLAY_TEXT_BOX_START = 0

◆ PERFORMANCE_OVERLAY_MENU

int PERFORMANCE_OVERLAY_MENU = 0

◆ TEXT_VAO

GLuint TEXT_VAO = 0

Definition at line 250 of file main.c.

Referenced by init(), and render().

◆ TEXT_VBO

GLuint TEXT_VBO = 0

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 = 0

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 = 0

Definition at line 254 of file main.c.

Referenced by init(), and render().

◆ UI_VBO

GLuint UI_VBO = 0

Definition at line 255 of file main.c.

Referenced by init().

◆ UI_INSTANCE_VBO

GLuint UI_INSTANCE_VBO = 0

Definition at line 256 of file main.c.

Referenced by init().

◆ DRAW_COMMANDS

DrawCommand DRAW_COMMANDS[512]

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

Definition at line 260 of file main.c.

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

◆ SDL_AUDIO_DEVICE

SDL_AudioDeviceID SDL_AUDIO_DEVICE

Definition at line 263 of file main.c.

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

◆ SHADOW_DRAW_COMMANDS

DrawCommand SHADOW_DRAW_COMMANDS[512]

Definition at line 265 of file main.c.

◆ shadow_draw_command_count

int shadow_draw_command_count

Definition at line 266 of file main.c.

◆ LPV_TEXTURE

GLuint LPV_TEXTURE

Definition at line 268 of file main.c.

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

◆ MANIFOLDS

◆ PP_SHADER_VERSIONS

uint32_t PP_SHADER_VERSIONS = 0

Definition at line 272 of file main.c.

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

◆ INIT_CLUSTER_AABBS_SHADER

GLuint INIT_CLUSTER_AABBS_SHADER = 0

◆ DEPTH_DOWNSAMPLE_FBO

Framebuffer DEPTH_DOWNSAMPLE_FBO = {0}

Definition at line 275 of file main.c.

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

◆ DEBUG_FACES

DebugVertex DEBUG_FACES[1024][3]

Definition at line 277 of file main.c.

◆ DEBUG_FACE_COUNT

int DEBUG_FACE_COUNT

Definition at line 278 of file main.c.

Referenced by main().

◆ DEBUG_POINTS

DebugVertex DEBUG_POINTS[1024]

Definition at line 279 of file main.c.

◆ DEBUG_POINT_COUNT

int DEBUG_POINT_COUNT

Definition at line 280 of file main.c.

Referenced by main().

◆ DEBUG_LINES

◆ DEBUG_LINE_COUNT

◆ asset_dir

char asset_dir[256]

Definition at line 284 of file main.c.

Referenced by init_globals(), and render_main_menu().

◆ rprobe_dir

char rprobe_dir[256]

Definition at line 285 of file main.c.

Referenced by init_globals(), and render_main_menu().

◆ player

◆ spawn_point

vec3 spawn_point = {0, 0, 0}

Spawn point.

Todo
encapsulate.

Definition at line 289 of file main.c.

Referenced by init_player(), and process_input().

◆ EW

◆ RENDER_FENCE

GLsync RENDER_FENCE[3]

Definition at line 293 of file main.c.

Referenced by render().

◆ left_hip_pos

vec3 left_hip_pos

Definition at line 295 of file main.c.

◆ right_hip_pos

vec3 right_hip_pos

Definition at line 296 of file main.c.

◆ right_leg_moving

bool right_leg_moving = false

Definition at line 298 of file main.c.

◆ frame_time

float frame_time = 0

The actual frame time in s.

Definition at line 300 of file main.c.

Referenced by main(), and render().

◆ SKYBOX

GLuint SKYBOX = 0

◆ SKY_VAO

GLuint SKY_VAO = 0

Definition at line 303 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ SKY_VBO

GLuint SKY_VBO = 0

Definition at line 304 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ RPROBE_CUBE_MAP_ARRAY

GLuint RPROBE_CUBE_MAP_ARRAY = 0

Definition at line 305 of file main.c.

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

◆ RPROBE_FBO

GLuint RPROBE_FBO = 0

Definition at line 306 of file main.c.

Referenced by bake_reflection_probes(), and init().

◆ POINT_LIGHT_SHADOWS_FBO

Framebuffer POINT_LIGHT_SHADOWS_FBO = {0}

Definition at line 307 of file main.c.

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

◆ FOCAL_DISTANCE_SHADER

ShaderProgram FOCAL_DISTANCE_SHADER = {0}

◆ GLOBALS

Globals GLOBALS = {0}

Engine Globals.

Definition at line 310 of file main.c.

Referenced by a_star_aportal(), add_all_meshes_to_buffer(), add_image_to_registry(), add_mesh_to_buffer(), add_uv_island_to_lightmap(), allocate_gbuffer_msaa(), allocate_lightmap_ssbo(), allocate_main_fbo(), assign_uvs(), bake_audio_probe_volume(), bake_lighting_probe_volume(), bake_lightmap(), bake_reflection_probes(), bind_dynamic_shader(), bind_material(), build_light_bvh(), build_uv_islands(), calc_mesh_index_size(), calc_mesh_size(), check_audio_pv(), check_lighting_pv(), create_entity(), create_physics_component(), destroy_asset_instance(), determine_closest_rprobes(), determine_light_visibility_per_mesh(), determine_mesh_visibility(), ESTATE_chair_interact(), execute_aportal_undo(), execute_aprobe_undo(), execute_globals_undo(), execute_light_undo(), execute_lprobe_undo(), execute_mesh_node_undo(), execute_rprobe_undo(), fill_buffer_with_mesh_tri(), fill_vertex_buffer_mesh(), find_animation(), find_closest_visible_aportal(), find_free_mn(), find_mn_by_name(), GPU_upload_scene_data(), init_default_textures(), init_globals(), init_new_asset_instance(), init_new_audio_portal(), init_new_material(), init_PC(), init_scene_bvh(), init_vertex_layouts(), interpolate_nearest_aprobes(), LM_allocate_empty_mns(), LM_regenerate_texels(), load_aprobes(), load_audio_pv(), load_gltf(), load_gltf_texture(), load_lighting_pv(), load_lightmap_from_binary(), load_lprobes(), main(), MN_INIT(), pathfind_audio_occlusion(), PC_find_collision(), PC_resolve_impulse(), PC_resolve_impulse_static(), PC_traverse_scene_bvh(), play_animation(), player_find_collision(), player_resolve_impulse(), player_resolve_impulse_static(), populate_draw_commands(), process_input(), process_probe_chunk(), process_sdl_event(), query_probe_volume(), ray_traverse_scene_bvh(), raycast_scene(), read_mesh_node(), reallocate_rprobe_array(), recalculate_audio_portal_paths(), remove_audio_portal(), render(), render_all_draw_commands(), render_asset_instance_menu(), render_audio_menu(), render_editor_menu(), render_light_menu(), render_lprobe_menu(), render_main_menu(), render_material_menu(), render_mesh_aabbs_from_root(), render_mn_menu(), render_to_cubemap_face(), reset_audio_pvs(), reset_lighting_pvs(), resolve_collisions(), retrieve_asset_by_name(), retrieve_mesh_by_name(), save_aprobes(), save_lightmap_to_binary(), save_lprobes(), scene_load(), scene_load_volumes(), scene_save(), scene_save_volumes(), search_collisions_from_hull(), search_collisions_from_pc(), SKIN_INIT(), update_body_from_legs(), update_camera(), update_physics_components(), update_player_ir(), update_scene_nodes(), update_skin_matrices(), upload_bake_lights_gpu(), upload_instance_data(), upload_instances(), upload_joint_matrices(), upload_lights(), upload_material_data(), write_mesh_node(), and write_point_light_shadows().

◆ ENTITIES

◆ ASSET_INSTANCES

◆ PHYSICS_COMPONENTS

◆ ANIMATION_COMPONENTS

◆ running

int running = 0

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().

◆ dt

◆ time

float time = 0

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().

◆ cam

◆ LIGHT_CAM

Camera LIGHT_CAM[4] = {0}

DIRECTIONAL_LIGHT Cameras for shadowmaps

Definition at line 323 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ DIRECTIONAL_LIGHT_COUNT

int DIRECTIONAL_LIGHT_COUNT = 0

Definition at line 324 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ NK_CTX

◆ NUKLEAR_HOVERED

◆ EDITOR_SETTINGS

◆ cam_ubo_padded

size_t cam_ubo_padded

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

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

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

Definition at line 336 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ rprobe_ubo_padded

size_t rprobe_ubo_padded

Definition at line 338 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ rprobe_ubo_ptr

uint8_t* rprobe_ubo_ptr

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

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

Definition at line 342 of file main.c.

Referenced by init(), and render_to_cubemap_face().

◆ light_ssbo_size

size_t light_ssbo_size

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

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

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

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

Definition at line 350 of file main.c.

Referenced by init(), and upload_joint_matrices().

◆ joint_ssbo_ptr

uint8_t* joint_ssbo_ptr

Definition at line 351 of file main.c.

Referenced by init(), and upload_joint_matrices().

◆ instance_vbo_size

size_t instance_vbo_size

Definition at line 353 of file main.c.

Referenced by init().

◆ instance_vbo_ptr

uint8_t* instance_vbo_ptr

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

Definition at line 356 of file main.c.

◆ mesh_node_ssbo_size

size_t mesh_node_ssbo_size

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

Definition at line 359 of file main.c.

Referenced by init(), and upload_instance_data().

◆ indirect_arrays_ptr

uint8_t* indirect_arrays_ptr

Definition at line 361 of file main.c.

Referenced by init(), and upload_instance_data().

◆ visible_indices_ptr

uint8_t* visible_indices_ptr

Definition at line 363 of file main.c.

◆ indirect_arrays_out_ptr

uint8_t* indirect_arrays_out_ptr

Definition at line 365 of file main.c.

Referenced by init().

◆ indirect_elements_ptr

uint8_t* indirect_elements_ptr

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

Definition at line 369 of file main.c.

Referenced by init().

◆ text_box_ssbo_size

size_t text_box_ssbo_size

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

Definition at line 372 of file main.c.

Referenced by GPU_upload_ui_elements(), and init().

◆ instance_ssbo_size

size_t instance_ssbo_size

Definition at line 374 of file main.c.

Referenced by init(), and upload_instances().

◆ instance_ssbo_ptr

uint8_t* instance_ssbo_ptr

Definition at line 375 of file main.c.

Referenced by init(), and upload_instances().

◆ text_vbo_size

size_t text_vbo_size

Definition at line 377 of file main.c.

Referenced by init().

◆ ui_ssbo_size

size_t ui_ssbo_size

Definition at line 379 of file main.c.

Referenced by GPU_upload_ui_elements(), and init().

◆ ui_ssbo_ptr

uint8_t* ui_ssbo_ptr

Definition at line 380 of file main.c.

Referenced by GPU_upload_ui_elements(), and init().

◆ ui_vbo_size

size_t ui_vbo_size

Definition at line 382 of file main.c.

Referenced by init().

◆ ui_vbo_ptr

uint8_t* ui_vbo_ptr

Definition at line 383 of file main.c.

Referenced by init().

◆ ui_instance_vbo_size

size_t ui_instance_vbo_size

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

Definition at line 386 of file main.c.

Referenced by GPU_upload_ui_elements(), and init().

◆ draw_dirty

bool draw_dirty

◆ left_leg_offset

const vec3 left_leg_offset = {0, -0.1f, 0}

Definition at line 391 of file main.c.

Referenced by update_skeleton().

◆ right_leg_offset

const vec3 right_leg_offset = {0, 0.1f, 0}

Definition at line 392 of file main.c.

Referenced by update_skeleton().

◆ time_since_last_render

double time_since_last_render = 0.0

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*}

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

Definition at line 505 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ main_queries

GLuint main_queries[QUERY_FRAMES]

Definition at line 506 of file main.c.

Referenced by main(), and render().

◆ pl_queries

GLuint pl_queries[QUERY_FRAMES]

Definition at line 507 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ sm_queries

GLuint sm_queries[QUERY_FRAMES]

Definition at line 508 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ render_queries

GLuint render_queries[QUERY_FRAMES]

Definition at line 509 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ cull_queries

GLuint cull_queries[QUERY_FRAMES]

Definition at line 510 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ gbuffer_queries

GLuint gbuffer_queries[QUERY_FRAMES]

Definition at line 511 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ dof_queries

GLuint dof_queries[QUERY_FRAMES]

Definition at line 512 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ ssao_queries

GLuint ssao_queries[QUERY_FRAMES]

Definition at line 513 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ taa_queries

GLuint taa_queries[QUERY_FRAMES]

Definition at line 514 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ ssr_queries

GLuint ssr_queries[QUERY_FRAMES]

Definition at line 515 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ bloom_queries

GLuint bloom_queries[QUERY_FRAMES]

Definition at line 516 of file main.c.

Referenced by main(), and render_to_cubemap_face().

◆ current_query_frame

int current_query_frame = 1

Definition at line 517 of file main.c.

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

◆ window