Untitled
Loading...
Searching...
No Matches
render.c File Reference
#include <GL/glew.h>
#include <assert.h>
#include "SDL2/SDL_timer.h"
#include "core/camera.h"
#include "utilities/mathf.h"
#include "load/init.h"
#include "utilities/types.h"
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "ui/ui.h"
#include "utilities/utilities.h"
#include "render/render.h"
#include "utilities/engine_utilities.h"
#include "core/engine_types.h"
#include "core/animation.h"
#include "ui/fonts.h"

Go to the source code of this file.

Data Structures

struct  UIUIDPair

Macros

#define MAX_MESHES_PER_PT_LIGHT_SHADOW   32

Functions

void bind_baking_ssbos ()
 Binds SSBOs required for baking.
void unbind_baking_ssbos ()
 Unbinds SSBOs required for baking.
void bind_render_ssbos ()
 Binds SSBOs required for rendering.
size_t fill_buffer_with_mesh_tri (Mesh *mesh, MainVertex *verts, size_t offset)
size_t fill_vertex_buffer_mesh (Mesh *mesh, MainVertex *verts, size_t offset, size_t *lm_offset)
size_t fill_index_buffer_mesh (Mesh *mesh, uint32_t *indices, size_t vertex_offset, size_t offset, size_t *lm_uv_offset)
size_t calc_mesh_size (Mesh *m)
size_t calc_mesh_index_size (Mesh *m)
void add_mesh_to_buffer (Mesh *m, VertexLayout *layout)
 Adds a single Mesh to the MAIN_VBO.
size_t allocate_lightmap_ssbo ()
void add_all_meshes_to_buffer (VertexLayout *layout)
 Adds all Meshes that have valid MeshNodes.
void aabb_to_vertices (DebugVertex *out, AABB *aabb, vec3 offset)
 Transfers an AABB to DebufVertex for a wireframe (GL_LINES).
void render_mesh_aabbs_from_root (MeshNode *mn)
 Adds Mesh AABBs for each MeshNode child recursively to DEBUG_LINES.
void obb_to_vertices (DebugVertex *out, OBB *obb)
void copy_light_to_gpu_light (LightGPU *lgpu, Light *l)
 Transfers a Light to a LightGPU.
void upload_lights ()
 Uploads all current Lights inside of Globals.lights to the GPU in a triple buffered LIGHT_SSBO.
void determine_light_visibility_per_mesh ()
void upload_joint_matrices ()
void update_node_global (MeshNode *nodes, int idx, mat4 parent)
void update_scene_nodes ()
void update_skin_matrices ()
void upload_material_data ()
 Uploads Material data to the GPU as MaterialGPU.
void get_view_planes (vec4 planes[6], Camera *cam)
bool aabb_in_frustum (vec3 min, vec3 max, vec4 planes[6])
void determine_mesh_visibility (Camera *camera, size_t *meshes_frame, size_t *meshes_frame_cnt)
void populate_draw_commands (DrawCommand *dcs, int *draw_command_cnt)
int compare_draw_commands (const void *a, const void *b)
void create_and_sort_draw_commands (int *dc_cnt, DrawCommand *dcs)
 Creates all DrawCommands based on unique SubMeshes and sorts them via DrawCommand.sort_key.
float compute_ui_scale (int base_w, int base_h, int target_w, int target_h)
void add_text_box (Vector *tvs, Vector *tis, TextBox *tb, int current_box)
 Adds a TextBox to a vertex and index buffer, to be uploaded to TEXT_VBO and TEXT_EBO.
void add_all_text_boxes_to_draw_buffer ()
 Adds all TextBoxes to TEXT_VBO and iterates through each character to push indices to TEXT_EBO.
