Added SHVec4U and modified SHMesh to use SHVec4U instead of uint32_t
This commit is contained in:
parent
5089957468
commit
1fc2897150
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include "Math/SHMath.h"
|
#include "Math/SHMath.h"
|
||||||
#include "Assets/Asset Types/SHAssetData.h"
|
#include "Assets/Asset Types/SHAssetData.h"
|
||||||
|
#include "Math/Vector/SHVec4U.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -20,11 +21,6 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
constexpr int BONE_INDEX_ALIGHTMENT = 4;
|
constexpr int BONE_INDEX_ALIGHTMENT = 4;
|
||||||
|
|
||||||
struct IndexUInt4
|
|
||||||
{
|
|
||||||
std::array<uint32_t,BONE_INDEX_ALIGHTMENT> indices;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SHMeshDataHeader
|
struct SHMeshDataHeader
|
||||||
{
|
{
|
||||||
uint32_t vertexCount;
|
uint32_t vertexCount;
|
||||||
|
@ -60,7 +56,7 @@ namespace SHADE
|
||||||
std::vector<SHVec3> VertexNormals;
|
std::vector<SHVec3> VertexNormals;
|
||||||
std::vector<SHVec2> VertexTexCoords;
|
std::vector<SHVec2> VertexTexCoords;
|
||||||
std::vector<uint32_t> Indices;
|
std::vector<uint32_t> Indices;
|
||||||
std::vector<IndexUInt4> VertexBoneIndices;
|
std::vector<SHVec4U> VertexBoneIndices;
|
||||||
std::vector<SHVec4> VertexBoneWeights;
|
std::vector<SHVec4> VertexBoneWeights;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,7 +260,7 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
if (boneWeight[j] == 0.f)
|
if (boneWeight[j] == 0.f)
|
||||||
{
|
{
|
||||||
boneIndices.indices[j] = boneIndex;
|
boneIndices[j] = boneIndex;
|
||||||
boneWeight[j] = weight.weight;
|
boneWeight[j] = weight.weight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,12 +168,12 @@ namespace SHADE
|
||||||
vertBoneIdxStorage.insert
|
vertBoneIdxStorage.insert
|
||||||
(
|
(
|
||||||
vertBoneIdxStorage.end(),
|
vertBoneIdxStorage.end(),
|
||||||
addJob.VertexBoneIndices, addJob.VertexBoneIndices + addJob.VertexCount * SHMesh::BONE_INDICES_PER_VERTEX
|
addJob.VertexBoneIndices, addJob.VertexBoneIndices + addJob.VertexCount
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vertBoneIdxStorage.resize(vertBoneIdxStorage.size() + addJob.VertexCount * SHMesh::BONE_INDICES_PER_VERTEX);
|
vertBoneIdxStorage.resize(vertBoneIdxStorage.size() + addJob.VertexCount);
|
||||||
}
|
}
|
||||||
if (addJob.VertexBoneWeights)
|
if (addJob.VertexBoneWeights)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,6 +20,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "Math/Vector/SHVec2.h"
|
#include "Math/Vector/SHVec2.h"
|
||||||
#include "Math/Vector/SHVec3.h"
|
#include "Math/Vector/SHVec3.h"
|
||||||
#include "Math/Vector/SHVec4.h"
|
#include "Math/Vector/SHVec4.h"
|
||||||
|
#include "Math/Vector/SHVec4U.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -50,14 +51,9 @@ namespace SHADE
|
||||||
using VertexTexCoord = SHVec2;
|
using VertexTexCoord = SHVec2;
|
||||||
using VertexTangent = SHVec3;
|
using VertexTangent = SHVec3;
|
||||||
using VertexNormal = SHVec3;
|
using VertexNormal = SHVec3;
|
||||||
using VertexBoneIndices = int;
|
using VertexBoneIndices = SHVec4U;
|
||||||
using VertexWeights = SHVec4;
|
using VertexWeights = SHVec4;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
/* Constants */
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
|
||||||
static constexpr size_t BONE_INDICES_PER_VERTEX = 4;
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Data Members */
|
/* Data Members */
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
/************************************************************************************//*!
|
||||||
|
\file SHVec4U.h
|
||||||
|
\author Tng Kah Wei, kahwei.tng, 390009620
|
||||||
|
\par email: kahwei.tng\@digipen.edu
|
||||||
|
\date Jan 16, 2023
|
||||||
|
\brief Contains type alias for SHVec4U.
|
||||||
|
|
||||||
|
Copyright (C) 2023 DigiPen Institute of Technology.
|
||||||
|
Reproduction or disclosure of this file or its contents without the prior written consent
|
||||||
|
of DigiPen Institute of Technology is prohibited.
|
||||||
|
*//*************************************************************************************/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace SHADE
|
||||||
|
{
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
/* Type Definitions */
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Simple type alias for a array of uint32_t of 4 uint32_ts.
|
||||||
|
/// </summary>
|
||||||
|
using SHVec4U = std::array<uint32_t, 4>;
|
||||||
|
}
|
Loading…
Reference in New Issue