Untitled
Loading...
Searching...
No Matches
Shader Structures

Avoids polluting main C namespaces. More...

Data Structures

struct  OBB
 Oriented Bounding Boxes. More...
struct  Light
 The CPU side structure for Lights. More...
struct  Material
 The Materials parsed in from scene files that determine rendering pipeline setup, uploads, and ordering. More...
struct  RProbe
 The structure for ReflectionProbes padded for the GPU. More...
struct  Cluster
 GPU-side Clusters for clustered forward. More...
struct  DrawArraysIndirectCommand
 DrawArraysIndirect commands are used for static meshes (eg. More...
struct  MeshNode
 MeshNodes that describe the position of Meshes, GLTF nodes for GLTFAnimations, or hold references to other MeshNodes. More...
struct  Transform
 Transforms for MeshNode models. More...

Detailed Description

Avoids polluting main C namespaces.


Data Structure Documentation

◆ OBB

struct OBB

Oriented Bounding Boxes.

Definition at line 13 of file dynamic.frag.

Data Fields
vec3 center
uint loaded
vec3 axis_x
uint pad1
vec3 axis_y
uint pad2
vec3 axis_z
uint pad3
vec3 extents
uint pad4
mat3 rot

◆ Light

struct Light

The CPU side structure for Lights.

GPU Lights.

See also
Globals.lights
LightGPU
upload_lights()
build_light_bvh()

Definition at line 1461 of file engine_types.h.

Data Fields
vec3 pos Position of light.
uint32_t entity_id Entity ID into ENTITIES.
vec3 dir Direction for lights that are not POINT_LIGHTs.
float cone_angle Cone angle for SPOT_LIGHTs.
vec3 rgb Color of the light.
float penumbra Penumbra (opening) for SPOT_LIGHTs.
float intensity The intensity of the Light.
LightType light_type The type of Light.
float inner_angle Starting angle for SPOT_LIGHTs.
float outer_angle Outer angle for SPOT_LIGHTs.
float radius The radius of the Light.

Computed via copy_light_to_gpu_light()

float threshold The threshold (how far a light reaches).
AABB area The physical area of AREA_LIGHTs.
bool sm_dirty If a point light needs a new shadowmap.
uint32_t layer Which layer a DIRECTIONAL_LIGHT corresponds to in the SHADOW_MAP_FBO.
int mesh The MeshNode this corresponds to.

Used when building light BVH in build_light_bvh().

int tri The MeshFace this corresponds to.

Used when building light BVH in build_light_bvh().

float lum The luminosity for importance sampling.
float power The power for importance sampling.
vec3 A
vec3 B
vec3 C
vec3 normal
float surface_area The surface area of the triangle.
uint entity_id
float outer_cos
vec3 color
float cos_diff
uint light_type
uint layer
uint mesh
uint tri
float area
uint bvh_index
uint dynamic
uint pad2
uint pad0
uint pad1

◆ Material

struct Material

The Materials parsed in from scene files that determine rendering pipeline setup, uploads, and ordering.

GPU-side Materials.

See also
MaterialGPU

Definition at line 12 of file audio_probe_bake.comp.

Data Fields
vec4 ambient
vec4 diffuse
vec4 specular
vec4 emissive
float absorption_coefficients[6] How much audio is absorbed when hitting this Material.
uint pad0
uint pad1
float scattering_coefficients[6] How much audio specularly reflects when hitting this Material.
uint pad2
uint pad3
sampler2D albedo_tex
sampler2D normal_tex
sampler2D arm_tex
sampler2D emissive_tex
float metallic
float roughness
float ao_strength
float normal_scale Unused - Used to determine how much of the texture normal to use.
uint alpha_mode
float alpha_cutoff Used to discard transparent Materials.
uint double_sided
float emissive_strength
char name[256] The Material path.
int fwd_shader The corresponding forward rendering shader branch in DYNAMIC_SHADER.
int gbuffer_shader The corresponding gbuffer rendering shader branch in DEPTH_PRE_PASS_SHADER or DEPTH_PRE_PASS_SHADER_MSAA.
vec4 ka Ambient.
vec4 kd Diffuse.
vec4 ks Specular (unused).
vec4 ke Emissive.
int diffuse_tex
int normal_tex
int emissive_tex
int arm_tex
int ao_tex
int mr_tex
AlphaMode alpha_mode Determines transparency.
bool double_sided If we should disable backface culling.
bool override_transparent If we are overriding transparency of this Material.
bool override_arm If we override the ARM texture and bind a dummy instead.

◆ RProbe

struct RProbe

The structure for ReflectionProbes padded for the GPU.

GPU-side ReflectionProbes.

Stores AABB bounds

See also
RPROBE_SSBO

Definition at line 1359 of file engine_types.h.

Data Fields
vec3 center
uint32_t pad0
vec3 min
uint32_t pad1
vec3 max
uint32_t pad2
uint pad0
uint pad1
uint pad2

◆ Cluster

struct Cluster

GPU-side Clusters for clustered forward.

Definition at line 87 of file cull_clusters.comp.

Data Fields
uint offset
uint count

◆ DrawArraysIndirectCommand

struct DrawArraysIndirectCommand

DrawArraysIndirect commands are used for static meshes (eg.

Indirect draw commands for GPU indirect.

those that can be lightmapped).

See also
https://registry.khronos.org/OpenGL-Refpages/gl4/html/glDrawArraysIndirect.xhtml

Definition at line 842 of file engine_types.h.

Data Fields
uint32_t count
uint32_t instanceCount
uint32_t first
uint32_t baseInstance
uint32_t instanceOffset This tracks how many offsets were pushed in a frame and is used in the prefix sum.
uint32_t pad0
uint count
uint instanceCount
uint first
uint baseInstance
uint instanceOffset
uint pad0

◆ MeshNode

struct MeshNode

MeshNodes that describe the position of Meshes, GLTF nodes for GLTFAnimations, or hold references to other MeshNodes.

GPU-side MeshNodes.

See also
Mesh
Entity
PhysicsComponent
GLTFSkin
Globals

Definition at line 85 of file audio_probe_bake.comp.

Data Fields
uint mesh_node_id
uint mesh_id
uint node_count
uint node_offset
uint vertex_offset
uint vertex_count
uint tri_offset
uint tri_count
uint bvh_index
uint is_static
uint skip_directional_light
uint pad2
mat4 global_matrix
mat4 inverse_global_matrix
char name[256] The name generated on loading from file.
bool active If the MeshNode can be effected.
bool free If the MeshNode can be replaced.
size_t id The ID inside of Globals.mesh_nodes.
size_t local_id The ID local to the original file structure.
vec3 translation
vec4 rotation
vec3 scale
mat4 local_matrix
int mesh The Mesh it references.
int asset The Asset it comes from.
int asset_instance The AssetInstance it belongs to.
int skin The GLTFSkin it controls.
uint32_t skin_offset The offset into the JOINT_SSBO, comes from DrawCommand.
int parent The parent to this node, a global index into Globals.mesh_nodes.
int children[128] The children to this node, a global index into Globals.mesh_nodes.
Todo
Remove this static array and replace it with a safer memory system for larger node graphs.
int child_count The amount of children.
bool static_mesh If this mesh is static (DrawArrays) or dynamic (DrawElements), used to indicate Lightmap status.
size_t offset Offset into the MAIN_VBO.
size_t count Count of vertices pushed into the MAIN_VBO.
size_t point_light_offset
size_t point_light_count
size_t directional_light_offset
size_t directional_light_count
size_t spot_light_offset
size_t spot_light_count
bool skip_directional_uv_lighting Skips directional Lights and rays go through them.

Not in use.

UVMapping * uv_map The mapping between MeshNodes and UVIslands for uv lightmapping.
uint32_t mesh_data_id[32]
uint32_t command_id[32]
Entity * ent The Entity this MeshNode refers to (all children point to the same Entity as parent).
CollisionType collision_type The type of collision to apply for the PhysicsComponent that may not have been created yet.
PhysicsType physics_mode The type of physics to apply for the PhysicsComponent that may not have been created yet.
PhysicsComponent * pc The physics controller initialized based on data from this MeshNode.
AABB aabb The AABB of the MeshNode and its children.
Note
This is used for PhysicsComponents on MeshNodes without Meshes.
vec4 min
vec4 max
vec4 center
vec4 extents
uint instance_count
uint static_mesh
uint lm_offset
uint material
uint first
uint count
uint pad0
uint pad1

◆ Transform

struct Transform

Transforms for MeshNode models.

Definition at line 71 of file cull_draw_calls.comp.

Data Fields
uint mn_id
uint command_id
uvec2 directional_lights
uvec2 spot_lights
uint skin_offset
uint material
mat4 mat
uint pad0