void GPU_upload_singular_text_box (UIContainer *cs, TextBox *tb, int *TC)
int compare_uid_pair (const void *a, const void *b)
void GPU_upload_singular_element (UIContainer *cs, UIElement *el, int *ui_el_count, int *el_count)
void upload_parent_container (UIElement *el, UIContainer *cs, UIElement *els, int *el_count, size_t offset)
void GPU_upload_ui_elements ()
void bind_dynamic_shader (int shader, bool probe_bake)
void bind_material (Material *mat)
void upload_instance_data (int *draw_calls, int *in_off, int dc_counts[MAX_DRAW_COMMANDS], int dc_off[MAX_DRAW_COMMANDS], int *draw_command_cnt, DrawCommand *dcs, MeshNodeSSBO *mn_data, uint8_t *instance_ptr, int current_frame_offset)
void draw_arrays_elements (ShaderProgram *s, int start_arr, size_t start_array_offset, uint32_t array_count, int start_ele, size_t start_element_offset, uint32_t element_count)
void write_point_light_shadows ()
void upload_instances ()
void render_all_draw_commands (bool probe_bake)
void determine_closest_rprobes ()
void render_to_cubemap_face (Camera *rprobe_cam, GLuint render_fbo, int render_width, int render_height, bool probe_bake)
 Uploads per-frame data to GPU and renders main render pass to a target FBO (omits Text, UI, and postprocessing that occurs after).
int find_depth (BVHNode *nodes, BVHNode *node, int depth)
void render_tree (BVHNode *nodes, BVHNode *node, mat4 tr, DebugVertex *points, int *count, int depth, int max_depth, vec3 start_color, vec3 end_color)
void render_bvh (BVHNode *nodes, int node_count, mat4 tr)
void render_probe_volume (ProbeVolume *pv, bool audio)
void render ()
 The main render pass.

Variables

int master_frame = 0
int cur_history = 0
int current_frame = 0
size_t meshes_in_frame [MAX_MESH_NODES]
size_t meshes_this_frame
size_t shadow_meshes_in_frame [MAX_MESH_NODES]
size_t shadow_meshes_this_frame
size_t vsize = 0
size_t visize = 0
LightGPU GPU_LIGHTS [MAX_LIGHTS]
int gpu_light_count = 0
mat4 JOINT_MATS [MAX_JOINT_MATRICES]
int joint_mat_count = 0
TextBoxGPU TB_GPU [MAX_TEXT_BOXES]
float angle_tr = 0
UIElementGPU UI_GPU [MAX_UI_ELEMENTS] = {0}
UIUIDPair UI_UIDS [MAX_UI_ELEMENTS] = {0}
uint32_t UI_UID_OUT [MAX_UI_ELEMENTS] = {0}
int ui_element_count = 0
int * container_ids = NULL
size_t container_ids_cap = 0
InstanceData instance_matrices [MAX_INSTANCES]
int draw_command_offsets [MAX_DRAW_COMMANDS]
int draw_command_counts [MAX_DRAW_COMMANDS]
int draw_call_count = 0
int instance_offset = 0
InstanceData shadow_instance_matrices [MAX_INSTANCES]
int shadow_draw_command_offsets [MAX_DRAW_COMMANDS]
int shadow_draw_command_counts [MAX_DRAW_COMMANDS]
int shadow_draw_call_count = 0
int shadow_instance_offset = 0
MeshNodeSSBO mesh_node_data_gpu
DrawArraysIndirectCommand arrays_indirect [MAX_MESH_NODES]
int array_offset = 0
DrawElementsIndirectCommand elements_indirect [MAX_MESH_NODES]
int element_offset = 0
TransformGPU transforms [MAX_MESH_NODES *MAX_INSTANCES]
int transform_count = 0
int static_count = 0
int dynamic_count = 0
RProbeUBO RPROBE_UBO_DATA
int RPROBE_COUNT = 0
ShadowmapUBO SHADOWMAP_FRAME_DATA

Data Structure Documentation

◆ UIUIDPair

struct UIUIDPair

Definition at line 1335 of file render.c.

Data Fields
uint32_t uid
uint32_t layer

Macro Definition Documentation

◆ MAX_MESHES_PER_PT_LIGHT_SHADOW

#define MAX_MESHES_PER_PT_LIGHT_SHADOW   32

Definition at line 1833 of file render.c.

Function Documentation

◆ bind_baking_ssbos()

void bind_baking_ssbos ( )

◆ unbind_baking_ssbos()

◆ bind_render_ssbos()

◆ fill_buffer_with_mesh_tri()

◆ fill_vertex_buffer_mesh()

