|
Untitled
|
Saves and loads various files that store engine data. More...
#include "core/engine_types.h"Go to the source code of this file.
Functions | |||
| unsigned char * | open_image (Image *image) | ||
| Opens an image in bytes via stb. | |||
| GLuint | load_cubemap (const char *path) | ||
| Loads a cubemap in OpenGL naming convention (must be HDR). | |||
| GLuint | load_3d_lut (const char *filepath) | ||
| Loads a 3D LUT for postprocessing. | |||
| GLuint | load_texture (const char *path, GLint min_filter, GLint mag_filter, GLint wrap_s, GLint wrap_t, bool sRGB) | ||
| Loads a texture through OpenGL. | |||
| int | add_image_to_registry (char *filename, GLint min_filter, GLint mag_filter, GLint wrap_s, GLint wrap_t, bool sRGB) | ||
| Loads an adds an image to Globals.images. | |||
| void | scene_save (const char *name) | ||
| Saves an entire scene into separate files. | |||
| void | scene_load (const char *name) | ||
| Loads an entire scene from separate files in FileDirectoryRegistry directories. | |||
| void | scene_save_volumes (const char *name) | ||
| Saves only AudioProbes, AudioPortals, and ReflectionProbes. | |||
| void | scene_load_volumes (const char *name) | ||
| Loads only AudioProbes, AudioPortals, and ReflectionProbes. | |||
| void | reallocate_rprobe_array () | ||
| Reallocates RPROBE_CUBE_MAP_ARRAY to new dimensions or when loading. | |||
Saving and Loading Individual System Data | |||
Individual functions for loading specific systems. Useful for not touching the rest of the scene. | |||
| void | save_vector (const char *filename, Vector *vec) | ||
| void | load_vector (const char *filename, Vector *vec) | ||
| void | save_rprobes (const char *filename, Vector *vec) | ||
| void | load_rprobes (const char *filename, Vector *vec) | ||
| void | save_lprobes (const char *filename, Vector *vec) | ||
| void | load_lprobes (const char *filename, Vector *vec) | ||
| void | save_aportals (const char *filename, Vector *vec) | ||
| void | load_aportals (const char *filename, Vector *vec) | ||
| void | save_aprobes (const char *filename) | ||
| void | load_aprobes (const char *filename) | ||
Saving and Loading UI from Binary | |||
| |||
| void | save_ui (const char *name) | ||
| void | load_ui (const char *name) | ||
Saves and loads various files that store engine data.
Definition in file load.h.
| unsigned char * open_image | ( | Image * | image | ) |
Opens an image in bytes via stb.
| image | Pointer to Image. |
Definition at line 275 of file load.c.
References Image::channels, Image::height, open_image(), Image::path, and Image::width.
Referenced by open_image().
| GLuint load_cubemap | ( | const char * | path | ) |
Loads a cubemap in OpenGL naming convention (must be HDR).
| path | Path to cubemap folder. |
Definition at line 160 of file load.c.
References load_cubemap().
Referenced by init(), and load_cubemap().
| GLuint load_3d_lut | ( | const char * | filepath | ) |
Loads a 3D LUT for postprocessing.
| filePath | The path to the LUT. |
Definition at line 221 of file load.c.
References load_3d_lut().
Referenced by init(), and load_3d_lut().
| GLuint load_texture | ( | const char * | path, |
| GLint | min_filter, | ||
| GLint | mag_filter, | ||
| GLint | wrap_s, | ||
| GLint | wrap_t, | ||
| bool | sRGB ) |
Loads a texture through OpenGL.
| path | The path and name of the texture. |
| sRGB | Indicates if we load this as sRGB. |
Definition at line 19 of file load.c.
References load_texture(), and MIN.
Referenced by add_image_to_registry(), load_texture(), and scene_load().
| int add_image_to_registry | ( | char * | filename, |
| GLint | min_filter, | ||
| GLint | mag_filter, | ||
| GLint | wrap_s, | ||
| GLint | wrap_t, | ||
| bool | sRGB ) |
Loads an adds an image to Globals.images.
| filename | The name and path to the image. |
| sRGB | Indicates if we load this as sRGB. |
Definition at line 292 of file load.c.
References add_image_to_registry(), Image::buf, Image::channels, Vector::count, GLOBALS, Image::handle, Image::i, Globals::images, load_texture(), Image::path, Image::sRGB, and vector_expand().
Referenced by add_image_to_registry(), init_globals(), and load_gltf_texture().
| void scene_save | ( | const char * | name | ) |
Saves an entire scene into separate files.
| name | The name of the scene. |
Definition at line 502 of file load.c.
References Asset::aabb, AssetInstance::aabb, ConvexHull::aabb, Entity::aabb, Mesh::aabb, PhysicsComponent::aabb, SceneData::aabb, Material::absorption_coefficients, AnimationTrack::active, TriangleAdjacency::adjacent_indices, Material::alpha_cutoff, Material::alpha_mode, PhysicsComponent::angular_velocity, ANIM_TARGET_BOOL, ANIM_TARGET_FLOAT, ANIM_TARGET_INT, ANIM_TARGET_VEC3, ANIMATION_COMPONENTS, Asset::animation_count, Asset::animations, Material::ao_strength, Material::ao_tex, aportal_registry, aprobe_registry, Material::arm_tex, Animation::asset_id, Asset::asset_id, AssetInstance::asset_id, Mesh::asset_id, ASSET_INSTANCES, Globals::assets, PhysicsComponent::at_rest, LightmapData::atlas, AUDIO_NUM_BANDS, Globals::audio_portals, LightmapAtlas::block_size, Vector::buffer, Mesh::bvh_indices, SceneData::bvh_indices, SceneData::bvh_indices_count, SceneData::bvh_nodes, Mesh::bvh_prim, CAST_VEC, PhysicsComponent::cd, PhysicsComponent::center_of_mass, ConvexHull::centroid, Animation::channel_count, Animation::channels, AnimationSampler::count, Vector::count, AnimationTrack::current_time, AnimationTrack::data_byte_offset, AnimationTrack::data_index_offset, AnimationTrack::data_type, DEFAULT_TEXTURES, Material::diffuse_tex, FileDirectoryRegistry::directory, Material::double_sided, AnimationTrack::duration, AnimationSampler::elem_count, Material::emissive_strength, Material::emissive_tex, AnimationComponent::ent, PhysicsComponent::ent, ENTITIES, ConvexHull::faces, AssetInstance::first_skin, FONTS, AnimationComponent::free, AssetInstance::free, Entity::free, PhysicsComponent::free, Material::fwd_shader, Material::gbuffer_shader, GLOBALS, Font::glyph_count, Font::glyphs, LightmapAtlas::height, ConvexHull::hull_faces, Mesh::hulls, AssetInstance::id, Entity::id, Mesh::id, PhysicsComponent::id, Globals::images, LightBVH::indices, Entity::instance, AnimationSampler::interpolation, PhysicsComponent::inverse_inertia, PhysicsComponent::inverse_world, LightmapData::islands, Material::ka, Material::kd, Material::ke, AnimationTrack::kf, AnimationTrack::kf_count, Material::ks, SceneData::light_bvh, light_registry, SceneData::lightmap_data, lightmap_registry, Globals::lights, LightBVH::lights, AnimationTrack::loop, lprobe_registry, Image::mag_filter, PhysicsComponent::mass, Globals::materials, MAX_ANIMATION_COMPONENTS, MAX_ASSET_INSTANCES, MAX_ENTITIES, MAX_PHYSICS_COMPONENTS, Asset::mesh_indices, Entity::mesh_node, UVIsland::mesh_node, Globals::mesh_nodes, Globals::meshes, Material::metallic, Image::mime_type, Image::min_filter, Material::mr_tex, PhysicsComponent::mu, Animation::name, Image::name, Material::name, Mesh::name, SceneData::name, Globals::noclip, Asset::node_count, AssetInstance::node_count, Asset::nodes, LightBVH::nodes, Mesh::nodes, UVIsland::normal, Material::normal_scale, Material::normal_tex, LightmapAtlas::occupied, Asset::path, Image::path, Entity::pc, PHYSICS_COMPONENTS, PhysicsComponent::player_pc, Globals::probe_spacing, Globals::probe_tex_size, UVIsland::rect, SceneData::reflection_probes, PhysicsComponent::restitution, Material::roughness, rprobe_registry, LightmapData::sample_cubemap, Animation::sampler_count, Animation::samplers, save_aportals(), save_aprobes(), save_lightmap_to_binary(), save_rprobes(), save_vector(), Material::scattering_coefficients, scene_apv_registry, Globals::scene_data, scene_registry, scene_save(), Entity::skin, Asset::skin_count, AssetInstance::skin_count, Asset::skins, Globals::skins, Image::sRGB, Mesh::static_mesh, Mesh::submeshes, AnimationKeyframe::time, AnimationSampler::times, AnimationComponent::track_count, AnimationComponent::tracks, Mesh::tri_aabbs, Mesh::tri_adjacency, Mesh::tris, UVIsland::tris, AnimationTrack::type, UVIsland::uvs, AnimationKeyframe::val, AnimationSampler::values, PhysicsComponent::vel, ConvexHull::vertices, Mesh::vertices, LightmapAtlas::width, Globals::world_min, Globals::world_size, Image::wrap_s, Image::wrap_t, write_mesh_node(), and write_skin().
Referenced by render_main_menu(), and scene_save().
| void scene_load | ( | const char * | name | ) |
Loads an entire scene from separate files in FileDirectoryRegistry directories.
| name | The name of the scene. |
Definition at line 1262 of file load.c.
References Asset::aabb, AssetInstance::aabb, ConvexHull::aabb, Entity::aabb, Mesh::aabb, PhysicsComponent::aabb, SceneData::aabb, Material::absorption_coefficients, AnimationTrack::active, add_all_meshes_to_buffer(), add_all_text_boxes_to_draw_buffer(), TriangleAdjacency::adjacent_indices, Material::alpha_cutoff, Material::alpha_mode, PhysicsComponent::angular_velocity, ANIM_TARGET_BOOL, ANIM_TARGET_FLOAT, ANIM_TARGET_INT, ANIM_TARGET_VEC3, ANIMATION_COMPONENTS, Asset::animation_count, Asset::animations, Material::ao_strength, Material::ao_tex, aportal_registry, aprobe_registry, Material::arm_tex, Animation::asset_id, Asset::asset_id, AssetInstance::asset_id, Mesh::asset_id, ASSET_INSTANCES, Globals::assets, PhysicsComponent::at_rest, LightmapData::atlas, AUDIO_NUM_BANDS, Globals::audio_portals, LightmapAtlas::block_size, Image::buf, Vector::buffer, Mesh::bvh_indices, SceneData::bvh_indices, SceneData::bvh_indices_count, SceneData::bvh_nodes, Mesh::bvh_prim, Vector::capacity, CAST_VEC, PhysicsComponent::cd, PhysicsComponent::center_of_mass, ConvexHull::centroid, Animation::channel_count, Animation::channels, Image::channels, AnimationTrack::completion_data, AnimationSampler::count, Vector::count, create_performance_overlay(), AnimationTrack::current_time, AnimationTrack::data, AnimationTrack::data_byte_offset, AnimationTrack::data_index_offset, AnimationTrack::data_type, DEFAULT_TEXTURES, Material::diffuse_tex, FileDirectoryRegistry::directory, Material::double_sided, draw_dirty, AnimationTrack::duration, AnimationSampler::elem_count, Material::emissive_strength, Material::emissive_tex, AnimationComponent::ent, PhysicsComponent::ent, ENTITIES, ConvexHull::faces, GLTFSkin::final_mat, AssetInstance::first_skin, FONTS, AnimationComponent::free, AssetInstance::free, Entity::free, PhysicsComponent::free, free_mesh_node(), free_skin(), Material::fwd_shader, Material::gbuffer_shader, GLOBALS, Font::glyph_count, Font::glyphs, GPU_upload_scene_data(), Image::handle, LightmapAtlas::height, ConvexHull::hull_faces, Mesh::hulls, Image::i, Entity::id, Mesh::id, PhysicsComponent::id, Globals::images, LightBVH::indices, init_vector(), Entity::instance, AnimationSampler::interpolation, GLTFSkin::inverse_bind, PhysicsComponent::inverse_inertia, PhysicsComponent::inverse_world, LightmapData::islands, GLTFSkin::joints, Material::ka, Material::kd, Material::ke, AnimationTrack::kf, AnimationTrack::kf_count, Material::ks, SceneData::light_bvh, light_registry, SceneData::lightmap_data, lightmap_registry, Globals::lights, LightBVH::lights, load_aportals(), load_aprobes(), load_lightmap_from_binary(), load_rprobes(), load_texture(), load_vector(), AnimationTrack::loop, lprobe_registry, Image::mag_filter, PhysicsComponent::mass, Globals::materials, MAX_ANIMATION_COMPONENTS, MAX_ASSET_INSTANCES, MAX_ENTITIES, MAX_PHYSICS_COMPONENTS, Asset::mesh_indices, Entity::mesh_node, UVIsland::mesh_node, Globals::mesh_nodes, Globals::meshes, Material::metallic, Image::mime_type, Image::min_filter, Material::mr_tex, PhysicsComponent::mu, Animation::name, Image::name, Material::name, Mesh::name, SceneData::name, Globals::noclip, Asset::node_count, AssetInstance::node_count, Asset::nodes, LightBVH::nodes, Mesh::nodes, UVIsland::normal, Material::normal_scale, Material::normal_tex, LightmapAtlas::occupied, Asset::path, Image::path, Entity::pc, PHYSICS_COMPONENTS, PhysicsComponent::player_pc, Globals::probe_spacing, Globals::probe_tex_size, read_alloc_vector(), read_mesh_node(), read_skin(), read_vector(), reallocate_rprobe_array(), UVIsland::rect, SceneData::reflection_probes, PhysicsComponent::restitution, Material::roughness, rprobe_registry, LightmapData::sample_cubemap, Animation::sampler_count, Animation::samplers, Material::scattering_coefficients, scene_apv_registry, Globals::scene_data, scene_load(), scene_registry, Entity::skin, Asset::skin_count, AssetInstance::skin_count, Asset::skins, Globals::skins, Image::sRGB, Mesh::static_mesh, Mesh::submeshes, AnimationKeyframe::time, AnimationSampler::times, AnimationComponent::track_count, AnimationComponent::tracks, Mesh::tri_aabbs, Mesh::tri_adjacency, Mesh::tris, UVIsland::tris, AnimationTrack::type, upload_lights(), upload_material_data(), MeshNode::uv_map, UVIsland::uvs, AnimationKeyframe::val, AnimationSampler::values, PhysicsComponent::vel, Globals::vertex_layouts, ConvexHull::vertices, Mesh::vertices, LightmapAtlas::width, Globals::world_min, Globals::world_size, Image::wrap_s, and Image::wrap_t.
Referenced by render_main_menu(), and scene_load().
| void scene_save_volumes | ( | const char * | name | ) |
Saves only AudioProbes, AudioPortals, and ReflectionProbes.
| name | The name of the scene. |
Definition at line 2399 of file load.c.
References aportal_registry, aprobe_registry, Globals::audio_portals, FileDirectoryRegistry::directory, GLOBALS, light_registry, lightmap_registry, Globals::lights, lprobe_registry, SceneData::reflection_probes, rprobe_registry, save_aportals(), save_aprobes(), save_rprobes(), save_vector(), scene_apv_registry, Globals::scene_data, scene_registry, and scene_save_volumes().
Referenced by render_main_menu(), and scene_save_volumes().
| void scene_load_volumes | ( | const char * | name | ) |
Loads only AudioProbes, AudioPortals, and ReflectionProbes.
| name | The name of the scene. |
Definition at line 2452 of file load.c.
References aportal_registry, aprobe_registry, Globals::audio_portals, CAST_VEC, Vector::count, FileDirectoryRegistry::directory, GLOBALS, GPU_upload_scene_data(), light_registry, Light::light_type, lightmap_registry, Globals::lights, load_aportals(), load_aprobes(), load_rprobes(), load_vector(), lprobe_registry, reallocate_rprobe_array(), SceneData::reflection_probes, rprobe_registry, scene_apv_registry, Globals::scene_data, scene_load_volumes(), scene_registry, upload_lights(), and upload_material_data().
Referenced by render_main_menu(), and scene_load_volumes().
| void reallocate_rprobe_array | ( | ) |
Reallocates RPROBE_CUBE_MAP_ARRAY to new dimensions or when loading.
Definition at line 392 of file load.c.
References Vector::count, GLOBALS, MAX_RPROBE_MIPS, reallocate_rprobe_array(), SceneData::reflection_probes, RPROBE_CUBE_MAP_ARRAY, RPROBE_HEIGHT, RPROBE_WIDTH, and Globals::scene_data.
Referenced by load_rprobes(), reallocate_rprobe_array(), render_light_menu(), scene_load(), and scene_load_volumes().
| void save_vector | ( | const char * | filename, |
| Vector * | vec ) |
Definition at line 2517 of file load.c.
References Vector::buffer, Vector::count, save_vector(), and Vector::type_size.
Referenced by render_light_menu(), render_main_menu(), save_vector(), scene_save(), and scene_save_volumes().
| void load_vector | ( | const char * | filename, |
| Vector * | vec ) |
Definition at line 2529 of file load.c.
References load_vector(), read_vector(), and Vector::type_size.
Referenced by load_vector(), render_light_menu(), scene_load(), and scene_load_volumes().
| void save_rprobes | ( | const char * | filename, |
| Vector * | vec ) |
Definition at line 2543 of file load.c.
References Vector::buffer, Vector::count, save_rprobes(), and Vector::type_size.
Referenced by save_rprobes(), scene_save(), and scene_save_volumes().
| void load_rprobes | ( | const char * | filename, |
| Vector * | vec ) |
Definition at line 2555 of file load.c.
References load_rprobes(), read_vector(), reallocate_rprobe_array(), and Vector::type_size.
Referenced by load_rprobes(), render_main_menu(), scene_load(), and scene_load_volumes().
| void save_lprobes | ( | const char * | filename, |
| Vector * | vec ) |
Definition at line 2568 of file load.c.
References Vector::buffer, Vector::count, GLOBALS, SceneData::LPV_PATH, save_lprobes(), Globals::scene_data, and Vector::type_size.
Referenced by render_lprobe_menu(), and save_lprobes().
| void load_lprobes | ( | const char * | filename, |
| Vector * | vec ) |
Definition at line 2582 of file load.c.
References GLOBALS, load_lprobes(), SceneData::LPV_FILE, SceneData::LPV_PATH, read_vector(), reset_lighting_pvs(), Globals::scene_data, and Vector::type_size.
Referenced by load_lprobes(), and render_lprobe_menu().
| void save_aportals | ( | const char * | filename, |
| Vector * | vec ) |
Definition at line 2607 of file load.c.
References AudioPortal::adjacent_portals, Vector::buffer, CAST_VEC, Vector::count, AudioPortal::pos, and save_aportals().
Referenced by render_audio_menu(), save_aportals(), scene_save(), and scene_save_volumes().
| void load_aportals | ( | const char * | filename, |
| Vector * | vec ) |
Definition at line 2634 of file load.c.
References AudioPortal::adjacent_portals, Vector::buffer, Vector::capacity, CAST_VEC, Vector::count, init_vector(), load_aportals(), AudioPortal::pos, and Vector::type_size.
Referenced by load_aportals(), render_audio_menu(), scene_load(), and scene_load_volumes().
| void save_aprobes | ( | const char * | filename | ) |
Definition at line 2679 of file load.c.
References SceneData::APV_PATH, SceneData::audio_probe_volumes, Vector::buffer, Vector::count, GLOBALS, save_aprobes(), and Globals::scene_data.
Referenced by render_audio_menu(), save_aprobes(), scene_save(), and scene_save_volumes().
| void load_aprobes | ( | const char * | filename | ) |
Definition at line 2699 of file load.c.
References SceneData::APV_FILE, SceneData::APV_PATH, SceneData::audio_probe_volumes, GLOBALS, load_aprobes(), read_vector(), reset_audio_pvs(), and Globals::scene_data.
Referenced by load_aprobes(), render_audio_menu(), scene_load(), and scene_load_volumes().
| void save_ui | ( | const char * | name | ) |
Definition at line 315 of file load.c.
References CAST_VEC, UIMenu::containers, Vector::count, FileDirectoryRegistry::directory, UIMenu::elements, UIMenu::id, MAX_TEXT_BOXES, MAX_UI_CONTAINERS, MAX_UI_ELEMENTS, MENUS, save_ui(), TextBox::text, UIMenu::text_boxes, TextBox::text_cap, ui_registry, and UIMenu::uID.
Referenced by render_main_menu(), and save_ui().
| void load_ui | ( | const char * | name | ) |
Definition at line 348 of file load.c.
References Vector::buffer, Vector::capacity, CAST_VEC, UIMenu::containers, Vector::count, FileDirectoryRegistry::directory, UIMenu::elements, UIMenu::id, init_vector(), load_ui(), MAX_TEXT_BOXES, MAX_UI_CONTAINERS, MAX_UI_ELEMENTS, MENUS, TextBox::text, UIMenu::text_boxes, TextBox::text_cap, ui_registry, and UIMenu::uID.
Referenced by load_ui(), and render_main_menu().