Allow tangent mesh to be converted
This commit is contained in:
parent
57d9e83ed4
commit
a3905a1e19
@ -236,17 +236,48 @@ struct SSkinMeshBuffer : public IMeshBuffer
|
||||
{
|
||||
for(u32 n=0;n<Vertices_Standard.size();++n)
|
||||
{
|
||||
video::S3DVertexSkinnedMesh Vertex = {};
|
||||
video::S3DVertexSkinnedMesh Vertex;
|
||||
Vertex.Color=Vertices_Standard[n].Color;
|
||||
Vertex.Pos=Vertices_Standard[n].Pos;
|
||||
Vertex.Normal=Vertices_Standard[n].Normal;
|
||||
Vertex.TCoords=Vertices_Standard[n].TCoords;
|
||||
Vertex.Tangent=core::vector3df(0.0f, 0.0f, 0.0f);
|
||||
Vertex.Binormal=core::vector3df(0.0f, 0.0f, 0.0f);
|
||||
Vertex.m_joint_idx1 = 0;
|
||||
Vertex.m_joint_idx2 = 0;
|
||||
Vertex.m_joint_idx3 = 0;
|
||||
Vertex.m_joint_idx4 = 0;
|
||||
Vertex.m_weight1 = 0;
|
||||
Vertex.m_weight2 = 0;
|
||||
Vertex.m_weight3 = 0;
|
||||
Vertex.m_weight4 = 0;
|
||||
Vertices_SkinnedMesh.push_back(Vertex);
|
||||
}
|
||||
}
|
||||
if (VertexType==video::EVT_TANGENTS)
|
||||
{
|
||||
for(u32 n=0;n<Vertices_Tangents.size();++n)
|
||||
{
|
||||
video::S3DVertexSkinnedMesh Vertex;
|
||||
Vertex.Color=Vertices_Tangents[n].Color;
|
||||
Vertex.Pos=Vertices_Tangents[n].Pos;
|
||||
Vertex.Normal=Vertices_Tangents[n].Normal;
|
||||
Vertex.TCoords=Vertices_Tangents[n].TCoords;
|
||||
Vertex.Tangent=Vertices_Tangents[n].Tangent;
|
||||
Vertex.Binormal=Vertices_Tangents[n].Binormal;
|
||||
Vertex.m_joint_idx1 = 0;
|
||||
Vertex.m_joint_idx2 = 0;
|
||||
Vertex.m_joint_idx3 = 0;
|
||||
Vertex.m_joint_idx4 = 0;
|
||||
Vertex.m_weight1 = 0;
|
||||
Vertex.m_weight2 = 0;
|
||||
Vertex.m_weight3 = 0;
|
||||
Vertex.m_weight4 = 0;
|
||||
Vertices_SkinnedMesh.push_back(Vertex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! Convert to tangents vertex type
|
||||
virtual void convertToTangents()
|
||||
{
|
||||
|
@ -18,11 +18,11 @@ namespace scene
|
||||
|
||||
//! constructor
|
||||
CSkinnedMesh::CSkinnedMesh()
|
||||
: m_joint_total_size(0), SkinningBuffers(0), AnimationFrames(0.f), FramesPerSecond(25.f),
|
||||
: SkinningBuffers(0), AnimationFrames(0.f), FramesPerSecond(25.f),
|
||||
LastAnimatedFrame(-1), SkinnedLastFrame(false),
|
||||
InterpolationMode(EIM_LINEAR),
|
||||
HasAnimation(false), PreparedForSkinning(false),
|
||||
AnimateNormals(true), HardwareSkinning(false)
|
||||
AnimateNormals(true), HardwareSkinning(false), m_joint_total_size(0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CSkinnedMesh");
|
||||
|
@ -14,18 +14,18 @@
|
||||
#include "matrix4.h"
|
||||
#include "quaternion.h"
|
||||
|
||||
class JointInfluence
|
||||
{
|
||||
public:
|
||||
int joint_idx;
|
||||
float weight;
|
||||
bool operator < (const JointInfluence& other) const
|
||||
{
|
||||
return weight < other.weight;
|
||||
}
|
||||
};
|
||||
|
||||
typedef irr::core::array<irr::core::array
|
||||
class JointInfluence
|
||||
{
|
||||
public:
|
||||
int joint_idx;
|
||||
float weight;
|
||||
bool operator < (const JointInfluence& other) const
|
||||
{
|
||||
return weight < other.weight;
|
||||
}
|
||||
};
|
||||
|
||||
typedef irr::core::array<irr::core::array
|
||||
<irr::core::array<JointInfluence> > > WeightInfluence;
|
||||
|
||||
namespace irr
|
||||
@ -173,17 +173,17 @@ namespace scene
|
||||
IAnimatedMeshSceneNode* node,
|
||||
ISceneManager* smgr);
|
||||
|
||||
void convertForSkinning();
|
||||
void convertForSkinning();
|
||||
|
||||
void computeWeightInfluence(SJoint *joint, size_t &index, WeightInfluence& wi);
|
||||
void computeWeightInfluence(SJoint *joint, size_t &index, WeightInfluence& wi);
|
||||
|
||||
const void* getJointPointer() const { return m_joint_matrixes.const_pointer(); }
|
||||
const void* getJointPointer() const { return m_joint_matrixes.const_pointer(); }
|
||||
|
||||
u32 getTotalJointSize() const
|
||||
{
|
||||
_IRR_DEBUG_BREAK_IF(m_joint_total_size == 0);
|
||||
return m_joint_total_size;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void checkForAnimation();
|
||||
@ -230,7 +230,7 @@ private:
|
||||
bool HasAnimation;
|
||||
bool PreparedForSkinning;
|
||||
bool AnimateNormals;
|
||||
bool HardwareSkinning;
|
||||
bool HardwareSkinning;
|
||||
core::array<core::matrix4> m_joint_matrixes;
|
||||
u32 m_joint_total_size;
|
||||
};
|
||||
|
@ -476,7 +476,7 @@ scene::IMesh* MeshTools::createMeshWithTangents(scene::IMesh* mesh,
|
||||
|
||||
void MeshTools::createSkinnedMeshWithTangents(scene::ISkinnedMesh* mesh,
|
||||
bool(*predicate)(scene::IMeshBuffer*))
|
||||
{return;
|
||||
{
|
||||
core::array<scene::SSkinMeshBuffer*>& all_mb = mesh->getMeshBuffers();
|
||||
const int all_mb_size = all_mb.size();
|
||||
for (int i = 0; i < all_mb_size; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user