◆ fill_index_buffer_mesh()

size_t fill_index_buffer_mesh ( Mesh * mesh,
uint32_t * indices,
size_t vertex_offset,
size_t offset,
size_t * lm_uv_offset )

◆ calc_mesh_size()

size_t calc_mesh_size ( Mesh * m)

◆ calc_mesh_index_size()

size_t calc_mesh_index_size ( Mesh * m)

◆ add_mesh_to_buffer()

void add_mesh_to_buffer ( Mesh * m,
VertexLayout * layout )

◆ allocate_lightmap_ssbo()

◆ add_all_meshes_to_buffer()

void add_all_meshes_to_buffer ( VertexLayout * layout)

◆ aabb_to_vertices()

void aabb_to_vertices ( DebugVertex * out,
AABB * aabb,
vec3 offset )

Transfers an AABB to DebufVertex for a wireframe (GL_LINES).

Parameters
outThe outgoing vertices.
aabbThe input AABB.
offsetThe offset in world space.
Todo
Make a matrix transform instead of an offset. Or instance the AABBs and transform on the GPU.

Definition at line 475 of file render.c.

References aabb_to_vertices(), AABB::center, DebugVertex::pos, and vec3_add().

Referenced by aabb_to_vertices(), ray_traverse_scene_bvh(), render(), render_mesh_aabbs_from_root(), render_probe_volume(), render_tree(), and update_physics_components().

◆ render_mesh_aabbs_from_root()

◆ obb_to_vertices()

◆ copy_light_to_gpu_light()

◆ upload_lights()

◆ determine_light_visibility_per_mesh()

◆ upload_joint_matrices()

◆ update_node_global()

void update_node_global ( MeshNode * nodes,
int idx,
mat4 parent )

Definition at line 796 of file render.c.

References compose_trs_from_mesh_node(), m4_mul(), n, and update_node_global().

Referenced by update_node_global(), and update_scene_nodes().

◆ update_scene_nodes()

◆ update_skin_matrices()

◆ upload_material_data()

◆ get_view_planes()

◆ aabb_in_frustum()

bool aabb_in_frustum ( vec3 min,
vec3 max,
vec4 planes[6] )

Definition at line 983 of file render.c.

References aabb_in_frustum(), planes, vec3_dot(), vec4::w, vec3::x, vec4::x, vec3::y, vec4::y, vec3::z, and vec4::z.

◆ determine_mesh_visibility()

◆ populate_draw_commands()

◆ compare_draw_commands()

int compare_draw_commands ( const void * a,
const void * b )

◆ create_and_sort_draw_commands()

void create_and_sort_draw_commands ( int * dc_cnt,
DrawCommand * dcs )

Creates all DrawCommands based on unique SubMeshes and sorts them via DrawCommand.sort_key.

Parameters
dc_cntThe output count of DrawCommands.
dcsThe output DrawCommands.

Definition at line 1132 of file render.c.

References compare_draw_commands(), create_and_sort_draw_commands(), and populate_draw_commands().

Referenced by create_and_sort_draw_commands(), and render_to_cubemap_face().

◆ compute_ui_scale()

float compute_ui_scale ( int base_w,
int base_h,
int target_w,
int target_h )

◆ add_text_box()

void add_text_box ( Vector * tvs,
Vector * tis,
TextBox * tb,
int current_box )

Adds a TextBox to a vertex and index buffer, to be uploaded to TEXT_VBO and TEXT_EBO.

Parameters
tvsThe out vertex Vector.
tisThe out index Vector.
tbThe TextBox to upload.
current_boxThe index within the entire buffer, meaning a running count through each individual UIMenus.
Todo
This current_box variable makes it so we can never reorder our TEXT_BOX_SSBO or else every vertex will be pointing to the wrong data. Resolve this.

Definition at line 1154 of file render.c.

References add_text_box(), CAST_VEC, TextBox::color, Vector::count, TextBox::fill, TextBox::font_id, FONTS, Font::glyph_count, Font::glyphs, Glyph::height, TextBox::start, TextBox::text, TextBox::text_size, Glyph::u0, Glyph::u1, Glyph::v0, Glyph::v1, vector_expand(), Glyph::width, vec2::x, Glyph::xadvance, Glyph::xoffset, vec2::y, and Glyph::yoffset.

