This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <string_view> | |
| #include <iostream> | |
| void message(std::string_view sv) { | |
| std::cout << sv; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmake_minimum_required(VERSION 3.12 FATAL_ERROR) | |
| set(AUDEO_DEPENDENCIES_FOLDER_NAME "dependencies") | |
| set(DEBUG_OUTPUT_DIRECTORY "bin/debug") | |
| set(RELEASE_OUTPUT_DIRECTORY "bin/release") | |
| project(audeo) | |
| enable_language(CXX) | |
| set(CMAKE_CXX_EXTENSIONS OFF) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #version 430 core | |
| #define MAX_LIGHTS_PER_TYPE 15 | |
| in vec2 TexCoords; | |
| in vec3 Normal; | |
| in vec3 FragPos; | |
| in vec4 FragPosLightSpace; | |
| struct PointLight { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template<typename AssetT> | |
| void display_preview(AssetT& asset, ImVec2 size) { | |
| // Default preview: an image saying no preview is available | |
| Resource<Texture> no_preview_tex = AssetManager<Texture>::get_resource( | |
| "config/resources/textures/no_preview.tex", true); | |
| ImGui::Image(reinterpret_cast<ImTextureID>(no_preview_tex->handle()), size); | |
| } | |
| template<> | |
| void display_preview(AssetManager<Texture>::Asset& asset, ImVec2 size) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ! | |
| ! Copyright 1993, 1995, 1998 The Open Group | |
| ! Permission to use, copy, modify, distribute, and sell this software and its | |
| ! documentation for any purpose is hereby granted without fee, provided that | |
| ! the above copyright notice appear in all copies and that both that | |
| ! copyright notice and this permission notice appear in supporting | |
| ! documentation. | |
| ! | |
| ! The above copyright notice and this permission notice shall be |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct vec2 { | |
| float x, y; | |
| float magnitude() const { | |
| return std::sqrt(x * x + y * y); | |
| } | |
| vec2 normalized() const { | |
| float mag = magnitude(); | |
| return {x / mag, y / mag}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static void generate_chunk_lod(HeightmapTerrain& terrain, HeightmapTerrain::Chunk& chunk, HeightmapTerrainInfo const& info, | |
| size_t const lod_index, size_t const lod) { | |
| GridMeshOptions options; | |
| options.tex_w = terrain.width; | |
| options.tex_h = terrain.length; | |
| options.xoffset = chunk.xoffset; | |
| options.yoffset = chunk.yoffset; | |
| chunk.meshes[lod_index] = create_grid_mesh(chunk.width, chunk.length, lod, options); | |
| calculate_normals(terrain, chunk.meshes[lod_index]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "renderer/swap_buffer.hpp" | |
| #include <glad/glad.h> | |
| #include <iostream> | |
| namespace titan::renderer { | |
| SwapBuffer::SwapBuffer(unsigned int buffer_target, size_t max_byte_size) | |
| : target(buffer_target), size(max_byte_size) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "generators/heightmap_terrain.hpp" | |
| #include "generators/noise.hpp" | |
| #include "math.hpp" | |
| #include <thread> | |
| #include <iostream> | |
| namespace titan { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static void calculate_normals(HeightmapTerrain& terrain, GridMesh& mesh, size_t const offset) { | |
| // Loop over each face | |
| auto const& indices = mesh.indices; | |
| auto& vertices = mesh.vertices; | |
| size_t const vertex_size = mesh.vertex_size; | |
| for (size_t quad = 0; quad < indices.size(); quad += 6) { | |
| // Grab the verts of this quad | |
| size_t const v1_index = vertex_size * indices[quad]; | |
| size_t const v2_index = vertex_size * indices[quad + 1]; | |
| size_t const v3_index = vertex_size * indices[quad + 2]; |