Skip to content

Commit

Permalink
Better Makefile, ECS progress
Browse files Browse the repository at this point in the history
  • Loading branch information
kosshi-net committed Sep 8, 2017
1 parent c4cbe6c commit 270d0bf
Show file tree
Hide file tree
Showing 57 changed files with 3,582 additions and 246 deletions.
75 changes: 34 additions & 41 deletions Makefile
@@ -1,16 +1,11 @@
# -*- MakeFile -*-

SRC= src/
BIN= bin/
BUILD= build/
CC= g++
CFLAGS= -O3 -ftree-vectorize -msse2 -static -fopenmp -Wall -static-libgcc -static-libstdc++ -std=c++11 -m32
# CFLAGS= -g -fopenmp -Wall -std=c++11
#-Wl,-subsystem,windows
# -Wl,-subsystem,windows -fopt-info-vec-missed
# CFLAGS=-fopenmp -static -Wall -static-libgcc -static-libstdc++
# CFLAGS=-fopenmp -Wall -O0 -std=c++11
EXT = C:/ext/
CFLAGS= -O3 -ftree-vectorize -msse3 -static -fopenmp -Wall -static-libgcc -static-libstdc++ -std=c++11 -m32
#-Wl,-subsystem,windows -fopt-info-vec-missed
EXT = lib/
GLFW = $(EXT)glfw-3.2.1/
GLEW = $(EXT)glew-2.0.0/
SIMPLEX = $(EXT)simplex-1.0/
Expand All @@ -21,43 +16,41 @@ INC = -I $(GLFW)include -I $(GLEW)include -I $(SIMPLEX)include -I $(GLM)include
LIB = $(GLEW)lib/glew.o -L $(GLFW)lib $(SIMPLEX)lib/simplex.o $(FT)lib/libfreetype.a
HEAD = include/

$(BIN)game: $(BUILD)game.o $(BUILD)renderer.o $(BUILD)input.o $(BUILD)terrain.o $(BUILD)terrainmesher.o $(BUILD)log.o;
$(CC) $(BUILD)game.o $(BUILD)log.o $(BUILD)renderer.o $(BUILD)input.o $(BUILD)terrain.o $(BUILD)terrainmesher.o $(LIB) -lglfw3 -lgdi32 -lopengl32 $(CFLAGS) -o $(BIN)game.exe

$(BUILD)game.o: $(SRC)game.cpp $(SRC)other/defineterrain.hpp
$(CC) -c $(SRC)game.cpp $(INC) $(CFLAGS) -o $(BUILD)game.o
OBJECTS = \
$(SRC)game.o \
$(BUILD)renderer.o \
$(SRC)input/input.o \
$(SRC)terrain/terrain.o \
$(SRC)mesher/terrainmesher.o \
$(SRC)log/log.o \
$(SRC)entity/entity.o \
$(SRC)entity/entityfactory.o \
$(SRC)system/localcontrol.o \
$(SRC)system/physics.o \
$(SRC)system/camera.o \
$(SRC)other/util.o \


$(BIN)game: $(OBJECTS)
@echo Linking $@
@$(CC) $^ $(LIB) -lglfw3 -lgdi32 -lopengl32 $(CFLAGS) -o $(BIN)game.exe

$(BUILD)renderer.o: $(SRC)renderer/renderer.cpp $(BUILD)res.h $(SRC)renderer/textrenderer.hpp
$(CC) -c $(SRC)renderer/renderer.cpp $(INC) $(CFLAGS) -o $(BUILD)renderer.o

$(BUILD)input.o: $(SRC)input/input.cpp
$(CC) -c $(SRC)input/input.cpp $(INC) $(CFLAGS) -o $(BUILD)input.o

$(BUILD)terrain.o: $(SRC)terrain/terrain.cpp
$(CC) -c $(SRC)terrain/terrain.cpp $(INC) $(CFLAGS) -o $(BUILD)terrain.o
@echo Building $@
@$(CC) -c $< $(INC) $(CFLAGS) -o $@

$(BUILD)terrainmesher.o: $(SRC)mesher/terrainmesher.cpp
$(CC) -c $(SRC)mesher/terrainmesher.cpp $(INC) -fopenmp $(CFLAGS) -o $(BUILD)terrainmesher.o

$(BUILD)log.o: $(SRC)log/log.cpp
$(CC) -c $(SRC)log/log.cpp $(INC) $(CFLAGS) -o $(BUILD)log.o