Referenced by add_all_text_boxes_to_draw_buffer(), and add_text_box().

◆ add_all_text_boxes_to_draw_buffer()

void add_all_text_boxes_to_draw_buffer ( )

Adds all TextBoxes to TEXT_VBO and iterates through each character to push indices to TEXT_EBO.

Note
This function is currently called on TextBox text change. Text should always be pre-loaded because this should not be called during "game-time."

Definition at line 1220 of file render.c.

References add_all_text_boxes_to_draw_buffer(), add_text_box(), Vector::buffer, CAST_VEC, Vector::count, init_vector(), MAX_TEXT_BOXES, MENUS, UIMenu::text_boxes, TEXT_EBO, TEXT_INDEX_COUNT, and TEXT_VBO.

Referenced by add_all_text_boxes_to_draw_buffer(), execute_text_box_undo(), execute_ui_element_undo(), main(), render_text_menu(), render_ui_menu(), scene_load(), and update_performance_overlay().

◆ GPU_upload_singular_text_box()

◆ compare_uid_pair()

int compare_uid_pair ( const void * a,
const void * b )

Definition at line 1343 of file render.c.

References compare_uid_pair(), and UIUIDPair::layer.

Referenced by compare_uid_pair(), and GPU_upload_ui_elements().

◆ GPU_upload_singular_element()

◆ upload_parent_container()

◆ GPU_upload_ui_elements()

◆ bind_dynamic_shader()

◆ bind_material()

◆ upload_instance_data()

void upload_instance_data ( int * draw_calls,
int * in_off,
int dc_counts[MAX_DRAW_COMMANDS],
int dc_off[MAX_DRAW_COMMANDS],
int * draw_command_cnt,
DrawCommand * dcs,
MeshNodeSSBO * mn_data,
uint8_t * instance_ptr,
int current_frame_offset )

Definition at line 1732 of file render.c.

References Mesh::aabb, array_offset, DrawCommand::array_offset, arrays_indirect, DrawArraysIndirectCommand::baseInstance, DrawElementsIndirectCommand::baseInstance, DrawElementsIndirectCommand::baseVertex, CAST_VEC, AABB::center, MeshNodeDataGPU::center, MeshNode::command_id, DrawArraysIndirectCommand::count, DrawElementsIndirectCommand::count, MeshNodeDataGPU::count, current_frame, DrawCommand::element_offset, element_offset, elements_indirect, AABB::extents, MeshNodeDataGPU::extents, DrawArraysIndirectCommand::first, MeshNodeDataGPU::first, DrawElementsIndirectCommand::firstIndex, DrawCommand::fwd_shader, GLOBALS, DrawCommand::index_count, INDIRECT_ARRAYS_COMMAND_BUFFER, indirect_arrays_ptr, INDIRECT_ELEMENTS_COMMAND_BUFFER, indirect_elements_ptr, MeshNodeDataGPU::instance_count, DrawArraysIndirectCommand::instanceCount, DrawElementsIndirectCommand::instanceCount, DrawCommand::lm_offset, MeshNodeDataGPU::lm_offset, DrawCommand::material, MeshNodeDataGPU::material, MeshNodeDataGPU::max, MAX_DRAW_COMMANDS, MAX_INSTANCES, AABB::max_x, AABB::max_y, AABB::max_z, MeshNode::mesh_data_id, DrawCommand::mesh_id, MESH_NODE_SSBO, mesh_node_ssbo_ptr, mesh_node_ssbo_size, Globals::mesh_nodes, Globals::meshes, MeshNodeDataGPU::min, AABB::min_x, AABB::min_y, AABB::min_z, DrawCommand::mn_id, MeshNodeSSBO::mns, DrawCommand::skin_offset, MeshNode::skin_offset, DrawCommand::sm_id, DrawCommand::start_index, DrawCommand::static_mesh, Mesh::static_mesh, MeshNodeDataGPU::static_mesh, transform_count, upload_instance_data(), vec3::x, vec3::y, and vec3::z.

