|
Untitled
|
#include <SDL2/SDL.h>#include <GL/glew.h>#include <SDL2/SDL_events.h>#include <SDL2/SDL_mouse.h>#include <SDL2/SDL_video.h>#include "SDL2/SDL_atomic.h"#include "SDL2/SDL_mutex.h"#include "SDL2/SDL_opengl.h"#include "editor/editor.h"#include "fftw3.h"#include "utilities/mathf.h"#include <complex.h>#include <math.h>#include <stdatomic.h>#include <stdbool.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include "init.h"#include "core/mesh.h"#include "render/render.h"#include "core/engine_types.h"#include "ui/ui.h"#include "core/shaders.h"#include "stb/stb_image.h"#include "utilities/utilities.h"#include "core/acceleration.h"#include "ECS/entity.h"#include "load/load.h"#include "ui/fonts.h"#include "nuklear/nuklear.h"#include "nuklear/nuklear_sdl_gl3.h"#include "audio/audio.h"#include "audio/audio_ir.h"#include "ui/ui_callbacks.h"Go to the source code of this file.
Macros | |
| #define | MN_STARTING_SIZE 10000 |
| #define | SKIN_STARTING_SIZE 10000 |
| #define | CROSSFADE_FRAMES 512 |
Functions | |
| Material * | init_new_material (const char *filename) |
| Expands Globals.materials and initializes a material to default. | |
| void | init_mesh (Mesh *mesh) |
| Initializes a static or dynamic Mesh. | |
| void | MN_INIT () |
| void | SKIN_INIT () |
| MeshNode * | find_free_mn () |
| void * | find_free_in_vector (Vector *v, size_t byte_size, size_t free_byte_offset, size_t id_byte_offset) |
| Asset * | retrieve_asset_by_name (const char *asset_name) |
| Mesh * | retrieve_mesh_by_name (const char *asset_name, const char *mesh_name) |
| Searches Globals.assets for a certain Mesh. | |
| void | set_mn_components_to_children (MeshNode *mns, MeshNode *mn, MeshNode *parent) |
| AssetInstance * | init_new_asset_instance (const char *asset_name, vec3 tr, vec4 rot, vec3 scale) |
| Initializes and spawns a new AssetInstance based on an Asset name, and places the AssetInstance.model at a certain transformation. | |
| void | destroy_asset_instance (uint32_t id) |
| Destroys and frees an AssetInstance. | |
| void | init_player_PC (PhysicsComponent *pc, Player *player) |
| void | init_player () |
| void | GPU_unwrap_mesh_to_buffers (Mesh *m, Vector *vertices, Vector *tris, Vector *nodes) |
| void | GPU_upload_scene_data () |
| Uploads current Globals and SceneData structures to the GPU for baking SSBOs. | |
| void | GPU_init_cluster_aabbs () |
| Initializes AABBs on the GPU for clustered forward shading. | |
| void | init_default_textures () |
| Initializes dummy default textures inside of Globals.images that are used as fallback for empty Materials. | |
| bool | init_globals () |
| bool | init_vertex_layouts () |
| void | precompute_fbm_texture () |
| void | precompute_ssao_kernel () |
| int | generate_gl_texture (GLTexture tex) |
| GLTexture | init_gl_texture (GLenum target, GLint internal_format, GLenum format, GLenum type, GLint min_filter, GLint mag_filter, GLint wrap_s, GLint wrap_t, GLint wrap_r, int w, int h, int d, int levels, DepthMode dm) |
| void | init_fbo (Framebuffer *fbo) |
| void | change_fbo_resolution (Framebuffer *fbo, int w, int h, bool skip_depth) |
| Changes Framebuffer's resolution, and deletes the old textures. | |
| void | init_sdl_audio () |
| void | convolver_node_process_pcm_frames (ma_node *pNode, const float **ppFramesIn, ma_uint32 *pFrameCountIn, float **ppFramesOut, ma_uint32 *pFrameCountOut) |
| void | init_audio_scratch_buffers () |
| void | deallocate_fbo (Framebuffer *fbo) |
| void | init_gl_renderbuffer (GLRenderbuffer *rbo, GLint internal_format, GLsizei w, GLsizei h, bool multisampled, int samples) |
| void | allocate_main_fbo () |
| Allocates the main FBO, changes if MSAA is enabled. | |
| void | allocate_gbuffer_msaa () |
| Allocated a gbuffer with multisampled textures. | |
| void | allocate_gbuffer () |
| Allocates a gbuffer without multisampled textures. | |
| bool | init (SDL_Window **window, SDL_GLContext *context) |
| Initializes the engine, including SDL, OpenGL, GLEW, Nuklear, and engine-specific systems. | |
Variables | |
| vec3 * | fbm_tex = NULL |
| int | estimated_frame_count = 0 |
| ma_node_vtable | my_custom_node_vtable |
| #define SKIN_STARTING_SIZE 10000 |
Definition at line 137 of file init.c.
Referenced by SKIN_INIT().
| #define CROSSFADE_FRAMES 512 |
Definition at line 1405 of file init.c.
Referenced by convolver_node_process_pcm_frames().
| Material * init_new_material | ( | const char * | filename | ) |
Expands Globals.materials and initializes a material to default.
| filename | The path and name of the file. |
Definition at line 41 of file init.c.
References Material::alpha_cutoff, Material::alpha_mode, Material::ao_strength, Material::ao_tex, Material::arm_tex, Material::diffuse_tex, Material::double_sided, Material::emissive_tex, GLOBALS, init_new_material(), Material::ka, Material::kd, Material::ke, Material::ks, Globals::materials, Material::metallic, Material::mr_tex, Material::name, Material::normal_scale, Material::normal_tex, Material::roughness, and vector_expand().
Referenced by init_globals(), and init_new_material().
| void init_mesh | ( | Mesh * | mesh | ) |
Initializes a static or dynamic Mesh.
| mesh | Pointer to Mesh. |
Definition at line 68 of file init.c.
References ConvexHull::aabb, Mesh::aabb, Vector::buffer, build_adjacency_map(), Mesh::bvh_indices, Mesh::bvh_prim, CAST_VEC, compute_mesh_hulls(), Vector::count, ConvexHull::faces, ConvexHull::hull_faces, Mesh::hulls, incremental_hull(), init_mesh(), init_mesh_tri_bvh(), init_vector(), Mesh::nodes, Point::pos, Mesh::static_mesh, Mesh::tri_aabbs, Mesh::tri_adjacency, Mesh::tris, vector_expand(), ConvexHull::vertices, and Mesh::vertices.
Referenced by init_mesh(), and load_gltf().
| void MN_INIT | ( | ) |
Definition at line 122 of file init.c.
References CAST_VEC, MeshNode::free, GLOBALS, MeshNode::id, init_vector(), Globals::mesh_nodes, MN_INIT(), and MN_STARTING_SIZE.
Referenced by init_globals(), and MN_INIT().
| void SKIN_INIT | ( | ) |
Definition at line 138 of file init.c.
References CAST_VEC, GLTFSkin::free, GLOBALS, GLTFSkin::id, init_vector(), SKIN_INIT(), SKIN_STARTING_SIZE, and Globals::skins.
Referenced by init_globals(), and SKIN_INIT().
| MeshNode * find_free_mn | ( | ) |
Definition at line 153 of file init.c.
References Vector::capacity, CAST_VEC, find_free_mn(), MeshNode::free, GLOBALS, MeshNode::id, Globals::mesh_nodes, and vector_expand().
Referenced by find_free_mn().
| void * find_free_in_vector | ( | Vector * | v, |
| size_t | byte_size, | ||
| size_t | free_byte_offset, | ||
| size_t | id_byte_offset ) |
Definition at line 183 of file init.c.
References Vector::buffer, Vector::capacity, find_free_in_vector(), and vector_expand().
Referenced by find_free_in_vector(), and init_new_asset_instance().
| Asset * retrieve_asset_by_name | ( | const char * | asset_name | ) |
Definition at line 220 of file init.c.
References Globals::assets, CAST_VEC, Vector::count, GLOBALS, Asset::path, and retrieve_asset_by_name().
Referenced by init_new_asset_instance(), and retrieve_asset_by_name().
| Mesh * retrieve_mesh_by_name | ( | const char * | asset_name, |
| const char * | mesh_name ) |
Searches Globals.assets for a certain Mesh.
Definition at line 242 of file init.c.
References Globals::assets, CAST_VEC, Vector::count, GLOBALS, Asset::mesh_indices, Globals::meshes, Mesh::name, Asset::path, and retrieve_mesh_by_name().
Referenced by retrieve_mesh_by_name().
Definition at line 291 of file init.c.
References MeshNode::child_count, MeshNode::children, MeshNode::ent, MeshNode::pc, and set_mn_components_to_children().
Referenced by init_new_asset_instance(), and set_mn_components_to_children().
| AssetInstance * init_new_asset_instance | ( | const char * | asset_name, |
| vec3 | tr, | ||
| vec4 | rot, | ||
| vec3 | scale ) |
Initializes and spawns a new AssetInstance based on an Asset name, and places the AssetInstance.model at a certain transformation.
| asset_name | The name of the Asset. |
| tr | The translation. |
| rot | The rotation. |
| scale | The scale. |
Definition at line 304 of file init.c.
References Asset::aabb, AssetInstance::aabb, GLTFSkin::animation_indices, Asset::asset_id, AssetInstance::asset_id, MeshNode::asset_instance, ASSET_INSTANCES, Globals::assets, CAST_VEC, MeshNode::child_count, MeshNode::children, compose_trs_from_vectors(), Vector::count, create_entity(), MeshNode::ent, GLTFSkin::final_mat, find_free_in_vector(), AssetInstance::first_skin, AssetInstance::free, GLTFSkin::free, MeshNode::free, GLOBALS, AssetInstance::id, GLTFSkin::id, MeshNode::id, init_new_asset_instance(), GLTFSkin::inverse_bind, GLTFSkin::joint_count, GLTFSkin::joints, MeshNode::local_id, MAX_ANIMATION_INDICES, MAX_ASSET_INSTANCES, Globals::mesh_nodes, AssetInstance::model, GLTFSkin::name, MeshNode::name, Asset::node_count, AssetInstance::node_count, AssetInstance::node_indices, Asset::nodes, MeshNode::parent, MeshNode::pc, MeshNode::physics_mode, retrieve_asset_by_name(), AssetInstance::rot, rot(), AssetInstance::scale, set_mn_components_to_children(), MeshNode::skin, Asset::skin_count, AssetInstance::skin_count, AssetInstance::skin_indices, Asset::skins, Globals::skins, MeshNode::skip_directional_uv_lighting, AssetInstance::tr, and MeshNode::uv_map.
Referenced by init_new_asset_instance(), main(), and render_main_menu().
| void destroy_asset_instance | ( | uint32_t | id | ) |
Destroys and frees an AssetInstance.
| id | The ID of the AssetInstance into ASSET_INSTANCES to destroy. |
Definition at line 418 of file init.c.
References ASSET_INSTANCES, CAST_VEC, destroy_asset_instance(), GLTFSkin::final_mat, AssetInstance::free, GLTFSkin::free, MeshNode::free, GLOBALS, GLTFSkin::inverse_bind, GLTFSkin::joints, Globals::mesh_nodes, AssetInstance::node_count, AssetInstance::node_indices, AssetInstance::skin_count, AssetInstance::skin_indices, and Globals::skins.
Referenced by destroy_asset_instance(), execute_globals_undo(), and render_asset_instance_menu().
| void init_player_PC | ( | PhysicsComponent * | pc, |
| Player * | player ) |
Definition at line 454 of file init.c.
References mat3::a0, mat3::a1, mat3::a2, PhysicsComponent::angular_velocity, mat3::b0, mat3::b1, mat3::b2, mat3::c0, mat3::c1, mat3::c2, PhysicsComponent::center_of_mass, Player::height, init_player_PC(), PhysicsComponent::inverse_inertia, PhysicsComponent::mass, PhysicsComponent::mu, player, PhysicsComponent::player_pc, Player::radius, PhysicsComponent::restitution, and PhysicsComponent::vel.
Referenced by init_player(), and init_player_PC().
| void init_player | ( | ) |
Definition at line 485 of file init.c.
References ConvexHull::aabb, Mesh::aabb, calculate_aabb_bounds(), cam, Player::cam, Camera::cam_data, CamData::cam_pos, CAST_VEC, AABB::center, ConvexHull::centroid, compute_mesh_hulls(), Spring::damp, Spring::damp_rot, PhysicsComponent::ent, AABB::extents, ConvexHull::faces, PhysicsComponent::free, Player::height, Skeleton::hip_height, Mesh::hulls, incremental_hull(), init_player(), init_player_PC(), init_vector(), Skeleton::left_leg, Skeleton::lower_leg_length, MAX_PHYSICS_COMPONENTS, Player::mesh, Skeleton::neck, Skeleton::neck_height, Skeleton::neck_pelvis_diff, Player::pc, Skeleton::pelvis, Skeleton::pelvis_height, Skeleton::pelvis_hip_diff, PHYSICS_COMPONENTS, player, LegIK::pos, Player::pos, Spring::pos, Player::radius, Skeleton::right_leg, Player::skeleton, spawn_point, Spring::stiff, Spring::stiff_rot, Spring::target, Skeleton::upper_leg_length, vec3_add(), vec3_mul(), vector_expand(), Spring::velocity, ConvexHull::vertices, vec3::x, vec4::x, vec3::y, vec4::y, vec3::z, and vec4::z.
Referenced by init(), and init_player().
Definition at line 589 of file init.c.
References BVHNode::aabb, TriGPU::bvh_index, Mesh::bvh_indices, CAST_VEC, AABB::center, BVHNode::count, Vector::count, AABB::extents, BVHNode::first_index, GPU_unwrap_mesh_to_buffers(), Mesh::id, BVHNode::index, MeshFace::indices, TriGPU::indices, BVHNode::left, MeshFace::material_id, TriGPU::material_id, AABB::max_x, AABB::max_y, AABB::max_z, TriGPU::mesh_id, AABB::min_x, AABB::min_y, AABB::min_z, n, BVHNode::next, Mesh::nodes, MeshFace::normal, Point::normal, TriGPU::normal, VertexGPU::normal, BVHNode::parent, Point::pos, VertexGPU::pos, BVHNode::right, TriGPU::tri_idx, Mesh::tris, Point::uv, VertexGPU::uv, TriGPU::v0, TriGPU::v1, TriGPU::v2, vector_expand(), Mesh::vertices, uvec3::x, uvec3::y, and uvec3::z.
Referenced by GPU_unwrap_mesh_to_buffers(), and GPU_upload_scene_data().
| void GPU_upload_scene_data | ( | ) |
Uploads current Globals and SceneData structures to the GPU for baking SSBOs.
Definition at line 661 of file init.c.
References BVHNode::aabb, Vector::buffer, MeshGPU::bvh_index, SceneData::bvh_indices, SceneData::bvh_indices_count, SceneData::bvh_nodes, CAST_VEC, AABB::center, BVHNode::count, Vector::count, AABB::extents, BVHNode::first_index, MeshNode::free, MeshGPU::global_matrix, MeshNode::global_matrix, GLOBALS, GPU_unwrap_mesh_to_buffers(), GPU_upload_scene_data(), init_vector(), MeshGPU::is_static, BVHNode::left, m4_inverse(), AABB::max_x, AABB::max_y, AABB::max_z, MeshNode::mesh, MESH_BVH_DATA, MESH_BVH_SSBO, MESH_DATA, MeshGPU::mesh_id, MeshGPU::mesh_node_id, Globals::mesh_nodes, MESH_SSBO, Globals::meshes, MeshData::meshes, AABB::min_x, AABB::min_y, AABB::min_z, n, BVHNode::next, MeshGPU::node_count, MeshGPU::node_offset, BVHGPU::nodes, BVHNode::parent, BVHNode::right, SCENE_BVH_DATA, SCENE_BVH_SSBO, Globals::scene_data, MeshGPU::skip_directional_light, MeshNode::skip_directional_uv_lighting, Mesh::static_mesh, MeshGPU::tri_count, TRI_DATA, MeshGPU::tri_offset, TRI_SSBO, TriData::tris, MeshGPU::vertex_count, VERTEX_DATA, MeshGPU::vertex_offset, VERTEX_SSBO, and VertexData::vertices.
Referenced by execute_globals_undo(), GPU_upload_scene_data(), main(), render_light_menu(), render_main_menu(), scene_load(), and scene_load_volumes().
| void GPU_init_cluster_aabbs | ( | ) |
Initializes AABBs on the GPU for clustered forward shading.
Definition at line 778 of file init.c.
References GPU_init_cluster_aabbs(), GRID_X, GRID_Y, GRID_Z, INIT_CLUSTER_AABBS_SHADER, RENDER_HEIGHT, RENDER_WIDTH, VIEW_FAR, and VIEW_NEAR.
Referenced by GPU_init_cluster_aabbs(), and main().
| void init_default_textures | ( | ) |
Initializes dummy default textures inside of Globals.images that are used as fallback for empty Materials.
Definition at line 794 of file init.c.
References Image::buf, Image::channels, Vector::count, DEFAULT_ARM, DEFAULT_DIFFUSE, DEFAULT_EMISSIVE, DEFAULT_NORMAL, DUMMY_LIGHTMAP, GLOBALS, Image::handle, Image::height, Image::i, Globals::images, init_default_textures(), Image::path, vector_expand(), and Image::width.
Referenced by init_default_textures(), and init_globals().
| bool init_globals | ( | ) |
<The maximum amount of Manifolds in MANIFOLDS.
Definition at line 920 of file init.c.
References Manifold::a, Material::absorption_coefficients, EditorSettings::ACES, add_image_to_registry(), ANIMATION_COMPONENTS, EditorSettings::ao_iterations, EditorSettings::ao_threshold, SceneData::APV_FILE, Material::arm_tex, asset_dir, ASSET_INSTANCES, Globals::assets, PhysicsComponent::at_rest, AUDIO_EMITTERS, AUDIO_NUM_BANDS, Globals::audio_portals, EditorSettings::audio_probe_bounces, EditorSettings::audio_probe_iterations, SceneData::audio_probe_volumes, Globals::audio_probes, AW, Manifold::b, EditorSettings::BLOOM, Vector::buffer, SceneData::bvh_indices, SceneData::bvh_nodes, AABB::center, AnimationTrack::completion_data, create_entity(), AnimationTrack::data, DEFAULT_ARM, DEFAULT_DIFFUSE, DEFAULT_EMISSIVE, DEFAULT_NORMAL, DEPTH_PRE_PASS_SHADER, Material::diffuse_tex, Light::dir, DIRECTIONAL_LIGHT, DIRECTIONAL_MAP_NORMALIZE_SHADER, EditorSettings::DOF, EditorSettings::DOF_focal_length, EditorSettings::DOF_fstop, EditorSettings::DOF_max_blur_radius, EditorSettings::DOF_sensor_height, DYNAMIC_SHADER, EditorSettings::editor_mode, EDITOR_SETTINGS, Material::emissive_tex, ENTITIES, Light::entity_id, EW, AABB::extents, AnimationComponent::free, AssetInstance::free, AudioEmitter::free, Entity::free, Manifold::free, PhysicsComponent::free, EditorSettings::FULL_GBUFFER, Material::fwd_shader, Material::gbuffer_shader, GBUFFER_VERSIONS, GLOBALS, AssetInstance::id, AudioEmitter::id, Entity::id, PhysicsComponent::id, Globals::images, LightBVH::indices, init_default_textures(), init_globals(), init_new_material(), init_vector(), Light::intensity, LightmapData::islands, SceneData::light_bvh, Light::light_type, SceneData::lighting_probe_volumes, LIGHTMAP_BOUNCE_SHADER, LIGHTMAP_DATA, SceneData::lightmap_data, LIGHTMAP_DENOISE_SHADER, LIGHTMAP_DILATE_SHADER, LIGHTMAP_SHADER, Globals::lights, LightBVH::lights, Globals::lights_dirty, EditorSettings::lm_aabb, EditorSettings::lm_iterations, SceneData::LOADED_AUDIO_PV, SceneData::LOADED_AUDIO_PV_FLAG, SceneData::LOADED_LIGHTING_PV, SceneData::LOADED_LIGHTING_PV_FLAG, SceneData::LPV_FILE, LPV_SLOTS, EditorSettings::LUT, MANIFOLDS, Globals::materials, MAX_ANIMATION_COMPONENTS, MAX_ASSET_INSTANCES, MAX_AUDIO_EMITTERS, MAX_AUDIO_PROBE_VOLUMES, MAX_ENTITIES, MAX_LIGHTS_PER_MESH, MAX_MANIFOLDS, MAX_MESH_NODES, MAX_PHYSICS_COMPONENTS, MAX_PORTALS, MAX_TRACKS, EditorSettings::MBLUR, MESH_BVH_DATA, MESH_DATA, Globals::mesh_light_indices, Globals::meshes, MeshData::meshes, EditorSettings::mfactor, EditorSettings::mfactor_enabled, AStarWorkspace::min_heap, MN_INIT(), Material::mr_tex, EditorSettings::MSAA, Globals::msaa_samples, Font::name, BVHGPU::nodes, LightBVH::nodes, EditorSettings::NOISE, Material::normal_tex, AStarWorkspace::path, AStarWorkspace::path_count, PHYSICS_COMPONENTS, POINT_LIGHT, POINT_LIGHT_SHADOW_SHADER, Light::pos, POSTPROCESS_SHADER, PROBE_BAKE_SHADER, EditorSettings::probe_iterations, Globals::probe_spacing, Globals::probe_tex_size, PROBE_UNPACK_SHADER, PROBE_VOLUME_DEPTH, PROBE_VOLUME_HEIGHT, PROBE_VOLUME_WIDTH, ShaderProgram::program, read_json_msdf(), SceneData::reflection_probes, EditorSettings::render_framerate_target, EditorSettings::reverb_wet, Light::rgb, rprobe_dir, Material::scattering_coefficients, SCENE_BVH_DATA, Globals::scene_data, EditorSettings::selected_audio_emitter_id, EditorSettings::selected_r_probe, EditorSettings::SELMODE, SELMODE_LIGHT, SHADOW_MAP_SHADER, SKIN_INIT(), SKY_SHADER, Light::sm_dirty, EditorSettings::SSAO, SSAO_BLUR_SHADER, SSAO_SHADER, EditorSettings::SSR, SSR_BLUR_SHADER, SSR_SHADER, AStarWorkspace::stack, EditorSettings::TAA, EditorSettings::texels_per_uv_unit, TEXT_SHADER, Font::texture, Light::threshold, AnimationComponent::track_count, AnimationComponent::tracks, TRI_DATA, TriData::tris, UBERSHADER_VERSIONS, EditorSettings::UI, EditorSettings::undo_stack_max_byte_size, LightmapSSBO::uvs, vec3_normalize(), vector_expand(), VERTEX_DATA, Globals::vertex_layouts, VertexData::vertices, WIREFRAME_SHADER, and EditorSettings::wireframe_toggled.
Referenced by init(), and init_globals().
| bool init_vertex_layouts | ( | ) |
Definition at line 1159 of file init.c.
References VertexLayout::current_capacity, VertexLayout::current_index_capacity, VertexLayout::current_index_offset, VertexLayout::current_offset, VertexLayout::ebo, GLOBALS, init_vector(), init_vertex_layouts(), MAIN_EBO, MAIN_VAO, MAIN_VBO, VertexLayout::meshes, VertexLayout::vao, VertexLayout::vbo, vector_expand(), and Globals::vertex_layouts.
Referenced by init(), and init_vertex_layouts().
| void precompute_fbm_texture | ( | ) |
Definition at line 1184 of file init.c.
References fbm(), fbm_tex, FBM_TEXTURE, FBM_TEXTURE_SIZE, precompute_fbm_texture(), vec3_scale(), vec3::x, vec3::y, and vec3::z.
Referenced by init(), and precompute_fbm_texture().
| void precompute_ssao_kernel | ( | ) |
Definition at line 1219 of file init.c.
References lerp(), precompute_ssao_kernel(), rand(), SSAO_KERNEL, vec3_normalize(), vec3_scale(), and vec3_to_vec4().
Referenced by init(), and precompute_ssao_kernel().
| int generate_gl_texture | ( | GLTexture | tex | ) |
Definition at line 1243 of file init.c.
References GLTexture::d, DEPTH_MODE_HW, DEPTH_MODE_NO_HW, DEPTH_MODE_NONE, GLTexture::dm, GLTexture::fixed_sample_locations, GLTexture::format, generate_gl_texture(), GLTexture::h, GLTexture::internal_format, GLTexture::levels, GLTexture::mag_filter, GLTexture::min_filter, GLTexture::samples, GLTexture::target, GLTexture::type, GLTexture::w, GLTexture::wrap_r, GLTexture::wrap_s, and GLTexture::wrap_t.
Referenced by change_fbo_resolution(), generate_gl_texture(), and init_gl_texture().
| GLTexture init_gl_texture | ( | GLenum | target, |
| GLint | internal_format, | ||
| GLenum | format, | ||
| GLenum | type, | ||
| GLint | min_filter, | ||
| GLint | mag_filter, | ||
| GLint | wrap_s, | ||
| GLint | wrap_t, | ||
| GLint | wrap_r, | ||
| int | w, | ||
| int | h, | ||
| int | d, | ||
| int | levels, | ||
| DepthMode | dm ) |
Definition at line 1288 of file init.c.
References GLTexture::d, GLTexture::dm, GLTexture::fixed_sample_locations, GLTexture::format, generate_gl_texture(), GLTexture::h, GLTexture::i, init_gl_texture(), GLTexture::internal_format, GLTexture::levels, GLTexture::mag_filter, GLTexture::min_filter, GLTexture::multisampled, GLTexture::samples, GLTexture::target, GLTexture::type, GLTexture::w, GLTexture::wrap_r, GLTexture::wrap_s, and GLTexture::wrap_t.
Referenced by allocate_gbuffer(), allocate_gbuffer_msaa(), allocate_main_fbo(), init(), and init_gl_texture().
| void init_fbo | ( | Framebuffer * | fbo | ) |
Definition at line 1318 of file init.c.
References Framebuffer::depth_rbo, Framebuffer::depth_texture, Framebuffer::fbo, GLRenderbuffer::i, GLTexture::i, init_fbo(), Framebuffer::rbo_count, Framebuffer::renderbuffers, GLTexture::target, Framebuffer::texture, and Framebuffer::texture_count.
Referenced by allocate_gbuffer(), allocate_gbuffer_msaa(), allocate_main_fbo(), change_fbo_resolution(), init(), and init_fbo().
| void change_fbo_resolution | ( | Framebuffer * | fbo, |
| int | w, | ||
| int | h, | ||
| bool | skip_depth ) |
Changes Framebuffer's resolution, and deletes the old textures.
| fbo | The Framebuffer that changes. |
| w | The width. |
| h | The height. |
| skip_depth | If depth texture needs to also change. |
Definition at line 1361 of file init.c.
References change_fbo_resolution(), Framebuffer::depth_texture, Framebuffer::fbo, generate_gl_texture(), Framebuffer::h, GLTexture::h, GLTexture::i, init_fbo(), Framebuffer::texture, Framebuffer::texture_count, Framebuffer::w, and GLTexture::w.
Referenced by change_bloom_res(), change_dof_res(), change_fbo_resolution(), change_render_resolution(), and change_ssao_res().
| void init_sdl_audio | ( | ) |
Definition at line 1387 of file init.c.
References AUDIO_ENGINE, estimated_frame_count, init_sdl_audio(), SDL_AUDIO_DEVICE, and SDLAudioCallback().
Referenced by init(), and init_sdl_audio().
| void convolver_node_process_pcm_frames | ( | ma_node * | pNode, |
| const float ** | ppFramesIn, | ||
| ma_uint32 * | pFrameCountIn, | ||
| float ** | ppFramesOut, | ||
| ma_uint32 * | pFrameCountOut ) |
Definition at line 1409 of file init.c.
References ConvolverNode::AUDIO_HISTORY, ConvolverNode::block_size, ConvolverNode::bwd_plan, ConvolverNode::complex_len, CONVOLVER_NODE, convolver_node_process_pcm_frames(), CROSSFADE_FRAMES, ConvolverNode::crossfade_pos, ConvolverNode::crossfading, EDITOR_SETTINGS, fft_channels(), HRTFThreadData::FRONT, ConvolverNode::history_head, HRTF_TD, ConvolverNode::ir, HRTFThreadData::ir_swap_lock, ConvolverNode::LEFT_OUT, NUM_PARTITIONS, NUM_PARTITIONS_MAX, ConvolverNode::padded_len, ConvolverNode::prev_ir, ConvolverNode::PREV_LEFT_OUT, ConvolverNode::PREV_RIGHT_OUT, ConvolverNode::PREV_SUM_L, ConvolverNode::PREV_SUM_R, ConvolverNode::PREV_TAIL_LEFT, ConvolverNode::PREV_TAIL_RIGHT, EditorSettings::reverb_wet, ConvolverNode::RIGHT_OUT, ConvolverNode::SUM_L, ConvolverNode::SUM_R, ConvolverNode::TAIL_LEFT, ConvolverNode::tail_len, ConvolverNode::TAIL_RIGHT, EditorSettings::volume, and X.
Referenced by convolver_node_process_pcm_frames().
| void init_audio_scratch_buffers | ( | ) |
Definition at line 1601 of file init.c.
References AudioScratchBuffers::aprobe_mutex, ConvolverNode::AUDIO_HISTORY, AUDIO_SCRATCH, AudioScratchBuffers::block_size, ConvolverNode::block_size, AudioScratchBuffers::bwd_plan, ConvolverNode::bwd_plan, AudioScratchBuffers::complex_len, ConvolverNode::complex_len, CONVOLVER_NODE, AudioScratchBuffers::fwd_plan, ConvolverNode::fwd_plan, ConvolverNode::history_head, AudioScratchBuffers::HRTF_IR_IN, HRTF_TD, init_audio_scratch_buffers(), init_hrtf_worker_thread(), ConvolverNode::ir, ConvolverNode::LEFT_OUT, ConvolverNode::MONO_FWD, NUM_PARTITIONS_MAX, AudioScratchBuffers::padded_len, ConvolverNode::padded_len, ConvolverNode::prev_ir, ConvolverNode::PREV_LEFT_OUT, ConvolverNode::PREV_RIGHT_OUT, ConvolverNode::PREV_SUM_L, ConvolverNode::PREV_SUM_R, ConvolverNode::PREV_TAIL_LEFT, ConvolverNode::PREV_TAIL_RIGHT, ConvolverNode::RIGHT_OUT, ConvolverNode::SUM_L, ConvolverNode::SUM_R, ConvolverNode::TAIL_LEFT, ConvolverNode::tail_len, and ConvolverNode::TAIL_RIGHT.
Referenced by init(), and init_audio_scratch_buffers().
| void deallocate_fbo | ( | Framebuffer * | fbo | ) |
Definition at line 1671 of file init.c.
References deallocate_fbo(), Framebuffer::depth_rbo, Framebuffer::depth_texture, Framebuffer::fbo, GLRenderbuffer::i, GLTexture::i, Framebuffer::rbo_count, Framebuffer::renderbuffers, Framebuffer::texture, and Framebuffer::texture_count.
Referenced by allocate_gbuffer(), allocate_gbuffer_msaa(), allocate_main_fbo(), and deallocate_fbo().
| void init_gl_renderbuffer | ( | GLRenderbuffer * | rbo, |
| GLint | internal_format, | ||
| GLsizei | w, | ||
| GLsizei | h, | ||
| bool | multisampled, | ||
| int | samples ) |
Definition at line 1694 of file init.c.
References GLRenderbuffer::h, GLRenderbuffer::i, init_gl_renderbuffer(), GLRenderbuffer::internal_format, GLRenderbuffer::multisampled, GLRenderbuffer::samples, samples, and GLRenderbuffer::w.
Referenced by allocate_gbuffer_msaa(), allocate_main_fbo(), and init_gl_renderbuffer().
| void allocate_main_fbo | ( | ) |
Allocates the main FBO, changes if MSAA is enabled.
Definition at line 1711 of file init.c.
References allocate_main_fbo(), deallocate_fbo(), DEPTH_MODE_NONE, Framebuffer::depth_rbo, GLOBALS, Framebuffer::h, init_fbo(), init_gl_renderbuffer(), init_gl_texture(), MAIN_FBO, MAIN_RESOLVE_FBO, Globals::msaa_samples, Framebuffer::rbo_count, RENDER_HEIGHT, RENDER_WIDTH, Framebuffer::renderbuffers, Framebuffer::texture, Framebuffer::texture_count, and Framebuffer::w.
Referenced by allocate_main_fbo(), change_render_resolution(), init(), and render_main_menu().
| void allocate_gbuffer_msaa | ( | ) |
Allocated a gbuffer with multisampled textures.
Definition at line 1769 of file init.c.
References allocate_gbuffer_msaa(), deallocate_fbo(), DEPTH_MODE_NO_HW, DEPTH_MODE_NONE, Framebuffer::depth_rbo, Framebuffer::depth_texture, GBUFFER_FBO, GBUFFER_RESOLVE_FBO, GLOBALS, GVEL, Framebuffer::h, init_fbo(), init_gl_renderbuffer(), init_gl_texture(), Globals::msaa_samples, Framebuffer::rbo_count, RENDER_HEIGHT, RENDER_WIDTH, Framebuffer::renderbuffers, Framebuffer::texture, Framebuffer::texture_count, and Framebuffer::w.
Referenced by allocate_gbuffer_msaa(), change_render_resolution(), init(), and render_main_menu().
| void allocate_gbuffer | ( | ) |
Allocates a gbuffer without multisampled textures.
Definition at line 1844 of file init.c.
References allocate_gbuffer(), deallocate_fbo(), DEPTH_MODE_NO_HW, DEPTH_MODE_NONE, Framebuffer::depth_texture, GALBEDO, GBUFFER_FBO, GBUFFER_RESOLVE_FBO, GEXTRA, GNORMAL, GPOMDEPTH, GUV, GVEL, Framebuffer::h, init_fbo(), init_gl_texture(), RENDER_HEIGHT, RENDER_WIDTH, Framebuffer::texture, Framebuffer::texture_count, and Framebuffer::w.
Referenced by allocate_gbuffer(), init(), and render_main_menu().
| bool init | ( | SDL_Window ** | window, |
| SDL_GLContext * | context ) |
Initializes the engine, including SDL, OpenGL, GLEW, Nuklear, and engine-specific systems.
| window | SDL Window. |
| context | SDL Context. |
Definition at line 1987 of file init.c.
References allocate_gbuffer(), allocate_gbuffer_msaa(), allocate_main_fbo(), AUDIO_ENGINE, BAND_IMPULSES, ConvolverNode::base, bind_render_ssbos(), BLENDED_RPROBE_CUBE_MAP, BLOOM_HEIGHT, BLOOM_PYRAMID, BLOOM_WIDTH, BOKEH_FBO, BRDF_FBO, BRDF_LUT, BRDF_SHADER, BUFFER_FRAMES, CAM_UBO, cam_ubo_padded, cam_ubo_ptr, CLUSTER_AABB_SSBO, CLUSTER_SSBO, COC_FBO, COLOR_GRADE_LUT, CONVOLVE_TRIANGLE_VAO, CONVOLVE_TRIANGLE_VBO, CONVOLVER_NODE, DEBUG_LINES_MAX, DEFAULT_POINT_LIGHT_SHADOWS_SIZE, DEFAULT_SHADOW_MAP_SIZE, DEPTH_DOWNSAMPLE_FBO, DEPTH_MODE_HW, DEPTH_MODE_NONE, Framebuffer::depth_rbo, Framebuffer::depth_texture, DOF_HEIGHT, DOF_WIDTH, EDITOR_SETTINGS, FBM_TEXTURE, FBM_TEXTURE_SIZE, Framebuffer::fbo, FILE_DIR_REGISTRY_INIT(), FONTS_INIT(), FOOTSTEP_EMITTER, FS_VAO, GBUFFER_FBO, GBUFFER_RESOLVE_FBO, GLOBAL_INSTANCE_SSBO, GLOBAL_LIGHT_INDICES_SSBO, Framebuffer::h, HISTORY_FBO, HISTORY_TEXTURE, HRTF_TD, GLRenderbuffer::i, GLTexture::i, INDIRECT_ARRAYS_COMMAND_BUFFER, INDIRECT_ARRAYS_COMMAND_BUFFER_OUT, indirect_arrays_out_ptr, indirect_arrays_ptr, INDIRECT_ELEMENTS_COMMAND_BUFFER, INDIRECT_ELEMENTS_COMMAND_BUFFER_OUT, indirect_elements_out_ptr, indirect_elements_ptr, init(), init_action_callbacks(), init_audio_scratch_buffers(), init_band_kernels(), init_emitter(), init_fbo(), init_gl_texture(), init_globals(), init_hover_callbacks(), init_player(), init_sdl_audio(), init_vertex_layouts(), INSTANCE_SSBO, instance_ssbo_ptr, instance_ssbo_size, INSTANCE_VBO, instance_vbo_ptr, instance_vbo_size, HRTFThreadData::ir_swap_lock, JOINT_SSBO, joint_ssbo_ptr, joint_ssbo_size, LIGHT_CAM_UBO, light_cam_ubo_padded, light_cam_ubo_ptr, LIGHT_SSBO, light_ssbo_ptr, light_ssbo_size, LIGHTMAP_FBO, LIGHTMAP_HEIGHT, LIGHTMAP_ID_TEXTURE, LIGHTMAP_NORM_TEXTURE, LIGHTMAP_POS_TEXTURE, LIGHTMAP_SSBO, LIGHTMAP_VAO, LIGHTMAP_VBO, LIGHTMAP_WIDTH, load_3d_lut(), load_cubemap(), load_hrtf_from_binary(), ConvolverNode::lock, LPV_SLOTS, LPV_TEXTURE, MAIN_EBO, MAIN_FBO, MAIN_RESOLVE_FBO, MAIN_VAO, MAIN_VBO, MATERIAL_SSBO, MAX_DIRECTIONAL_LIGHTS, MAX_INSTANCES, MAX_JOINT_MATRICES, MAX_LIGHTS, MAX_LIGHTS_PER_CLUSTER, MAX_LIGHTS_PER_MESH, MAX_MESH_NODES, MAX_POINT_LIGHT_SHADOWS_CMA, MAX_RPROBE_MIPS, MAX_TEXT_BOX_CHARACTERS, MAX_TEXT_BOXES, MAX_UI_ELEMENTS, MESH_BVH_SSBO, MESH_LIGHT_SSBO, mesh_light_ssbo_ptr, mesh_light_ssbo_size, MESH_NODE_SSBO, mesh_node_ssbo_ptr, mesh_node_ssbo_size, MESH_SSBO, EditorSettings::MSAA, my_custom_node_vtable, NK_CTX, play_emitter(), POINT_LIGHT_SHADOWS_FBO, precompute_fbm_texture(), precompute_ssao_kernel(), PROBE_SSBO, PROBE_VOLUME_DEPTH_PADDED, PROBE_VOLUME_HEIGHT, PROBE_VOLUME_UBO, probe_volume_ubo_padded, probe_volume_ubo_ptr, PROBE_VOLUME_WIDTH, ShaderProgram::program, rand(), Framebuffer::rbo_count, RENDER_HEIGHT, RENDER_UBO, RENDER_WIDTH, RPROBE_BACK_FBO, RPROBE_BACK_TEXTURE, RPROBE_CUBE_MAP_ARRAY, RPROBE_DEPTH_TEXTURE, RPROBE_FBO, RPROBE_HEIGHT, RPROBE_SSBO, RPROBE_UBO, rprobe_ubo_padded, rprobe_ubo_ptr, RPROBE_WIDTH, SCENE_BVH_SSBO, SCREEN_HEIGHT, SCREEN_WIDTH, SDL_AUDIO_DEVICE, SH_MAX, SHADERS_INIT(), SHADOW_MAP_FBO, SKY_VAO, SKY_VBO, SKYBOX, SOBEL_FBO, SOBEL_TEXTURE, SSAO_BLUR_FBO, SSAO_FBO, SSAO_HEIGHT, SSAO_KERNEL, SSAO_KERNEL_SIZE, SSAO_KERNEL_UBO, SSAO_NOISE_TEXTURE, SSAO_WIDTH, SSR_BLUR_FBO, SSR_FBO, SSR_HEIGHT, SSR_WIDTH, STATES_INIT(), TAA_FBO, TEMP_RPROBE_CUBE_MAP, TEXT_BOX_SSBO, text_box_ssbo_ptr, text_box_ssbo_size, TEXT_EBO, TEXT_FBO, TEXT_HEIGHT, TEXT_VAO, TEXT_VBO, text_vbo_size, TEXT_WIDTH, Framebuffer::texture, Framebuffer::texture_count, TOTAL_CLUSTERS, TRI_SSBO, UI_INIT(), UI_INSTANCE_VBO, ui_instance_vbo_ptr, ui_instance_vbo_size, UI_SSBO, ui_ssbo_ptr, ui_ssbo_size, UI_VAO, UI_VBO, ui_vbo_ptr, ui_vbo_size, UNDO_INIT(), VERTEX_SSBO, Framebuffer::w, window, WIREFRAME_VAO, and WIREFRAME_VBO.
| vec3* fbm_tex = NULL |
Definition at line 1180 of file init.c.
Referenced by precompute_fbm_texture().
| int estimated_frame_count = 0 |
Definition at line 1386 of file init.c.
Referenced by init_sdl_audio().
| ma_node_vtable my_custom_node_vtable |
Definition at line 1592 of file init.c.
Referenced by init().