From 542a1d70e7925625e7461d37a810c8859a3f5124 Mon Sep 17 00:00:00 2001 From: Jeremy Hu Date: Mon, 30 Jan 2017 00:12:50 +0930 Subject: [PATCH] Add skinned mesh define --- build/dust3d.pro | 6 ++++-- src/skinnedmesh.c | 2 ++ src/skinnedmesh.h | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 src/skinnedmesh.c create mode 100644 src/skinnedmesh.h diff --git a/build/dust3d.pro b/build/dust3d.pro index 53e8137f..843a5723 100644 --- a/build/dust3d.pro +++ b/build/dust3d.pro @@ -18,7 +18,8 @@ SOURCES += main.cpp \ convexhull.c \ hashtable.c \ osutil.cpp \ - subdivide.c + subdivide.c \ + skinnedmesh.c HEADERS += mainwindow.h \ render.h \ @@ -31,4 +32,5 @@ HEADERS += mainwindow.h \ hashtable.h \ 3dstruct.h \ osutil.h \ - subdivide.h \ No newline at end of file + subdivide.h \ + skinnedmesh.h \ No newline at end of file diff --git a/src/skinnedmesh.c b/src/skinnedmesh.c new file mode 100644 index 00000000..a961d97c --- /dev/null +++ b/src/skinnedmesh.c @@ -0,0 +1,2 @@ +#include "skinnedmesh.h" + diff --git a/src/skinnedmesh.h b/src/skinnedmesh.h new file mode 100644 index 00000000..da73baf0 --- /dev/null +++ b/src/skinnedmesh.h @@ -0,0 +1,21 @@ +#ifndef SKINNED_MESH_H +#define SKINNED_MESH_H +#include "3dstruct.h" +#include "matrix.h" + +#define SKINNED_MESH_MAX_BONE 4 + +typedef struct skinnedMeshVertex { + vec3 position; + vec3 normal; + int boneIndices[SKINNED_MESH_MAX_BONE]; + float boneWeights[SKINNED_MESH_MAX_BONE]; +} skinnedMeshVertex; + +typedef struct skinnedMeshBone { + vec3 translation; + vec3 rotation; + matrix toRoot; +} skinnedMeshBone; + +#endif