$(BUILD)entitysys.o: $(SRC)entitysys/entitysys.cpp
$(CC) -c $(SRC)entitysys/entitysys.cpp $(INC) $(CFLAGS) -o $(BUILD)entitysys.o
$(SRC)%.o : $(SRC)%.cpp
@echo Building $@
@$(CC) -c $< $(INC) $(CFLAGS) -o $@

$(BUILD)res.h: $(SRC)renderer/shader.glsl
node scripts/res.js
@node scripts/res.js

run: bin/game
@bin/game

.PHONY: clean
clean:
del build\*
del bin\game.exe

test: $(BIN)game
bin/game

phystest:
$(CC) $(SRC)tests/aabbtest.cpp $(INC) $(CFLAGS) -o $(BUILD)phystest.exe
./build/phystest
test_entitysys:
$(CC) $(SRC)tests/test_entitysys.cpp $(INC) $(CFLAGS) -o $(BUILD)test_entitysys.exe
./build/test_entitysys
@del build\* /Q
@del src\*.o /Q /S
@del bin\game.exe /Q
102 changes: 102 additions & 0 deletions Makefile - IMPROVED
@@ -0,0 +1,102 @@
# -*- MakeFile -*-
SRC= src/
BIN= bin/
BUILD= build/
CC= g++
CFLAGS= -O3 -ftree-vectorize -msse2 -static -fopenmp -Wall -static-libgcc -static-libstdc++ -std=c++11 -m32
# CFLAGS= -g -fopenmp -Wall -std=c++11
#-Wl,-subsystem,windows
# -Wl,-subsystem,windows -fopt-info-vec-missed
# CFLAGS=-fopenmp -static -Wall -static-libgcc -static-libstdc++
# CFLAGS=-fopenmp -Wall -O0 -std=c++11
EXT = C:/ext/
GLFW = $(EXT)glfw-3.2.1/
GLEW = $(EXT)glew-2.0.0/
SIMPLEX = $(EXT)simplex-1.0/
GLM = $(EXT)glm-0.9.8.4/
FT = $(EXT)freetype-2.8/

INC = -I $(GLFW)include -I $(GLEW)include -I $(SIMPLEX)include -I $(GLM)include -I $(FT)include -I include -I src
LIB = $(GLEW)lib/glew.o -L $(GLFW)lib $(SIMPLEX)lib/simplex.o $(FT)lib/libfreetype.a
HEAD = include/

OBJECTS = \
$(BUILD)game.o \
$(BUILD)renderer.o \
$(BUILD)input.o \
$(BUILD)terrain.o \
$(BUILD)terrainmesher.o \
$(BUILD)log.o \
$(BUILD)entity.o \
$(BUILD)entityfactory.o \
$(BUILD)localcontrol.o \
$(BUILD)physics.o \
$(BUILD)camera.o \
$(BUILD)util.o \


# %.o: %.cpp
# $(CC) -c $< $(INC) $(CFLAGS) -o $@



$(BIN)game: $(OBJECTS)
@echo LINK GAME.EXE
@$(CC) $^ $(LIB) -lglfw3 -lgdi32 -lopengl32 $(CFLAGS) -o $(BIN)game.exe

$(BUILD)game.o: $(SRC)game.cpp $(SRC)other/defineterrain.hpp
$(CC) -c $(SRC)game.cpp $(INC) $(CFLAGS) -o $(BUILD)game.o

$(BUILD)renderer.o: $(SRC)renderer/renderer.cpp $(BUILD)res.h $(SRC)renderer/textrenderer.hpp
$(CC) -c $(SRC)renderer/renderer.cpp $(INC) $(CFLAGS) -o $(BUILD)renderer.o

$(BUILD)input.o: $(SRC)input/input.cpp
$(CC) -c $(SRC)input/input.cpp $(INC) $(CFLAGS) -o $(BUILD)input.o

$(BUILD)terrain.o: $(SRC)terrain/terrain.cpp
$(CC) -c $(SRC)terrain/terrain.cpp $(INC) $(CFLAGS) -o $(BUILD)terrain.o

$(BUILD)terrainmesher.o: $(SRC)mesher/terrainmesher.cpp
$(CC) -c $(SRC)mesher/terrainmesher.cpp $(INC) -fopenmp $(CFLAGS) -o $(BUILD)terrainmesher.o

$(BUILD)log.o: $(SRC)log/log.cpp
$(CC) -c $(SRC)log/log.cpp $(INC) $(CFLAGS) -o $(BUILD)log.o


$(BUILD)entity.o: $(SRC)entity/entity.cpp
$(CC) -c $(SRC)entity/entity.cpp $(INC) $(CFLAGS) -o $(BUILD)entity.o

