compileargs = -Wall -Wextra -Wpedantic
-linkargs = -lGL -lglut
+linkargs = -L/usr/local/lib -lGL -lglut -lassimp
objects = out/main.o out/debugutil.o out/glut_janitor.o out/render.o \
out/tga.o out/level.o
gcc -o out/shadowclad $(objects) $(linkargs)
run : shadowclad
- out/shadowclad
+ LD_LIBRARY_PATH=/usr/local/lib out/shadowclad
out/main.o : main.c debugutil.h glut_janitor.h render.h
gcc -c -o out/main.o main.c $(compileargs)
#include <GL/gl.h>
#include <stdlib.h>
+#include <stdio.h> // TODO remove
+#include <assimp/cimport.h>
+#include <assimp/scene.h>
#include "level.h"
#include "tga.h"
+const Block BLOCK_EMPTY = 0;
+const Block BLOCK_WALL01 = 1;
+
TGAimage* level_image = NULL;
Block get_block(GLushort x, GLushort y) {
void set_image(TGAimage* image) {
level_image = image;
}
+
+void import_model(const char* path) {
+ const struct aiScene* scene = aiImportFile(path, 0u);
+ if (scene == NULL) {
+ printf("We have nothing.\n");
+ return;
+ }
+ printf("mFlags = %u\nmRootNode = %p\nmNumMeshes = %u\nmMeshes = %p\nmNumMaterials = %u\nmMaterials = %p\nmNumAnimations = %u\nmAnimations = %p\nmNumTextures = %u\nmTextures = %p\nmNumLights = %u\nmLights = %p\n",
+ (*scene).mFlags,
+ (*scene).mRootNode,
+ (*scene).mNumMeshes,
+ (*scene).mMeshes,
+ (*scene).mNumMaterials,
+ (*scene).mMaterials,
+ (*scene).mNumAnimations,
+ (*scene).mAnimations,
+ (*scene).mNumTextures,
+ (*scene).mTextures,
+ (*scene).mNumLights,
+ (*scene).mLights);
+ aiReleaseImport(scene);
+}
typedef GLuint Block;
-const Block BLOCK_EMPTY = 0;
-const Block BLOCK_WALL01 = 1;
+const Block BLOCK_EMPTY;
+const Block BLOCK_WALL01;
Block get_block(GLushort x, GLushort y);
void set_image(TGAimage* image);
#include "debugutil.h"
#include "glut_janitor.h"
#include "render.h"
+#include "level.h"
int main(int argc, char** argv) {
glutInit(&argc, argv);
init_render();
+ import_model("out/assets/wall01.3ds");
+
glutMainLoop();
return 0;
}