added keyframe animation model supporting chunk structs and other classes (KeyFrame, KeyFrameTriangle, AnimationSequence)

This commit is contained in:
gered 2011-04-24 20:12:12 -04:00
parent 4851363425
commit c026932e19
7 changed files with 146 additions and 0 deletions

View file

@ -89,9 +89,13 @@
<ClCompile Include="src\util\files.cpp" /> <ClCompile Include="src\util\files.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="src\assets\animationsequence.h" />
<ClInclude Include="src\assets\color.h" /> <ClInclude Include="src\assets\color.h" />
<ClInclude Include="src\assets\material.h" /> <ClInclude Include="src\assets\material.h" />
<ClInclude Include="src\chunks\animations.h" />
<ClInclude Include="src\chunks\chunks.h" /> <ClInclude Include="src\chunks\chunks.h" />
<ClInclude Include="src\chunks\keyframes.h" />
<ClInclude Include="src\chunks\keyframetriangles.h" />
<ClInclude Include="src\chunks\materials.h" /> <ClInclude Include="src\chunks\materials.h" />
<ClInclude Include="src\chunks\normals.h" /> <ClInclude Include="src\chunks\normals.h" />
<ClInclude Include="src\chunks\texcoords.h" /> <ClInclude Include="src\chunks\texcoords.h" />
@ -99,6 +103,8 @@
<ClInclude Include="src\chunks\vertices.h" /> <ClInclude Include="src\chunks\vertices.h" />
<ClInclude Include="src\common.h" /> <ClInclude Include="src\common.h" />
<ClInclude Include="src\geometry\common.h" /> <ClInclude Include="src\geometry\common.h" />
<ClInclude Include="src\geometry\keyframe.h" />
<ClInclude Include="src\geometry\keyframetriangle.h" />
<ClInclude Include="src\geometry\matrix4x4.h" /> <ClInclude Include="src\geometry\matrix4x4.h" />
<ClInclude Include="src\geometry\quaternion.h" /> <ClInclude Include="src\geometry\quaternion.h" />
<ClInclude Include="src\geometry\triangle.h" /> <ClInclude Include="src\geometry\triangle.h" />

View file

@ -0,0 +1,15 @@
#ifndef __ASSETS_ANIMATIONSEQUENCE_H_INCLUDED__
#define __ASSETS_ANIMATIONSEQUENCE_H_INCLUDED__
#include "../common.h"
#include <string>
class AnimationSequence
{
public:
std::string name;
uint32_t start;
uint32_t end;
};
#endif

View file

@ -0,0 +1,33 @@
#ifndef __CHUNKS_ANIMATIONS_H_INCLUDED__
#define __CHUNKS_ANIMATIONS_H_INCLUDED__
#include "../common.h"
#include "../assets/animationsequence.h"
#include <vector>
struct AnimationsChunk
{
std::vector<AnimationSequence> animations;
uint32_t GetCount()
{
return animations.size();
}
uint32_t GetSize()
{
if (animations.size() == 0)
return 0;
uint32_t size = sizeof(uint32_t);
for (uint32_t i = 0; i < animations.size(); ++i)
{
size += animations[i].name.length() + 1; // include null terminator
size += sizeof(uint32_t) * 2 // start + end
}
return size;
}
};
#endif

View file

@ -0,0 +1,33 @@
#ifndef __CHUNKS_KEYFRAMES_H_INCLUDED__
#define __CHUNKS_KEYFRAMES_H_INCLUDED__
#include "../common.h"
#include "../geometry/keyframe.h"
#include <vector>
struct KeyFramesChunk
{
std::vector<KeyFrame> frames;
uint32_t GetCount()
{
return frames.size();
}
uint32_t GetSize()
{
if (frames.size() == 0)
return 0;
uint32_t size = sizeof(uint32_t);
size +=
(
(sizeof(float) * 3) // vertex
+ (sizeof(float) * 3) // normal
) * frames.size();
return size;
}
};
#endif

View file

@ -0,0 +1,33 @@
#ifndef __CHUNKS_KEYFRAMETRIANGLES_H_INCLUDED__
#define __CHUNKS_KEYFRAMETRIANGLES_H_INCLUDED__
#include "../common.h"
#include "../geometry/keyframetriangle.h"
#include <vector>
struct KeyFrameTrianglesChunk
{
std::vector<KeyFrameTriangle> triangles;
uint32_t GetCount()
{
return triangles.size();
}
uint32_t GetSize()
{
if (triangles.size() == 0)
return 0;
uint32_t size = sizeof(uint32_t);
size +=
(
(sizeof(uint32_t) * 3) // vertex indices
+ (sizeof(uint32_t) * 3) // texcoord indices
) * triangles.size();
return size;
}
};
#endif

View file

@ -0,0 +1,13 @@
#ifndef __GEOMETRY_KEYFRAME_H_INCLUDED__
#define __GEOMETRY_KEYFRAME_H_INCLUDED__
#include "vector3.h"
class KeyFrame
{
public:
Vector3 vertex;
Vector3 normal;
};
#endif

View file

@ -0,0 +1,13 @@
#ifndef __GEOMETRY_KEYFRAMETRIANGLE_H_INCLUDED__
#define __GEOMETRY_KEYFRAMETRIANGLE_H_INCLUDED__
#include "../common.h"
class KeyFrameTriangle
{
public:
uint32_t vertices[3];
uint32_t texCoords[3];
};
#endif