commit
7b4f916b13
|
@ -84,7 +84,10 @@ class BVHLoader : public BaseImporter
|
||||||
std::vector<ChannelType> mChannels;
|
std::vector<ChannelType> mChannels;
|
||||||
std::vector<float> mChannelValues; // motion data values for that node. Of size NumChannels * NumFrames
|
std::vector<float> mChannelValues; // motion data values for that node. Of size NumChannels * NumFrames
|
||||||
|
|
||||||
Node() { }
|
Node()
|
||||||
|
: mNode(nullptr)
|
||||||
|
{ }
|
||||||
|
|
||||||
explicit Node( const aiNode* pNode) : mNode( pNode) { }
|
explicit Node( const aiNode* pNode) : mNode( pNode) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -157,9 +157,6 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions)
|
||||||
// read 200 characters from the file
|
// read 200 characters from the file
|
||||||
std::unique_ptr<char[]> _buffer (new char[searchBytes+1 /* for the '\0' */]);
|
std::unique_ptr<char[]> _buffer (new char[searchBytes+1 /* for the '\0' */]);
|
||||||
char* buffer = _buffer.get();
|
char* buffer = _buffer.get();
|
||||||
if( NULL == buffer ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const size_t read = pStream->Read(buffer,1,searchBytes);
|
const size_t read = pStream->Read(buffer,1,searchBytes);
|
||||||
if( !read ) {
|
if( !read ) {
|
||||||
|
|
|
@ -136,7 +136,7 @@ void CSMImporter::InternReadFile( const std::string& pFile,
|
||||||
TextFileToBuffer(file.get(),mBuffer2);
|
TextFileToBuffer(file.get(),mBuffer2);
|
||||||
const char* buffer = &mBuffer2[0];
|
const char* buffer = &mBuffer2[0];
|
||||||
|
|
||||||
aiAnimation* anim = new aiAnimation();
|
std::unique_ptr<aiAnimation> anim(new aiAnimation());
|
||||||
int first = 0, last = 0x00ffffff;
|
int first = 0, last = 0x00ffffff;
|
||||||
|
|
||||||
// now process the file and look out for '$' sections
|
// now process the file and look out for '$' sections
|
||||||
|
@ -294,8 +294,8 @@ void CSMImporter::InternReadFile( const std::string& pFile,
|
||||||
|
|
||||||
// Store the one and only animation in the scene
|
// Store the one and only animation in the scene
|
||||||
pScene->mAnimations = new aiAnimation*[pScene->mNumAnimations=1];
|
pScene->mAnimations = new aiAnimation*[pScene->mNumAnimations=1];
|
||||||
pScene->mAnimations[0] = anim;
|
|
||||||
anim->mName.Set("$CSM_MasterAnim");
|
anim->mName.Set("$CSM_MasterAnim");
|
||||||
|
pScene->mAnimations[0] = anim.release();
|
||||||
|
|
||||||
// mark the scene as incomplete and run SkeletonMeshBuilder on it
|
// mark the scene as incomplete and run SkeletonMeshBuilder on it
|
||||||
pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
|
pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
|
||||||
|
|
|
@ -120,7 +120,11 @@ public:
|
||||||
{
|
{
|
||||||
unsigned int mBone; ///< Index of the bone
|
unsigned int mBone; ///< Index of the bone
|
||||||
float mWeight; ///< Weight of that bone on this vertex
|
float mWeight; ///< Weight of that bone on this vertex
|
||||||
Weight() { }
|
Weight()
|
||||||
|
: mBone(0)
|
||||||
|
, mWeight(0.0f)
|
||||||
|
{ }
|
||||||
|
|
||||||
Weight( unsigned int pBone, float pWeight)
|
Weight( unsigned int pBone, float pWeight)
|
||||||
{
|
{
|
||||||
mBone = pBone;
|
mBone = pBone;
|
||||||
|
|
|
@ -651,7 +651,8 @@ void PretransformVertices::Execute( aiScene* pScene)
|
||||||
// generate mesh nodes
|
// generate mesh nodes
|
||||||
for (unsigned int i = 0; i < pScene->mNumMeshes;++i,++nodes)
|
for (unsigned int i = 0; i < pScene->mNumMeshes;++i,++nodes)
|
||||||
{
|
{
|
||||||
aiNode* pcNode = *nodes = new aiNode();
|
aiNode* pcNode = new aiNode();
|
||||||
|
*nodes = pcNode;
|
||||||
pcNode->mParent = pScene->mRootNode;
|
pcNode->mParent = pScene->mRootNode;
|
||||||
pcNode->mName = pScene->mMeshes[i]->mName;
|
pcNode->mName = pScene->mMeshes[i]->mName;
|
||||||
|
|
||||||
|
@ -663,7 +664,8 @@ void PretransformVertices::Execute( aiScene* pScene)
|
||||||
// generate light nodes
|
// generate light nodes
|
||||||
for (unsigned int i = 0; i < pScene->mNumLights;++i,++nodes)
|
for (unsigned int i = 0; i < pScene->mNumLights;++i,++nodes)
|
||||||
{
|
{
|
||||||
aiNode* pcNode = *nodes = new aiNode();
|
aiNode* pcNode = new aiNode();
|
||||||
|
*nodes = pcNode;
|
||||||
pcNode->mParent = pScene->mRootNode;
|
pcNode->mParent = pScene->mRootNode;
|
||||||
pcNode->mName.length = ai_snprintf(pcNode->mName.data, MAXLEN, "light_%u",i);
|
pcNode->mName.length = ai_snprintf(pcNode->mName.data, MAXLEN, "light_%u",i);
|
||||||
pScene->mLights[i]->mName = pcNode->mName;
|
pScene->mLights[i]->mName = pcNode->mName;
|
||||||
|
@ -671,7 +673,8 @@ void PretransformVertices::Execute( aiScene* pScene)
|
||||||
// generate camera nodes
|
// generate camera nodes
|
||||||
for (unsigned int i = 0; i < pScene->mNumCameras;++i,++nodes)
|
for (unsigned int i = 0; i < pScene->mNumCameras;++i,++nodes)
|
||||||
{
|
{
|
||||||
aiNode* pcNode = *nodes = new aiNode();
|
aiNode* pcNode = new aiNode();
|
||||||
|
*nodes = pcNode;
|
||||||
pcNode->mParent = pScene->mRootNode;
|
pcNode->mParent = pScene->mRootNode;
|
||||||
pcNode->mName.length = ::ai_snprintf(pcNode->mName.data,MAXLEN,"cam_%u",i);
|
pcNode->mName.length = ::ai_snprintf(pcNode->mName.data,MAXLEN,"cam_%u",i);
|
||||||
pScene->mCameras[i]->mName = pcNode->mName;
|
pScene->mCameras[i]->mName = pcNode->mName;
|
||||||
|
|
|
@ -139,6 +139,11 @@ public:
|
||||||
*/
|
*/
|
||||||
Importer(const Importer& other);
|
Importer(const Importer& other);
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
/** Assignment operator has been deleted
|
||||||
|
*/
|
||||||
|
Importer &operator=(const Importer &) = delete;
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
/** Destructor. The object kept ownership of the imported data,
|
/** Destructor. The object kept ownership of the imported data,
|
||||||
* which now will be destroyed along with the object.
|
* which now will be destroyed along with the object.
|
||||||
|
|
|
@ -162,7 +162,10 @@ struct aiMeshKey
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
aiMeshKey() {
|
aiMeshKey()
|
||||||
|
: mTime(0.0)
|
||||||
|
, mValue(0)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Construction from a given time and key value */
|
/** Construction from a given time and key value */
|
||||||
|
|
|
@ -313,16 +313,16 @@ inline aiMatrix3x3t<TReal>& aiMatrix3x3t<TReal>::FromToMatrix(const aiVector3t<T
|
||||||
u.x = x.x - from.x; u.y = x.y - from.y; u.z = x.z - from.z;
|
u.x = x.x - from.x; u.y = x.y - from.y; u.z = x.z - from.z;
|
||||||
v.x = x.x - to.x; v.y = x.y - to.y; v.z = x.z - to.z;
|
v.x = x.x - to.x; v.y = x.y - to.y; v.z = x.z - to.z;
|
||||||
|
|
||||||
const TReal c1 = static_cast<TReal>(2.0) / (u * u);
|
const TReal c1_ = static_cast<TReal>(2.0) / (u * u);
|
||||||
const TReal c2 = static_cast<TReal>(2.0) / (v * v);
|
const TReal c2_ = static_cast<TReal>(2.0) / (v * v);
|
||||||
const TReal c3 = c1 * c2 * (u * v);
|
const TReal c3_ = c1_ * c2_ * (u * v);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < 3; i++)
|
for (unsigned int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
for (unsigned int j = 0; j < 3; j++)
|
for (unsigned int j = 0; j < 3; j++)
|
||||||
{
|
{
|
||||||
mtx[i][j] = - c1 * u[i] * u[j] - c2 * v[i] * v[j]
|
mtx[i][j] = - c1_ * u[i] * u[j] - c2_ * v[i] * v[j]
|
||||||
+ c3 * v[i] * u[j];
|
+ c3_ * v[i] * u[j];
|
||||||
}
|
}
|
||||||
mtx[i][i] += static_cast<TReal>(1.0);
|
mtx[i][i] += static_cast<TReal>(1.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,10 @@ struct aiVertexWeight
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
//! Default constructor
|
//! Default constructor
|
||||||
aiVertexWeight() { }
|
aiVertexWeight()
|
||||||
|
: mVertexId(0)
|
||||||
|
, mWeight(0.0f)
|
||||||
|
{ }
|
||||||
|
|
||||||
//! Initialisation from a given index and vertex weight factor
|
//! Initialisation from a given index and vertex weight factor
|
||||||
//! \param pID ID
|
//! \param pID ID
|
||||||
|
@ -270,6 +273,32 @@ struct aiBone
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//! Assignment operator
|
||||||
|
aiBone &operator=(const aiBone& other)
|
||||||
|
{
|
||||||
|
if (this == &other) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
mName = other.mName;
|
||||||
|
mNumWeights = other.mNumWeights;
|
||||||
|
mOffsetMatrix = other.mOffsetMatrix;
|
||||||
|
|
||||||
|
if (other.mWeights && other.mNumWeights)
|
||||||
|
{
|
||||||
|
if (mWeights) {
|
||||||
|
delete[] mWeights;
|
||||||
|
}
|
||||||
|
|
||||||
|
mWeights = new aiVertexWeight[mNumWeights];
|
||||||
|
::memcpy(mWeights,other.mWeights,mNumWeights * sizeof(aiVertexWeight));
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Destructor - deletes the array of vertex weights
|
//! Destructor - deletes the array of vertex weights
|
||||||
~aiBone()
|
~aiBone()
|
||||||
{
|
{
|
||||||
|
|
|
@ -304,6 +304,20 @@ struct aiString
|
||||||
data[len] = 0;
|
data[len] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Assigment operator */
|
||||||
|
aiString& operator = (const aiString &rOther) {
|
||||||
|
if (this == &rOther) {
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
length = rOther.length;;
|
||||||
|
memcpy( data, rOther.data, length);
|
||||||
|
data[length] = '\0';
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Assign a const char* to the string */
|
/** Assign a const char* to the string */
|
||||||
aiString& operator = (const char* sz) {
|
aiString& operator = (const char* sz) {
|
||||||
Set(sz);
|
Set(sz);
|
||||||
|
|
Loading…
Reference in New Issue