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

Engine specific types and defines. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <SDL2/SDL.h>
#include <GL/glew.h>
#include "SDL2/SDL_mutex.h"
#include "SDL2/SDL_thread.h"
#include "nk_config.h"
#include "nuklear/nuklear.h"
#include <omp.h>
#include "nuklear/nuklear_sdl_gl3.h"
#include "miniaudio/miniaudio.h"
#include <fftw3.h>
#include "uthash/uthash.h"
#include <stdatomic.h>
#include "utilities/types.h"

Go to the source code of this file.

Data Structures

struct  ReflectionProbe
 ReflectionProbes used for parallax corrected cubemaps. More...
struct  AudioProbeWeights
 Weights used for interpolating between audio probes. More...
struct  AudioPortal
 AudioPortals used for determining paths to transmit sound when emitter and listener are occluded. More...
struct  HRTFThreadData
 The data for the thread that prepares IRs by rotating then convolving them with an HRTF before it presents it to the audio thread. More...
struct  AudioScratchBuffers
 Scratch buffers and dimensions used for audio convolution FFTs. More...
struct  ConvolverNode
 The IR CONVOLVER_NODE used to process frames in the audio thread. More...
struct  AudioEmitter
 An AudioEmitter that plays audio possibily from a certain position or at a certain time. More...
struct  GLTexture
 Texture abstraction for init. More...
struct  GLRenderbuffer
 The abstraction for a renderbuffer in OpenGL. More...
struct  Framebuffer
 The abstraction for a framebuffer in OpenGL. More...
struct  EditorSettings
 Editor settings and engine global variables that can be changed through the editor. More...