Referenced by render_to_cubemap_face(), and upload_instance_data().

◆ draw_arrays_elements()

void draw_arrays_elements ( ShaderProgram * s,
int start_arr,
size_t start_array_offset,
uint32_t array_count,
int start_ele,
size_t start_element_offset,
uint32_t element_count )

◆ write_point_light_shadows()

◆ upload_instances()

◆ render_all_draw_commands()

◆ determine_closest_rprobes()

◆ render_to_cubemap_face()

void render_to_cubemap_face ( Camera * rprobe_cam,
GLuint render_fbo,
int render_width,
int render_height,
bool probe_bake )

Uploads per-frame data to GPU and renders main render pass to a target FBO (omits Text, UI, and postprocessing that occurs after).

Parameters
rprobe_camThe Camera to upload for the CAM_UBO.
render_fboThe main target FBO.
render_widthThe width of the target FBO.
probe_bakeIf this is baking ReflectionProbes. This flag controls if ReflectionProbes are sampled so that there is no accumulation.
Note
This is used by the main pass and the ReflectionProbe cubemap rendering.

Definition at line 2278 of file render.c.

References mat3::a0, mat3::a1, mat3::a2, array_offset, DrawCommand::array_offset, OBBGPU::axis_x, OBBGPU::axis_y, OBBGPU::axis_z, mat3::b0, mat3::b1, mat3::b2, EditorSettings::BLOOM, BLOOM_DOWNSCALE_SHADER, BLOOM_PYRAMID, bloom_queries, BLOOM_SHADER, BLOOM_UPSCALE_SHADER, BOKEH_FBO, BOKEH_SHADER, BUFFER_FRAMES, mat3::c0, mat3::c1, mat3::c2, Camera::cam_data, CAM_UBO, cam_ubo_padded, cam_ubo_ptr, CAST_VEC, OBB::center, OBBGPU::center, COC_FBO, COC_SHADER, Vector::count, create_and_sort_draw_commands(), CULL_CLUSTERS_SHADER, CULL_DRAW_CALLS_SHADER, cull_queries, cur_history, current_frame, current_query_frame, DEPTH_DOWNSAMPLE_FBO, DEPTH_DOWNSAMPLE_SHADER, DEPTH_PRE_PASS_SHADER, DEPTH_PRE_PASS_SHADER_MSAA, Framebuffer::depth_texture, determine_closest_rprobes(), determine_light_visibility_per_mesh(), DIRECTIONAL_LIGHT_COUNT, EditorSettings::DOF, EditorSettings::DOF_focal_length, EditorSettings::DOF_fstop, DOF_HEIGHT, EditorSettings::DOF_max_blur_radius, dof_queries, EditorSettings::DOF_sensor_height, DOF_WIDTH, draw_arrays_elements(), draw_call_count, draw_command_count, draw_command_counts, draw_command_offsets, DRAW_COMMANDS, draw_dirty, EDITOR_SETTINGS, DrawCommand::element_offset, element_offset, ELEMENTS_PREFIX_SHADER, OBB::extents, OBBGPU::extents, Framebuffer::fbo, FOCAL_DISTANCE_SHADER, EditorSettings::FULL_GBUFFER, DrawCommand::fwd_shader, GALBEDO, GBUFFER_FBO, gbuffer_queries, GBUFFER_RESOLVE_FBO, DrawCommand::gbuffer_shader, get_view_planes(), GEXTRA, GLOBAL_INSTANCE_SSBO, GLOBALS, GNORMAL, GPOMDEPTH, GRID_X, GRID_Y, GRID_Z, GVEL, Framebuffer::h, GLTexture::i, INDIRECT_ARRAYS_COMMAND_BUFFER, INDIRECT_ARRAYS_COMMAND_BUFFER_OUT, INDIRECT_ELEMENTS_COMMAND_BUFFER, INDIRECT_ELEMENTS_COMMAND_BUFFER_OUT, INDIRECT_PREFIX_SHADER, instance_offset, INSTANCE_VBO, instance_vbo_ptr, JITTER_OFFSET, LIGHT_CAM, LIGHT_CAM_UBO, light_cam_ubo_padded, light_cam_ubo_ptr, SceneData::lighting_probe_volumes, Globals::lights, Globals::lights_dirty, OBBGPU::loaded, SceneData::LOADED_LIGHTING_PV, SceneData::LOADED_LIGHTING_PV_FLAG, Uniform::location, LPV_SLOTS, MAIN_EBO, MAIN_FBO, MAIN_RESOLVE_FBO, MAIN_VAO, MAIN_VBO, MAX_LIGHTS_PER_CLUSTER, mesh_node_data_gpu, Globals::mesh_nodes, Globals::meshes, EditorSettings::MSAA, ProbeVolume::obb, ProbeVolumeUBO::obb, DrawCommand::opaque, pl_queries, planes, probe_bake, PROBE_VOLUME_UBO, probe_volume_ubo_padded, probe_volume_ubo_ptr, ShaderProgram::program, CamData::proj, ShadowmapUBO::proj, LPV::pv_id, render_all_draw_commands(), RENDER_HEIGHT, render_queries, render_to_cubemap_face(), RENDER_WIDTH, OBB::rot, RPROBE_UBO, RPROBE_UBO_DATA, rprobe_ubo_padded, rprobe_ubo_ptr, Globals::scene_data, SHADOW_MAP_FBO, SHADOW_MAP_SHADER, SHADOWMAP_FRAME_DATA, SKY_SHADER, SKY_VAO, SKY_VBO, SKYBOX, sm_queries, EditorSettings::SSAO, SSAO_BLUR_FBO, SSAO_BLUR_SHADER, SSAO_FBO, SSAO_HEIGHT, SSAO_NOISE_TEXTURE, ssao_queries, SSAO_SHADER, SSAO_WIDTH, EditorSettings::SSR, SSR_FBO, SSR_HEIGHT, SSR_HISTORY_SHADER, ssr_queries, SSR_SHADER, SSR_WIDTH, DrawCommand::static_mesh, EditorSettings::TAA, TAA_FBO, taa_queries, Framebuffer::texture, time, time_since_last_render, transform_count, ShaderProgram::uniforms, update_scene_nodes(), update_skin_matrices(), upload_instance_data(), upload_instances(), upload_joint_matrices(), upload_lights(), CamData::view, ShadowmapUBO::view, VIEW_FAR, VIEW_NEAR, Framebuffer::w, write_point_light_shadows(), vec2::x, and vec2::y.

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