$(BUILD)entityfactory.o: $(SRC)entity/entityfactory.cpp
$(CC) -c $(SRC)entity/entityfactory.cpp $(INC) $(CFLAGS) -o $(BUILD)entityfactory.o


$(BUILD)localcontrol.o: $(SRC)system/localcontrol.cpp
$(CC) -c $(SRC)system/localcontrol.cpp $(INC) $(CFLAGS) -o $(BUILD)localcontrol.o
$(BUILD)physics.o: $(SRC)system/physics.cpp
$(CC) -c $(SRC)system/physics.cpp $(INC) $(CFLAGS) -o $(BUILD)physics.o
$(BUILD)camera.o: $(SRC)system/camera.cpp
$(CC) -c $(SRC)system/camera.cpp $(INC) $(CFLAGS) -o $(BUILD)camera.o


$(BUILD)util.o: $(SRC)other/util.cpp
$(CC) -c $(SRC)other/util.cpp $(INC) $(CFLAGS) -o $(BUILD)util.o



$(BUILD)res.h: $(SRC)renderer/shader.glsl
node scripts/res.js

.PHONY: clean
clean:
del build\* /Q
del bin\game.exe /Q

test: $(BIN)game
bin/game

phystest:
$(CC) $(SRC)tests/aabbtest.cpp $(INC) $(CFLAGS) -o $(BUILD)phystest.exe
./build/phystest
test_entitysys:
$(CC) $(SRC)tests/test_entitysys.cpp $(INC) $(CFLAGS) -o $(BUILD)test_entitysys.exe
./build/test_entitysys
82 changes: 82 additions & 0 deletions Makefile - ORIGINAL
@@ -0,0 +1,82 @@
# -*- MakeFile -*-
SRC= src/
BIN= bin/
BUILD= build/
CC= g++
CFLAGS= -O3 -ftree-vectorize -msse2 -static -fopenmp -Wall -static-libgcc -static-libstdc++ -std=c++11 -m32
# CFLAGS= -g -fopenmp -Wall -std=c++11
#-Wl,-subsystem,windows
# -Wl,-subsystem,windows -fopt-info-vec-missed
# CFLAGS=-fopenmp -static -Wall -static-libgcc -static-libstdc++
# CFLAGS=-fopenmp -Wall -O0 -std=c++11
EXT = C:/ext/
GLFW = $(EXT)glfw-3.2.1/
GLEW = $(EXT)glew-2.0.0/
SIMPLEX = $(EXT)simplex-1.0/
GLM = $(EXT)glm-0.9.8.4/
FT = $(EXT)freetype-2.8/

INC = -I $(GLFW)include -I $(GLEW)include -I $(SIMPLEX)include -I $(GLM)include -I $(FT)include -I include -I src
LIB = $(GLEW)lib/glew.o -L $(GLFW)lib $(SIMPLEX)lib/simplex.o $(FT)lib/libfreetype.a
HEAD = include/

$(BIN)game: $(BUILD)game.o $(BUILD)renderer.o $(BUILD)input.o $(BUILD)terrain.o $(BUILD)terrainmesher.o $(BUILD)log.o \
$(BUILD)entity.o $(BUILD)entityfactory.o $(BUILD)localcontrol.o $(BUILD)physics.o $(BUILD)camera.o $(BUILD)util.o
$(CC) \
$(BUILD)game.o $(BUILD)log.o $(BUILD)renderer.o $(BUILD)input.o $(BUILD)terrain.o \
$(BUILD)terrainmesher.o $(BUILD)entity.o $(BUILD)entityfactory.o $(BUILD)localcontrol.o \
$(BUILD)physics.o $(BUILD)util.o $(BUILD)camera.o \
$(LIB) -lglfw3 -lgdi32 -lopengl32 $(CFLAGS) -o $(BIN)game.exe

$(BUILD)game.o: $(SRC)game.cpp $(SRC)other/defineterrain.hpp
$(CC) -c $(SRC)game.cpp $(INC) $(CFLAGS) -o $(BUILD)game.o

$(BUILD)renderer.o: $(SRC)renderer/renderer.cpp $(BUILD)res.h $(SRC)renderer/textrenderer.hpp
$(CC) -c $(SRC)renderer/renderer.cpp $(INC) $(CFLAGS) -o $(BUILD)renderer.o

$(BUILD)input.o: $(SRC)input/input.cpp
$(CC) -c $(SRC)input/input.cpp $(INC) $(CFLAGS) -o $(BUILD)input.o

