Fixed makefile always rebuilding from scratch

dev
Shariq Shah 9 years ago
parent 14992ad143
commit 145a0977ee
  1. 14
      build/linux/makefile
  2. 4
      orgfile.org
  3. 9
      src/geometry.c
  4. 2
      src/model.c
  5. 2
      src/renderer.c
  6. 1
      src/scene.c
  7. 1
      src/transform.c

@ -6,28 +6,30 @@ LIB_DIR_RELEASE = ../../libs/release/linux64_gcc
LIB_DIR_DEBUG = ../../libs/debug/linux64_gcc LIB_DIR_DEBUG = ../../libs/debug/linux64_gcc
BUILD_TYPE = release BUILD_TYPE = release
SRCS = $(patsubst $(SRC_DIR)/%.c, %.c, $(wildcard ../../src/*.c)) SRCS = $(patsubst $(SRC_DIR)/%.c, %.c, $(wildcard ../../src/*.c))
OBJS = $(patsubst %.c,%.o,$(SRCS))
OBJS_RELEASE = $(patsubst %.c,.release/%.o,$(SRCS)) OBJS_RELEASE = $(patsubst %.c,.release/%.o,$(SRCS))
OBJS_DEBUG = $(patsubst %.c,.debug/%.o,$(SRCS)) OBJS_DEBUG = $(patsubst %.c,.debug/%.o,$(SRCS))
CFLAGS = -Wall -I$(INCLUDE_DIR) -DUSE_GLAD CFLAGS = -Wall -I$(INCLUDE_DIR) -DUSE_GLAD
CFLAGS_DEBUG = -g -DGL_DEBUG_CONTEXT -DAL_DEBUG -std=c99 CFLAGS_DEBUG = -g -DGL_DEBUG_CONTEXT -DAL_DEBUG -std=c99
CFLAGS_RELEASE = -O2 CFLAGS_RELEASE = -O3 -ffast-math
LFLAGS = -lSDL2 -lpthread -ldl -lm -lopenal -lsndio -lGL LFLAGS = -lSDL2 -lpthread -ldl -lm -lopenal -lsndio -lGL
all: release all: release
release: BUILD_TYPE = release release: BUILD_TYPE = release
release: CFLAGS += $(CFLAGS_RELEASE) release: CFLAGS += $(CFLAGS_RELEASE)
release: pre_build $(OBJS) post_build release: pre_build $(OBJS_RELEASE) post_build
$(CC) $(OBJS_RELEASE) -L$(LIB_DIR_RELEASE) $(LFLAGS) -o $(PROJECT_NAME) $(CC) $(OBJS_RELEASE) -L$(LIB_DIR_RELEASE) $(LFLAGS) -o $(PROJECT_NAME)
debug: BUILD_TYPE = debug debug: BUILD_TYPE = debug
debug: CFLAGS += $(CFLAGS_DEBUG) debug: CFLAGS += $(CFLAGS_DEBUG)
debug: pre_build $(OBJS) post_build debug: pre_build $(OBJS_DEBUG) post_build
$(CC) $(OBJS_DEBUG) -L$(LIB_DIR_DEBUG) $(LFLAGS) -o $(PROJECT_NAME) $(CC) $(OBJS_DEBUG) -L$(LIB_DIR_DEBUG) $(LFLAGS) -o $(PROJECT_NAME)
%.o: $(SRC_DIR)/%.c .release/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -c $< -o .$(BUILD_TYPE)/$@ $(CC) $(CFLAGS) -c $< -o $@
.debug/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
pre_build: pre_build:
-@mkdir .debug .release -@mkdir .debug .release

@ -98,6 +98,7 @@ All the code in this repository is under GPLv3, see LICENSE for more information
- State "DONE" from "TODO" [2017-03-19 Sun 01:31] - State "DONE" from "TODO" [2017-03-19 Sun 01:31]
** TODO Ability to mark meshes for debug rendering with possibility of different color for each? ** TODO Ability to mark meshes for debug rendering with possibility of different color for each?
** TODO Setup cross compilation with mingw or stick to msvc? ** TODO Setup cross compilation with mingw or stick to msvc?
** TODO Add marking or queuing up custom meshes for debug render with particular transform and color for rendering bounding spheres for example
** DONE Toggleable debug drawing for meshes ** DONE Toggleable debug drawing for meshes
- State "DONE" from "TODO" [2017-03-18 Sat 16:18] - State "DONE" from "TODO" [2017-03-18 Sat 16:18]
** TODO Interleaved vbos for meshes and changes to blender exporter accordingly ** TODO Interleaved vbos for meshes and changes to blender exporter accordingly
@ -110,7 +111,8 @@ x Font atlas proper cleanup
- Custom rendering for gui - Custom rendering for gui
** TODO Allow passsing base path as commandline argument? ** TODO Allow passsing base path as commandline argument?
** TODO Better handling incase assets folder is not found? ** TODO Better handling incase assets folder is not found?
** TODO OpenAL not working in release builds ** DONE OpenAL not working in release builds
- State "DONE" from "TODO" [2017-03-25 Sat 02:06]
** DONE 3d sound using OpenAL ** DONE 3d sound using OpenAL
- State "DONE" from "TODO" [2017-03-23 Thu 01:43] - State "DONE" from "TODO" [2017-03-23 Thu 01:43]
** TODO Ogg format loading and playback ** TODO Ogg format loading and playback

@ -13,6 +13,7 @@
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#include <math.h> #include <math.h>
#include <float.h>
struct Geometry struct Geometry
{ {
@ -75,6 +76,12 @@ static void generate_bounding_volume(int geometry_index)
struct Geometry* geometry = &geometry_list[geometry_index]; struct Geometry* geometry = &geometry_list[geometry_index];
struct Bounding_Box* box = &geometry->bounding_box; struct Bounding_Box* box = &geometry->bounding_box;
struct Bounding_Sphere* sphere = &geometry->bounding_sphere; struct Bounding_Sphere* sphere = &geometry->bounding_sphere;
vec3_fill(&box->max, -FLT_MIN, -FLT_MIN, -FLT_MIN);
vec3_fill(&box->min, FLT_MAX, FLT_MAX, FLT_MAX);
vec3_fill(&sphere->center, 0.f, 0.f, 0.f);
sphere->radius = 0.f;
for(int i = 0; i < array_len(geometry->vertices); i++) for(int i = 0; i < array_len(geometry->vertices); i++)
{ {
vec3* vertex = &geometry->vertices[i]; vec3* vertex = &geometry->vertices[i];
@ -90,7 +97,7 @@ static void generate_bounding_volume(int geometry_index)
vec3_scale(&sphere->center, &sphere->center, 0.5f); vec3_scale(&sphere->center, &sphere->center, 0.5f);
vec3 len_vec; vec3 len_vec;
vec3_sub(&len_vec, &box->max, &sphere->center); vec3_sub(&len_vec, &box->max, &sphere->center);
sphere->radius = fabs(vec3_len(&len_vec)); sphere->radius = fabsf(vec3_len(&len_vec));
} }
static struct Geometry* generate_new_index(int* out_new_index) static struct Geometry* generate_new_index(int* out_new_index)

@ -415,7 +415,7 @@ void model_render_all_debug(struct Camera* camera,
struct Transform* parent_transform = entity_component_get(parent, C_TRANSFORM); struct Transform* parent_transform = entity_component_get(parent, C_TRANSFORM);
mat4_mul(&temp_trans.trans_mat, &temp_trans.trans_mat, &parent_transform->trans_mat); mat4_mul(&temp_trans.trans_mat, &temp_trans.trans_mat, &parent_transform->trans_mat);
} }
//log_message("Radius %.3f", sphere->radius);
mat4_identity(&mvp); mat4_identity(&mvp);
//mat4_mul(&mvp, &camera->view_proj_mat, &transform->trans_mat); //mat4_mul(&mvp, &camera->view_proj_mat, &transform->trans_mat);
mat4_mul(&mvp, &camera->view_proj_mat, &temp_trans.trans_mat); mat4_mul(&mvp, &camera->view_proj_mat, &temp_trans.trans_mat);

@ -40,7 +40,7 @@ void renderer_init(void)
settings.fog.density = 0.01f; settings.fog.density = 0.01f;
settings.fog.start_dist = 50.f; settings.fog.start_dist = 50.f;
settings.fog.max_dist = 150.f; settings.fog.max_dist = 150.f;
settings.debug_draw_enabled = 0; settings.debug_draw_enabled = 1;
settings.debug_draw_mode = GDM_TRIANGLES; settings.debug_draw_mode = GDM_TRIANGLES;
settings.max_gui_vertex_memory = MAX_GUI_VERTEX_MEMORY; settings.max_gui_vertex_memory = MAX_GUI_VERTEX_MEMORY;
settings.max_gui_element_memory = MAX_GUI_ELEMENT_MEMORY; settings.max_gui_element_memory = MAX_GUI_ELEMENT_MEMORY;

@ -14,6 +14,7 @@ void scene_init(void)
/* Add root node to scene */ /* Add root node to scene */
struct Entity* root = entity_create("ROOT", NULL); struct Entity* root = entity_create("ROOT", NULL);
root_node = root->node; root_node = root->node;
log_message("Root Parent : %d", root->parent);
} }
struct Entity* scene_add_new(const char* name, const char* tag) struct Entity* scene_add_new(const char* name, const char* tag)

@ -41,6 +41,7 @@ int transform_create(int node)
vec3_fill(&new_transform->position, 0.f, 0.f, 0.f); vec3_fill(&new_transform->position, 0.f, 0.f, 0.f);
vec3_fill(&new_transform->scale, 1.f, 1.f, 1.f); vec3_fill(&new_transform->scale, 1.f, 1.f, 1.f);
quat_identity(&new_transform->rotation); quat_identity(&new_transform->rotation);
mat4_identity(&new_transform->trans_mat);
transform_update_transmat(new_transform); transform_update_transmat(new_transform);
} }
return index; return index;

Loading…
Cancel
Save