◆ find_depth()

int find_depth ( BVHNode * nodes,
BVHNode * node,
int depth )

Definition at line 2915 of file render.c.

References find_depth(), BVHNode::left, MAX, and BVHNode::right.

Referenced by find_depth(), and render_bvh().

◆ render_tree()

void render_tree ( BVHNode * nodes,
BVHNode * node,
mat4 tr,
DebugVertex * points,
int * count,
int depth,
int max_depth,
vec3 start_color,
vec3 end_color )

◆ render_bvh()

void render_bvh ( BVHNode * nodes,
int node_count,
mat4 tr )

Definition at line 2960 of file render.c.

References find_depth(), render_bvh(), render_tree(), and WIREFRAME_VBO.

Referenced by render_bvh().

◆ render_probe_volume()

◆ render()

void render ( )

The main render pass.

Calls render_to_cubemap_face() and then renders wireframes, text, ui, and postprocessing.

Definition at line 3057 of file render.c.

References ReflectionProbe::aabb, aabb_to_vertices(), EditorSettings::ACES, animation_length(), AUDIO_EMITTERS, EditorSettings::audio_menu_open, Globals::audio_portals, SceneData::audio_probe_volumes, EditorSettings::BLOOM, BLOOM_PYRAMID, BOKEH_FBO, BUFFER_FRAMES, SceneData::bvh_nodes, cam, ReflectionProbe::capture_pos, CAST_VEC, AABB::center, COC_FBO, DebugVertex::color, COLOR_GRADE_LUT, Vector::count, cur_history, current_frame, current_query_frame, DEBUG_LINE_COUNT, DEBUG_LINES, DEBUG_LINES_MAX, Framebuffer::depth_texture, EditorSettings::DOF, EditorSettings::DOF_focal_length, EditorSettings::DOF_fstop, EditorSettings::DOF_max_blur_radius, EditorSettings::DOF_sensor_height, EDITOR_APORTAL_SIZE, EDITOR_AUDIO_EMITTER_SIZE, EDITOR_LIGHT_SIZE, EDITOR_SETTINGS, AABB::extents, FBM_TEXTURE, Framebuffer::fbo, find_animation(), FONTS, frame_time, GBUFFER_RESOLVE_FBO, GLOBALS, GPU_upload_ui_elements(), GVEL, Framebuffer::h, HISTORY_TEXTURE, Mesh::hulls, GLTexture::i, Image::i, Globals::images, LightmapData::islands, Skeleton::left_hip_pos, SceneData::lighting_probe_volumes, SceneData::lightmap_data, Globals::lights, Uniform::location, EditorSettings::LUT, MAIN_FBO, main_queries, MAIN_RESOLVE_FBO, make_ortho(), master_frame, MAX_AUDIO_EMITTERS, MAX_UI_ELEMENTS, EditorSettings::MBLUR, Player::mesh, EditorSettings::mesh_node_menu_open, Globals::mesh_nodes, Globals::meshes, EditorSettings::MSAA, EditorSettings::NOISE, Skeleton::p_left, Skeleton::p_right, perm(), play_animation(), player, AudioEmitter::pos, AudioPortal::pos, DebugVertex::pos, Light::pos, POSTPROCESS_SHADER, PP_ACES, PP_BLOOM, PP_DOF, EditorSettings::pp_dview, PP_LUT, PP_MBLUR, PP_NOISE, PP_SHADER_VERSIONS, PPDVIEW_DEFAULT, ShaderProgram::program, Skeleton::q_left, Skeleton::q_right, SceneData::reflection_probes, render(), RENDER_FENCE, EditorSettings::render_framerate_target, RENDER_HEIGHT, render_probe_volume(), render_to_cubemap_face(), RENDER_WIDTH, Light::rgb, Skeleton::right_hip_pos, EditorSettings::rotation_axis, Globals::scene_data, SCREEN_HEIGHT, SCREEN_WIDTH, EditorSettings::selected_mn_id, Player::skeleton, SSR_FBO, EditorSettings::TAA, TAA_FBO, TEXT_EBO, TEXT_FBO, TEXT_INDEX_COUNT, TEXT_SHADER, TEXT_VAO, TEXT_VBO, Font::texture, Framebuffer::texture, LightmapData::texture_id, time, MeshNode::translation, ui_element_count, UI_SHADER, UI_VAO, ShaderProgram::uniforms, vec3_add(), vec3_sub(), Framebuffer::w, WIREFRAME_SHADER, EditorSettings::wireframe_toggled, WIREFRAME_VAO, and WIREFRAME_VBO.

