added various missing structs to hold raw output mesh data to be written
This commit is contained in:
parent
b10c3cb2c4
commit
0770dc01e4
25
src/geometry/group.h
Normal file
25
src/geometry/group.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef __GEOMETRY_GROUP_H_INCLUDED__
|
||||||
|
#define __GEOMETRY_GROUP_H_INCLUDED__
|
||||||
|
|
||||||
|
#include "../common.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
struct Group
|
||||||
|
{
|
||||||
|
std::string name;
|
||||||
|
uint32_t numTriangles;
|
||||||
|
|
||||||
|
uint32_t GetSize() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline uint32_t Group::GetSize() const
|
||||||
|
{
|
||||||
|
uint32_t size = 0;
|
||||||
|
|
||||||
|
size += sizeof(char) * (name.size() + 1); // name string (including null-terminator)
|
||||||
|
size += sizeof(uint32_t); // number of triangles
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
30
src/geometry/joint.h
Normal file
30
src/geometry/joint.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#ifndef __GEOMETRY_JOINT_H_INCLUDED__
|
||||||
|
#define __GEOMETRY_JOINT_H_INCLUDED__
|
||||||
|
|
||||||
|
#include "../common.h"
|
||||||
|
#include "vector3.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
struct Joint
|
||||||
|
{
|
||||||
|
std::string name;
|
||||||
|
int32_t parentJointIndex; // -1 = no parent
|
||||||
|
Vector3 position;
|
||||||
|
Vector3 rotation;
|
||||||
|
|
||||||
|
uint32_t GetSize() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline uint32_t Joint::GetSize() const
|
||||||
|
{
|
||||||
|
uint32_t size = 0;
|
||||||
|
|
||||||
|
size += sizeof(char) * (name.size() + 1); // name string (including null-terminator)
|
||||||
|
size += sizeof(int32_t); // parent index
|
||||||
|
size += sizeof(float) * 3; // position
|
||||||
|
size += sizeof(float) * 3; // rotation
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
24
src/geometry/jointvertexinfo.h
Normal file
24
src/geometry/jointvertexinfo.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#ifndef __GEOMETRY_JOINTVERTEXINFO_H_INCLUDED__
|
||||||
|
#define __GEOMETRY_JOINTVERTEXINFO_H_INCLUDED__
|
||||||
|
|
||||||
|
#include "../common.h"
|
||||||
|
|
||||||
|
struct JointVertexInfo
|
||||||
|
{
|
||||||
|
uint32_t jointIndex;
|
||||||
|
float weight;
|
||||||
|
|
||||||
|
uint32_t GetSize() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline uint32_t JointVertexInfo::GetSize() const
|
||||||
|
{
|
||||||
|
uint32_t size = 0;
|
||||||
|
|
||||||
|
size += sizeof(uint32_t); // joint index
|
||||||
|
size += sizeof(float); // weight
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
46
src/geometry/keyframe.h
Normal file
46
src/geometry/keyframe.h
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#ifndef __GEOMETRY_KEYFRAME_H_INCLUDED__
|
||||||
|
#define __GEOMETRY_KEYFRAME_H_INCLUDED__
|
||||||
|
|
||||||
|
#include "../common.h"
|
||||||
|
#include "vector3.h"
|
||||||
|
|
||||||
|
struct Keyframe
|
||||||
|
{
|
||||||
|
Keyframe(uint32_t numJoints);
|
||||||
|
virtual ~Keyframe();
|
||||||
|
|
||||||
|
uint32_t numJoints;
|
||||||
|
Vector3 *position;
|
||||||
|
Vector3 *rotation;
|
||||||
|
|
||||||
|
uint32_t GetSize() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline Keyframe::Keyframe(uint32_t numJoints)
|
||||||
|
{
|
||||||
|
this->numJoints = numJoints;
|
||||||
|
position = new Vector3[numJoints];
|
||||||
|
rotation = new Vector3[numJoints];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Keyframe::~Keyframe()
|
||||||
|
{
|
||||||
|
SAFE_DELETE_ARRAY(position);
|
||||||
|
SAFE_DELETE_ARRAY(rotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline uint32_t Keyframe::GetSize() const
|
||||||
|
{
|
||||||
|
uint32_t singleJointFrameSize = 0;
|
||||||
|
|
||||||
|
singleJointFrameSize += (sizeof(float) * 3) * 3; // position (xyz)
|
||||||
|
singleJointFrameSize += (sizeof(float) * 3) * 3; // rotation (xyz)
|
||||||
|
|
||||||
|
uint32_t size = 0;
|
||||||
|
|
||||||
|
size += numJoints * singleJointFrameSize;
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
30
src/geometry/triangle.h
Normal file
30
src/geometry/triangle.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#ifndef __GEOMETRY_TRIANGLE_H_INCLUDED__
|
||||||
|
#define __GEOMETRY_TRIANGLE_H_INCLUDED__
|
||||||
|
|
||||||
|
#include "../common.h"
|
||||||
|
#include "vector2.h"
|
||||||
|
#include "vector3.h"
|
||||||
|
|
||||||
|
struct Triangle
|
||||||
|
{
|
||||||
|
uint32_t vertices[3];
|
||||||
|
uint32_t groupIndex;
|
||||||
|
Vector3 normals[3];
|
||||||
|
Vector2 texCoords[2];
|
||||||
|
|
||||||
|
uint32_t GetSize() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline uint32_t Triangle::GetSize() const
|
||||||
|
{
|
||||||
|
uint32_t size = 0;
|
||||||
|
|
||||||
|
size += sizeof(uint32_t) * 3; // vertices (index)
|
||||||
|
size += sizeof(uint32_t); // group index
|
||||||
|
size += (sizeof(float) * 3) * 3; // normals (xyz)
|
||||||
|
size += (sizeof(float) * 3) * 2; // texcoords (uv)
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Reference in a new issue