From f5190745aed65b231e380fa3f25fce46d220dcbc Mon Sep 17 00:00:00 2001 From: omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Fri, 18 Oct 2024 12:55:02 +1100 Subject: removing some outdated docs files --- TODO.md | 4 +- archive/xmake.lua | 205 ++++++++++++++++++++++++++++++++++ bindgen/rust/celeritas-sys/src/lib.rs | 43 +++---- docs/getting-started.md | 7 -- docs/index.md | 2 +- docs/project-layout.md | 32 ------ include/celeritas.h | 95 ++++++++++++---- src/camera.c | 15 +++ src/mem.c | 2 +- src/scene.c | 26 +++++ xmake.lua | 205 ---------------------------------- 11 files changed, 347 insertions(+), 289 deletions(-) create mode 100644 archive/xmake.lua delete mode 100644 docs/getting-started.md delete mode 100644 docs/project-layout.md create mode 100644 src/camera.c create mode 100644 src/scene.c delete mode 100644 xmake.lua diff --git a/TODO.md b/TODO.md index aa01249..00fb831 100644 --- a/TODO.md +++ b/TODO.md @@ -4,9 +4,9 @@ - ~~compile shared lib~~ - compile and run tests - compile example -- [ ] Consolidate down to a handful of examples +- [x] Consolidate down to a handful of examples - [x] Get rid of doxygen - [ ] make format - [ ] Move to Vulkan-first rendering -- [ ] Build in pipeline (needs vulkan) +- [ ] Build in CI pipeline (needs vulkan) - [ ] Incorporate vma \ No newline at end of file diff --git a/archive/xmake.lua b/archive/xmake.lua new file mode 100644 index 0000000..3c05a70 --- /dev/null +++ b/archive/xmake.lua @@ -0,0 +1,205 @@ +-- set_project("celeritas") +-- set_version("0.1.0") +-- set_config("cc", "clang") + +-- add_rules("mode.debug", "mode.release") -- we have two modes: debug & release + +-- -- -Wall : base set of warnings +-- -- -Wextra : additional warnings not covered by -Wall +-- -- -Wundef : undefined macros +-- -- -Wdouble-promotion : catch implicit converion of float to double +-- add_cflags("-Wall", "-Wextra", "-Wundef", "-Wdouble-promotion") + +-- if is_mode("debug") then +-- add_cflags("-g") -- Add debug symbols in debug mode +-- add_defines("CDEBUG") +-- elseif is_mode("release") then +-- add_defines("CRELEASE") +-- end + +-- -- Platform defines and system packages +-- if is_plat("linux") then +-- add_defines("CEL_PLATFORM_LINUX") +-- add_syslinks("dl", "X11", "pthread") --, "vulkan") +-- elseif is_plat("windows") then +-- add_defines("CEL_PLATFORM_WINDOWS") +-- add_syslinks("user32", "gdi32", "kernel32", "shell32") +-- -- add_requires("vulkansdk", { system = true }) +-- -- add_links("pthreadVC2-w64") +-- elseif is_plat("macosx") then +-- add_defines("CEL_PLATFORM_MAC") +-- add_frameworks("Cocoa", "IOKit", "CoreVideo", "OpenGL") +-- add_frameworks("Foundation", "Metal", "QuartzCore") +-- set_runenv("MTL_DEBUG_LAYER", "1") +-- add_requires("vulkansdk", { system = true }) +-- -- add_syslinks("GL") +-- end + +-- -- Compile GLFW from source +-- package("local_glfw") +-- add_deps("cmake") +-- set_sourcedir(path.join(os.scriptdir(), "deps/glfw-3.3.8")) +-- on_install(function(package) +-- local configs = {} +-- -- NOTE(omni): Keeping these around as comments in case we need to modify glfw flags +-- -- table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) +-- -- table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) +-- import("package.tools.cmake").install(package, configs) +-- end) +-- on_test(function(package) +-- -- assert(package:has_cfuncs("add", {includes = "foo.h"})) +-- end) +-- package_end() + +-- add_requires("local_glfw") + +-- local core_sources = { +-- "deps/glad/src/glad.c", +-- "src/*.c", +-- "src/core/*.c", +-- "src/logos/*.c", +-- "src/maths/*.c", +-- "src/platform/*.c", +-- "src/ral/*.c", +-- "src/ral/backends/opengl/*.c", +-- "src/render/*.c", +-- "src/resources/*.c", +-- "src/std/*.c", +-- "src/std/containers/*.c", +-- "src/systems/*.c", +-- } + +-- local unity_sources = { +-- "deps/Unity/src/unity.c", +-- "deps/Unity/extras/fixture/src/unity_fixture.c", +-- "deps/Unity/extras/memory/src/unity_memory.c", +-- } + +-- rule("compile_glsl_vert_shaders") +-- set_extensions(".vert") +-- on_buildcmd_file(function(target, batchcmds, sourcefile, opt) +-- local targetfile = path.join(target:targetdir(), path.basename(sourcefile) .. ".vert.spv") + +-- print("Compiling shader: %s to %s", sourcefile, targetfile) +-- batchcmds:vrunv('glslc', { sourcefile, "-o", targetfile }) +-- -- batchcmds:add_depfiles(sourcefile) +-- end) + +-- rule("compile_glsl_frag_shaders") +-- set_extensions(".frag") +-- on_buildcmd_file(function(target, batchcmds, sourcefile, opt) +-- local targetfile = path.join(target:targetdir(), path.basename(sourcefile) .. ".frag.spv") + +-- print("Compiling shader: %s to %s", sourcefile, targetfile) +-- batchcmds:vrunv('glslc', { sourcefile, "-o", targetfile }) +-- -- batchcmds:add_depfiles(sourcefile) +-- end) +-- -- TODO: Metal shaders compilation + +-- -- common configuration for both static and shared libraries +-- target("core_config") +-- set_kind("static") -- kind is required but you can ignore it since it's just for common settings +-- add_packages("local_glfw") +-- add_defines("CEL_REND_BACKEND_OPENGL") +-- add_includedirs("deps/cgltf", { public = true }) +-- add_includedirs("deps/glfw-3.3.8/include/GLFW", { public = true }) +-- add_includedirs("deps/glad/include", { public = true }) +-- add_includedirs("deps/stb_image", { public = true }) +-- add_includedirs("deps/stb_image_write", { public = true }) +-- add_includedirs("deps/stb_truetype", { public = true }) +-- add_includedirs("include/", { public = true }) +-- add_includedirs("src/", { public = true }) +-- add_includedirs("src/core", { public = true }) +-- add_includedirs("src/logos/", { public = true }) +-- add_includedirs("src/maths/", { public = true }) +-- add_includedirs("src/platform/", { public = true }) +-- add_includedirs("src/ral", { public = true }) +-- add_includedirs("src/ral/backends/opengl", { public = true }) +-- add_includedirs("src/render", { public = true }) +-- add_includedirs("src/ral/backends/vulkan", { public = true }) +-- add_includedirs("src/resources/", { public = true }) +-- add_includedirs("src/std/", { public = true }) +-- add_includedirs("src/std/containers", { public = true }) +-- add_includedirs("src/systems/", { public = true }) +-- add_files("src/empty.c") -- for some reason we need this on Mac so it doesnt call 'ar' with no files and error +-- -- add_rules("compile_glsl_vert_shaders") +-- -- add_rules("compile_glsl_frag_shaders") +-- -- add_files("assets/shaders/*.frag") +-- if is_plat("windows") then +-- -- add_includedirs("$(env VULKAN_SDK)/Include", { public = true }) +-- -- add_linkdirs("$(env VULKAN_SDK)/Lib", { public = true }) +-- -- add_links("vulkan-1") +-- end +-- if is_plat("macosx") then +-- -- add_files("src/renderer/backends/metal/*.m") +-- -- add_files("src/ral/backends/vulkan/*.c") +-- end +-- set_default(false) -- prevents standalone building of this target + +-- target("core_static") +-- set_kind("static") +-- add_deps("core_config") -- inherit common configurations +-- set_policy("build.merge_archive", true) +-- add_files(core_sources) +-- -- Link against static CRT +-- if is_plat("windows") then +-- add_links("libcmt", "legacy_stdio_definitions") -- for release builds +-- add_links("libcmtd", "legacy_stdio_definitions") -- for debug builds +-- end + +-- target("core_shared") +-- set_kind("shared") +-- add_deps("core_config") -- inherit common configurations +-- add_files(core_sources) +-- -- Link against dynamic CRT +-- if is_plat("windows") then +-- add_links("msvcrt", "legacy_stdio_definitions") -- for release builds +-- add_links("msvcrtd", "legacy_stdio_definitions") -- for debug builds +-- end + +-- -- target("main_loop") +-- -- set_kind("binary") +-- -- set_group("examples") +-- -- add_deps("core_static") +-- -- add_files("examples/main_loop/ex_main_loop.c") +-- -- set_rundir("$(projectdir)") + +-- -- target("tri") +-- -- set_kind("binary") +-- -- set_group("examples") +-- -- add_deps("core_static") +-- -- add_files("examples/triangle/ex_triangle.c") +-- -- set_rundir("$(projectdir)") +-- -- if is_plat("macosx") then +-- -- before_build(function (target) +-- -- print("build metal shaders lib") +-- -- os.exec("mkdir -p build/shaders") +-- -- os.exec("xcrun -sdk macosx metal -c assets/shaders/triangle.metal -o build/shaders/gfx.air") +-- -- os.exec("xcrun -sdk macosx metallib build/shaders/gfx.air -o build/gfx.metallib") +-- -- end) +-- -- end + +-- target("skinned") +-- set_kind("binary") +-- set_group("examples") +-- add_deps("core_shared") +-- add_files("examples/skinned_animation/ex_skinned_animation.c") +-- set_rundir("$(projectdir)") + +-- target("game") +-- set_kind("binary") +-- set_group("examples") +-- add_deps("core_static") +-- add_files("examples/game_demo/game_demo.c") +-- set_rundir("$(projectdir)") + +-- target("pool_tests") +-- set_kind("binary") +-- set_group("tests") +-- add_deps("core_static") +-- add_files(unity_sources) +-- add_includedirs("deps/Unity/src", {public = true}) +-- add_includedirs("deps/Unity/extras/fixture/src", {public = true}) +-- add_includedirs("deps/Unity/extras/memory/src", {public = true}) +-- add_files("tests/pool_tests.c") +-- add_files("tests/pool_test_runner.c") diff --git a/bindgen/rust/celeritas-sys/src/lib.rs b/bindgen/rust/celeritas-sys/src/lib.rs index 3d877a4..5b65f5e 100644 --- a/bindgen/rust/celeritas-sys/src/lib.rs +++ b/bindgen/rust/celeritas-sys/src/lib.rs @@ -6,28 +6,29 @@ use serde::{Deserialize, Serialize}; include!(concat!(env!("OUT_DIR"), "/bindings.rs")); -// // --- Conversions -// pub mod conversions { -// use crate::{Mat4, Vec3, Vec4}; +// --- Conversions +pub mod conversions { + use crate::{mat4, vec3, vec4}; -// impl From for glam::Vec3 { -// fn from(v: Vec3) -> Self { -// Self { -// x: v.x, -// y: v.y, -// z: v.z, -// } -// } -// } -// impl From for Vec3 { -// fn from(v: glam::Vec3) -> Self { -// Self { -// x: v.x, -// y: v.y, -// z: v.z, -// } -// } -// } + impl From for glam::Vec3 { + fn from(v: vec3) -> Self { + Self { + x: v.x, + y: v.y, + z: v.z, + } + } + } + impl From for vec3 { + fn from(v: glam::Vec3) -> Self { + Self { + x: v.x, + y: v.y, + z: v.z, + } + } + } +} // impl From for glam::Vec4 { // fn from(v: Vec4) -> Self { diff --git a/docs/getting-started.md b/docs/getting-started.md deleted file mode 100644 index 0baf21c..0000000 --- a/docs/getting-started.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Getting up and running ---- - -The main build tool we use is [xmake](https://xmake.io/#/getting_started) so installing that is the main prerequisite. - -Once that is installed you *should* be able to simply run `xmake build` in the top-level directory. \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index fd5b8f6..fb3b6e2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -20,7 +20,7 @@ Celeritas is the original Latin word for celerity that the English is derived fr ## Feature Set -[See here (README)](https://github.com/omnisci3nce/celeritas-core/blob/winter-cleaning/README.md#todo) +[See here (README)](https://github.com/omnisci3nce/celeritas-core/blob/masterREADME.md#goals) ## Getting started diff --git a/docs/project-layout.md b/docs/project-layout.md deleted file mode 100644 index 9a33e8f..0000000 --- a/docs/project-layout.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: Project Structure ---- - -``` -assets/ - shaders and bundled assets for examples (must be licensed open) -bindgen/ - bindings generation -deps/ - third-party dependencies -docs/ - these docs you're reading now that get built with mkdocs -src/ - core/ - core game engine facilities - logos/ - - maths/ - platform/ - ral/ - render/ - resources/ - std/ - systems/ - ui/ -``` - - -#### Core - -Core holds specifically functionality vital to making games or 3D applications. Contrast this with `std` which contains -code that could form the base layer of almost any software out there. - -#### Std - -Data structures, algorithms, memory management, etc - all code here forms a foundation for everything above it and can conceivably -be reused in non-game applications. \ No newline at end of file diff --git a/include/celeritas.h b/include/celeritas.h index 51a9a3d..6b8a673 100644 --- a/include/celeritas.h +++ b/include/celeritas.h @@ -1,5 +1,13 @@ #pragma once +/* + Common abbreviations: + buf = buffer + tex = texture + desc = description + idx = index +*/ + // Standard library includes #include #include @@ -407,7 +415,7 @@ typedef struct shader_function { shader_stage stage; } shader_function; -typedef enum cull_mode { CULL_BACK_FACE, CULL_FRONT_FACE } cull_mode; +typedef enum cull_mode { Cull_BackFace, Cull_FrontFace } cull_mode; typedef struct gfx_pipeline_desc { const char* label; @@ -476,9 +484,9 @@ typedef struct u32_darray u32_darray; // --- Base Renderer types -DEFINE_HANDLE(MeshHandle); -DEFINE_HANDLE(MaterialHandle); -DEFINE_HANDLE(ModelHandle); +DEFINE_HANDLE(mesh_handle); +DEFINE_HANDLE(material_handle); +DEFINE_HANDLE(model_handle); typedef struct geometry { vertex_desc vertex_format; @@ -487,17 +495,30 @@ typedef struct geometry { u32_darray* indices; } geometry; +typedef u32 joint_idx; +typedef struct armature { +} armature; + +/** @brief Mesh data that has been uploaded to GPU and is ready to be rendered each frame + Gets stored in a pool */ typedef struct mesh { buf_handle vertex_buffer; buf_handle index_buffer; - MaterialHandle material; - geometry geometry; - // bool is_skinned; // false = its static - // Armature armature; - // bool is_uploaded; // has the data been uploaded to the GPU + // todo: material? + geometry geo; // the originating mesh data + const armature* skinning_data; } mesh; -// --- Render primitives +typedef struct draw_mesh_cmd { + mesh_handle mesh; + mat4 transform; + vec3 bounding_sphere_center; + f32 bounding_sphere_radius; + const armature* skinning_data; // NULL = static mesh + bool cast_shadows; +} draw_mesh_cmd; + +// --- Geometry/Mesh primitives geometry geo_plane(f32 x_scale, f32 z_scale, u32 tiling_u, u32 tiling_v); geometry geo_cuboid(f32 x_scale, f32 y_scale, f32 z_scale); @@ -505,31 +526,33 @@ geometry geo_cylinder(f32 radius, f32 height, u32 resolution); geometry geo_cone(f32 radius, f32 height, u32 resolution); geometry geo_uv_sphere(f32 radius, u32 north_south_lines, u32 east_west_lines); geometry geo_ico_sphere(f32 radius, f32 n_subdivisions); +void geo_scale_uniform(geometry* geo, f32 scale); +void geo_scale_xyz(geometry* geo, vec3 scale_xyz); // --- Renderer // void renderer_init(renderer* rend); // void renderer_shutdown(renderer* rend); -// --- Scene / Transform Hierarchy - -// --- Gameplay - typedef struct camera { vec3 position; - quat orientation; + // TODO: move to using a quaternion for the camera's orientation - need to update + // how the view transformation matrix is calculated + vec3 forwards; + vec3 up; f32 fov; } camera; -mat4 camera_view_proj(camera); - -// --- Reference Renderer +/** @brief calculates the view and projection matrices for a camera */ +mat4 camera_view_proj(camera camera, f32 lens_height, f32 lens_width, mat4* out_view, mat4* out_proj); // TODO: Filament PBR model -// --- Game and model data +// --- Scene / Transform Hierarchy -DEFINE_HANDLE(model_handle); +// --- Gameplay + +// --- Game and model data typedef struct model { } model; @@ -538,8 +561,40 @@ model_handle model_load_from_gltf(const char* path); // --- Animation +typedef enum keyframe_kind { Keyframe_Rotation, Keyframe_Translation, Keyframe_Scale, Keyframe_Weights } keyframe_kind; + +const char* keyframe_kind_strings[4] = { "ROTATION", "TRANSLATION", "SCALE", "WEIGHTS" }; + +typedef union keyframe { + quat rotation; + vec3 translation; + vec3 scale; + f32 weights[4]; +} keyframe; + +typedef struct keyframes { + keyframe_kind kind; + keyframe* values; + size_t n_frames; +} keyframes; + +typedef enum interpolation { + Interpolation_Step, + Interpolation_Linear, + Interpolation_Cubic +} interpolation; + +typedef struct animation_spline { + f32* timestamps; + size_t n_timestamps; + keyframes frames; +} animation_spline; + // Compute shader approach so we only need one kind of vertex format +// --- Input + + // --- Collisions // --- Physics diff --git a/src/camera.c b/src/camera.c new file mode 100644 index 0000000..79f9c19 --- /dev/null +++ b/src/camera.c @@ -0,0 +1,15 @@ +#include + +mat4 camera_view_proj(camera camera, f32 lens_height, f32 lens_width, mat4* out_view, mat4* out_proj) { + mat4 projection_matrix = mat4_perspective(camera.fov, lens_width / lens_height, 0.1, 1000.0); + // TODO: store near/far on camera rather than hard-coding here. + + vec3 camera_direction = vec3_add(camera.position, camera.forwards); + mat4 view_matrix = mat4_look_at(camera.position, camera_direction, camera.up); + if (out_view) + *out_view = view_matrix; + if (out_proj) + *out_proj = projection_matrix; + + return mat4_mult(view_matrix, projection_matrix); +} \ No newline at end of file diff --git a/src/mem.c b/src/mem.c index dd8acda..2649db5 100644 --- a/src/mem.c +++ b/src/mem.c @@ -1,7 +1,7 @@ #include void_pool void_pool_create(void* storage, const char* debug_label, u64 capacity, u64 entry_size) { - size_t memory_requirements = capacity * entry_size; + size_t _memory_requirements = capacity * entry_size; // void* backing_buf = arena_alloc(a, memory_requirements); assert(entry_size >= sizeof(void_pool_header)); // TODO: create my own assert with error message diff --git a/src/scene.c b/src/scene.c new file mode 100644 index 0000000..fa4d9b5 --- /dev/null +++ b/src/scene.c @@ -0,0 +1,26 @@ +/** + * @file scene.c + * @author your name (you@domain.com) + * @brief + * @version 0.1 + * @date 2024-10-18 + * + * @copyright Copyright (c) 2024 + * + */ +#include + +// Retained mode scene tree that handles performant transform propagation, and allows systems, or other languages via bindings, to +// manipulate rendering/scene data without *owning* said data. + +typedef struct scene_tree_node { + const char* label; +} scene_tree_node; + +DEFINE_HANDLE(scene_node_handle); +TYPED_POOL(scene_tree_node, scene_node); + +typedef struct render_scene_tree { +} render_scene_tree; + +// What kind of operations and mutations can we perform on the tree? diff --git a/xmake.lua b/xmake.lua deleted file mode 100644 index 3c05a70..0000000 --- a/xmake.lua +++ /dev/null @@ -1,205 +0,0 @@ --- set_project("celeritas") --- set_version("0.1.0") --- set_config("cc", "clang") - --- add_rules("mode.debug", "mode.release") -- we have two modes: debug & release - --- -- -Wall : base set of warnings --- -- -Wextra : additional warnings not covered by -Wall --- -- -Wundef : undefined macros --- -- -Wdouble-promotion : catch implicit converion of float to double --- add_cflags("-Wall", "-Wextra", "-Wundef", "-Wdouble-promotion") - --- if is_mode("debug") then --- add_cflags("-g") -- Add debug symbols in debug mode --- add_defines("CDEBUG") --- elseif is_mode("release") then --- add_defines("CRELEASE") --- end - --- -- Platform defines and system packages --- if is_plat("linux") then --- add_defines("CEL_PLATFORM_LINUX") --- add_syslinks("dl", "X11", "pthread") --, "vulkan") --- elseif is_plat("windows") then --- add_defines("CEL_PLATFORM_WINDOWS") --- add_syslinks("user32", "gdi32", "kernel32", "shell32") --- -- add_requires("vulkansdk", { system = true }) --- -- add_links("pthreadVC2-w64") --- elseif is_plat("macosx") then --- add_defines("CEL_PLATFORM_MAC") --- add_frameworks("Cocoa", "IOKit", "CoreVideo", "OpenGL") --- add_frameworks("Foundation", "Metal", "QuartzCore") --- set_runenv("MTL_DEBUG_LAYER", "1") --- add_requires("vulkansdk", { system = true }) --- -- add_syslinks("GL") --- end - --- -- Compile GLFW from source --- package("local_glfw") --- add_deps("cmake") --- set_sourcedir(path.join(os.scriptdir(), "deps/glfw-3.3.8")) --- on_install(function(package) --- local configs = {} --- -- NOTE(omni): Keeping these around as comments in case we need to modify glfw flags --- -- table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) --- -- table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) --- import("package.tools.cmake").install(package, configs) --- end) --- on_test(function(package) --- -- assert(package:has_cfuncs("add", {includes = "foo.h"})) --- end) --- package_end() - --- add_requires("local_glfw") - --- local core_sources = { --- "deps/glad/src/glad.c", --- "src/*.c", --- "src/core/*.c", --- "src/logos/*.c", --- "src/maths/*.c", --- "src/platform/*.c", --- "src/ral/*.c", --- "src/ral/backends/opengl/*.c", --- "src/render/*.c", --- "src/resources/*.c", --- "src/std/*.c", --- "src/std/containers/*.c", --- "src/systems/*.c", --- } - --- local unity_sources = { --- "deps/Unity/src/unity.c", --- "deps/Unity/extras/fixture/src/unity_fixture.c", --- "deps/Unity/extras/memory/src/unity_memory.c", --- } - --- rule("compile_glsl_vert_shaders") --- set_extensions(".vert") --- on_buildcmd_file(function(target, batchcmds, sourcefile, opt) --- local targetfile = path.join(target:targetdir(), path.basename(sourcefile) .. ".vert.spv") - --- print("Compiling shader: %s to %s", sourcefile, targetfile) --- batchcmds:vrunv('glslc', { sourcefile, "-o", targetfile }) --- -- batchcmds:add_depfiles(sourcefile) --- end) - --- rule("compile_glsl_frag_shaders") --- set_extensions(".frag") --- on_buildcmd_file(function(target, batchcmds, sourcefile, opt) --- local targetfile = path.join(target:targetdir(), path.basename(sourcefile) .. ".frag.spv") - --- print("Compiling shader: %s to %s", sourcefile, targetfile) --- batchcmds:vrunv('glslc', { sourcefile, "-o", targetfile }) --- -- batchcmds:add_depfiles(sourcefile) --- end) --- -- TODO: Metal shaders compilation - --- -- common configuration for both static and shared libraries --- target("core_config") --- set_kind("static") -- kind is required but you can ignore it since it's just for common settings --- add_packages("local_glfw") --- add_defines("CEL_REND_BACKEND_OPENGL") --- add_includedirs("deps/cgltf", { public = true }) --- add_includedirs("deps/glfw-3.3.8/include/GLFW", { public = true }) --- add_includedirs("deps/glad/include", { public = true }) --- add_includedirs("deps/stb_image", { public = true }) --- add_includedirs("deps/stb_image_write", { public = true }) --- add_includedirs("deps/stb_truetype", { public = true }) --- add_includedirs("include/", { public = true }) --- add_includedirs("src/", { public = true }) --- add_includedirs("src/core", { public = true }) --- add_includedirs("src/logos/", { public = true }) --- add_includedirs("src/maths/", { public = true }) --- add_includedirs("src/platform/", { public = true }) --- add_includedirs("src/ral", { public = true }) --- add_includedirs("src/ral/backends/opengl", { public = true }) --- add_includedirs("src/render", { public = true }) --- add_includedirs("src/ral/backends/vulkan", { public = true }) --- add_includedirs("src/resources/", { public = true }) --- add_includedirs("src/std/", { public = true }) --- add_includedirs("src/std/containers", { public = true }) --- add_includedirs("src/systems/", { public = true }) --- add_files("src/empty.c") -- for some reason we need this on Mac so it doesnt call 'ar' with no files and error --- -- add_rules("compile_glsl_vert_shaders") --- -- add_rules("compile_glsl_frag_shaders") --- -- add_files("assets/shaders/*.frag") --- if is_plat("windows") then --- -- add_includedirs("$(env VULKAN_SDK)/Include", { public = true }) --- -- add_linkdirs("$(env VULKAN_SDK)/Lib", { public = true }) --- -- add_links("vulkan-1") --- end --- if is_plat("macosx") then --- -- add_files("src/renderer/backends/metal/*.m") --- -- add_files("src/ral/backends/vulkan/*.c") --- end --- set_default(false) -- prevents standalone building of this target - --- target("core_static") --- set_kind("static") --- add_deps("core_config") -- inherit common configurations --- set_policy("build.merge_archive", true) --- add_files(core_sources) --- -- Link against static CRT --- if is_plat("windows") then --- add_links("libcmt", "legacy_stdio_definitions") -- for release builds --- add_links("libcmtd", "legacy_stdio_definitions") -- for debug builds --- end - --- target("core_shared") --- set_kind("shared") --- add_deps("core_config") -- inherit common configurations --- add_files(core_sources) --- -- Link against dynamic CRT --- if is_plat("windows") then --- add_links("msvcrt", "legacy_stdio_definitions") -- for release builds --- add_links("msvcrtd", "legacy_stdio_definitions") -- for debug builds --- end - --- -- target("main_loop") --- -- set_kind("binary") --- -- set_group("examples") --- -- add_deps("core_static") --- -- add_files("examples/main_loop/ex_main_loop.c") --- -- set_rundir("$(projectdir)") - --- -- target("tri") --- -- set_kind("binary") --- -- set_group("examples") --- -- add_deps("core_static") --- -- add_files("examples/triangle/ex_triangle.c") --- -- set_rundir("$(projectdir)") --- -- if is_plat("macosx") then --- -- before_build(function (target) --- -- print("build metal shaders lib") --- -- os.exec("mkdir -p build/shaders") --- -- os.exec("xcrun -sdk macosx metal -c assets/shaders/triangle.metal -o build/shaders/gfx.air") --- -- os.exec("xcrun -sdk macosx metallib build/shaders/gfx.air -o build/gfx.metallib") --- -- end) --- -- end - --- target("skinned") --- set_kind("binary") --- set_group("examples") --- add_deps("core_shared") --- add_files("examples/skinned_animation/ex_skinned_animation.c") --- set_rundir("$(projectdir)") - --- target("game") --- set_kind("binary") --- set_group("examples") --- add_deps("core_static") --- add_files("examples/game_demo/game_demo.c") --- set_rundir("$(projectdir)") - --- target("pool_tests") --- set_kind("binary") --- set_group("tests") --- add_deps("core_static") --- add_files(unity_sources) --- add_includedirs("deps/Unity/src", {public = true}) --- add_includedirs("deps/Unity/extras/fixture/src", {public = true}) --- add_includedirs("deps/Unity/extras/memory/src", {public = true}) --- add_files("tests/pool_tests.c") --- add_files("tests/pool_test_runner.c") -- cgit v1.2.3-70-g09d2