Referenced by main(), and render().

Variable Documentation

◆ master_frame

int master_frame = 0

Definition at line 21 of file render.c.

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

◆ cur_history

int cur_history = 0

Definition at line 22 of file render.c.

Referenced by render(), and render_to_cubemap_face().

◆ current_frame

◆ meshes_in_frame

size_t meshes_in_frame[MAX_MESH_NODES]

Definition at line 26 of file render.c.

◆ meshes_this_frame

size_t meshes_this_frame

Definition at line 27 of file render.c.

◆ shadow_meshes_in_frame

size_t shadow_meshes_in_frame[MAX_MESH_NODES]

Definition at line 28 of file render.c.

◆ shadow_meshes_this_frame

size_t shadow_meshes_this_frame

Definition at line 29 of file render.c.

◆ vsize

size_t vsize = 0

Definition at line 340 of file render.c.

Referenced by add_mesh_to_buffer().

◆ visize

size_t visize = 0

Definition at line 341 of file render.c.

Referenced by add_mesh_to_buffer().

◆ GPU_LIGHTS

LightGPU GPU_LIGHTS[MAX_LIGHTS]

Definition at line 599 of file render.c.

Referenced by upload_lights().

◆ gpu_light_count

int gpu_light_count = 0

Definition at line 600 of file render.c.

Referenced by upload_lights().

◆ JOINT_MATS