struct  DrawArraysIndirectCommand
 DrawArraysIndirect commands are used for static meshes (eg. More...
struct  DrawElementsIndirectCommand
 DrawArraysIndirect commands are used for non-static meshes. More...
struct  GlobalInstanceGPU
 The global visibility buffer that holds all indices to instances per frame after they are pushed during culling. More...
struct  MeshNodeDataGPU
 MeshNode structure padded for GPU (MESH_NODE_SSBO). More...
struct  MeshNodeSSBO
 MeshNode buffer structure for MESH_NODE_SSBO. More...
struct  TransformGPU
 TransformGPU buffer structure for INSTANCE_SSBO. More...
struct  Filter
 Filters to be used for filtering out entities for triggers. More...
struct  Trigger
 Triggers that cause events or persisting effects. More...
struct  CollisionPoints
 Points that track collision data such as direction, penetration depth, and more to generate Manifolds and resolve impulses. More...
struct  Manifold
 Persistent Manifolds that track collisions and how to resolve them. More...
struct  ConvexHull
 Convex Hulls that are generated via incremental hull for non-static meshes. More...
struct  TriangleGroup
 Groups of contiguous triangles with the same plane that are combined via jarvis marching. More...
struct  BVHNode
 Nodes for the acceleration structures of BVHs. More...
struct  MainVertex
 Main rendering vertex. More...
struct  LightmapVertex
 The structure used when rasterizing lightmap data to a texture before baking. More...
struct  DebugVertex
 The structure used for debug wireframes. More...
struct  TextVertex
 The structure used for rendering TextBoxes. More...
struct  ShadowmapUBO
 The structure used for uploading matrices for directional Lights used when rendering shadowmaps. More...
struct  CamData
 The structure uploaded to the GPU for providing render data for a Camera. More...
struct  RenderData
 The structure uploaded to the GPU for providing the current resolution (fairly unused). More...
struct  Spring
 The spring used for determining Skeleton positions and eventually neck trajectory. More...
struct  LegIK
 The controller for leg IKs for Skeletons. More...
struct  Skeleton
 The controller for leg IKs for Skeletons. More...
struct  Camera
 The camera structure for players and entities. More...
struct  RProbe
 The structure for ReflectionProbes padded for the GPU. More...
struct  RProbeData
 The structure for RProbes sent to the GPU. More...
struct  Biquad
 Biquad filter. More...
struct  AudioProbe
 Baked IR samples loaded in from binary into APVs from ProbeVolumes. More...
struct  AudioProbeGPU
 Simply stores the positions for audio probes during the bake. More...
struct  AudioSampleGPU
 Each ray's samples when baking AudioProbes, padded for GPU. More...
struct  Light
 The CPU side structure for Lights. More...
struct  LightGPU
 The GPU side structure for Lights padded for GPU. More...
struct  ComboLabel
 The structure used for some dropdown abstractions in the Editor UI. More...
struct  Material
 The Materials parsed in from scene files that determine rendering pipeline setup, uploads, and ordering. More...
struct  MaterialGPU
 The GPU side padded structure for Materials. More...
struct  MaterialData
 The GPU side SSBO structure. More...
struct  VertexGPU
 The GPU side structure of a Point, used for path traced baking. More...
struct  VertexData
 The GPU side structure for the SSBO of Points. More...
struct  TriGPU
 The GPU side structure of a MeshFace, used for path traced baking. More...
struct  TriData
 The GPU side structure for the SSBO of MeshFaces. More...
struct  MeshGPU
 The GPU side structure of a Mesh, used for path traced baking. More...
struct  MeshData
 The GPU side structure for the SSBO of Meshs. More...
struct  AABBGPU
 The GPU side structure of an AABB, used for path traced baking. More...
struct  BVHNodeGPU
 The GPU side structure of a BVHNode, used for path traced baking. More...
struct  BVHGPU
 The GPU side structure for the SSBO of BVHNodes. More...
struct  SHDataGPU
 Used to store SH coefficients when baking LPVs into ProbeVolumes. More...
struct  OBBGPU
 GPU side structure for an OBB. More...
struct  ProbeVolumeUBO
 GPU side structure for an OBB UBO. More...
struct  RProbeUBO
 The UBO structure for pushing the closest ReflectionProbes to the main shader. More...
struct  RProbeUBO::Align16
struct  LightmapGPU
 The structure that stores lightmap uvs. More...
struct  LightmapSSBO
 The structure for the LIGHTMAP_SSBO. More...
struct  ClusterAABBGPU
 The structure for cluster AABBs for clustered shading. More...
struct  ClusterGPU
 The structure that we push clusters to when we cull them in clustered shading. More...
struct  LightmapAtlas
 The atlas that UVIslands are allocated on in LightmapRects during UV lightmapping. More...
struct  LightmapRect
 The rects that are slotted into thet LightmapAtlas during UV generation for UV lightmaps. More...
struct  UVIsland
 The UVIslands that are generated from contiguous MeshFaces with similar planes for UV lightmapping. More...
struct  LightmapData
 The metadata for the lightmap settings. More...
struct  UVMapping
 This bridges from MeshNode's MeshFaces to their respective UVIslands. More...
struct  CapsuleData
 The capsule data for collisions. More...
struct  HullData
 Hull data that refers to ConvexHulls of Meshes. More...
struct  CollisionData
 The tagged union for collision type, stored in PhysicsComponent. More...
struct  PhysicsComponent
 Entity Component used for physics resolution. More...
struct  AnimationKeyframe
 Tagged union for the value stored in a keyframe. More...
struct  AnimationTrack
 Tagged union for the value stored in a keyframe. More...
struct  AnimationComponent
 The animation component for interpolation between AnimationKeyframes. More...
struct  State
 Entity States that control what functions are available for an Entity. More...
struct  Entity
 Entity structure that holds components and references to the data it owns. More...
struct  MeshNode
 MeshNodes that describe the position of Meshes, GLTF nodes for GLTFAnimations, or hold references to other MeshNodes. More...
struct  SubMesh
 Sections of Meshes that are divided based on Material for batching and DrawCommand ordering purposes. More...
struct  TriangleAdjacency
 Adjacent triangles for each MeshFace on a Mesh. More...
struct  Mesh
 A Mesh with geometry data that is either initialized as static or dynamic and split into SubMeshes. More...
struct  Image
 Where Material textures are saved upon loading from file. More...
struct  GLTFMaterial
 The structure for Materials when loaded in from file. More...
struct  GLTFBuffer
 The raw bytes of a GLTF file. More...
struct  GLTFBufferView
 The views of a GLTF file. More...
struct  GLTFAccessor
 The accessors of a GLTF file. More...
struct  GLTFPrimitive
 The primitives of a GLTF file. More...
struct  GLTFMesh
 The Meshes of a GLTF file. More...
struct  AnimationSampler
 Engine-side sampler version of GLTFAnimationSampler with the field allocated. More...
struct  GLTFAnimationSampler
 The individual interpolation of an Animation. More...
struct  GLTFAnimationChannel
 The channels of an Animation. More...
struct  GLTFAnimation
 The GLTF structure of an Animation. More...
struct  Animation
 The structure of an Skeletatal Animation loaded in from GLTFAnimation. More...
struct  GLTFSkin
 The structure of an Skeletatal Animation loaded in from GLTFAnimation. More...
struct  GLTFTexture
 The GLTFTexture before it is processed. More...
struct  GLTFImage
 The Image before it is processed. More...
struct  GLTFSampler
 The sampler for the Image before it is processed. More...
struct  GLTFDoc
 The entire GLTF after it is parsed via load_gltf(). More...
struct  AssetInstance
 A instance of an Asset that retains its node structure but can be duplicated into multiple instances that are independent. More...
struct  Asset
 An Asset after it is loaded in from file into Globals.assets. More...
struct  InstanceData
 Simply the size we use to allocate the INSTANCE_VBO (unused). More...
struct  DrawCommand
 The structure used to sort unique submeshes by materials, and shaders in the main render pass. More...
struct  EPAWorkspace
 A workspace used for EPA during collision detection. More...
struct  OpenNode
 A node inside of the min_heap of an AStarWorkspace. More...
struct  AStarStateStack
 A running stack of nodes in a path that tracks where they came from so they can be retraced at the end. More...
struct  AStarWorkspace
 The workspace for conducting a-star pathfinding/. More...
struct  Player
 The Player. More...
struct  ProbeVolume
 The ProbeVolumes for APVs and LPVs, controlled by OBBs. More...
struct  APV
 A ProbeVolume for AudioProbes. More...
struct  LPV
 A ProbeVolume for indirect lighting probes. More...
struct  LightBVH
 The BVH for Lights. More...
struct  SceneData
 The data for the current scene. More...
struct  FileDirectoryRegistry
 Registry for folders that are used for dropdowns in the editor UI. More...
struct  MainEditorMenu
struct  LightEditorMenu
struct  LProbeEditorMenu
struct  AProbeEditorMenu
struct  UIElementEditorMenu
struct  AssetInstanceEditorMenu
struct  MeshNodeEditorMenu
struct  TextBoxEditorMenu
struct  Globals
 Global settings and structures for each system in the engine. More...
struct  Uniform
 OpenGL shader Uniforms. More...
struct  ShaderProgram
 OpenGL ShaderPrograms: vertex, fragment, geometry, and compute. More...
struct  VertexLayout
 An unused abstraction for VertexLayouts. More...

Macros

#define MAX_AUDIO_EMITTERS   1024
 The maximum amount of AudioEmitters.
#define MAX_AUDIO_EMITTERS_PER_ENTITY   24
 How many AudioEmitters an entity can have attached.
#define LPF_ORDER   2
 Used for miniaudio low pass filters.
#define PI   3.14159265358979323846
#define FOV   90
 FOV constant for player.
#define VIEW_NEAR   0.1
 Near plane for player.
#define VIEW_FAR   1000.0
 Far plane for player.
#define MAX_INTERP_APROBES   4
 Max AudioProbes that can be sampled at once.
#define SAMPLE_RATE   48000
 Audio sample rate.
#define IR_SAMPLE_RATE   48000
 Sample rate for baked audio IRs.
#define EDC_SAMPLE_RATE   48000
 EDC sample rate for schroeder integration.
#define SPEED_OF_SOUND   343.0f
 Speed of sound constant.
#define MAX_APROBE_SECONDS   1
 Longest amount of AudioProbe samples when baking.
#define MAX_IR_SAMPLES   (IR_SAMPLE_RATE * MAX_APROBE_SECONDS)
 Maximum IR sample length.
#define MAX_EDC_SAMPLES   (EDC_SAMPLE_RATE * MAX_APROBE_SECONDS)
 Maximum EDC sample length.
#define MAX_SAMPLES   (SAMPLE_RATE * MAX_APROBE_SECONDS)
 Max samples for runtime convolution.
#define AUDIO_PROBE_BINS   48000
 The amount of bins (to reduce max sample size).
#define AUDIO_KERNEL_SIZE   31
 Frequency kernel size for distributing samples during audio bake.
#define AUDIO_KERNEL_CENTER   15
 Center of the kernel for distributing samples during audio bake.
#define AUDIO_NUM_BANDS   6
 The amount of bands to use for audio probe baking.
#define NUM_PARTITIONS_MAX   96
 Amount of max partitions to be used for overlap-add for audio probes + 1 for the tail trick.
#define NUM_PARTITIONS   95
 Amount of max partitions to be used for overlap-add.
#define MAX_NUKLEAR_EVENTS   256
 Max amount of events to poll in one render step.
#define MAX_SDL_EVENTS   512
 Max amount of events to poll in one render step.
#define MAX_MESH_NODES   1024
 Maximum MeshNodes in a scene (used for SSBO sizing).
#define MAX_MESHES   512
 Maximum Meshes in a scene (used for SSBO sizing).
#define MAX_JOINT_MATRICES   512
 Maximum joints in a scene (used for SSBO sizing).
#define MAX_INSTANCES   1024
 Maximum amount of TransformGPU instances to push in one frame (used for SSBO sizing).
#define MAX_MATERIALS   256
 Maximum amount of Materials (used for SSBO sizing).
#define MAX_LIGHTS   1024
 Maximum amount of Lights to be pushed per frame (used for SSBO sizing).
#define MINIMUM_LIGHT_VISIBILITY_DIST   0.01
 Light visibility dist used for culling (only used for spot Lights(?) now).
#define MAX_LIGHTS_PER_MESH   4
 Max directional + spot Lights to push at one time for a Mesh.
#define MAX_DRAW_COMMANDS   512
 Maxmimum amount of draw commands to push to the gpu.
#define MAX_DIRECTIONAL_LIGHTS   4
 Maxmimum directional Lights at one time (used for shadowmap sizing).
#define MAX_ENTITY_STATES   256
 Maximim Entity states for behaviors.
#define DEFAULT_TEXTURES   5
 How many dummy default textures are on init.
#define MAX_UI_MENU_NAMES   128
 Used in editor to determine dropdown size.
#define PERFORMANCE_OVERLAY_TEXT_BOX_COUNT   13
 Offset of how many text boxes are used for the debug performance overlay.
#define BUFFER_FRAMES   3
 Triple buffer count.
#define UBERSHADER_VERSIONS   17
 Maxmimum main shader brances.
#define GBUFFER_VERSIONS   1
 Maxmimum gbuffer shader branches.
#define MAX_PLAYER_CONTACTS   10
 Maximum amount of CollisionPoints to consider per frame.
#define MAX_POINT_LIGHT_SHADOWS_CMA   16
 Maximum amount of point light shadows in texture depth.
#define SH_MAX   9
#define MAX_RPROBE_MIPS   1
 The amount of mips to allocate for rprobes.
#define MAX_RPROBES_PER_FRAME   4
 Max ReflectionProbes to push to UBOs per frame (for sizing).
#define SSAO_KERNEL_SIZE   16
 SSAO init kernel size.
#define ACCEL_BETA   0.005f
 Friction / air accel decay constant.
#define PARTITION_BUFFERS   4
 The amount of audio partition back buffers.
#define MAX_RPROBES   256
 The maximum amount of RProbes to send to the GPU at once.
#define MAX_TEX_LABELS   600
 The maximum amount of labels for a ComboLabel.
#define LABEL_LEN   256
 The maximum label length of labels in a ComboLabel.
#define MAX_KEYFRAMES   64
 Maximum AnimationKeyframes in an AnimationTrack.
#define MAX_TRACKS   64
 Maximum AnimationTracks in an AnimationComponent.
#define MAX_NODE_CHILDREN   128
 Maximum amount of direct MeshNode children to be stored in a MeshNode.
#define MAX_ANIMATION_INDICES   256
 The maximum amount of animation indices per GLTFSkin.
#define MAX_PORTALS   256
 The maximum amount of portals that are allocated to AStarWorkspace.path.
Editor Wireframe Sizes

Sizes of wireframes for various engine structures.

#define EDITOR_LIGHT_SIZE   0.5f
#define EDITOR_RPROBE_SIZE   0.5f
#define EDITOR_AUDIO_EMITTER_SIZE   0.5f
#define EDITOR_APROBE_SIZE   0.1f
#define EDITOR_APORTAL_SIZE   0.2f
Resolutions

Sizes of various textures.

#define LIGHTMAP_WIDTH   2048
#define LIGHTMAP_HEIGHT   2048
#define RPROBE_WIDTH   128
#define RPROBE_HEIGHT   128
#define DEFAULT_POINT_LIGHT_SHADOWS_SIZE   128
#define DEFAULT_SHADOW_MAP_SIZE   2048
#define FBM_TEXTURE_SIZE   128
Clustered shading

Sizes of cluster grid and constants.

#define GRID_X   16
#define GRID_Y   9
#define GRID_Z   24
#define TOTAL_CLUSTERS   (GRID_X * GRID_Y * GRID_Z)
#define MAX_LIGHTS_PER_CLUSTER   12
ProbeVolume Constants

ProbeVolume sizes, amounts, and dimensions.

Audio probes have the ability to have different dimensions, while lighting probe volumes are standardized here.

#define LPV_SLOTS   6
#define MAX_AUDIO_PROBE_VOLUMES   4
#define PROBE_VOLUME_WIDTH   12
#define PROBE_VOLUME_HEIGHT   12
#define PROBE_VOLUME_DEPTH   12
#define PROBE_VOLUME_DEPTH_PADDED   (PROBE_VOLUME_DEPTH + 2)
 Padding to avoid leaking on edges in Z.
#define LPV_COUNT   (PROBE_VOLUME_WIDTH * PROBE_VOLUME_HEIGHT * PROBE_VOLUME_DEPTH)
#define LPV_PADDED_COUNT   (PROBE_VOLUME_WIDTH * PROBE_VOLUME_HEIGHT * PROBE_VOLUME_DEPTH_PADDED)
EPAWorkspace Maximum Sizes

Sizes of statically sized arrays for EPA.

See also
physics/GJK.c
#define MAX_EPA_VERTICES   1024
#define MAX_EPA_FACES   1024
#define MAX_EPA_INDICES   1024
#define MAX_EPA_HORIZON_EDGES   1024
#define MAX_EPA_HORIZON_COUNTS   1024
#define MAX_EPA_VISIBLE_FACES_INDICES   1024

Typedefs

typedef fftwf_complex * PartitionTableChannel[95]
 Type for one FFT partiton for overlap-add.
typedef PartitionTableChannel PartitionTable[2]
 Type for two channels (stereo) for overlap-add.
typedef vec2 LightmapUV[3]
 The lightmap UVs stored on UVIslands per MeshFace.

Enumerations

enum  DebugView {
  DVIEW_DEFAULT , DVIEW_ALBEDO , DVIEW_ARM , DVIEW_EMISSIVE , DVIEW_AO , DVIEW_UV , DVIEW_POM_VDIR , DVIEW_CLUSTERS ,
  DVIEW_NORMAL , DVIEW_ORIGINAL_NORMAL , DVIEW_DIRECT , DVIEW_INDIRECT , DVIEW_LM_IRRADIANCE , DVIEW_LM_DIRECTIONAL , DVIEW_RPROBE , DVIEW_SPECULAR ,
  DVIEW_MAX
}
 Enum for debug views that are ubershader branches. More...
enum  PostprocessToggles { PP_MBLUR , PP_DOF , PP_BLOOM , PP_NOISE , PP_ACES , PP_LUT , PP_MAX }
 Postprocess options. More...
enum  PostprocessDView { PPDVIEW_DEFAULT , PPDVIEW_DEPTH , PPDVIEW_VEL , PPDVIEW_BOKEH , PPDVIEW_LM , PPDVIEW_MAX }
 Postprocess debug view shader branches. More...
enum  FullscreenOptions { FSOPT_FULLSCREEN , FSOPT_BORDERLESS , FSOPT_WINDOWED , FSOPT_MAX }
 Fullscreen options. More...
enum  MSAASampleOptions { MSAA_2 , MSAA_4 , MSAA_8 , MSAA_16 , MSAA_SAMPLE_OPTIONS_MAX }
 MSAA options handled in render_main_menu(). More...
enum  GBufferTextureNames { GVEL , GUV , GNORMAL , GPOMDEPTH , GALBEDO , GEXTRA }
 Gbuffer textures. More...
enum  DepthMode { DEPTH_MODE_NONE , DEPTH_MODE_NO_HW , DEPTH_MODE_HW }
 The depth modes for initializing depth textures. More...
enum  SelectionMode {
  SELMODE_MN , SELMODE_LIGHT , SELMODE_LPV , SELMODE_RPROBE , SELMODE_ENTITY , SELMODE_TEXTBOX , SELMODE_UIELEMENT , SELMODE_APV ,
  SELMODE_APORTAL , SELMODE_AEM , SELMODE_ASSETINSTANCE
}
 The selection mode for the editor. More...
enum  MenuNames {
  MENU_MAIN , MENU_MN , MENU_MATERIAL , MENU_LIGHT , MENU_ENT , MENU_TEXT , MENU_UI , MENU_AUDIO ,
  MENU_LPROBE , MENU_AINST , MENU_MAX
}
 The Editor menu names rendered in editor/editor.c. More...
enum  TriggerType { TRIGGER_NONE , TRIGGER_ONESHOT , TRIGGER_CONTINUOUS }
 Types of Triggers. More...
enum  PerformanceQueryTypes {
  PQUERY_CULL , PQUERY_PL , PQUERY_SM , PQUERY_GBUFFER , PQUERY_DOF , PQUERY_SSAO , PQUERY_TAA , PQUERY_SSR ,
  PQUERY_BLOOM , PQUERY_RENDER , PQUERY_MAIN , PQUERY_MAX
}
 Performance query types used to profile the render loop. More...
enum  LightType : uint32_t { POINT_LIGHT , DIRECTIONAL_LIGHT , SPOT_LIGHT , AREA_LIGHT , MAX_LIGHT_TYPES }
 Enum for types of Lights. More...
enum  AlphaMode { ALPHA_OPAQUE , ALPHA_MASK , ALPHA_BLEND }
 Alpha mode to determine Material blending. More...
enum  CollisionType { COL_TRIANGLE , COL_HULL , COL_CAPSULE }
 Defines collision types with different behaviors and mesh setup and validation. More...
enum  PhysicsType { PHYSICS_NONE , PHYSICS_FULL , PHYSICS_NO_ROT , PHYSICS_GRAVITY_ONLY }
 Defines physics types with different behaviors in impulse resolution. More...
enum  AnimationTargetType { ANIM_TARGET_FLOAT , ANIM_TARGET_VEC3 , ANIM_TARGET_INT , ANIM_TARGET_BOOL , ANIM_TARGET_MAX }
 Animation targets based on type to cast. More...
enum  AnimationDataType {
  ANIM_DATA_MN , ANIM_DATA_MESH , ANIM_DATA_AC , ANIM_DATA_PC , ANIM_DATA_ENT , ANIM_DATA_LIGHT , ANIM_DATA_ASSET_INSTANCE , ANIM_DATA_ASSET ,
  ANIM_DATA_RPROBE , ANIM_DATA_MAX
}
 Indicates what type of structure the animation is targeting. More...
enum  EntityType { ENTITY_NONE , ENTITY_TRIGGER , ENTITY_FILTER }
 Types of Entity used for Filters. More...
enum  StateType {
  ESTATE_NONE , ESTATE_PLAYER_INTERACT , ESTATE_COMBAT , ESTATE_TRIGGER , ESTATE_IDLE , ESTATE_DAMAGED , ESTATE_KILLED , ESTATE_DISABLED ,
  ESTATE_MAX
}
 Entity States that change behaviors and available reactions to Triggers. More...
enum  AnimationInterpolation { LINEAR , STEP , CUBICSPLINE }
 Types of Animation interpolation. More...
enum  AnimationPath { TARGET_TRANSLATION , TARGET_ROTATION , TARGET_SCALE , TARGET_WEIGHTS }
 What an GLTFAnimationChannel is targeting. More...

Variables

const float AUDIO_BAND_FREQ [] = {125.0f, 250.0f, 500.0f, 1000.0f, 2000.0f, 4000.0f}
 Audio frequencies for each band for audio probe baking.
const char * DVIEW_NAMES []
 Debug view names used for choosing a debug view.
const char * PPDVIEW_NAMES []
 Postprocess debug view names used for choosing.
const char * FULLSCREEN_OPTION_NAMES []
 Fullscreen option names.
const ivec3 DEFAULT_APV_RES = {6, 6, 6}
 When APVs are spawned, they use this.
const ivec3 DEFAULT_LPV_RES = { 12 , 12 , 12 }
 What LPVs should always be at to match texture dimensions.
Globals GLOBALS
 Engine Globals.
Camera cam
 The Camera attached to the Player.
Camera LIGHT_CAM [4]
 DIRECTIONAL_LIGHT Cameras for shadowmaps

Detailed Description

Engine specific types and defines.

Definition in file engine_types.h.


Data Structure Documentation

◆ ReflectionProbe

struct ReflectionProbe

ReflectionProbes used for parallax corrected cubemaps.

Remarks
Located in Globals.scene_data.reflection_probes
See also
GLOBALS
RPROBE_CUBE_MAP_ARRAY
RPROBE_UBO

Definition at line 354 of file engine_types.h.

Data Fields
AABB aabb Bounding box of area.
vec3 fade_margin The margin to fade between this probe and another.
vec3 capture_pos The position to capture the cubemap from.
int cubemap_idx Which cubemap this is linked to.

◆ GLTexture

struct GLTexture

Texture abstraction for init.

Each field corresponds to an OpenGL equivalent.

See also
generate_gl_texture()
init_gl_texture()

Definition at line 575 of file engine_types.h.

Data Fields
GLint min_filter
GLint mag_filter
GLint wrap_s
GLint wrap_t
GLint wrap_r
GLint internal_format
GLenum format
GLenum type
GLenum target
GLsizei w
GLsizei h
GLsizei d
GLsizei levels
vec4 border_color
GLuint i The image handle for this texture.
DepthMode dm If this is a depth texture and what mode it is.
bool multisampled If this is a multisampled texture.
int samples If multisampled, how many samples.
bool fixed_sample_locations This is set to true if multisampled and is standard for MSAA.

◆ GLRenderbuffer

struct GLRenderbuffer

The abstraction for a renderbuffer in OpenGL.

Mainly used for multisampled contexts.

See also
init_fbo()

Definition at line 602 of file engine_types.h.

Data Fields
GLuint i
GLint internal_format
GLsizei w
GLsizei h
GLsizei d
bool multisampled
int samples

◆ Framebuffer

struct Framebuffer

The abstraction for a framebuffer in OpenGL.

See also
init_fbo()

Definition at line 618 of file engine_types.h.

Data Fields
int texture_count The amount of GLTextures bound.
int rbo_count The amount of GLRenderbuffers bound.
GLuint fbo The handle for this fbo.
GLTexture texture[6] The textures bound to this fbo.
GLRenderbuffer renderbuffers[6] The renderbuffers bound to this fbo.
GLTexture depth_texture The normal depth texture, if there is one.
GLRenderbuffer depth_rbo The renderbuffer depth texture, if there is one.
int w
int h Dimensions.

◆ DrawElementsIndirectCommand

struct DrawElementsIndirectCommand

DrawArraysIndirect commands are used for non-static meshes.

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

Definition at line 857 of file engine_types.h.

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

◆ GlobalInstanceGPU

struct GlobalInstanceGPU

The global visibility buffer that holds all indices to instances per frame after they are pushed during culling.

See also
GLOBAL_INSTANCE_SSBO
render/cull_draw_calls.comp

Definition at line 873 of file engine_types.h.

Data Fields
uint32_t visibility[512 *1024]

◆ MeshNodeDataGPU

struct MeshNodeDataGPU

MeshNode structure padded for GPU (MESH_NODE_SSBO).

See also
MESH_NODE_SSBO
render/dynamic.vert

Definition at line 884 of file engine_types.h.

Data Fields
vec4 min
vec4 max
vec4 center
vec4 extents
uint32_t instance_count Used to be used to find the instance being rendered, but now that's on the transform data itself.
uint32_t static_mesh
uint32_t lm_offset The lightmap offset into LIGHTMAP_SSBO where this mesh node starts.
uint32_t material
uint32_t first
uint32_t count
uint32_t pad0
uint32_t pad1

◆ MeshNodeSSBO

struct MeshNodeSSBO

MeshNode buffer structure for MESH_NODE_SSBO.

See also
MESH_NODE_SSBO

Definition at line 913 of file engine_types.h.

Data Fields
float focal_distance The current focal distance found via compute shader, transported via this ssbo to coc.
uint32_t pad0
uint32_t pad1
uint32_t pad2
MeshNodeDataGPU mns[1024]

◆ TransformGPU

struct TransformGPU

TransformGPU buffer structure for INSTANCE_SSBO.

Triple buffered and submitted into each frame for each mesh node.

See also
INSTANCE_SSBO

Definition at line 926 of file engine_types.h.

Data Fields
uint32_t mn_id The MeshNode this belongs to.
uint32_t command_id The DrawCommand this refers to.
uvec2 directional_lights Directional Lights count and offset.
uvec2 spot_lights Spot Lights count and offset.
uint32_t skin_offset The GLTFSkin matrix offset for this transform.
uint32_t material The Material ID for this submesh.
mat4 tr The Transform's matrix.

◆ Filter

struct Filter

Filters to be used for filtering out entities for triggers.

Definition at line 944 of file engine_types.h.

Data Fields
void * val
size_t byte_size
bool(*) fn(void *, Filter *)

◆ Trigger

struct Trigger

Triggers that cause events or persisting effects.

Definition at line 968 of file engine_types.h.

Data Fields
TriggerType type
OBB obb
void(*) fn(void *)

◆ BVHNode

struct BVHNode

Nodes for the acceleration structures of BVHs.

See also
Scene MeshNode BVH: Globals.scene_data.bvh_nodes
Light BVH: Globals.scene_data.light_bvh.nodes
Mesh MeshFace BVH: Mesh.nodes
core/acceleration.c

Definition at line 125 of file audio_probe_bake.comp.

Data Fields
int left Left child.

-1 if empty.

int right Right child.

-1 if empty.

int parent Parent.

-1 if empty.

int index The index of the node inside of the array.
int first_index
int count
int next The pointer to the next node (either right child or parent's right child) for recursion-less traversal.

See: assign_next_nodes().

uint pad0
vec3 min
uint pad1
vec3 max
uint pad2
vec3 center
uint pad3
vec3 extents
uint pad4
AABB aabb The bounding box of all of this node's children.
size_t first_index The first index into the bvh_indices array.
size_t count How many children are inside this node.
float flux The total light flux of this node.

Used for Light BVH importance sampling.

float emissive_flux The only-emissive flux.

Used for Light BVH importance sampling.

◆ MainVertex

struct MainVertex

Main rendering vertex.

See also
MAIN_VBO
render/dynamic.vert

Definition at line 1169 of file engine_types.h.

Data Fields
vec3 pos The position.
vec3 normal The normal.
vec4 tangent The tangent for TBN construction.

This is supplied by GLTF.

ivec4 joint_indices The indices for each joint matrix (skeletal animations).
vec4 weights The weights each joint is multiplied by.
vec2 uv The texture coordinates.

◆ LightmapVertex

struct LightmapVertex

The structure used when rasterizing lightmap data to a texture before baking.

See also
bake_lightmap()

Definition at line 1185 of file engine_types.h.

Data Fields
vec3 pos The position.
vec3 normal The normal.
vec2 uv The texture coordinates for the actual face's GLTexture.
vec2 lm_uv The texture coordinates for the LightmapAtlas.
int material_id The Material this belongs to.
int tri_id The ID of the MeshFace.

◆ DebugVertex

struct DebugVertex

The structure used for debug wireframes.

See also
WIREFRAME_VBO

Definition at line 1202 of file engine_types.h.

Data Fields
vec3 pos
vec3 color

◆ TextVertex

struct TextVertex

The structure used for rendering TextBoxes.

See also
bake_lightmap()

Definition at line 1213 of file engine_types.h.

Data Fields
vec2 pos The position.
vec2 uv The Font atlas coordinates.
vec2 center The center of the TextBox before transform (should be 0,0 if justified center).
vec4 color The color of the text.
vec4 fill The fill color for the TextBox.
uint32_t state The current UIState.
uint32_t uID The ID in the TEXT_BOX_SSBO.

◆ ShadowmapUBO

struct ShadowmapUBO

The structure used for uploading matrices for directional Lights used when rendering shadowmaps.

See also
LIGHT_CAM_UBO

Definition at line 1230 of file engine_types.h.

Data Fields
mat4 proj[4]
mat4 view[4]

◆ CamData

struct CamData

The structure uploaded to the GPU for providing render data for a Camera.

See also
CAM_UBO

Definition at line 1242 of file engine_types.h.

Data Fields
vec4 cam_pos The position of the Camera (padded).
vec4 cam_vel The velocity of the Camera (padded).
mat4 proj The projection matrix.
mat4 unjittered_proj The projection matrix without TAA jittering.
mat4 view The view matrix.
mat4 inv_proj The inverse projection matrix.
mat4 unjittered_inv_proj The inverse projection matrix without TAA jittering.
mat4 inv_view The inverse view matrix.

◆ RenderData

struct RenderData

The structure uploaded to the GPU for providing the current resolution (fairly unused).

See also
RENDER_UBO

Definition at line 1258 of file engine_types.h.

Data Fields
ivec4 resolution

◆ Spring

struct Spring

The spring used for determining Skeleton positions and eventually neck trajectory.

See also
update_skeleton()

Definition at line 1268 of file engine_types.h.

Data Fields
float stiff Stiffness.
float damp Dampening.
vec3 velocity Velocity of this spring.
vec3 pos Position of the spring.
vec3 target Where the spring wants to move to based on Skeleton positions, before velocity is integrated.
float stiff_rot Stiffness for rotation.
float damp_rot Dampening for rotation.
vec3 rotation Current rotation of the spring.
vec3 angular_vel Current velocity for the rotation.
vec3 target_rot Where the spring is facing based on Skeleton positions.

◆ LegIK

struct LegIK

The controller for leg IKs for Skeletons.

See also
update_skeleton()
move_foot()
update_body_from_legs()

Definition at line 1290 of file engine_types.h.

Data Fields
bool stepping If the leg is currently stepping.
bool stepping_off_ledge If the leg is over air.
vec3 pos Position of the foot.
vec3 start_pos Starting position of the foot.
vec3 target_pos Target position for the current step.
float duration The duration of the entire step.
float time The current time to linearly interpolate between start and target pos.

◆ Skeleton

struct Skeleton

The controller for leg IKs for Skeletons.

See also
update_skeleton()
move_foot()
update_body_from_legs()

Definition at line 1309 of file engine_types.h.

Data Fields
float pelvis_height Height from ground to pelvis.
float hip_height Height from ground to hip.
float neck_height Height from ground to neck.
float pelvis_hip_diff Height from pelvis to hip.
float neck_pelvis_diff Height from pelvis to neck.
float upper_leg_length Upper leg length.
float lower_leg_length Lower leg length.
vec3 q_left The current knee position for left leg.
vec3 q_right The current knee position for right leg.
vec3 p_left The current left foot position.
vec3 p_right The current right foot position.
vec3 left_hip_pos The left hip pos, offset by left_leg_offset.
vec3 right_hip_pos The right hip pos, offset by right_leg_offset.
Spring pelvis Pelvis Spring (target based on leg positions).
Spring neck Neck Spring (target based on pelvis).
LegIK left_leg Left leg.
LegIK right_leg Right leg.

◆ Camera

struct Camera

The camera structure for players and entities.

See also
cam
Player
update_camera()

Definition at line 1346 of file engine_types.h.

Data Fields
vec3 forward
vec3 right
vec3 up
vec3 dir
vec3 target
float yaw
float pitch
float roll
CamData cam_data
bool on_ground If the camera is on the ground.

Used in resolve_collisions().

◆ RProbeData

struct RProbeData

The structure for RProbes sent to the GPU.

See also
RPROBE_SSBO

Definition at line 1375 of file engine_types.h.

Data Fields
RProbe probes[256]

◆ Biquad

struct Biquad

Biquad filter.

Used for audio probe baking.

See also
process_biquad()

Definition at line 1387 of file engine_types.h.

Data Fields
float b0
float b1
float b2
float a0
float a1
float a2
float x1
float x2
float y1
float y2

◆ LightGPU

struct LightGPU

The GPU side structure for Lights padded for GPU.

See also
Globals.lights
LIGHT_SSBO
upload_lights()
copy_light_to_gpu_light()

Definition at line 1513 of file engine_types.h.

Data Fields
vec3 pos
uint32_t entity_id
vec3 dir
float outer_cos Precomputed when uploading to the GPU for SPOT_LIGHTs.
vec3 rgb
float cos_diff Precomputed when uploading to the GPU for SPOT_LIGHTs.
float intensity
LightType light_type
float inner_angle
float outer_angle
float radius
uint32_t layer
uint32_t mesh
uint32_t tri
float area
uint32_t bvh_index
uint32_t pad1
uint32_t pad2

◆ MaterialGPU

struct MaterialGPU

The GPU side padded structure for Materials.

See also
Material
MATERIAL_SSBO

Definition at line 1627 of file engine_types.h.

Data Fields
vec4 ambient
vec4 diffuse
vec4 specular
vec4 emissive
float absorption_coefficients[6]
uint32_t pad0
uint32_t pad1
float scattering_coefficients[6]
uint32_t pad2
uint32_t pad3
uint64_t albedo_handle
uint64_t normal_handle
uint64_t arm_handle
uint64_t emissive_handle
float metallic
float roughness
float ao_strength
float normal_scale
uint32_t alpha_mode
float alpha_cutoff
uint32_t double_sided
float emissive_strength

◆ MaterialData

struct MaterialData

The GPU side SSBO structure.

See also
Material
MaterialGPU
MATERIAL_SSBO

Definition at line 1669 of file engine_types.h.

Data Fields
MaterialGPU materials[256]

◆ VertexGPU

struct VertexGPU

The GPU side structure of a Point, used for path traced baking.

See also
Point
VERTEX_SSBO

Definition at line 1681 of file engine_types.h.

Data Fields
vec3 pos
uint32_t pad0
vec3 normal
uint32_t pad1
vec2 uv
uint32_t pad2
uint32_t pad3

◆ VertexData

struct VertexData

The GPU side structure for the SSBO of Points.

See also
Point
VERTEX_SSBO

Definition at line 1699 of file engine_types.h.

Data Fields
VertexGPU * vertices

◆ TriGPU

struct TriGPU

The GPU side structure of a MeshFace, used for path traced baking.

See also
MeshFace
TRI_SSBO

Definition at line 1711 of file engine_types.h.

Data Fields
uvec3 indices Unused - the indices of each point.
uint32_t material_id
vec3 normal
uint32_t mesh_id The Mesh id.
uint32_t bvh_index Global: The bvh index + the offset for the current Mesh.
uint32_t tri_idx Local: The bvh index for this MeshFace.
uint32_t pad1
uint32_t pad2
VertexGPU v0
VertexGPU v1
VertexGPU v2

◆ TriData

struct TriData

The GPU side structure for the SSBO of MeshFaces.

See also
MeshFace
TRI_SSBO

Definition at line 1740 of file engine_types.h.

Data Fields
TriGPU * tris

◆ MeshGPU

struct MeshGPU

The GPU side structure of a Mesh, used for path traced baking.

See also
Mesh
MESH_SSBO

Definition at line 1752 of file engine_types.h.

Data Fields
uint32_t mesh_node_id
uint32_t mesh_id
uint32_t node_offset Where the BVHNodes start in the SSBO.
uint32_t node_count How many BVHNodes are in this Mesh.
uint32_t vertex_offset Where the VertexGPUs for this Mesh start in the SSBO.
uint32_t vertex_count How many VertexGPUs this Mesh has.
uint32_t tri_offset Where the TriGPUs for this Mesh start in the SSBO.
uint32_t tri_count How many TriGPUs there are for this Mesh.
uint32_t bvh_index The BVH index for this Mesh in the scene BVH.
uint32_t is_static If the mesh is not static it is not considered for path tracing.
uint32_t skip_directional_light Skip directional lights so that they go through this Mesh.
uint32_t pad2
mat4 global_matrix
mat4 inverse_global_matrix

◆ MeshData

struct MeshData

The GPU side structure for the SSBO of Meshs.

See also
Mesh
MESH_SSBO

Definition at line 1779 of file engine_types.h.

Data Fields
MeshGPU * meshes

◆ AABBGPU

struct AABBGPU

The GPU side structure of an AABB, used for path traced baking.

Definition at line 1789 of file engine_types.h.

Data Fields
vec3 min
uint32_t pad0
vec3 max
uint32_t pad1
vec3 center
uint32_t pad2
vec3 extents
uint32_t pad3

◆ BVHNodeGPU

struct BVHNodeGPU

The GPU side structure of a BVHNode, used for path traced baking.

See also
MESH_BVH_SSBO
SCENE_BVH_SSBO

Definition at line 1808 of file engine_types.h.

Data Fields
int32_t left
int32_t right
int32_t parent
int32_t index
int32_t first_index
int32_t count
int32_t next
float flux
vec3 min
float emissive_flux
vec3 max
uint32_t pad2
vec3 center
uint32_t pad3
vec3 extents
uint32_t pad4

◆ BVHGPU

struct BVHGPU

The GPU side structure for the SSBO of BVHNodes.

See also
MESH_BVH_SSBO
SCENE_BVH_SSBO

Definition at line 1837 of file engine_types.h.

Data Fields
BVHNodeGPU * nodes

◆ SHDataGPU

struct SHDataGPU

Used to store SH coefficients when baking LPVs into ProbeVolumes.

See also
bake_lighting_probe_volume()

Definition at line 1848 of file engine_types.h.

Data Fields
vec3 pos
uint32_t pad0
vec4 coefficients[9]

◆ OBBGPU

struct OBBGPU

GPU side structure for an OBB.

Used for LPV sampling.

See also
render/dynamic.vert

Definition at line 1859 of file engine_types.h.

Data Fields
vec3 center
uint32_t loaded
vec3 axis_x
uint32_t pad1
vec3 axis_y
uint32_t pad2
vec3 axis_z
uint32_t pad3
vec3 extents
uint32_t pad4

◆ ProbeVolumeUBO

struct ProbeVolumeUBO

GPU side structure for an OBB UBO.

Used for LPV sampling.

See also
PROBE_VOLUME_UBO
render/dynamic.vert

Definition at line 1880 of file engine_types.h.

Data Fields
OBBGPU obb[6]

◆ RProbeUBO

struct RProbeUBO

The UBO structure for pushing the closest ReflectionProbes to the main shader.

See also
RPROBE_UBO
render/dynamic.vert

Definition at line 1892 of file engine_types.h.

Data Fields
struct Align16 probe_indices[4]
uint32_t probe_count
uint32_t pad0
uint32_t pad1
uint32_t pad2

◆ RProbeUBO::Align16

struct RProbeUBO::Align16

Definition at line 1895 of file engine_types.h.

Data Fields
uint32_t val
uint32_t padding[3]

◆ LightmapGPU

struct LightmapGPU

The structure that stores lightmap uvs.

See also
LIGHTMAP_SSBO
add_all_meshes_to_buffer()

Definition at line 1914 of file engine_types.h.

Data Fields
vec4 uv

◆ LightmapSSBO

struct LightmapSSBO

The structure for the LIGHTMAP_SSBO.

See also
add_all_meshes_to_buffer()

Definition at line 1923 of file engine_types.h.

Data Fields
LightmapGPU * uvs

◆ ClusterAABBGPU

struct ClusterAABBGPU

The structure for cluster AABBs for clustered shading.

See also
CLUSTER_SSBO
render/init_cluster_aabbs.comp

Definition at line 1935 of file engine_types.h.

Data Fields
vec4 min
vec4 max

◆ ClusterGPU

struct ClusterGPU

The structure that we push clusters to when we cull them in clustered shading.

See also
CLUSTER_SSBO
render/cull_clusters.comp

Definition at line 1948 of file engine_types.h.

Data Fields
uint32_t offset
uint32_t count

◆ LightmapAtlas

struct LightmapAtlas

The atlas that UVIslands are allocated on in LightmapRects during UV lightmapping.

See also
SceneData.LightmapData
init_lightmap_atlas()
allocate_lightmap_rect()

Definition at line 1961 of file engine_types.h.

Data Fields
int width Width of the atlas.
int height Height of the atlas.
int block_size How much to allocate in one rect.
unsigned char * occupied The map of what is currently occupied by LightmapRects.

◆ LightmapRect

struct LightmapRect

The rects that are slotted into thet LightmapAtlas during UV generation for UV lightmaps.

See also
SceneData.LightmapData
init_lightmap_atlas()
allocate_lightmap_rect()

Definition at line 1976 of file engine_types.h.

Data Fields
int u The width of the rect in UV space.
int v The height of the rect in UV space.
int w The width of the rect in pixels.
int h The height of the rect in piexles.
int padding How much padding to avoid light leaking.
int success If the rect was allocated.

◆ UVIsland

struct UVIsland

The UVIslands that are generated from contiguous MeshFaces with similar planes for UV lightmapping.

See also
LightmapData.islands
assign_uvs()
build_uv_islands()

Definition at line 2000 of file engine_types.h.

Data Fields
int mesh_node The MeshNode this island belongs to.
Vector tris size_t indices of the MeshFaces in this island.
vec3 normal The normal of the island.
LightmapRect rect The rect that this island allocates.
LightmapUV * uvs The uvs for each MeshFace on this islands.
bool currently_rasterizing If we are going to rasterize this island on the next lightmap bake.
bool valid If this island is valid to rasterize.
vec3 centroid The centroid of the MeshFaces on this island.

◆ LightmapData

struct LightmapData

The metadata for the lightmap settings.

See also
Globals.scene_data
assign_uvs()
build_uv_islands()
init_lightmap_data()

Definition at line 2021 of file engine_types.h.

Data Fields
Vector islands The UVIslands on the current lightmap.
LightmapAtlas atlas The atlas settings for the lightmap.
GLuint texture_id The texture ID for the current lightmap.
bool sample_cubemap Unused - was used to toggle skybox sampling.

◆ UVMapping

struct UVMapping

This bridges from MeshNode's MeshFaces to their respective UVIslands.

Used when uploading vertices to the GPU.

See also
MeshNode
assign_uvs()
build_uv_islands()
add_all_meshes_to_buffer()

Definition at line 2039 of file engine_types.h.

Data Fields
size_t uv_island What island inside of LightmapData.islands that this MeshFace refers to.
size_t uv_idx The UV slot on the UVIsland.
bool valid If this mapping is valid.

◆ AnimationKeyframe

struct AnimationKeyframe

Tagged union for the value stored in a keyframe.

See also
core/animation.c
AnimationTrack
AnimationComponent

Definition at line 2216 of file engine_types.h.

Data Fields
float time
union val

◆ AnimationTrack

struct AnimationTrack

Tagged union for the value stored in a keyframe.

See also
core/animation.c
AnimationComponent

Definition at line 2236 of file engine_types.h.

Data Fields
AnimationTargetType type The type of the data stored on AnimationKeyframe.
AnimationKeyframe kf[64] The AnimationKeyframes for this track.
int kf_count The amount of AnimationKeyframes.
float current_time How long the animation has been running.
float duration The duration of all of the AnimationKeyframes.
bool loop If the animation loops.
AnimationDataType data_type The type of data that is changed during animation.
size_t data_index_offset The index of the structure we are targeting.
size_t data_byte_offset The byte offset in the structure we are targeting.
void * data Stored pointer to data to change during animation.
AnimationTargetType completion_type Type of data that is modified on completion.
void * completion_data Pointer to the data that is modified on completion.
bool active If this animation is currently running.

◆ AnimationComponent

struct AnimationComponent

The animation component for interpolation between AnimationKeyframes.

See also
ANIMATION_COMPONENTS
core/animation.c
AnimationTrack
AnimationKeyframe
Entity

Definition at line 2266 of file engine_types.h.

Data Fields
AnimationTrack tracks[64] The AnimationTracks with individual values that occur simultaneously.
int track_count The amount of AnimationTracks.
bool free If the component is empty.
Entity * ent The pointer to the Entity.

◆ State

struct State

Entity States that control what functions are available for an Entity.

See also
Entity
Filter

Definition at line 2317 of file engine_types.h.

Data Fields
char name[256]
void(*[ESTATE_MAX])(void *) fn

◆ Entity

struct Entity

Entity structure that holds components and references to the data it owns.

See also
ENTITIES
Filter

Definition at line 2332 of file engine_types.h.

Data Fields
size_t id ID inside of ENTITIES.
bool free If the Entity is empty.
int mesh_node The top-most MeshNode that belongs to this Entity.
int skin The GLTFSkin to be modified by this Entity (skeletal animations).
AABB aabb The bounding box over all MeshNodes for this Entity.
EntityType type Type of entity for Filters.
union as
State * state The current State that describes actions for this Entity.
struct AssetInstance * instance The AssetInstance that spawned this Entity.
PhysicsComponent * pc The PhysicsComponent inside of PHYSICS_COMPONENTS.
AnimationComponent * ac The AnimationComponent inside of ANIMATION_COMPONENTS.

◆ SubMesh

struct SubMesh

Sections of Meshes that are divided based on Material for batching and DrawCommand ordering purposes.

See also
Mesh
MeshNode
load_gltf()
add_all_meshes_to_buffer()

Definition at line 2452 of file engine_types.h.

Data Fields
size_t material The Material.
size_t first_vertex The first Point in Mesh.vertices that this SubMesh refers to.
size_t vertex_count The amount of Points that this SubMesh refers to.
size_t first_index The first index that this SubMesh refers to (Mesh.tris count * 3).
size_t index_count The amount of indices that this SubMesh refers to: Mesh.tris -> MeshFace.indices.
size_t lm_offset The starting index in LIGHTMAP_DATA that this SubMesh points to.
size_t draw_offset Currently the same index as SubMesh.lm_offset.
size_t command_id The DrawCommand this is assigned to.
size_t mesh_data_id The MeshNodeDataGPU this is assigned to.

◆ TriangleAdjacency

struct TriangleAdjacency

Adjacent triangles for each MeshFace on a Mesh.

See also
build_adjacency_map()
walk_coplanar_adjacency()

Definition at line 2472 of file engine_types.h.

Data Fields
Vector adjacent_indices size_t indices.

◆ Mesh

struct Mesh

A Mesh with geometry data that is either initialized as static or dynamic and split into SubMeshes.

See also
MeshNode
Globals
init_mesh()

Definition at line 2484 of file engine_types.h.

Data Fields
char name[256] The Mesh name assigned on load.
size_t id The ID into Globals.meshes.
size_t asset_id The Asset ID into Globals.assets.
bool bvh_prim This Mesh has a BVH computed.
bool static_mesh This Mesh is static and must create a BVH or if not it must perform incremental_hull.
AABB aabb The AABB of the mesh.
size_t offset The offset into MAIN_VBO.
size_t count The count pushed into MAIN_VBO.
Vector submeshes The SubMeshes split via Materials.
Vector hulls The ConvexHulls generated if this Mesh is dynamic.
Vector vertices The Points.
Vector tris The MeshFaces.
TriangleAdjacency * tri_adjacency Adjacent triangles allocated per MeshFace.
size_t * bvh_indices Indices for the BVH, sorted as the BVH is generated.
Vector nodes BVHNodes.
Vector tri_aabbs AABBs for each triangle inside of this Mesh.
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 pad0
uint pad1
mat4 global_matrix
mat4 inverse_global_matrix

◆ Image

struct Image

Where Material textures are saved upon loading from file.

See also
Material
Globals

Definition at line 2529 of file engine_types.h.

Data Fields
char path[256] The path to the Image.
char mime_type[256] Unused, refer to GLTF spec.
char name[256] The name of the Image file.
int channels The amount of channels for an Image (RGBA).
unsigned char * buf If available, the raw bytes of the Image.
GLuint i The handle for the texture.
GLuint64 handle The handle for the bindless texture.
int width
int height
bool sRGB To load in this Image as sRGB.
GLint min_filter Refer to OpenGL texture loading.
GLint mag_filter Refer to OpenGL texture loading.
GLint wrap_s Refer to OpenGL texture loading.
GLint wrap_t Refer to OpenGL texture loading.

◆ GLTFMaterial

struct GLTFMaterial

The structure for Materials when loaded in from file.

See also
Material
GLTFDoc

Definition at line 2555 of file engine_types.h.

Data Fields
char name[64]
float base_color_factor[4]
float metallic_factor
float roughness_factor
float emissive_factor[3]
int base_color_tex
int metallic_roughness_tex
int normal_tex
int occlusion_tex
int emissive_tex
float normal_scale
float occlusion_strength
AlphaMode alpha_mode
float alpha_cutoff
bool double_sided
float absorption_coefficients[6]
float scattering_coefficients[6]
float emissive_strength
int fwd_shader
int gbuffer_shader
bool override_transparent

◆ GLTFBuffer

struct GLTFBuffer

The raw bytes of a GLTF file.

See also
GLTFDoc

Definition at line 2591 of file engine_types.h.

Data Fields
char * uri
int byteLength
unsigned char * data

◆ GLTFBufferView

struct GLTFBufferView

The views of a GLTF file.

See also
GLTFDoc

Definition at line 2603 of file engine_types.h.

Data Fields
int buffer
int byteOffset
int byteLength
int byteStride

◆ GLTFAccessor

struct GLTFAccessor

The accessors of a GLTF file.

See also
GLTFDoc

Definition at line 2614 of file engine_types.h.

Data Fields
int bufferView
int byteOffset
int componentType
int count
char type[8]

◆ GLTFPrimitive

struct GLTFPrimitive

The primitives of a GLTF file.

See also
GLTFDoc

Definition at line 2626 of file engine_types.h.

Data Fields
int position
int normal
int tangent
int texcoord0
int joints0
int weights0
int indices
int material

◆ GLTFMesh

struct GLTFMesh

The Meshes of a GLTF file.

See also
Mesh
GLTFDoc

Definition at line 2642 of file engine_types.h.

Data Fields
GLTFPrimitive * prims
int primCount

◆ AnimationSampler

struct AnimationSampler

Engine-side sampler version of GLTFAnimationSampler with the field allocated.

See also
Animation
GLTFDoc

Definition at line 2666 of file engine_types.h.

Data Fields
int count
float * times
int elem_count
float * values
AnimationInterpolation interpolation

◆ GLTFAnimationSampler

struct GLTFAnimationSampler

The individual interpolation of an Animation.

See also
Animation
GLTFDoc

Definition at line 2681 of file engine_types.h.

Data Fields
int input
int output
int interpolation

◆ GLTFAnimationChannel

struct GLTFAnimationChannel

The channels of an Animation.

See also
Animation
GLTFDoc

Definition at line 2692 of file engine_types.h.

Data Fields
int sampler
int target_node
AnimationPath path

◆ GLTFAnimation

struct GLTFAnimation

The GLTF structure of an Animation.

See also
Animation
GLTFDoc

Definition at line 2705 of file engine_types.h.

Data Fields
char name[64]
int sampler_count
GLTFAnimationSampler * samplers
int channel_count
GLTFAnimationChannel * channels

◆ Animation

struct Animation

The structure of an Skeletatal Animation loaded in from GLTFAnimation.

See also
GLTFAnimation
GLTFDoc

Definition at line 2719 of file engine_types.h.

Data Fields
char name[256]
int asset_id
int sampler_count
AnimationSampler * samplers
int channel_count
GLTFAnimationChannel * channels

◆ GLTFSkin

struct GLTFSkin

The structure of an Skeletatal Animation loaded in from GLTFAnimation.

See also
MeshNode
Globals
update_skin_matrices()
GLTFDoc

Definition at line 2746 of file engine_types.h.

Data Fields
char name[256] The name of the skin from load.
bool free If this skin is free.
size_t id The ID of this skin in Globals.skins.
int joint_count The amount of joints.
int * joints The joints for skeletal animating.
mat4 * final_mat The transformation after update_skin_matrices().
mat4 * inverse_bind The inverse_bind that is computed on load_gltf().
int ibm_accessor Which GLTFAccessor this refers to.
int animation_indices[256] Animation indices into Asset.
int animation_indices_count The amount of Animation indices.
int ssbo_offset The offset into JOINT_SSBO.

◆ GLTFTexture

struct GLTFTexture

The GLTFTexture before it is processed.

See also
GLTFDoc

Definition at line 2766 of file engine_types.h.

Data Fields
int source
int sampler

◆ GLTFImage

struct GLTFImage

The Image before it is processed.

See also
GLTFDoc

Definition at line 2778 of file engine_types.h.

Data Fields
char uri[256]
int buffer_view
char mime_type[256]
char name[256]

◆ GLTFSampler

struct GLTFSampler

The sampler for the Image before it is processed.

See also
GLTFDoc

Definition at line 2792 of file engine_types.h.

Data Fields
int mag_filter
int min_filter
int wrap_s
int wrap_t
char name[256]

◆ GLTFDoc

struct GLTFDoc

The entire GLTF after it is parsed via load_gltf().

Definition at line 2807 of file engine_types.h.

Data Fields
GLTFBuffer * buffers
int bufferCount
GLTFBufferView * views
int viewCount
GLTFAccessor * accessors
int accessorCount
GLTFMesh * meshes
int meshCount
GLTFMaterial * materials
int material_count
MeshNode * nodes
int node_count
GLTFSkin * skins
int skin_count
GLTFAnimation * animations
int animation_count
GLTFTexture * textures
int texture_count
GLTFImage * images
int image_count
GLTFSampler * samplers
int sampler_count

◆ AssetInstance

struct AssetInstance

A instance of an Asset that retains its node structure but can be duplicated into multiple instances that are independent.

See also
Asset
ASSET_INSTANCES
init_new_asset_instance()
Warning
Todo
Very important: The first_skin is not actually in use and needs to be resolved to use skin_indices instead in init_new_asset_instance()

Definition at line 2841 of file engine_types.h.

Data Fields
size_t id The ID in ASSET_INSTANCES.
size_t first_skin Refer to todo.
size_t skin_count The amount of GLTFSkins in this instance.
int asset_id The Asset ID in Globals.assets.
size_t node_count The amount of MeshNodes in this instance.
size_t * node_indices The indices of MeshNodes spawned from this instance inside of Globals.mesh_nodes.
size_t * skin_indices The indices of GLTFSkins spawned from this instance inside of Globals.skins.
vec3 tr
vec4 rot
vec3 scale
mat4 model
bool free Indicates an empty slot in ASSET_INSTANCES.
AABB aabb The AABB over each MeshNode via Asset.

◆ Asset

struct Asset

An Asset after it is loaded in from file into Globals.assets.

It is a template for AssetInstances.

See also
AssetInstance
Globals.assets

Definition at line 2875 of file engine_types.h.

Data Fields
char path[256] The path to the Asset.
Vector mesh_indices int - Indices into Globals.meshes which indicate what Meshes are within this Asset.
MeshNode * nodes
size_t node_count
GLTFSkin * skins
size_t skin_count
Animation * animations
size_t animation_count
int asset_id The ID into Globals.assets.
AABB aabb AABB over each MeshNode for this Asset.

◆ InstanceData

struct InstanceData

Simply the size we use to allocate the INSTANCE_VBO (unused).

Definition at line 2895 of file engine_types.h.

Data Fields
mat4 model
ivec2 point_lights
ivec2 directional_lights
ivec2 spot_lights
int skin_offset

◆ DrawCommand

struct DrawCommand

The structure used to sort unique submeshes by materials, and shaders in the main render pass.

See also
create_and_sort_draw_commands()
upload_instance_data()
Todo
Possibly sort 128 keys instead of 64

Definition at line 2912 of file engine_types.h.

Data Fields
uint8_t gbuffer_shader The shader for the DEPTH_PRE_PASS_SHADER.
uint8_t fwd_shader The shader in DYNAMIC_SHADER.
uint8_t material The Material ID into Globals.materials.
uint8_t opaque How opaque a Material is.
uint8_t static_mesh If it is a static mesh.
uint16_t mesh_id The Mesh.
uint16_t skin_offset The offset into JOINT_SSBO.
uint16_t point_light_offset
uint16_t point_light_count
uint16_t directional_light_offset
uint16_t directional_light_count
uint16_t spot_light_offset
uint16_t spot_light_count
uint32_t start_index Where the indices / vertices start for this SubMesh in MAIN_VBO.
uint32_t index_count How many indices in this SubMesh.
uint32_t lm_offset Lightmap offset into LIGHTMAP_DATA / LIGHTMAP_SSBO.
uint32_t mn_id The MeshNode.
uint32_t sm_id The SubMesh.
uint32_t array_offset The offset into INDIRECT_ARRAYS_COMMAND_BUFFER.
uint32_t element_offset The offset into INDIRECT_ELEMENTS_COMMAND_BUFFER.
uint64_t sort_key The key that is sorted in create_and_sort_draw_commands().
mat4 matrix The transformation matrix of the MeshNode.

◆ EPAWorkspace

struct EPAWorkspace

A workspace used for EPA during collision detection.

See also
epa()
physics/GJK.c
CollisionPoints

Definition at line 2971 of file engine_types.h.

Data Fields
SupportVertex vertices[1024] The vertices of the current polyhedron.
size_t vertices_count The amount of vertices.
MeshFace faces[1024] The faces of the current polyhedron.
size_t faces_count The amount of faces.
int indices[1024] Indices into EPAWorkspace.faces that describe which faces are still used (when faces are removed they are simply deleted from this array).
size_t indices_count The amount of current faces.
HorizonEdge horizon_edges[1024] The amount of unique edges that are not shared between visible faces.
size_t horizon_edges_count The amount of horizon edges.
int horizon_counts[1024] The amount of times each horizon edge appears (if it only appears once then it is evaluated).
size_t horizon_counts_count The amount of horizon counts.
int visible_faces_indices[1024] The faces that are visibile from the newest SupportVertex.
size_t visible_faces_count The amount of visible faces found.

◆ OpenNode

struct OpenNode

A node inside of the min_heap of an AStarWorkspace.

See also
a_star_aportal()
AStarWorkspace

Definition at line 2994 of file engine_types.h.

Data Fields
int i The index into the array of whatever is being traversed.
float g The g score: current score of the path.
float f The f score: score from neighbor to end.
int parent The index of the parent of this neighbor.

◆ AStarStateStack

struct AStarStateStack

A running stack of nodes in a path that tracks where they came from so they can be retraced at the end.

See also
a_star_aportal()

Definition at line 3011 of file engine_types.h.

Data Fields
float g The g score: current score of the path.
float f The f score: score from neighbor to end.
int came_from The index into the array of traversed items that this node came from.
int run_id Makes sure that no old stack items are used.

A new run is started on each a_star call.

◆ AStarWorkspace

struct AStarWorkspace

The workspace for conducting a-star pathfinding/.

See also
a_star_aportal()
Todo
Expand path size or make it reallocatable because the current limit is minimal.

Definition at line 3026 of file engine_types.h.

Data Fields
AStarStateStack * stack The stack that tracks where each node connects so that it can be backtracked.
int * path The path indices that are returned.
int path_count The final path count.
Vector min_heap OpenNode - the heap of nodes that are pushed and popped until there are none left or it reaches the end.
int current_run The current run indicates what AStarStateStack entries we can use.

◆ Player

struct Player

The Player.

There can currently only be one Player, located in player.

See also
update_camera()
process_input()
update_audio_occlusion()
audio_update()

Definition at line 3046 of file engine_types.h.

Data Fields
float radius The radius of the Player body.
float height The height of the Player body.
bool sprinting Currently unused flag for sprinting.
bool noclip Enables flying (but not collisions).
Camera * cam Player Camera.
PhysicsComponent * pc PhysicsComponent in PHYSICS_COMPONENTS.
vec3 pos Currently anchors the Skeleton.
Skeleton skeleton Player Skeleton.
Mesh mesh The Mesh for the ConvexHull used for collisions (an AABB).

◆ LPV

struct LPV

A ProbeVolume for indirect lighting probes.

See also
load_lighting_pv()
bake_lighting_probe_volume()

Definition at line 3103 of file engine_types.h.

Data Fields
int pv_id The ProbeVolume in SceneData.lighting_probe_volume.
float * lprobes The raw SH data.

P = LPV_PADDED_COUNT, 3 = [R, G, B], SH = SH_MAX \((P * 3 * SH)\).

◆ LightBVH

struct LightBVH

The BVH for Lights.

See also
init_light_bvh()
bake_lightmap()

Definition at line 3122 of file engine_types.h.

Data Fields
Vector nodes Each node of the BVH.
size_t * indices The indices sorted when initialized.
size_t indices_count The amount of indices on init (some lights are omitted).
Vector lights The Lights that were created (emissive triangles become AREA_LIGHTS).

◆ SceneData

struct SceneData

The data for the current scene.

Stored in Globals.

See also
init()
init_globals()
scene_load()

Definition at line 3138 of file engine_types.h.

Data Fields
char name[256] Modifiable name of the scene.
AABB aabb AABB over the entire scene.
Vector bvh_nodes
int bvh_indices_count
size_t * bvh_indices
Vector reflection_probes ReflectionProbes in the scene.
Vector audio_probe_volumes All of the AudioProbe% volumes, regardless of if they have been loaded yet.
Vector lighting_probe_volumes All of the lighting probe volumes, regardless of if they have been loaded yet.
LightBVH light_bvh The LightBVH, required for baking lighting.
APV LOADED_AUDIO_PV[4] Load slots for Audio ProbeVolumes.
bool LOADED_AUDIO_PV_FLAG[4] Flags that indicate if the slot is loaded.
LPV LOADED_LIGHTING_PV[6] Load slots for lighting ProbeVolumes.
bool LOADED_LIGHTING_PV_FLAG[6] Flags that indicate if the slot is loaded.
char LPV_PATH[256] Path to binary file with lighting ProbeVolumes.
FILE * LPV_FILE FILE pointer to the opened binary file.
char APV_PATH[256] Path to binary file with Audio ProbeVolumes.
FILE * APV_FILE FILE pointer to the opened binary file.
LightmapData lightmap_data The loaded lightmap and lightmap configuration for the scene.

◆ FileDirectoryRegistry

struct FileDirectoryRegistry

Registry for folders that are used for dropdowns in the editor UI.

See also
render_editor_menu()
init_file_directory_registries()
render_file_directory_dropdown()

Definition at line 3190 of file engine_types.h.

Data Fields
Vector names The name of each file in the directory.
char suffix[256] The suffix to append to the end of the file when searching.
bool search_suffix If there is a suffix.
char directory[256] Path to directory for the file.
int current_selection The file that is currently selected (starts at 0).
nk_bool open If the directory is currently open in a dropdown.

◆ Globals

struct Globals

Global settings and structures for each system in the engine.

See also
SceneData
init_globals()
scene_load()
Todo

rename noclip

change world min and size

remove probe spacing - should no longer be needed, use resolution

Definition at line 3401 of file engine_types.h.

Data Fields
bool lights_dirty If lights need to be reuploaded.
bool noclip If collision is enabled.
bool keyboard_locked If the keyboard is unlocked to register text events in the editor UI.
int msaa_samples How many samples our multisampled textures are using.
vec3 world_min Unused but uploaded to main shader.
vec3 world_size Unused but uploaded to main shader.
ivec3 probe_tex_size The texture size for lighting probes.
float probe_spacing The spacing between lighting probes.
Vector meshes Meshes.
Vector mesh_nodes MeshNodes.
Vector skins GLTFSkins.
Vector assets Assets.
Vector materials Materials.
Vector images Images.
Vector lights Lights.
Vector audio_portals AudioPortals.
Vector vertex_layouts VertexLayouts.
AudioProbe * audio_probes A scratch buffer used when baking AudioProbes.
uint32_t * mesh_light_indices Buffer used when calling determine_light_visibility_per_mesh.
SceneData scene_data SceneData that is more-so scene specific.

◆ Uniform

struct Uniform

OpenGL shader Uniforms.

See also
core/shaders.c

Definition at line 3439 of file engine_types.h.

Data Fields
GLuint location
char name[256]

◆ ShaderProgram

struct ShaderProgram

OpenGL ShaderPrograms: vertex, fragment, geometry, and compute.

See also
core/shaders.c
Todo
Expand uniform count or make it dynamic?

Definition at line 3450 of file engine_types.h.

Data Fields
GLuint program Program handle.
uint32_t perm Which permutation of a shader branch this is.
char name[256] Name of the shader.
char vert_path[256] Path to vertex shader (or compute shader).
char geom_path[256] Path to geometry shader.
char frag_path[256] Path to fragment shader.
Uniform uniforms[32] Uniforms for shader data.

◆ VertexLayout

struct VertexLayout

An unused abstraction for VertexLayouts.

Note
In an older engine, there was the capability to design your own layouts and render passes. This functionality is not necessary in this engine, and so there is only one VertexLayout currently.

Definition at line 3468 of file engine_types.h.

Data Fields
char name[256]
size_t attrib_count
GLsizei vertex_size
GLuint vao
GLuint vbo
GLuint ebo
GLenum buffer_usage
int buffer_override
GLenum buffer_target
void * buffer_override_data
size_t current_offset
size_t current_capacity
size_t current_index_offset
size_t current_index_capacity
Vector meshes

Macro Definition Documentation

◆ PI

#define PI   3.14159265358979323846

Definition at line 68 of file engine_types.h.

Referenced by calculate_light(), distribution_GGX(), and main().

◆ FOV

#define FOV   90

FOV constant for player.

Definition at line 70 of file engine_types.h.

Referenced by update_camera(), and update_light_camera().

◆ VIEW_NEAR

#define VIEW_NEAR   0.1

Near plane for player.

Definition at line 71 of file engine_types.h.

Referenced by bind_dynamic_shader(), GPU_init_cluster_aabbs(), render_to_cubemap_face(), and update_camera().

◆ VIEW_FAR

#define VIEW_FAR   1000.0

Far plane for player.

Definition at line 72 of file engine_types.h.

Referenced by bind_dynamic_shader(), GPU_init_cluster_aabbs(), render_to_cubemap_face(), and update_camera().

◆ MAX_NUKLEAR_EVENTS

#define MAX_NUKLEAR_EVENTS   256

Max amount of events to poll in one render step.

Definition at line 106 of file engine_types.h.

Referenced by main(), and process_input().

◆ MAX_SDL_EVENTS

#define MAX_SDL_EVENTS   512

Max amount of events to poll in one render step.

Definition at line 107 of file engine_types.h.

Referenced by main(), and process_input().

◆ MAX_MESH_NODES

#define MAX_MESH_NODES   1024

Maximum MeshNodes in a scene (used for SSBO sizing).

Definition at line 108 of file engine_types.h.

Referenced by init(), init_globals(), and layout().

◆ MAX_MESHES

#define MAX_MESHES   512

Maximum Meshes in a scene (used for SSBO sizing).

Definition at line 109 of file engine_types.h.

◆ MAX_JOINT_MATRICES

#define MAX_JOINT_MATRICES   512

Maximum joints in a scene (used for SSBO sizing).

Definition at line 110 of file engine_types.h.

Referenced by init().

◆ MAX_INSTANCES

#define MAX_INSTANCES   1024

Maximum amount of TransformGPU instances to push in one frame (used for SSBO sizing).

Definition at line 111 of file engine_types.h.

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

◆ MAX_MATERIALS

#define MAX_MATERIALS   256

Maximum amount of Materials (used for SSBO sizing).

Definition at line 112 of file engine_types.h.

◆ MAX_LIGHTS

#define MAX_LIGHTS   1024

Maximum amount of Lights to be pushed per frame (used for SSBO sizing).

Definition at line 113 of file engine_types.h.

Referenced by init(), and update_physics_components().

◆ MINIMUM_LIGHT_VISIBILITY_DIST

#define MINIMUM_LIGHT_VISIBILITY_DIST   0.01

Light visibility dist used for culling (only used for spot Lights(?) now).

Definition at line 116 of file engine_types.h.

Referenced by determine_light_visibility_per_mesh().

◆ MAX_LIGHTS_PER_MESH

#define MAX_LIGHTS_PER_MESH   4

Max directional + spot Lights to push at one time for a Mesh.

Definition at line 117 of file engine_types.h.

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

◆ MAX_DRAW_COMMANDS

#define MAX_DRAW_COMMANDS   512

Maxmimum amount of draw commands to push to the gpu.

Definition at line 120 of file engine_types.h.

Referenced by upload_instance_data().

◆ MAX_DIRECTIONAL_LIGHTS

#define MAX_DIRECTIONAL_LIGHTS   4

Maxmimum directional Lights at one time (used for shadowmap sizing).

Definition at line 122 of file engine_types.h.

Referenced by determine_light_visibility_per_mesh(), and init().

◆ MAX_ENTITY_STATES

#define MAX_ENTITY_STATES   256

Maximim Entity states for behaviors.

Definition at line 124 of file engine_types.h.

◆ DEFAULT_TEXTURES

#define DEFAULT_TEXTURES   5

How many dummy default textures are on init.

Definition at line 126 of file engine_types.h.

Referenced by scene_load(), and scene_save().

◆ MAX_UI_MENU_NAMES

#define MAX_UI_MENU_NAMES   128

Used in editor to determine dropdown size.

Definition at line 129 of file engine_types.h.

Referenced by render_text_menu(), and render_ui_menu().

◆ PERFORMANCE_OVERLAY_TEXT_BOX_COUNT

#define PERFORMANCE_OVERLAY_TEXT_BOX_COUNT   13

Offset of how many text boxes are used for the debug performance overlay.

Definition at line 153 of file engine_types.h.

Referenced by create_performance_overlay(), toggle_performance_overlay(), and update_performance_overlay().

◆ BUFFER_FRAMES

#define BUFFER_FRAMES   3

Triple buffer count.

Definition at line 155 of file engine_types.h.

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

◆ UBERSHADER_VERSIONS

#define UBERSHADER_VERSIONS   17

Maxmimum main shader brances.

Definition at line 157 of file engine_types.h.

Referenced by init_dynamic_shader(), init_globals(), parse_gltf_materials(), and SHADERS_INIT().

◆ GBUFFER_VERSIONS

#define GBUFFER_VERSIONS   1

Maxmimum gbuffer shader branches.

Definition at line 158 of file engine_types.h.

Referenced by init_depth_pre_pass_shader(), init_globals(), parse_gltf_materials(), and SHADERS_INIT().

◆ LIGHTMAP_WIDTH

#define LIGHTMAP_WIDTH   2048

Definition at line 167 of file engine_types.h.

Referenced by bake_lightmap(), init(), and init_lightmap_data().

◆ LIGHTMAP_HEIGHT

#define LIGHTMAP_HEIGHT   2048

Definition at line 168 of file engine_types.h.

Referenced by bake_lightmap(), init(), and init_lightmap_data().

◆ RPROBE_WIDTH

#define RPROBE_WIDTH   128

Definition at line 170 of file engine_types.h.

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

◆ RPROBE_HEIGHT

#define RPROBE_HEIGHT   128

Definition at line 171 of file engine_types.h.

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

◆ DEFAULT_POINT_LIGHT_SHADOWS_SIZE

#define DEFAULT_POINT_LIGHT_SHADOWS_SIZE   128

Definition at line 173 of file engine_types.h.

Referenced by init().

◆ DEFAULT_SHADOW_MAP_SIZE

#define DEFAULT_SHADOW_MAP_SIZE   2048

Definition at line 175 of file engine_types.h.

Referenced by init().

◆ FBM_TEXTURE_SIZE

#define FBM_TEXTURE_SIZE   128

Definition at line 177 of file engine_types.h.

Referenced by init(), and precompute_fbm_texture().

◆ MAX_POINT_LIGHT_SHADOWS_CMA

#define MAX_POINT_LIGHT_SHADOWS_CMA   16

Maximum amount of point light shadows in texture depth.

Definition at line 182 of file engine_types.h.

Referenced by init().

◆ MAX_RPROBE_MIPS

#define MAX_RPROBE_MIPS   1

The amount of mips to allocate for rprobes.

Definition at line 186 of file engine_types.h.

Referenced by init(), and reallocate_rprobe_array().

◆ MAX_RPROBES_PER_FRAME

#define MAX_RPROBES_PER_FRAME   4

Max ReflectionProbes to push to UBOs per frame (for sizing).

Definition at line 188 of file engine_types.h.

Referenced by determine_closest_rprobes().

◆ SSAO_KERNEL_SIZE

#define SSAO_KERNEL_SIZE   16

SSAO init kernel size.

Definition at line 190 of file engine_types.h.

Referenced by init().

◆ ACCEL_BETA

#define ACCEL_BETA   0.005f

Friction / air accel decay constant.

Definition at line 192 of file engine_types.h.

Referenced by update_physics_components(), and update_skeleton().

◆ GRID_X

#define GRID_X   16

◆ GRID_Y

#define GRID_Y   9

◆ GRID_Z

#define GRID_Z   24

◆ TOTAL_CLUSTERS

#define TOTAL_CLUSTERS   (GRID_X * GRID_Y * GRID_Z)

Definition at line 203 of file engine_types.h.

Referenced by init().

◆ MAX_LIGHTS_PER_CLUSTER

#define MAX_LIGHTS_PER_CLUSTER   12

Definition at line 204 of file engine_types.h.

Referenced by init(), and render_to_cubemap_face().

◆ LPV_SLOTS

◆ MAX_AUDIO_PROBE_VOLUMES

#define MAX_AUDIO_PROBE_VOLUMES   4

◆ PROBE_VOLUME_WIDTH

#define PROBE_VOLUME_WIDTH   12

Definition at line 215 of file engine_types.h.

Referenced by bake_lighting_probe_volume(), init(), init_globals(), and load_lighting_pv().

◆ PROBE_VOLUME_HEIGHT

#define PROBE_VOLUME_HEIGHT   12

Definition at line 216 of file engine_types.h.

Referenced by bake_lighting_probe_volume(), init(), init_globals(), and load_lighting_pv().

◆ PROBE_VOLUME_DEPTH

#define PROBE_VOLUME_DEPTH   12

Definition at line 217 of file engine_types.h.

Referenced by bake_lighting_probe_volume(), and init_globals().

◆ PROBE_VOLUME_DEPTH_PADDED

#define PROBE_VOLUME_DEPTH_PADDED   (PROBE_VOLUME_DEPTH + 2)

Padding to avoid leaking on edges in Z.

Definition at line 218 of file engine_types.h.

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

◆ LPV_COUNT

Definition at line 219 of file engine_types.h.

◆ LPV_PADDED_COUNT

◆ PARTITION_BUFFERS

#define PARTITION_BUFFERS   4

The amount of audio partition back buffers.

Definition at line 407 of file engine_types.h.

Referenced by delete_hrtf_worker_thread(), hrtf_worker(), and init_hrtf_worker_thread().

◆ MAX_RPROBES

#define MAX_RPROBES   256

The maximum amount of RProbes to send to the GPU at once.

Definition at line 1370 of file engine_types.h.

◆ MAX_TEX_LABELS

#define MAX_TEX_LABELS   600

The maximum amount of labels for a ComboLabel.

Definition at line 1542 of file engine_types.h.

◆ LABEL_LEN

#define LABEL_LEN   256

The maximum label length of labels in a ComboLabel.

Definition at line 1543 of file engine_types.h.

Referenced by render_dropdown(), render_dropdown_labels(), render_file_directory_dropdown(), render_main_menu(), and render_mn_menu().

◆ MAX_KEYFRAMES

#define MAX_KEYFRAMES   64

Maximum AnimationKeyframes in an AnimationTrack.

Definition at line 2229 of file engine_types.h.

◆ MAX_TRACKS

#define MAX_TRACKS   64

Maximum AnimationTracks in an AnimationComponent.

Definition at line 2256 of file engine_types.h.

Referenced by init_globals().

◆ MAX_NODE_CHILDREN

#define MAX_NODE_CHILDREN   128

Maximum amount of direct MeshNode children to be stored in a MeshNode.

Definition at line 2357 of file engine_types.h.

◆ MAX_ANIMATION_INDICES

#define MAX_ANIMATION_INDICES   256

The maximum amount of animation indices per GLTFSkin.

Todo
Remove this maximum or increase it.

Definition at line 2735 of file engine_types.h.

Referenced by init_new_asset_instance(), and load_gltf().

◆ MAX_EPA_VERTICES

#define MAX_EPA_VERTICES   1024

Definition at line 2957 of file engine_types.h.

◆ MAX_EPA_FACES

#define MAX_EPA_FACES   1024

Definition at line 2958 of file engine_types.h.

◆ MAX_EPA_INDICES

#define MAX_EPA_INDICES   1024

Definition at line 2959 of file engine_types.h.

◆ MAX_EPA_HORIZON_EDGES

#define MAX_EPA_HORIZON_EDGES   1024

Definition at line 2960 of file engine_types.h.

◆ MAX_EPA_HORIZON_COUNTS

#define MAX_EPA_HORIZON_COUNTS   1024

Definition at line 2961 of file engine_types.h.

◆ MAX_EPA_VISIBLE_FACES_INDICES

#define MAX_EPA_VISIBLE_FACES_INDICES   1024

Definition at line 2962 of file engine_types.h.

◆ MAX_PORTALS

#define MAX_PORTALS   256

The maximum amount of portals that are allocated to AStarWorkspace.path.

Definition at line 3005 of file engine_types.h.

Referenced by init_globals(), and reconstruct_path_aportal().

Typedef Documentation

◆ LightmapUV

typedef vec2 LightmapUV[3]

The lightmap UVs stored on UVIslands per MeshFace.

See also
assign_uvs()

Definition at line 1991 of file engine_types.h.

Enumeration Type Documentation

◆ DebugView

enum DebugView

Enum for debug views that are ubershader branches.

Enumerator
DVIEW_DEFAULT 
DVIEW_ALBEDO 
DVIEW_ARM 
DVIEW_EMISSIVE 
DVIEW_AO 
DVIEW_UV 
DVIEW_POM_VDIR 
DVIEW_CLUSTERS 
DVIEW_NORMAL 
DVIEW_ORIGINAL_NORMAL 
DVIEW_DIRECT 
DVIEW_INDIRECT 
DVIEW_LM_IRRADIANCE 
DVIEW_LM_DIRECTIONAL 
DVIEW_RPROBE 
DVIEW_SPECULAR 
DVIEW_MAX 

Definition at line 228 of file engine_types.h.

◆ PostprocessToggles

Postprocess options.

Enumerator
PP_MBLUR 
PP_DOF 
PP_BLOOM 
PP_NOISE 
PP_ACES 
PP_LUT 
PP_MAX 

Definition at line 277 of file engine_types.h.

◆ PostprocessDView

Postprocess debug view shader branches.

Enumerator
PPDVIEW_DEFAULT 
PPDVIEW_DEPTH 
PPDVIEW_VEL 
PPDVIEW_BOKEH 
PPDVIEW_LM 
PPDVIEW_MAX 

Definition at line 285 of file engine_types.h.

◆ FullscreenOptions

Fullscreen options.

See also
render_main_menu().
Enumerator
FSOPT_FULLSCREEN 
FSOPT_BORDERLESS 
FSOPT_WINDOWED 
FSOPT_MAX 

Definition at line 312 of file engine_types.h.

◆ MSAASampleOptions

MSAA options handled in render_main_menu().

Enumerator
MSAA_2 
MSAA_4 
MSAA_8 
MSAA_16 
MSAA_SAMPLE_OPTIONS_MAX 

Definition at line 336 of file engine_types.h.

◆ GBufferTextureNames

Gbuffer textures.

Gbuffer is unused currently as it is has been repurposed as a depth-only pass but is toggleable.

Enumerator
GVEL 
GUV 
GNORMAL 
GPOMDEPTH 
GALBEDO 
GEXTRA 

Definition at line 554 of file engine_types.h.

◆ DepthMode

enum DepthMode

The depth modes for initializing depth textures.

See also
generate_gl_texture()
Enumerator
DEPTH_MODE_NONE 
DEPTH_MODE_NO_HW 
DEPTH_MODE_HW 

Definition at line 564 of file engine_types.h.

◆ SelectionMode

The selection mode for the editor.

Depending on which one is enabled, you can select specific structures via clicking in edit mode.

See also
core/input.c
Enumerator
SELMODE_MN 

MeshNode.

SELMODE_LIGHT 

Light.

SELMODE_LPV 

Lighting ProbeVolume (LPV).

SELMODE_RPROBE 

ReflectionProbe.

SELMODE_ENTITY 

Entity.

SELMODE_TEXTBOX 

TextBox.

SELMODE_UIELEMENT 

UIElement.

SELMODE_APV 

Audio ProbeVolume (APV).

SELMODE_APORTAL 

AudioPortal.

SELMODE_AEM 

AudioEmitter.

SELMODE_ASSETINSTANCE 

AssetInstance.

Definition at line 636 of file engine_types.h.

◆ MenuNames

enum MenuNames

The Editor menu names rendered in editor/editor.c.

See also
render_main_menu()
Enumerator
MENU_MAIN 
MENU_MN 
MENU_MATERIAL 
MENU_LIGHT 
MENU_ENT 
MENU_TEXT 
MENU_UI 
MENU_AUDIO 
MENU_LPROBE 
MENU_AINST 
MENU_MAX 

Definition at line 658 of file engine_types.h.

◆ TriggerType

Types of Triggers.

Enumerator
TRIGGER_NONE 
TRIGGER_ONESHOT 
TRIGGER_CONTINUOUS 

Definition at line 956 of file engine_types.h.

◆ PerformanceQueryTypes

Performance query types used to profile the render loop.

See also
main()
Enumerator
PQUERY_CULL 
PQUERY_PL 
PQUERY_SM 
PQUERY_GBUFFER 
PQUERY_DOF 
PQUERY_SSAO 
PQUERY_TAA 
PQUERY_SSR 
PQUERY_BLOOM 
PQUERY_RENDER 
PQUERY_MAIN 
PQUERY_MAX 

Definition at line 1082 of file engine_types.h.

◆ LightType

enum LightType : uint32_t

Enum for types of Lights.

Enumerator
POINT_LIGHT 
DIRECTIONAL_LIGHT 
SPOT_LIGHT 
AREA_LIGHT 
MAX_LIGHT_TYPES 

Definition at line 1443 of file engine_types.h.

◆ AlphaMode

enum AlphaMode

Alpha mode to determine Material blending.

Enumerator
ALPHA_OPAQUE 
ALPHA_MASK 
ALPHA_BLEND 

Definition at line 1564 of file engine_types.h.

◆ AnimationTargetType

Animation targets based on type to cast.

See also
AnimationTrack
AnimationComponent
core/animation.c
Enumerator
ANIM_TARGET_FLOAT 
ANIM_TARGET_VEC3 
ANIM_TARGET_INT 
ANIM_TARGET_BOOL 
ANIM_TARGET_MAX 

Definition at line 2194 of file engine_types.h.

◆ AnimationDataType

Indicates what type of structure the animation is targeting.

See also
AnimationTrack
AnimationComponent
core/animation.c
Enumerator
ANIM_DATA_MN 
ANIM_DATA_MESH 
ANIM_DATA_AC 
ANIM_DATA_PC 
ANIM_DATA_ENT 
ANIM_DATA_LIGHT 
ANIM_DATA_ASSET_INSTANCE 
ANIM_DATA_ASSET 
ANIM_DATA_RPROBE 
ANIM_DATA_MAX 

Definition at line 2205 of file engine_types.h.

◆ EntityType

enum EntityType

Types of Entity used for Filters.

See also
Entity
Filter
Enumerator
ENTITY_NONE 
ENTITY_TRIGGER 
ENTITY_FILTER 

Definition at line 2281 of file engine_types.h.

◆ StateType

enum StateType

Entity States that change behaviors and available reactions to Triggers.

See also
Entity
Filter
State
Enumerator
ESTATE_NONE 
ESTATE_PLAYER_INTERACT 
ESTATE_COMBAT 
ESTATE_TRIGGER 
ESTATE_IDLE 
ESTATE_DAMAGED 
ESTATE_KILLED 
ESTATE_DISABLED 
ESTATE_MAX 

Definition at line 2296 of file engine_types.h.

◆ AnimationInterpolation

Types of Animation interpolation.

See also
Animation
GLTFDoc
Enumerator
LINEAR 
STEP 
CUBICSPLINE 

Definition at line 2652 of file engine_types.h.

◆ AnimationPath

What an GLTFAnimationChannel is targeting.

See also
Animation
GLTFDoc
Enumerator
TARGET_TRANSLATION 
TARGET_ROTATION 
TARGET_SCALE 
TARGET_WEIGHTS 

Definition at line 2659 of file engine_types.h.

Variable Documentation

◆ DVIEW_NAMES

const char* DVIEW_NAMES[]
Initial value:
=
{
"DVIEW_DEFAULT",
"DVIEW_ALBEDO",
"DVIEW_ARM",
"DVIEW_EMISSIVE",
"DVIEW_AO",
"DVIEW_UV",
"DVIEW_POM_VDIR",
"DVIEW_CLUSTERS",
"DVIEW_NORMAL",
"DVIEW_ORIGINAL_NORMAL",
"DVIEW_DIRECT",
"DVIEW_INDIRECT",
"DVIEW_LM_IRRADIANCE",
"DVIEW_LM_DIRECTIONAL",
"DVIEW_RPROBE",
"DVIEW_SPECULAR"
}

Debug view names used for choosing a debug view.

Definition at line 254 of file engine_types.h.

Referenced by render_main_menu().

◆ PPDVIEW_NAMES

const char* PPDVIEW_NAMES[]
Initial value:
=
{
"PP_DVIEW_DEFAULT",
"PPDVIEW_DEPTH",
"PPDVIEW_VEL",
"PPDVIEW_BOKEH",
"PPDVIEW_LM",
"PPDVIEW_MAX",
}

Postprocess debug view names used for choosing.

Definition at line 298 of file engine_types.h.

Referenced by render_main_menu().

◆ FULLSCREEN_OPTION_NAMES

const char* FULLSCREEN_OPTION_NAMES[]
Initial value:
=
{
"FULLSCREEN",
"BORDERLESS",
"WINDOWED"
}

Fullscreen option names.

See also
render_main_menu().

Definition at line 326 of file engine_types.h.

Referenced by render_main_menu().

◆ DEFAULT_APV_RES

const ivec3 DEFAULT_APV_RES = {6, 6, 6}

When APVs are spawned, they use this.

Definition at line 3062 of file engine_types.h.

Referenced by render_audio_menu().

◆ DEFAULT_LPV_RES

const ivec3 DEFAULT_LPV_RES = { 12 , 12 , 12 }

What LPVs should always be at to match texture dimensions.

Definition at line 3063 of file engine_types.h.

Referenced by render_lprobe_menu().

◆ GLOBALS

Globals GLOBALS
extern

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

◆ cam

Camera cam
extern

The Camera attached to the Player.

This is currently the player cam.

Definition at line 322 of file main.c.

◆ LIGHT_CAM

Camera LIGHT_CAM[4]
extern

DIRECTIONAL_LIGHT Cameras for shadowmaps

Definition at line 323 of file main.c.

Referenced by main(), and render_to_cubemap_face().