summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoromnisci3nce <omniscient.oce@gmail.com>2024-07-13 16:34:48 +1000
committeromnisci3nce <omniscient.oce@gmail.com>2024-07-13 16:34:48 +1000
commit8d6b838d0a5919620ca8562ac6be1da5c0c3237e (patch)
tree0cffbe159b23464e64cde1165e9e58031d0623b8
parentf74cf52946f4e569a26bc81105537b40be95c2c7 (diff)
add empty shell scripts
-rw-r--r--bindgen/BINDGEN.md1
-rw-r--r--examples/game_demo/game_demo.c5
-rw-r--r--scripts/gen_amalgamation.sh5
-rw-r--r--scripts/gen_apidocs.sh3
-rw-r--r--scripts/header_check.sh1
-rw-r--r--src/new_render/render.h6
-rw-r--r--src/new_render/render_types.h4
-rw-r--r--src/platform/file.c6
-rw-r--r--src/platform/file.h6
-rw-r--r--src/platform/path.h4
-rw-r--r--src/resources/gltf.c90
-rw-r--r--src/resources/obj.c366
-rw-r--r--src/std/str.c88
-rw-r--r--src/transform_hierarchy.c340
-rw-r--r--src/transform_hierarchy.h90
-rw-r--r--xmake.lua6
16 files changed, 519 insertions, 502 deletions
diff --git a/bindgen/BINDGEN.md b/bindgen/BINDGEN.md
new file mode 100644
index 0000000..20ba803
--- /dev/null
+++ b/bindgen/BINDGEN.md
@@ -0,0 +1 @@
+This is where we host code generation tools for generating bindings to `celeritas-core` in other languages.
diff --git a/examples/game_demo/game_demo.c b/examples/game_demo/game_demo.c
index 5e76ced..a9f91ea 100644
--- a/examples/game_demo/game_demo.c
+++ b/examples/game_demo/game_demo.c
@@ -50,13 +50,16 @@ int main() {
// TODO: query joints of the gltf to get the hand bone to parent a sword to
RenderEnt player_r = { .model = player_model, .affine = mat4_ident(), .casts_shadows = true };
+
+ RenderEnt entities[] = { player_r };
+
while (!ShouldExit()) {
Frame_Begin();
// BEGIN Draw calls
// draw the player model with shadows
-
+ Render_RenderEntities(entities, 1);
Render_DrawTerrain();
Skybox_Draw(&skybox);
diff --git a/scripts/gen_amalgamation.sh b/scripts/gen_amalgamation.sh
new file mode 100644
index 0000000..56df62e
--- /dev/null
+++ b/scripts/gen_amalgamation.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# Generates a single amalgamation C header file that includes all public types and functions.
+#
+# This makes including and linking Celeritas very easy.
diff --git a/scripts/gen_apidocs.sh b/scripts/gen_apidocs.sh
new file mode 100644
index 0000000..afad30e
--- /dev/null
+++ b/scripts/gen_apidocs.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+# Generates a static webpage for the public C-API of `celeritas-core`
diff --git a/scripts/header_check.sh b/scripts/header_check.sh
deleted file mode 100644
index 2edd9fe..0000000
--- a/scripts/header_check.sh
+++ /dev/null
@@ -1 +0,0 @@
-# TODO - check .h files for a valid header with @brief and #pragma once \ No newline at end of file
diff --git a/src/new_render/render.h b/src/new_render/render.h
index 7c6a4a5..b0b5495 100644
--- a/src/new_render/render.h
+++ b/src/new_render/render.h
@@ -28,7 +28,11 @@ PUB void Renderer_Shutdown(Renderer* renderer);
// NOTE: All of these functions grab the Renderer instance off the global Core
PUB void Render_FrameBegin(Renderer* renderer);
PUB void Render_FrameEnd(Renderer* renderer);
-PUB void Render_FrameDraw(Renderer* renderer);
+
+/** @brief */
+PUB void Render_RenderEntities(RenderEnt* entities, size_t entity_count);
+
+// TODO: Render_FrameDraw(); - this will
// --- Resources
diff --git a/src/new_render/render_types.h b/src/new_render/render_types.h
index 384a18f..b27bf2f 100644
--- a/src/new_render/render_types.h
+++ b/src/new_render/render_types.h
@@ -5,6 +5,7 @@
#pragma once
#include "defines.h"
+#include "maths_types.h"
#include "ral.h"
#include "maths.h"
#include "ral_types.h"
@@ -79,6 +80,7 @@ typedef struct DirectionalLight {
// A renderable 'thing'
typedef struct RenderEnt {
ModelHandle model;
- Mat4 affine;
+ Mat4 affine; // In the future this should be updated by the transform graph
+ // Bbox_3D bounding_box;
bool casts_shadows;
} RenderEnt;
diff --git a/src/platform/file.c b/src/platform/file.c
index 6030620..33194d7 100644
--- a/src/platform/file.c
+++ b/src/platform/file.c
@@ -33,7 +33,7 @@ const char *string_from_file(const char *path) {
return string;
}
-str8_opt str8_from_file(arena *a, str8 path) {
+str8_opt str8_from_file(arena *a, Str8 path) {
char *p = cstr(a, path);
str8_opt result = { .has_value = false };
@@ -51,7 +51,7 @@ str8_opt str8_from_file(arena *a, str8 path) {
rewind(f);
u8 *raw = arena_alloc(a, fsize + 1);
- str8 contents = str8_create(raw, fsize);
+ Str8 contents = str8_create(raw, fsize);
contents.buf[contents.len] = '\0';
fread(raw, fsize, 1, f);
@@ -90,4 +90,4 @@ FileData load_spv_file(const char *path) {
fclose(f);
return (FileData){ data, bytesRead };
-} \ No newline at end of file
+}
diff --git a/src/platform/file.h b/src/platform/file.h
index a8aa8ea..5e5e1e1 100644
--- a/src/platform/file.h
+++ b/src/platform/file.h
@@ -10,17 +10,17 @@
#include "str.h"
typedef struct str8_opt {
- str8 contents;
+ Str8 contents;
bool has_value;
} str8_opt;
const char* string_from_file(const char* path);
-str8_opt str8_from_file(arena* a, str8 path);
+str8_opt str8_from_file(arena* a, Str8 path);
typedef struct {
char* data;
size_t size;
} FileData;
-FileData load_spv_file(const char* path); \ No newline at end of file
+FileData load_spv_file(const char* path);
diff --git a/src/platform/path.h b/src/platform/path.h
index 73063ea..ce53339 100644
--- a/src/platform/path.h
+++ b/src/platform/path.h
@@ -9,8 +9,8 @@
#include "str.h"
typedef struct path_opt {
- str8 path;
+ Str8 path;
bool has_value;
} path_opt;
-path_opt path_parent(arena* a, const char* path); // TODO: convert to using str8 \ No newline at end of file
+path_opt path_parent(arena* a, const char* path); // TODO: convert to using str8
diff --git a/src/resources/gltf.c b/src/resources/gltf.c
index 5947bad..e381954 100644
--- a/src/resources/gltf.c
+++ b/src/resources/gltf.c
@@ -35,7 +35,7 @@ KITC_DECL_TYPED_ARRAY(Vec4)
KITC_DECL_TYPED_ARRAY(face)
// KITC_DECL_TYPED_ARRAY(joint)
-bool model_load_gltf_str(const char *file_string, const char *filepath, str8 relative_path,
+bool model_load_gltf_str(const char *file_string, const char *filepath, Str8 relative_path,
Model *out_model, bool invert_textures_y);
ModelHandle model_load_gltf(const char *path, bool invert_texture_y) {
@@ -85,7 +85,7 @@ typedef struct model {
u32 mesh_count;
} model;
*/
-bool model_load_gltf_str(const char *file_string, const char *filepath, str8 relative_path,
+bool model_load_gltf_str(const char *file_string, const char *filepath, Str8 relative_path,
Model *out_model, bool invert_textures_y) {
// TRACE("Load GLTF from string");
@@ -100,7 +100,7 @@ bool model_load_gltf_str(const char *file_string, const char *filepath, str8 rel
// // vertex_bone_data_darray *tmp_vertex_bone_data = vertex_bone_data_darray_new(1000);
// cgltf_options options = { 0 };
- // cgltf_data *data = NULL;
+ cgltf_data *data = NULL;
// cgltf_result result = cgltf_parse_file(&options, filepath, &data);
// if (result != cgltf_result_success) {
// WARN("gltf load failed");
@@ -183,13 +183,13 @@ bool model_load_gltf_str(const char *file_string, const char *filepath, str8 rel
snprintf(normal_map_path, sizeof(normal_map_path), "%s/%s", relative_path.buf,
normal_tex_view.texture->image->uri);
- material our_material =
- pbr_material_load(albedo_map_path, normal_map_path, true, metal_rough_map_path, NULL, NULL);
+ // material our_material =
+ // pbr_material_load(albedo_map_path, normal_map_path, true, metal_rough_map_path, NULL, NULL);
- our_material.name = malloc(strlen(gltf_material.name) + 1);
- strcpy(our_material.name, gltf_material.name);
+ // our_material.name = malloc(strlen(gltf_material.name) + 1);
+ // strcpy(our_material.name, gltf_material.name);
- material_darray_push(out_model->materials, our_material);
+ // material_darray_push(out_model->materials, our_material);
}
// TEMP
@@ -204,7 +204,7 @@ bool model_load_gltf_str(const char *file_string, const char *filepath, str8 rel
// DEBUG("Number of this primitive %d", primitive.)
for (cgltf_size a = 0; a < data->meshes[m].primitives[0].attributes_count; a++) {
- // cgltf_attribute attribute = data->meshes[m].primitives[0].attributes[a];
+ cgltf_attribute attribute = data->meshes[m].primitives[0].attributes[a];
if (attribute.type == cgltf_attribute_type_position) {
TRACE("Load positions from accessor");
@@ -322,34 +322,34 @@ bool model_load_gltf_str(const char *file_string, const char *filepath, str8 rel
// // }
bool has_indices = false;
- vertex_darray *geo_vertices = vertex_darray_new(3);
+ Vertex_darray *geo_vertices = Vertex_darray_new(3);
u32_darray *geo_indices = u32_darray_new(0);
// Store vertices
- printf("Positions %d Normals %d UVs %d\n", tmp_positions->len, tmp_normals->len, tmp_uvs->len);
- assert(tmp_positions->len == tmp_normals->len);
- assert(tmp_normals->len == tmp_uvs->len);
- for (u32 v_i = 0; v_i < tmp_positions->len; v_i++) {
- vertex v = { .static_3d = {
- .position = tmp_positions->data[v_i],
- .normal = tmp_normals->data[v_i],
- .tex_coords = tmp_uvs->data[v_i],
- } };
- vertex_darray_push(geo_vertices, v);
+ // printf("Positions %d Normals %d UVs %d\n", tmp_positions->len, tmp_normals->len, tmp_uvs->len);
+ // assert(tmp_positions->len == tmp_normals->len);
+ // assert(tmp_normals->len == tmp_uvs->len);
+ // for (u32 v_i = 0; v_i < tmp_positions->len; v_i++) {
+ // vertex v = { .static_3d = {
+ // .position = tmp_positions->data[v_i],
+ // .normal = tmp_normals->data[v_i],
+ // .tex_coords = tmp_uvs->data[v_i],
+ // } };
+ // vertex_darray_push(geo_vertices, v);
}
// Store indices
- cgltf_accessor *indices = primitive.indices;
- if (primitive.indices > 0) {
- WARN("indices! %d", indices->count);
- has_indices = true;
-
- // store indices
- for (cgltf_size i = 0; i < indices->count; ++i) {
- cgltf_uint ei;
- cgltf_accessor_read_uint(indices, i, &ei, 1);
- u32_darray_push(geo_indices, ei);
- }
+ // cgltf_accessor *indices = primitive.indices;
+ // if (primitive.indices > 0) {
+ // WARN("indices! %d", indices->count);
+ // has_indices = true;
+
+ // // store indices
+ // for (cgltf_size i = 0; i < indices->count; ++i) {
+ // cgltf_uint ei;
+ // cgltf_accessor_read_uint(indices, i, &ei, 1);
+ // u32_darray_push(geo_indices, ei);
+ // }
// fetch and store vertices for each index
// for (cgltf_size i = 0; i < indices->count; ++i) {
@@ -366,23 +366,23 @@ bool model_load_gltf_str(const char *file_string, const char *filepath, str8 rel
// }
// // for each vertex do the bone data
// }
- } else {
- has_indices = false;
- return false; // TODO: handle this
- }
+ // } else {
+ // has_indices = false;
+ // return false; // TODO: handle this
+ // }
- geometry_data *geometry = malloc(sizeof(geometry_data));
- geometry->format = VERTEX_STATIC_3D;
- geometry->colour = (rgba){ 1, 1, 1, 1 };
- geometry->vertices = geo_vertices;
- geometry->indices = geo_indices;
- geometry->has_indices = has_indices;
+ // geometry_data *geometry = malloc(sizeof(geometry_data));
+ // geometry->format = VERTEX_STATIC_3D;
+ // geometry->colour = (rgba){ 1, 1, 1, 1 };
+ // geometry->vertices = geo_vertices;
+ // geometry->indices = geo_indices;
+ // geometry->has_indices = has_indices;
- mesh m = mesh_create(geometry, true);
- m.material_index = (u32_opt){ .has_value = mat_idx == 9999, .value = mat_idx };
+ // mesh m = mesh_create(geometry, true);
+ // m.material_index = (u32_opt){ .has_value = mat_idx == 9999, .value = mat_idx };
- mesh_darray_push(out_model->meshes, m);
- }
+ // mesh_darray_push(out_model->meshes, m);
+ // }
// // clear data for each mesh
// vec3_darray_clear(tmp_positions);
diff --git a/src/resources/obj.c b/src/resources/obj.c
index bf2f353..87d3ed6 100644
--- a/src/resources/obj.c
+++ b/src/resources/obj.c
@@ -36,14 +36,14 @@ KITC_DECL_TYPED_ARRAY(Vec2)
KITC_DECL_TYPED_ARRAY(face)
// Forward declarations
-void create_submesh(mesh_darray *meshes, Vec3_darray *tmp_positions, Vec3_darray *tmp_normals,
- Vec2_darray *tmp_uvs, face_darray *tmp_faces, material_darray *materials,
- bool material_loaded, char current_material_name[256]);
-bool load_material_lib(const char *path, str8 relative_path, material_darray *materials);
-bool model_load_obj_str(const char *file_string, str8 relative_path, Model *out_model,
- bool invert_textures_y);
-
-model_handle model_load_obj(Core *core, const char *path, bool invert_textures_y) {
+// void create_submesh(mesh_darray *meshes, Vec3_darray *tmp_positions, Vec3_darray *tmp_normals,
+// Vec2_darray *tmp_uvs, face_darray *tmp_faces, material_darray *materials,
+// bool material_loaded, char current_material_name[256]);
+// bool load_material_lib(const char *path, str8 relative_path, material_darray *materials);
+// bool model_load_obj_str(const char *file_string, str8 relative_path, Model *out_model,
+// bool invert_textures_y);
+
+ModelHandle model_load_obj(Core *core, const char *path, bool invert_textures_y) {
size_t arena_size = 1024;
arena scratch = arena_create(malloc(arena_size), arena_size);
@@ -54,24 +54,24 @@ model_handle model_load_obj(Core *core, const char *path, bool invert_textures_y
}
const char *file_string = string_from_file(path);
- model_handle handle;
- model *model = model_pool_alloc(&g_core.models, &handle);
- model->name = str8_cstr_view(path);
- model->meshes = mesh_darray_new(1);
+ ModelHandle handle;
+ // model *model = model_pool_alloc(&g_core.models, &handle);
+ // model->name = str8_cstr_view(path);
+ // model->meshes = mesh_darray_new(1);
- bool success = model_load_obj_str(file_string, relative_path.path, &model, invert_textures_y);
+ // bool success = model_load_obj_str(file_string, relative_path.path, &model, invert_textures_y);
- if (!success) {
- FATAL("Couldnt load OBJ file at path %s", path);
- ERROR_EXIT("Load fails are considered crash-worthy right now. This will change later.\n");
- }
+ // if (!success) {
+ // FATAL("Couldnt load OBJ file at path %s", path);
+ // ERROR_EXIT("Load fails are considered crash-worthy right now. This will change later.\n");
+ // }
- arena_free_all(&scratch);
- arena_free_storage(&scratch);
+ // arena_free_all(&scratch);
+ // arena_free_storage(&scratch);
return handle;
}
-bool model_load_obj_str(const char *file_string, str8 relative_path, model *out_model,
+bool model_load_obj_str(const char *file_string, Str8 relative_path, Model *out_model,
bool invert_textures_y) {
TRACE("Load OBJ from string");
@@ -232,166 +232,166 @@ bool model_load_obj_str(const char *file_string, str8 relative_path, model *out_
return true;
}
-/**
- * @brief Takes the current positions, normals, uvs arrays and constructs the vertex array
- * from those indices.
- */
-void create_submesh(mesh_darray *meshes, vec3_darray *tmp_positions, vec3_darray *tmp_normals,
- vec2_darray *tmp_uvs, face_darray *tmp_faces, material_darray *materials,
- bool material_loaded, char current_material_name[256]) {
- // size_t num_verts = face_darray_len(tmp_faces) * 3;
- // vertex_darray *out_vertices = vertex_darray_new(num_verts);
-
- // face_darray_iter face_iter = face_darray_iter_new(tmp_faces);
- // struct face *f;
-
- // while ((f = face_darray_iter_next(&face_iter))) {
- // for (int j = 0; j < 3; j++) {
- // vertex vert = { 0 };
- // vert.position = tmp_positions->data[f->vertex_indices[j] - 1];
- // if (vec3_darray_len(tmp_normals) == 0) {
- // vert.normal = vec3_create(0.0, 0.0, 0.0);
- // } else {
- // vert.normal = tmp_normals->data[f->normal_indices[j] - 1];
- // }
- // vert.uv = tmp_uvs->data[f->uv_indices[j] - 1];
- // vertex_darray_push(out_vertices, vert);
- // }
- // }
-
- // DEBUG("Loaded submesh\n vertices: %zu\n uvs: %zu\n normals: %zu\n faces: %zu",
- // vec3_darray_len(tmp_positions), vec2_darray_len(tmp_uvs), vec3_darray_len(tmp_normals),
- // face_darray_len(tmp_faces));
-
- // // Clear current object faces
- // face_darray_clear(tmp_faces);
-
- // mesh m = { .vertices = out_vertices };
- // if (material_loaded) {
- // // linear scan to find material
- // bool found = false;
- // DEBUG("Num of materials : %ld", material_darray_len(materials));
- // material_darray_iter mat_iter = material_darray_iter_new(materials);
- // blinn_phong_material *cur_material;
- // while ((cur_material = material_darray_iter_next(&mat_iter))) {
- // if (strcmp(cur_material->name, current_material_name) == 0) {
- // DEBUG("Found match");
- // m.material_index = mat_iter.current_idx - 1;
- // found = true;
- // break;
- // }
- // }
-
- // if (!found) {
- // // TODO: default material
- // m.material_index = 0;
- // DEBUG("Set default material");
- // }
- // }
- // mesh_darray_push(meshes, m);
-}
-
-bool load_material_lib(const char *path, str8 relative_path, material_darray *materials) {
- TRACE("BEGIN load material lib at %s", path);
-
- // const char *file_string = string_from_file(path);
- // if (file_string == NULL) {
- // ERROR("couldnt load %s", path);
- // return false;
- // }
-
- // char *pch;
- // char *saveptr;
- // pch = strtok_r((char *)file_string, "\n", &saveptr);
-
- // material current_material = DEFAULT_MATERIAL;
-
- // bool material_set = false;
-
- // while (pch != NULL) {
- // char line_header[128];
- // int offset = 0;
- // // read the first word of the line
- // int res = sscanf(pch, "%s %n", line_header, &offset);
- // if (res != 1) {
- // break;
- // }
-
- // // When we see "newmtl", start a new material, or flush the previous one
- // if (strcmp(line_header, "newmtl") == 0) {
- // if (material_set) {
- // // a material was being parsed, so flush that one and start a new one
- // material_darray_push(materials, current_material);
- // DEBUG("pushed material with name %s", current_material.name);
- // WARN("Reset current material");
- // current_material = DEFAULT_MATERIAL;
- // } else {
- // material_set = true;
- // }
- // // scan the new material name
- // char material_name[64];
- // sscanf(pch + offset, "%s", current_material.name);
- // DEBUG("material name %s\n", current_material.name);
- // // current_material.name = material_name;
- // } else if (strcmp(line_header, "Ka") == 0) {
- // // ambient
- // sscanf(pch + offset, "%f %f %f", &current_material.ambient_colour.x,
- // &current_material.ambient_colour.y, &current_material.ambient_colour.z);
- // } else if (strcmp(line_header, "Kd") == 0) {
- // // diffuse
- // sscanf(pch + offset, "%f %f %f", &current_material.diffuse.x, &current_material.diffuse.y,
- // &current_material.diffuse.z);
- // } else if (strcmp(line_header, "Ks") == 0) {
- // // specular
- // sscanf(pch + offset, "%f %f %f", &current_material.specular.x,
- // &current_material.specular.y,
- // &current_material.specular.z);
- // } else if (strcmp(line_header, "Ns") == 0) {
- // // specular exponent
- // sscanf(pch + offset, "%f", &current_material.spec_exponent);
- // } else if (strcmp(line_header, "map_Kd") == 0) {
- // char diffuse_map_filename[1024];
- // sscanf(pch + offset, "%s", diffuse_map_filename);
- // char diffuse_map_path[1024];
- // snprintf(diffuse_map_path, sizeof(diffuse_map_path), "%s/%s", relative_path.buf,
- // diffuse_map_filename);
- // printf("load from %s\n", diffuse_map_path);
-
- // // --------------
- // texture diffuse_texture = texture_data_load(diffuse_map_path, true);
- // current_material.diffuse_texture = diffuse_texture;
- // strcpy(current_material.diffuse_tex_path, diffuse_map_path);
- // texture_data_upload(&current_material.diffuse_texture);
- // // --------------
- // } else if (strcmp(line_header, "map_Ks") == 0) {
- // // char specular_map_path[1024] = "assets/";
- // // sscanf(pch + offset, "%s", specular_map_path + 7);
- // char specular_map_filename[1024];
- // sscanf(pch + offset, "%s", specular_map_filename);
- // char specular_map_path[1024];
- // snprintf(specular_map_path, sizeof(specular_map_path), "%s/%s", relative_path.buf,
- // specular_map_filename);
- // printf("load from %s\n", specular_map_path);
- // // --------------
- // texture specular_texture = texture_data_load(specular_map_path, true);
- // current_material.specular_texture = specular_texture;
- // strcpy(current_material.specular_tex_path, specular_map_path);
- // texture_data_upload(&current_material.specular_texture);
- // // --------------
- // } else if (strcmp(line_header, "map_Bump") == 0) {
- // // TODO
- // }
-
- // pch = strtok_r(NULL, "\n", &saveptr);
- // }
-
- // TRACE("end load material lib");
-
- // // last mesh or if one wasnt created with 'o' directive
- // // TRACE("Last leftover material");
- // material_darray_push(materials, current_material);
-
- // INFO("Loaded %ld materials", material_darray_len(materials));
- TRACE("END load material lib");
- return true;
-}
+// /**
+// * @brief Takes the current positions, normals, uvs arrays and constructs the vertex array
+// * from those indices.
+// */
+// void create_submesh(mesh_darray *meshes, vec3_darray *tmp_positions, vec3_darray *tmp_normals,
+// vec2_darray *tmp_uvs, face_darray *tmp_faces, material_darray *materials,
+// bool material_loaded, char current_material_name[256]) {
+// // size_t num_verts = face_darray_len(tmp_faces) * 3;
+// // vertex_darray *out_vertices = vertex_darray_new(num_verts);
+
+// // face_darray_iter face_iter = face_darray_iter_new(tmp_faces);
+// // struct face *f;
+
+// // while ((f = face_darray_iter_next(&face_iter))) {
+// // for (int j = 0; j < 3; j++) {
+// // vertex vert = { 0 };
+// // vert.position = tmp_positions->data[f->vertex_indices[j] - 1];
+// // if (vec3_darray_len(tmp_normals) == 0) {
+// // vert.normal = vec3_create(0.0, 0.0, 0.0);
+// // } else {
+// // vert.normal = tmp_normals->data[f->normal_indices[j] - 1];
+// // }
+// // vert.uv = tmp_uvs->data[f->uv_indices[j] - 1];
+// // vertex_darray_push(out_vertices, vert);
+// // }
+// // }
+
+// // DEBUG("Loaded submesh\n vertices: %zu\n uvs: %zu\n normals: %zu\n faces: %zu",
+// // vec3_darray_len(tmp_positions), vec2_darray_len(tmp_uvs), vec3_darray_len(tmp_normals),
+// // face_darray_len(tmp_faces));
+
+// // // Clear current object faces
+// // face_darray_clear(tmp_faces);
+
+// // mesh m = { .vertices = out_vertices };
+// // if (material_loaded) {
+// // // linear scan to find material
+// // bool found = false;
+// // DEBUG("Num of materials : %ld", material_darray_len(materials));
+// // material_darray_iter mat_iter = material_darray_iter_new(materials);
+// // blinn_phong_material *cur_material;
+// // while ((cur_material = material_darray_iter_next(&mat_iter))) {
+// // if (strcmp(cur_material->name, current_material_name) == 0) {
+// // DEBUG("Found match");
+// // m.material_index = mat_iter.current_idx - 1;
+// // found = true;
+// // break;
+// // }
+// // }
+
+// // if (!found) {
+// // // TODO: default material
+// // m.material_index = 0;
+// // DEBUG("Set default material");
+// // }
+// // }
+// // mesh_darray_push(meshes, m);
+// }
+
+// bool load_material_lib(const char *path, str8 relative_path, material_darray *materials) {
+// TRACE("BEGIN load material lib at %s", path);
+
+// // const char *file_string = string_from_file(path);
+// // if (file_string == NULL) {
+// // ERROR("couldnt load %s", path);
+// // return false;
+// // }
+
+// // char *pch;
+// // char *saveptr;
+// // pch = strtok_r((char *)file_string, "\n", &saveptr);
+
+// // material current_material = DEFAULT_MATERIAL;
+
+// // bool material_set = false;
+
+// // while (pch != NULL) {
+// // char line_header[128];
+// // int offset = 0;
+// // // read the first word of the line
+// // int res = sscanf(pch, "%s %n", line_header, &offset);
+// // if (res != 1) {
+// // break;
+// // }
+
+// // // When we see "newmtl", start a new material, or flush the previous one
+// // if (strcmp(line_header, "newmtl") == 0) {
+// // if (material_set) {
+// // // a material was being parsed, so flush that one and start a new one
+// // material_darray_push(materials, current_material);
+// // DEBUG("pushed material with name %s", current_material.name);
+// // WARN("Reset current material");
+// // current_material = DEFAULT_MATERIAL;
+// // } else {
+// // material_set = true;
+// // }
+// // // scan the new material name
+// // char material_name[64];
+// // sscanf(pch + offset, "%s", current_material.name);
+// // DEBUG("material name %s\n", current_material.name);
+// // // current_material.name = material_name;
+// // } else if (strcmp(line_header, "Ka") == 0) {
+// // // ambient
+// // sscanf(pch + offset, "%f %f %f", &current_material.ambient_colour.x,
+// // &current_material.ambient_colour.y, &current_material.ambient_colour.z);
+// // } else if (strcmp(line_header, "Kd") == 0) {
+// // // diffuse
+// // sscanf(pch + offset, "%f %f %f", &current_material.diffuse.x, &current_material.diffuse.y,
+// // &current_material.diffuse.z);
+// // } else if (strcmp(line_header, "Ks") == 0) {
+// // // specular
+// // sscanf(pch + offset, "%f %f %f", &current_material.specular.x,
+// // &current_material.specular.y,
+// // &current_material.specular.z);
+// // } else if (strcmp(line_header, "Ns") == 0) {
+// // // specular exponent
+// // sscanf(pch + offset, "%f", &current_material.spec_exponent);
+// // } else if (strcmp(line_header, "map_Kd") == 0) {
+// // char diffuse_map_filename[1024];
+// // sscanf(pch + offset, "%s", diffuse_map_filename);
+// // char diffuse_map_path[1024];
+// // snprintf(diffuse_map_path, sizeof(diffuse_map_path), "%s/%s", relative_path.buf,
+// // diffuse_map_filename);
+// // printf("load from %s\n", diffuse_map_path);
+
+// // // --------------
+// // texture diffuse_texture = texture_data_load(diffuse_map_path, true);
+// // current_material.diffuse_texture = diffuse_texture;
+// // strcpy(current_material.diffuse_tex_path, diffuse_map_path);
+// // texture_data_upload(&current_material.diffuse_texture);
+// // // --------------
+// // } else if (strcmp(line_header, "map_Ks") == 0) {
+// // // char specular_map_path[1024] = "assets/";
+// // // sscanf(pch + offset, "%s", specular_map_path + 7);
+// // char specular_map_filename[1024];
+// // sscanf(pch + offset, "%s", specular_map_filename);
+// // char specular_map_path[1024];
+// // snprintf(specular_map_path, sizeof(specular_map_path), "%s/%s", relative_path.buf,
+// // specular_map_filename);
+// // printf("load from %s\n", specular_map_path);
+// // // --------------
+// // texture specular_texture = texture_data_load(specular_map_path, true);
+// // current_material.specular_texture = specular_texture;
+// // strcpy(current_material.specular_tex_path, specular_map_path);
+// // texture_data_upload(&current_material.specular_texture);
+// // // --------------
+// // } else if (strcmp(line_header, "map_Bump") == 0) {
+// // // TODO
+// // }
+
+// // pch = strtok_r(NULL, "\n", &saveptr);
+// // }
+
+// // TRACE("end load material lib");
+
+// // // last mesh or if one wasnt created with 'o' directive
+// // // TRACE("Last leftover material");
+// // material_darray_push(materials, current_material);
+
+// // INFO("Loaded %ld materials", material_darray_len(materials));
+// TRACE("END load material lib");
+// return true;
+// }
diff --git a/src/std/str.c b/src/std/str.c
index 07a8e73..e15c38f 100644
--- a/src/std/str.c
+++ b/src/std/str.c
@@ -3,62 +3,62 @@
#include <string.h>
#include "mem.h"
-str8 str8_create(u8* buf, size_t len) { return (str8){ .buf = buf, .len = len }; }
+// str8 str8_create(u8* buf, size_t len) { return (str8){ .buf = buf, .len = len }; }
-str8 str8_cstr_view(char* string) { return str8_create((u8*)string, strlen(string)); }
+// str8 str8_cstr_view(char* string) { return str8_create((u8*)string, strlen(string)); }
-bool str8_equals(str8 a, str8 b) {
- if (a.len != b.len) {
- return false;
- }
+// bool str8_equals(str8 a, str8 b) {
+// if (a.len != b.len) {
+// return false;
+// }
- for (size_t i = 0; i < a.len; i++) {
- if (a.buf[i] != b.buf[i]) {
- return false;
- }
- }
- return true;
-}
+// for (size_t i = 0; i < a.len; i++) {
+// if (a.buf[i] != b.buf[i]) {
+// return false;
+// }
+// }
+// return true;
+// }
-char* str8_to_cstr(arena* a, str8 s) {
- bool is_null_terminated = s.buf[s.len - 1] == 0;
- size_t n_bytes = is_null_terminated ? s.len : s.len + 1;
+// char* str8_to_cstr(arena* a, str8 s) {
+// bool is_null_terminated = s.buf[s.len - 1] == 0;
+// size_t n_bytes = is_null_terminated ? s.len : s.len + 1;
- u8* dest = arena_alloc(a, n_bytes);
+// u8* dest = arena_alloc(a, n_bytes);
- memcpy(dest, s.buf, s.len);
- if (is_null_terminated) {
- dest[s.len] = '\0';
- }
- return (char*)dest;
-}
+// memcpy(dest, s.buf, s.len);
+// if (is_null_terminated) {
+// dest[s.len] = '\0';
+// }
+// return (char*)dest;
+// }
-str8 str8_concat(arena* a, str8 left, str8 right) {
- size_t n_bytes = left.len + right.len + 1;
+// str8 str8_concat(arena* a, str8 left, str8 right) {
+// size_t n_bytes = left.len + right.len + 1;
- u8* dest = arena_alloc(a, n_bytes);
- memcpy(dest, left.buf, left.len);
- memcpy(dest + right.len, right.buf, right.len);
+// u8* dest = arena_alloc(a, n_bytes);
+// memcpy(dest, left.buf, left.len);
+// memcpy(dest + right.len, right.buf, right.len);
- dest[n_bytes - 1] = '\0';
+// dest[n_bytes - 1] = '\0';
- return str8_create(dest, n_bytes);
-}
+// return str8_create(dest, n_bytes);
+// }
-str8 str8_substr(str8 s, u64 min, u64 max) {
- assert(min >= 0);
- assert(min < s.len);
- assert(max >= 0);
- assert(max <= s.len);
- uint8_t* start = s.buf + (ptrdiff_t)min;
- size_t new_len = max - min;
- return (str8){ .buf = start, .len = new_len };
-}
+// str8 str8_substr(str8 s, u64 min, u64 max) {
+// assert(min >= 0);
+// assert(min < s.len);
+// assert(max >= 0);
+// assert(max <= s.len);
+// uint8_t* start = s.buf + (ptrdiff_t)min;
+// size_t new_len = max - min;
+// return (str8){ .buf = start, .len = new_len };
+// }
-str8 str8_take(str8 s, u64 first_n) { return str8_substr(s, 0, first_n); }
+// str8 str8_take(str8 s, u64 first_n) { return str8_substr(s, 0, first_n); }
-str8 str8_drop(str8 s, u64 last_n) { return str8_substr(s, s.len - last_n, s.len); }
+// str8 str8_drop(str8 s, u64 last_n) { return str8_substr(s, s.len - last_n, s.len); }
-str8 str8_skip(str8 s, u64 n) { return str8_substr(s, n, s.len); }
+// str8 str8_skip(str8 s, u64 n) { return str8_substr(s, n, s.len); }
-str8 str8_chop(str8 s, u64 n) { return str8_substr(s, 0, s.len - n); }
+// str8 str8_chop(str8 s, u64 n) { return str8_substr(s, 0, s.len - n); }
diff --git a/src/transform_hierarchy.c b/src/transform_hierarchy.c
index b08e545..a5f4d97 100644
--- a/src/transform_hierarchy.c
+++ b/src/transform_hierarchy.c
@@ -13,173 +13,173 @@
#include "maths_types.h"
#include "render_types.h"
-struct transform_hierarchy {
- transform_node root;
-};
-
-transform_hierarchy* transform_hierarchy_create() {
- transform_hierarchy* tfh = malloc(sizeof(struct transform_hierarchy));
-
- tfh->root = (transform_node){ .model = { ABSENT_MODEL_HANDLE },
- .tf = TRANSFORM_DEFAULT,
- .local_matrix_tf = mat4_ident(),
- .world_matrix_tf = mat4_ident(),
- .parent = NULL,
- .children = { 0 },
- .n_children = 0,
- .tfh = tfh };
- return tfh;
-}
-
-bool free_node(transform_node* node, void* _ctx_data) {
- if (!node) return true; // leaf node
- if (node == &node->tfh->root) {
- WARN("You can't free the root node!");
- return false;
- }
-
- printf("Freed node\n");
- free(node);
- return true;
-}
-
-void transform_hierarchy_free(transform_hierarchy* tfh) {
- transform_hierarchy_dfs(&tfh->root, free_node, false, NULL);
- free(tfh);
-}
-
-transform_node* transform_hierarchy_root_node(transform_hierarchy* tfh) { return &tfh->root; }
-
-transform_node* transform_hierarchy_add_node(transform_node* parent, ModelHandle model,
- Transform tf) {
- if (!parent) {
- WARN("You tried to add a node to a bad parent (NULL?)");
- return NULL;
- }
- transform_node* node = malloc(sizeof(transform_node));
- node->model = model;
- node->tf = tf;
- node->local_matrix_tf = mat4_ident();
- node->world_matrix_tf = mat4_ident();
- node->parent = parent;
- memset(node->children, 0, sizeof(node->children));
- node->n_children = 0;
- node->tfh = parent->tfh;
-
- // push into parent's children array
- u32 next_index = parent->n_children;
- if (next_index == MAX_TF_NODE_CHILDREN) {
- ERROR("This transform hierarchy node already has MAX children. Dropping.");
- free(node);
- } else {
- parent->children[next_index] = node;
- parent->n_children++;
- }
-
- return node;
-}
-
-void transform_hierarchy_delete_node(transform_node* node) {
- // delete all children
- for (u32 i = 0; i < node->n_children; i++) {
- transform_node* child = node->children[i];
- transform_hierarchy_dfs(child, free_node, false, NULL);
- }
-
- if (node->parent) {
- for (u32 i = 0; i < node->parent->n_children; i++) {
- transform_node* child = node->parent->children[i];
- if (child == node) {
- node->parent->children[i] = NULL; // HACK: this will leave behind empty slots in the
- // children array of the parent. oh well.
- }
- }
- }
-
- free(node);
-}
-
-void transform_hierarchy_dfs(transform_node* start_node,
- bool (*visit_node)(transform_node* node, void* ctx_data),
- bool is_pre_order, void* ctx_data) {
- if (!start_node) return;
-
- bool continue_traversal = true;
- if (is_pre_order) {
- continue_traversal = visit_node(start_node, ctx_data);
- }
-
- if (continue_traversal) {
- for (u32 i = 0; i < start_node->n_children; i++) {
- transform_node* child = start_node->children[i];
- transform_hierarchy_dfs(child, visit_node, is_pre_order, ctx_data);
- }
- }
-
- if (!is_pre_order) {
- // post-order
- visit_node(start_node, ctx_data);
- }
-}
-
-// Update matrix for the current node
-bool update_matrix(transform_node* node, void* _ctx_data) {
- if (!node) return true; // leaf node
-
- if (node->parent && node->parent->tf.is_dirty) {
- node->tf.is_dirty = true;
- }
-
- if (node->tf.is_dirty) {
- // invalidates children
- Mat4 updated_local_transform = transform_to_mat(&node->tf);
- node->local_matrix_tf = updated_local_transform;
- if (node->parent) {
- Mat4 updated_world_transform =
- mat4_mult(node->parent->world_matrix_tf, updated_local_transform);
- node->world_matrix_tf = updated_world_transform;
- }
- }
-
- return true;
-}
-
-void transform_hierarchy_propagate_transforms(transform_hierarchy* tfh) {
- // kickoff traversal
- transform_hierarchy_dfs(&tfh->root, update_matrix, false, NULL);
-}
-
-struct print_ctx {
- Core* core;
- u32 indentation_lvl;
-};
-
-bool print_node(transform_node* node, void* ctx_data) {
- struct print_ctx* ctx = (struct print_ctx*)ctx_data;
-
- if (!node) return true;
- if (!node->parent) {
- printf("Root Node\n");
- ctx->indentation_lvl++;
- return true;
- }
-
- // Grab the model
- // FIXME
- // model m = ctx->core->models->data[node->model.raw];
- for (int i = 0; i < ctx->indentation_lvl; i++) {
- printf(" ");
- }
- // printf("Node %s\n", m.name.buf);
- ctx->indentation_lvl++;
-
- return true;
-}
-
-void transform_hierarchy_debug_print(transform_node* start_node, Core* core) {
- struct print_ctx* ctx = malloc(sizeof(struct print_ctx));
- ctx->core = core;
- ctx->indentation_lvl = 0;
- transform_hierarchy_dfs(start_node, print_node, true, (void*)ctx);
- free(ctx);
-}
+// struct transform_hierarchy {
+// transform_node root;
+// };
+
+// transform_hierarchy* transform_hierarchy_create() {
+// transform_hierarchy* tfh = malloc(sizeof(struct transform_hierarchy));
+
+// tfh->root = (transform_node){ .model = { ABSENT_MODEL_HANDLE },
+// .tf = TRANSFORM_DEFAULT,
+// .local_matrix_tf = mat4_ident(),
+// .world_matrix_tf = mat4_ident(),
+// .parent = NULL,
+// .children = { 0 },
+// .n_children = 0,
+// .tfh = tfh };
+// return tfh;
+// }
+
+// bool free_node(transform_node* node, void* _ctx_data) {
+// if (!node) return true; // leaf node
+// if (node == &node->tfh->root) {
+// WARN("You can't free the root node!");
+// return false;
+// }
+
+// printf("Freed node\n");
+// free(node);
+// return true;
+// }
+
+// void transform_hierarchy_free(transform_hierarchy* tfh) {
+// transform_hierarchy_dfs(&tfh->root, free_node, false, NULL);
+// free(tfh);
+// }
+
+// transform_node* transform_hierarchy_root_node(transform_hierarchy* tfh) { return &tfh->root; }
+
+// transform_node* transform_hierarchy_add_node(transform_node* parent, ModelHandle model,
+// Transform tf) {
+// if (!parent) {
+// WARN("You tried to add a node to a bad parent (NULL?)");
+// return NULL;
+// }
+// transform_node* node = malloc(sizeof(transform_node));
+// node->model = model;
+// node->tf = tf;
+// node->local_matrix_tf = mat4_ident();
+// node->world_matrix_tf = mat4_ident();
+// node->parent = parent;
+// memset(node->children, 0, sizeof(node->children));
+// node->n_children = 0;
+// node->tfh = parent->tfh;
+
+// // push into parent's children array
+// u32 next_index = parent->n_children;
+// if (next_index == MAX_TF_NODE_CHILDREN) {
+// ERROR("This transform hierarchy node already has MAX children. Dropping.");
+// free(node);
+// } else {
+// parent->children[next_index] = node;
+// parent->n_children++;
+// }
+
+// return node;
+// }
+
+// void transform_hierarchy_delete_node(transform_node* node) {
+// // delete all children
+// for (u32 i = 0; i < node->n_children; i++) {
+// transform_node* child = node->children[i];
+// transform_hierarchy_dfs(child, free_node, false, NULL);
+// }
+
+// if (node->parent) {
+// for (u32 i = 0; i < node->parent->n_children; i++) {
+// transform_node* child = node->parent->children[i];
+// if (child == node) {
+// node->parent->children[i] = NULL; // HACK: this will leave behind empty slots in the
+// // children array of the parent. oh well.
+// }
+// }
+// }
+
+// free(node);
+// }
+
+// void transform_hierarchy_dfs(transform_node* start_node,
+// bool (*visit_node)(transform_node* node, void* ctx_data),
+// bool is_pre_order, void* ctx_data) {
+// if (!start_node) return;
+
+// bool continue_traversal = true;
+// if (is_pre_order) {
+// continue_traversal = visit_node(start_node, ctx_data);
+// }
+
+// if (continue_traversal) {
+// for (u32 i = 0; i < start_node->n_children; i++) {
+// transform_node* child = start_node->children[i];
+// transform_hierarchy_dfs(child, visit_node, is_pre_order, ctx_data);
+// }
+// }
+
+// if (!is_pre_order) {
+// // post-order
+// visit_node(start_node, ctx_data);
+// }
+// }
+
+// // Update matrix for the current node
+// bool update_matrix(transform_node* node, void* _ctx_data) {
+// if (!node) return true; // leaf node
+
+// if (node->parent && node->parent->tf.is_dirty) {
+// node->tf.is_dirty = true;
+// }
+
+// if (node->tf.is_dirty) {
+// // invalidates children
+// Mat4 updated_local_transform = transform_to_mat(&node->tf);
+// node->local_matrix_tf = updated_local_transform;
+// if (node->parent) {
+// Mat4 updated_world_transform =
+// mat4_mult(node->parent->world_matrix_tf, updated_local_transform);
+// node->world_matrix_tf = updated_world_transform;
+// }
+// }
+
+// return true;
+// }
+
+// void transform_hierarchy_propagate_transforms(transform_hierarchy* tfh) {
+// // kickoff traversal
+// transform_hierarchy_dfs(&tfh->root, update_matrix, false, NULL);
+// }
+
+// struct print_ctx {
+// Core* core;
+// u32 indentation_lvl;
+// };
+
+// bool print_node(transform_node* node, void* ctx_data) {
+// struct print_ctx* ctx = (struct print_ctx*)ctx_data;
+
+// if (!node) return true;
+// if (!node->parent) {
+// printf("Root Node\n");
+// ctx->indentation_lvl++;
+// return true;
+// }
+
+// // Grab the model
+// // FIXME
+// // model m = ctx->core->models->data[node->model.raw];
+// for (int i = 0; i < ctx->indentation_lvl; i++) {
+// printf(" ");
+// }
+// // printf("Node %s\n", m.name.buf);
+// ctx->indentation_lvl++;
+
+// return true;
+// }
+
+// void transform_hierarchy_debug_print(transform_node* start_node, Core* core) {
+// struct print_ctx* ctx = malloc(sizeof(struct print_ctx));
+// ctx->core = core;
+// ctx->indentation_lvl = 0;
+// transform_hierarchy_dfs(start_node, print_node, true, (void*)ctx);
+// free(ctx);
+// }
diff --git a/src/transform_hierarchy.h b/src/transform_hierarchy.h
index 0a506de..808baab 100644
--- a/src/transform_hierarchy.h
+++ b/src/transform_hierarchy.h
@@ -31,48 +31,48 @@ typedef struct Transform_Node TF_Node;
/** @brief Allocates and returns an empty transform hierarchy with a root node */
TransformHierarchy* TransformHierarchy_Create();
-/**
- * @brief recursively frees all the children and then finally itself
- * @note in the future we can use an object pool for the nodes
- */
-void transform_hierarchy_free(transform_hierarchy* tfh);
-
-// --- Main usecase
-
-/** @brief Updates matrices of any invalidated nodes based on the `is_dirty` flag inside `transform`
- */
-void transform_hierarchy_propagate_transforms(transform_hierarchy* tfh);
-
-// --- Queries
-
-/** @brief Get a pointer to the root node */
-Transform_Node* TransformHierarchy_RootNode(TransformHierarchy* tfh);
-
-// --- Mutations
-Transform_Node* TransformHierarchy_AddNode(transform_node* parent, ModelHandle model,
- Transform tf);
-void transform_hierarchy_delete_node(transform_node* node);
-
-// --- Traversal
-
-/**
- * @brief Perform a depth-first search traversal starting from `start_node`.
- * @param start_node The starting node of the traversal.
- * @param visit_node The function to call for each node visited. The callback should return false to
- stop the traversal early.
- * @param is_pre_order Indicates whether to do pre-order or post-order traversal i.e. when to call
- the `visit_node` function.
- * @param ctx_data An optional pointer to data that is be passed on each call to `visit_node`. Can
- be used to carry additional information or context.
- *
- * @note The main use-cases are:
- 1. traversing the whole tree to update cached 4x4 affine transform matrices (post-order)
- 2. freeing child nodes after deleting a node in the tree (post-order)
- 3. debug pretty printing the whole tree (post-order)
- */
-void transform_hierarchy_dfs(transform_node* start_node,
- bool (*visit_node)(transform_node* node, void* ctx_data),
- bool is_pre_order, void* ctx_data);
-
-struct Core;
-void transform_hierarchy_debug_print(transform_node* start_node, struct Core* core);
+// /**
+// * @brief recursively frees all the children and then finally itself
+// * @note in the future we can use an object pool for the nodes
+// */
+// void transform_hierarchy_free(transform_hierarchy* tfh);
+
+// // --- Main usecase
+
+// /** @brief Updates matrices of any invalidated nodes based on the `is_dirty` flag inside `transform`
+// */
+// void transform_hierarchy_propagate_transforms(transform_hierarchy* tfh);
+
+// // --- Queries
+
+// /** @brief Get a pointer to the root node */
+// Transform_Node* TransformHierarchy_RootNode(TransformHierarchy* tfh);
+
+// // --- Mutations
+// Transform_Node* TransformHierarchy_AddNode(transform_node* parent, ModelHandle model,
+// Transform tf);
+// void transform_hierarchy_delete_node(transform_node* node);
+
+// // --- Traversal
+
+// /**
+// * @brief Perform a depth-first search traversal starting from `start_node`.
+// * @param start_node The starting node of the traversal.
+// * @param visit_node The function to call for each node visited. The callback should return false to
+// stop the traversal early.
+// * @param is_pre_order Indicates whether to do pre-order or post-order traversal i.e. when to call
+// the `visit_node` function.
+// * @param ctx_data An optional pointer to data that is be passed on each call to `visit_node`. Can
+// be used to carry additional information or context.
+// *
+// * @note The main use-cases are:
+// 1. traversing the whole tree to update cached 4x4 affine transform matrices (post-order)
+// 2. freeing child nodes after deleting a node in the tree (post-order)
+// 3. debug pretty printing the whole tree (post-order)
+// */
+// void transform_hierarchy_dfs(transform_node* start_node,
+// bool (*visit_node)(transform_node* node, void* ctx_data),
+// bool is_pre_order, void* ctx_data);
+
+// struct Core;
+// void transform_hierarchy_debug_print(transform_node* start_node, struct Core* core);
diff --git a/xmake.lua b/xmake.lua
index 009b9fd..960923b 100644
--- a/xmake.lua
+++ b/xmake.lua
@@ -159,12 +159,12 @@ end
target("core_shared")
set_kind("shared")
-add_deps("core_config") -- inherit common configurations
+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
+ add_links("msvcrt", "legacy_stdio_definitions") -- for release builds
+ add_links("msvcrtd", "legacy_stdio_definitions") -- for debug builds
end
-- target("main_loop")