mat4 JOINT_MATS[MAX_JOINT_MATRICES]

Definition at line 761 of file render.c.

Referenced by upload_joint_matrices().

◆ joint_mat_count

int joint_mat_count = 0

Definition at line 762 of file render.c.

Referenced by upload_joint_matrices().

◆ TB_GPU

Definition at line 1144 of file render.c.

Referenced by GPU_upload_singular_text_box(), and GPU_upload_ui_elements().

◆ angle_tr

float angle_tr = 0

Definition at line 1145 of file render.c.

◆ UI_GPU

◆ UI_UIDS

UIUIDPair UI_UIDS[MAX_UI_ELEMENTS] = {0}

Definition at line 1357 of file render.c.

Referenced by GPU_upload_singular_element(), and GPU_upload_ui_elements().

◆ UI_UID_OUT

uint32_t UI_UID_OUT[MAX_UI_ELEMENTS] = {0}

Definition at line 1358 of file render.c.

Referenced by GPU_upload_ui_elements().

◆ ui_element_count

int ui_element_count = 0

◆ container_ids

int* container_ids = NULL

Definition at line 1432 of file render.c.

Referenced by GPU_upload_ui_elements(), and upload_parent_container().

◆ container_ids_cap

size_t container_ids_cap = 0

Definition at line 1433 of file render.c.

Referenced by GPU_upload_ui_elements().

◆ instance_matrices

InstanceData instance_matrices[MAX_INSTANCES]

Definition at line 1709 of file render.c.

◆ draw_command_offsets

int draw_command_offsets[MAX_DRAW_COMMANDS]

Definition at line 1710 of file render.c.

Referenced by render_to_cubemap_face().

◆ draw_command_counts

int draw_command_counts[MAX_DRAW_COMMANDS]

Definition at line 1711 of file render.c.

Referenced by render_to_cubemap_face().

◆ draw_call_count

int draw_call_count = 0

Definition at line 1712 of file render.c.

Referenced by render_to_cubemap_face().

◆ instance_offset

int instance_offset = 0

Definition at line 1713 of file render.c.

Referenced by render_to_cubemap_face().

◆ shadow_instance_matrices

InstanceData shadow_instance_matrices[MAX_INSTANCES]

Definition at line 1715 of file render.c.

◆ shadow_draw_command_offsets

int shadow_draw_command_offsets[MAX_DRAW_COMMANDS]

Definition at line 1716 of file render.c.

◆ shadow_draw_command_counts

int shadow_draw_command_counts[MAX_DRAW_COMMANDS]

Definition at line 1717 of file render.c.

◆ shadow_draw_call_count

int shadow_draw_call_count = 0

Definition at line 1718 of file render.c.

◆ shadow_instance_offset

int shadow_instance_offset = 0

Definition at line 1719 of file render.c.

◆ mesh_node_data_gpu

MeshNodeSSBO mesh_node_data_gpu

Definition at line 1721 of file render.c.

Referenced by render_to_cubemap_face().

◆ arrays_indirect

Definition at line 1724 of file render.c.

Referenced by upload_instance_data().

◆ array_offset

int array_offset = 0

◆ elements_indirect

Definition at line 1726 of file render.c.

Referenced by upload_instance_data().

◆ element_offset

int element_offset = 0

◆ transforms

Definition at line 1728 of file render.c.

Referenced by upload_instances().

◆ transform_count

int transform_count = 0

◆ static_count

int static_count = 0

Definition at line 1730 of file render.c.

Referenced by upload_instances().

◆ dynamic_count

int dynamic_count = 0

Definition at line 1731 of file render.c.

Referenced by upload_instances().

◆ RPROBE_UBO_DATA

RProbeUBO RPROBE_UBO_DATA

Definition at line 2229 of file render.c.

Referenced by determine_closest_rprobes(), and render_to_cubemap_face().

◆ RPROBE_COUNT

int RPROBE_COUNT = 0

Definition at line 2230 of file render.c.

◆ SHADOWMAP_FRAME_DATA

ShadowmapUBO SHADOWMAP_FRAME_DATA

Definition at line 2276 of file render.c.

Referenced by render_to_cubemap_face().