$(BUILD)terrain.o: $(SRC)terrain/terrain.cpp
$(CC) -c $(SRC)terrain/terrain.cpp $(INC) $(CFLAGS) -o $(BUILD)terrain.o

$(BUILD)terrainmesher.o: $(SRC)mesher/terrainmesher.cpp
$(CC) -c $(SRC)mesher/terrainmesher.cpp $(INC) -fopenmp $(CFLAGS) -o $(BUILD)terrainmesher.o

$(BUILD)log.o: $(SRC)log/log.cpp
$(CC) -c $(SRC)log/log.cpp $(INC) $(CFLAGS) -o $(BUILD)log.o


$(BUILD)entity.o: $(SRC)entity/entity.cpp
$(CC) -c $(SRC)entity/entity.cpp $(INC) $(CFLAGS) -o $(BUILD)entity.o

$(BUILD)entityfactory.o: $(SRC)entity/entityfactory.cpp
$(CC) -c $(SRC)entity/entityfactory.cpp $(INC) $(CFLAGS) -o $(BUILD)entityfactory.o


$(BUILD)%.o: $(SRC)system/%.cpp
$(CC) -c $(SRC)system/%.cpp $(INC) $(CFLAGS) -o $(BUILD)%.o


$(BUILD)util.o: $(SRC)other/util.cpp
$(CC) -c $(SRC)other/util.cpp $(INC) $(CFLAGS) -o $(BUILD)util.o



$(BUILD)res.h: $(SRC)renderer/shader.glsl
node scripts/res.js

.PHONY: clean
clean:
del build\* /Q
del bin\game.exe /Q

test: $(BIN)game
bin/game

phystest:
$(CC) $(SRC)tests/aabbtest.cpp $(INC) $(CFLAGS) -o $(BUILD)phystest.exe
./build/phystest
test_entitysys:
$(CC) $(SRC)tests/test_entitysys.cpp $(INC) $(CFLAGS) -o $(BUILD)test_entitysys.exe
./build/test_entitysys
Binary file modified bin/game.exe
Binary file not shown.
Binary file removed build/game.o
Binary file not shown.
Binary file removed build/input.o
Binary file not shown.
Binary file removed build/log.o
Binary file not shown.
Binary file removed build/phystest.exe
Binary file not shown.
Binary file modified build/renderer.o
Binary file not shown.
Binary file removed build/terrain.o
Binary file not shown.
Binary file removed build/test_entitysys.exe
Binary file not shown.
44 changes: 43 additions & 1 deletion doc/doc.mdown
Expand Up @@ -255,4 +255,46 @@ slice u v
int slices = root;
return (items*slices) * dimension + (items * slice);
}
}



<!-- MEMORY MANAGER, 6.9.2017 -->


void * createBlock( unsigned int size );

createPartitionTable( void* blockPtr, unsigned int maxPartitions);
/*
Writes a table to the block
[ uint, memsize ] [ uint, partcount ]
[ uint, pointer ] [ uint, size ]
[ uint, pointer ] [ uint, size ]
...

first integer is the size of the whole block
second integer is the count of partitions
after this the table begins

each element of the table has 2 values, pointer and a size

if pointer is NULL (0), theres no partition
pointers are an offset from the first value of the whole block


*/

int partCount(void* block){
return block[1];
}

int partTableSize(
){

}

alloc( void* block, size ) {



}
25 changes: 25 additions & 0 deletions lib/simplex-1.0/LICENSE
@@ -0,0 +1,25 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org>

14 changes: 14 additions & 0 deletions lib/simplex-1.0/Makefile
@@ -0,0 +1,14 @@
all: open-simplex-noise.o open-simplex-noise-test

CFLAGS=-W -Wall -Wextra -O3
#CFLAGS=-W -Wall -Wextra -g

open-simplex-noise-test: open-simplex-noise-test.c open-simplex-noise.o
gcc ${CFLAGS} -o open-simplex-noise-test open-simplex-noise.o open-simplex-noise-test.c -lpng

open-simplex-noise.o: open-simplex-noise.h open-simplex-noise.c Makefile
gcc ${CFLAGS} -c open-simplex-noise.c

clean:
rm -f open-simplex-noise.o open-simplex-noise-test test2d.png test3d.png test4d.png

4 changes: 4 additions & 0 deletions lib/simplex-1.0/README.md
@@ -0,0 +1,4 @@
open-simplex-noise-in-c
=======================

Port of Kurt Spencer's java implementation of open simplex noise to C

0 comments on commit 270d0bf

Please sign in to comment.