Added SkeletalMeshVertex struct

Alias of VertexStruct_XYZ_Normal_UV_Tangent_Skinning


Former-commit-id: 1bec60d399dd3293aebb7a7b84370ff33e8b85dd
This commit is contained in:
Lynix 2014-07-08 11:13:07 +02:00
parent 8ab69fa3ab
commit d636174c04
4 changed files with 28 additions and 1 deletions

View File

@ -254,6 +254,7 @@ enum nzVertexLayout
nzVertexLayout_XYZ_Normal,
nzVertexLayout_XYZ_Normal_UV,
nzVertexLayout_XYZ_Normal_UV_Tangent,
nzVertexLayout_XYZ_Normal_UV_Tangent_Skinning,
nzVertexLayout_XYZ_UV,
// Déclarations destinées à l'instancing

View File

@ -47,6 +47,7 @@ class NzMesh;
class NzPrimitiveList;
typedef NzVertexStruct_XYZ_Normal_UV_Tangent NzMeshVertex;
typedef NzVertexStruct_XYZ_Normal_UV_Tangent_Skinning NzSkeletalMeshVertex;
using NzMeshConstRef = NzResourceRef<const NzMesh>;
using NzMeshLoader = NzResourceLoader<NzMesh, NzMeshParams>;

View File

@ -10,6 +10,8 @@
#include <Nazara/Math/Vector2.hpp>
#include <Nazara/Math/Vector3.hpp>
/******************************* Structures 2D *******************************/
struct NzVertexStruct_XY
{
NzVector2f position;
@ -20,7 +22,7 @@ struct NzVertexStruct_XY_UV : public NzVertexStruct_XY
NzVector2f uv;
};
/////////////////////////////////////////
/******************************* Structures 3D *******************************/
struct NzVertexStruct_XYZ
{
@ -47,4 +49,15 @@ struct NzVertexStruct_XYZ_UV : public NzVertexStruct_XYZ
NzVector2f uv;
};
/************************* Structures 3D (+ Skinning) ************************/
struct NzVertexStruct_XYZ_Normal_UV_Tangent_Skinning : public NzVertexStruct_XYZ_Normal_UV_Tangent
{
nzInt32 weightCount;
NzVector4f weights;
NzVector4i32 jointIndexes;
};
#endif // NAZARA_VERTEXSTRUCT_HPP

View File

@ -247,6 +247,18 @@ bool NzVertexDeclaration::Initialize()
NazaraAssert(declaration->GetStride() == sizeof(NzVertexStruct_XYZ_Normal_UV_Tangent), "Invalid stride for declaration nzVertexLayout_XYZ_Normal_UV_Tangent");
// nzVertexLayout_XYZ_Normal_UV_Tangent_Skinning : NzVertexStruct_XYZ_Normal_UV_Tangent_Skinning
declaration = &s_declarations[nzVertexLayout_XYZ_Normal_UV_Tangent_Skinning];
declaration->EnableAttribute(nzAttributeUsage_Position, nzAttributeType_Float3, NzOffsetOf(NzVertexStruct_XYZ_Normal_UV_Tangent_Skinning, position));
declaration->EnableAttribute(nzAttributeUsage_Normal, nzAttributeType_Float3, NzOffsetOf(NzVertexStruct_XYZ_Normal_UV_Tangent_Skinning, normal));
declaration->EnableAttribute(nzAttributeUsage_TexCoord, nzAttributeType_Float2, NzOffsetOf(NzVertexStruct_XYZ_Normal_UV_Tangent_Skinning, uv));
declaration->EnableAttribute(nzAttributeUsage_Tangent, nzAttributeType_Float3, NzOffsetOf(NzVertexStruct_XYZ_Normal_UV_Tangent_Skinning, tangent));
declaration->EnableAttribute(nzAttributeUsage_Unused, nzAttributeType_Int1, NzOffsetOf(NzVertexStruct_XYZ_Normal_UV_Tangent_Skinning, weightCount));
declaration->EnableAttribute(nzAttributeUsage_Userdata0, nzAttributeType_Float4, NzOffsetOf(NzVertexStruct_XYZ_Normal_UV_Tangent_Skinning, weights));
declaration->EnableAttribute(nzAttributeUsage_Userdata1, nzAttributeType_Int4, NzOffsetOf(NzVertexStruct_XYZ_Normal_UV_Tangent_Skinning, jointIndexes));
NazaraAssert(declaration->GetStride() == sizeof(NzVertexStruct_XYZ_Normal_UV_Tangent_Skinning), "Invalid stride for declaration nzVertexLayout_XYZ_Normal_UV_Tangent_Skinning");
// nzVertexLayout_XYZ_UV : NzVertexStruct_XYZ_UV
declaration = &s_declarations[nzVertexLayout_XYZ_UV];
declaration->EnableAttribute(nzAttributeUsage_Position, nzAttributeType_Float3, NzOffsetOf(NzVertexStruct_XYZ_UV, position));