Merge branch 'master' of https://github.com/assimp/assimp into implementation_warning_fix
# Conflicts: # code/ObjFileImporter.cpppull/1083/head
commit
98e7eb476d
|
@ -150,7 +150,7 @@ void ReportSceneNotFoundError()
|
|||
DefaultLogger::get()->error("Unable to find the Assimp::Importer for this aiScene. "
|
||||
"The C-API does not accept scenes produced by the C++ API and vice versa");
|
||||
|
||||
assert(false);
|
||||
ai_assert(false);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -59,7 +59,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <memory>
|
||||
|
||||
|
||||
using namespace Assimp;
|
||||
using namespace Assimp::Collada;
|
||||
using namespace Assimp::Formatter;
|
||||
|
|
|
@ -268,8 +268,7 @@ namespace Assimp
|
|||
Collada::InputType GetTypeForSemantic( const std::string& pSemantic);
|
||||
|
||||
/** Finds the item in the given library by its reference, throws if not found */
|
||||
template <typename Type> const Type& ResolveLibraryReference(
|
||||
const std::map<std::string, Type>& pLibrary, const std::string& pURL) const;
|
||||
template <typename Type> const Type& ResolveLibraryReference( const std::map<std::string, Type>& pLibrary, const std::string& pURL) const;
|
||||
|
||||
protected:
|
||||
/** Filename, for a verbose error message */
|
||||
|
|
|
@ -602,28 +602,28 @@ bool ExportProperties :: HasPropertyInteger(const char* szName) const
|
|||
bool ExportProperties :: HasPropertyBool(const char* szName) const
|
||||
{
|
||||
return HasGenericProperty<int>(mIntProperties, szName);
|
||||
};
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Has a configuration property
|
||||
bool ExportProperties :: HasPropertyFloat(const char* szName) const
|
||||
{
|
||||
return HasGenericProperty<ai_real>(mFloatProperties, szName);
|
||||
};
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Has a configuration property
|
||||
bool ExportProperties :: HasPropertyString(const char* szName) const
|
||||
{
|
||||
return HasGenericProperty<std::string>(mStringProperties, szName);
|
||||
};
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Has a configuration property
|
||||
bool ExportProperties :: HasPropertyMatrix(const char* szName) const
|
||||
{
|
||||
return HasGenericProperty<aiMatrix4x4>(mMatrixProperties, szName);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif // !ASSIMP_BUILD_NO_EXPORT
|
||||
|
|
|
@ -62,7 +62,6 @@ namespace Assimp
|
|||
class ASSIMP_API JoinVerticesProcess : public BaseProcess
|
||||
{
|
||||
public:
|
||||
|
||||
JoinVerticesProcess();
|
||||
~JoinVerticesProcess();
|
||||
|
||||
|
|
|
@ -149,10 +149,10 @@ void ObjFileImporter::InternReadFile( const std::string &file, aiScene* pScene,
|
|||
// This next stage takes ~ 1/3th of the total readFile task
|
||||
// so should amount for 1/3th of the progress
|
||||
// only update every 100KB or it'll be too slow
|
||||
unsigned int progress = 0;
|
||||
/*unsigned int progress = 0;
|
||||
unsigned int progressCounter = 0;
|
||||
const unsigned int updateProgressEveryBytes = 100 * 1024;
|
||||
const unsigned int progressTotal = static_cast<unsigned int>(3*m_Buffer.size()/updateProgressEveryBytes);
|
||||
const unsigned int progressTotal = static_cast<unsigned int>(3*m_Buffer.size()/updateProgressEveryBytes);*/
|
||||
// process all '\'
|
||||
/*std::vector<char> ::iterator iter = m_Buffer.begin();
|
||||
while (iter != m_Buffer.end())
|
||||
|
@ -600,9 +600,6 @@ void ObjFileImporter::createMaterials(const ObjFile::Model* pModel, aiScene* pSc
|
|||
|
||||
mat->AddProperty<int>( &sm, 1, AI_MATKEY_SHADING_MODEL);
|
||||
|
||||
// multiplying the specular exponent with 2 seems to yield better results
|
||||
pCurrentMaterial->shineness *= 4.f;
|
||||
|
||||
// Adding material colors
|
||||
mat->AddProperty( &pCurrentMaterial->ambient, 1, AI_MATKEY_COLOR_AMBIENT );
|
||||
mat->AddProperty( &pCurrentMaterial->diffuse, 1, AI_MATKEY_COLOR_DIFFUSE );
|
||||
|
|
|
@ -102,7 +102,7 @@ ObjFile::Model *ObjFileParser::GetModel() const {
|
|||
// File parsing method.
|
||||
void ObjFileParser::parseFile( IOStreamBuffer<char> &streamBuffer ) {
|
||||
// only update every 100KB or it'll be too slow
|
||||
const unsigned int updateProgressEveryBytes = 100 * 1024;
|
||||
//const unsigned int updateProgressEveryBytes = 100 * 1024;
|
||||
unsigned int progressCounter = 0;
|
||||
const unsigned int bytesToProcess = static_cast<unsigned int>(streamBuffer.size());
|
||||
const unsigned int progressTotal = 3 * bytesToProcess;
|
||||
|
|
|
@ -197,13 +197,15 @@ static aiString ReadString(StreamReaderLE* stream, uint32_t numWChars)
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor to be privately used by Importer
|
||||
SIBImporter::SIBImporter()
|
||||
{}
|
||||
SIBImporter::SIBImporter() {
|
||||
// empty
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Destructor, private as well
|
||||
SIBImporter::~SIBImporter()
|
||||
{}
|
||||
SIBImporter::~SIBImporter() {
|
||||
// empty
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
|
@ -508,7 +510,7 @@ struct TempMesh
|
|||
std::vector<aiVector3D> vtx;
|
||||
std::vector<aiVector3D> nrm;
|
||||
std::vector<aiVector3D> uv;
|
||||
std::vector<aiFace> faces;
|
||||
std::vector<aiFace> faces;
|
||||
};
|
||||
|
||||
static void ReadShape(SIB* sib, StreamReaderLE* stream)
|
||||
|
@ -546,7 +548,7 @@ static void ReadShape(SIB* sib, StreamReaderLE* stream)
|
|||
stream->SetReadLimit(oldLimit);
|
||||
}
|
||||
|
||||
assert(smesh.faceStart.size() == smesh.mtls.size()); // sanity check
|
||||
ai_assert(smesh.faceStart.size() == smesh.mtls.size()); // sanity check
|
||||
|
||||
// Silo doesn't store any normals in the file - we need to compute
|
||||
// them ourselves. We can't let AssImp handle it as AssImp doesn't
|
||||
|
@ -792,8 +794,9 @@ static void ReadInstance(SIB* sib, StreamReaderLE* stream)
|
|||
stream->SetReadLimit(oldLimit);
|
||||
}
|
||||
|
||||
if (shapeIndex >= sib->objs.size())
|
||||
throw DeadlyImportError("SIB: Invalid shape index.");
|
||||
if ( shapeIndex >= sib->objs.size() ) {
|
||||
throw DeadlyImportError( "SIB: Invalid shape index." );
|
||||
}
|
||||
|
||||
const SIBObject& src = sib->objs[shapeIndex];
|
||||
inst.meshIdx = src.meshIdx;
|
||||
|
@ -805,8 +808,9 @@ static void ReadInstance(SIB* sib, StreamReaderLE* stream)
|
|||
static void CheckVersion(StreamReaderLE* stream)
|
||||
{
|
||||
uint32_t version = stream->GetU4();
|
||||
if (version != 1)
|
||||
throw DeadlyImportError("SIB: Unsupported file version.");
|
||||
if ( version != 1 ) {
|
||||
throw DeadlyImportError( "SIB: Unsupported file version." );
|
||||
}
|
||||
}
|
||||
|
||||
static void ReadScene(SIB* sib, StreamReaderLE* stream)
|
||||
|
|
|
@ -53,15 +53,13 @@ namespace Assimp {
|
|||
// ---------------------------------------------------------------------------
|
||||
/** Importer class for the Nevercenter Silo SIB scene format
|
||||
*/
|
||||
class SIBImporter : public BaseImporter
|
||||
class ASSIMP_API SIBImporter : public BaseImporter
|
||||
{
|
||||
public:
|
||||
SIBImporter();
|
||||
~SIBImporter();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Returns whether the class can handle the format of the given file.
|
||||
* See BaseImporter::CanRead() for details.
|
||||
|
@ -70,7 +68,6 @@ public:
|
|||
bool checkSig) const;
|
||||
|
||||
protected:
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Return importer meta information.
|
||||
* See #BaseImporter::GetInfo for the details
|
||||
|
@ -85,7 +82,6 @@ protected:
|
|||
IOSystem* pIOHandler);
|
||||
|
||||
private:
|
||||
|
||||
struct MeshInformation
|
||||
{
|
||||
explicit MeshInformation(const std::string& _name)
|
||||
|
|
|
@ -57,9 +57,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
* - dump all polygons and their triangulation sequences to
|
||||
* a file
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_TRIANGULATE_PROCESS
|
||||
#include "TriangulateProcess.h"
|
||||
#include "ProcessHelper.h"
|
||||
|
@ -106,11 +103,15 @@ void TriangulateProcess::Execute( aiScene* pScene)
|
|||
bool bHas = false;
|
||||
for( unsigned int a = 0; a < pScene->mNumMeshes; a++)
|
||||
{
|
||||
if( TriangulateMesh( pScene->mMeshes[a]))
|
||||
if ( TriangulateMesh( pScene->mMeshes[ a ] ) ) {
|
||||
bHas = true;
|
||||
}
|
||||
}
|
||||
if ( bHas ) {
|
||||
DefaultLogger::get()->info( "TriangulateProcess finished. All polygons have been triangulated." );
|
||||
} else {
|
||||
DefaultLogger::get()->debug( "TriangulateProcess finished. There was nothing to be done." );
|
||||
}
|
||||
if (bHas)DefaultLogger::get()->info ("TriangulateProcess finished. All polygons have been triangulated.");
|
||||
else DefaultLogger::get()->debug("TriangulateProcess finished. There was nothing to be done.");
|
||||
}
|
||||
|
||||
|
||||
|
@ -155,7 +156,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
|
|||
}
|
||||
|
||||
// Just another check whether aiMesh::mPrimitiveTypes is correct
|
||||
assert(numOut != pMesh->mNumFaces);
|
||||
ai_assert(numOut != pMesh->mNumFaces);
|
||||
|
||||
aiVector3D* nor_out = NULL;
|
||||
|
||||
|
@ -184,7 +185,6 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
|
|||
aiColor4D* clr = pMesh->mColors[0];
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef AI_BUILD_TRIANGULATE_DEBUG_POLYS
|
||||
FILE* fout = fopen(POLY_OUTPUT_FILE,"a");
|
||||
#endif
|
||||
|
@ -276,7 +276,7 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
|
|||
{
|
||||
// A polygon with more than 3 vertices can be either concave or convex.
|
||||
// Usually everything we're getting is convex and we could easily
|
||||
// triangulate by trifanning. However, LightWave is probably the only
|
||||
// triangulate by tri-fanning. However, LightWave is probably the only
|
||||
// modeling suite to make extensive use of highly concave, monster polygons ...
|
||||
// so we need to apply the full 'ear cutting' algorithm to get it right.
|
||||
|
||||
|
@ -325,7 +325,6 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
|
|||
done[tmp] = false;
|
||||
}
|
||||
|
||||
|
||||
#ifdef AI_BUILD_TRIANGULATE_DEBUG_POLYS
|
||||
// plot the plane onto which we mapped the polygon to a 2D ASCII pic
|
||||
aiVector2D bmin,bmax;
|
||||
|
@ -404,14 +403,13 @@ bool TriangulateProcess::TriangulateMesh( aiMesh* pMesh)
|
|||
if (num_found == 2) {
|
||||
|
||||
// Due to the 'two ear theorem', every simple polygon with more than three points must
|
||||
// have 2 'ears'. Here's definitely someting wrong ... but we don't give up yet.
|
||||
// have 2 'ears'. Here's definitely something wrong ... but we don't give up yet.
|
||||
//
|
||||
|
||||
// Instead we're continuting with the standard trifanning algorithm which we'd
|
||||
// Instead we're continuing with the standard tri-fanning algorithm which we'd
|
||||
// use if we had only convex polygons. That's life.
|
||||
DefaultLogger::get()->error("Failed to triangulate polygon (no ear found). Probably not a simple polygon?");
|
||||
|
||||
|
||||
#ifdef AI_BUILD_TRIANGULATE_DEBUG_POLYS
|
||||
fprintf(fout,"critical error here, no ear found! ");
|
||||
#endif
|
||||
|
|
|
@ -158,7 +158,7 @@ string tstr;
|
|||
|
||||
AttrHelper_FloatToString(pValue, tstr);
|
||||
pList.push_back({pName, tstr});
|
||||
};
|
||||
}
|
||||
|
||||
void X3DExporter::NodeHelper_OpenNode(const string& pNodeName, const size_t pTabLevel, const bool pEmptyElement, const list<SAttribute>& pAttrList)
|
||||
{
|
||||
|
|
|
@ -39,16 +39,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file anim.h
|
||||
* @brief Defines the data structures in which the imported animations
|
||||
* are returned.
|
||||
*/
|
||||
/**
|
||||
* @file anim.h
|
||||
* @brief Defines the data structures in which the imported animations
|
||||
* are returned.
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef AI_ANIM_H_INC
|
||||
#define AI_ANIM_H_INC
|
||||
|
||||
#include "types.h"
|
||||
#include "quaternion.h"
|
||||
#include <assimp/types.h>
|
||||
#include <assimp/quaternion.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -66,16 +67,20 @@ struct aiVectorKey
|
|||
|
||||
#ifdef __cplusplus
|
||||
|
||||
//! Default constructor
|
||||
aiVectorKey(){}
|
||||
/// @brief The default constructor.
|
||||
aiVectorKey()
|
||||
: mTime( 0.0 )
|
||||
, mValue() {
|
||||
// empty
|
||||
}
|
||||
|
||||
/// @brief Construction from a given time and key value.
|
||||
|
||||
//! Construction from a given time and key value
|
||||
aiVectorKey(double time, const aiVector3D& value)
|
||||
: mTime (time)
|
||||
, mValue (value)
|
||||
{}
|
||||
|
||||
|
||||
typedef aiVector3D elem_type;
|
||||
|
||||
// Comparison operators. For use with std::find();
|
||||
|
@ -93,7 +98,7 @@ struct aiVectorKey
|
|||
bool operator > (const aiVectorKey& o) const {
|
||||
return mTime > o.mTime;
|
||||
}
|
||||
#endif
|
||||
#endif // __cplusplus
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@ -108,7 +113,10 @@ struct aiQuatKey
|
|||
C_STRUCT aiQuaternion mValue;
|
||||
|
||||
#ifdef __cplusplus
|
||||
aiQuatKey(){
|
||||
aiQuatKey()
|
||||
: mTime( 0.0 )
|
||||
, mValue() {
|
||||
// empty
|
||||
}
|
||||
|
||||
/** Construction from a given time and key value */
|
||||
|
@ -145,7 +153,7 @@ struct aiMeshKey
|
|||
double mTime;
|
||||
|
||||
/** Index into the aiMesh::mAnimMeshes array of the
|
||||
* mesh coresponding to the #aiMeshAnim hosting this
|
||||
* mesh corresponding to the #aiMeshAnim hosting this
|
||||
* key frame. The referenced anim mesh is evaluated
|
||||
* according to the rules defined in the docs for #aiAnimMesh.*/
|
||||
unsigned int mValue;
|
||||
|
@ -204,8 +212,6 @@ enum aiAnimBehaviour
|
|||
* time is t, use the value at (t-n) % (|m-n|).*/
|
||||
aiAnimBehaviour_REPEAT = 0x3,
|
||||
|
||||
|
||||
|
||||
/** This value is not used, it is just here to force the
|
||||
* the compiler to map this enum to a 32 Bit integer */
|
||||
#ifndef SWIG
|
||||
|
@ -228,8 +234,7 @@ enum aiAnimBehaviour
|
|||
* Duplicate keys don't pass the validation step. Most likely there
|
||||
* will be no negative time values, but they are not forbidden also ( so
|
||||
* implementations need to cope with them! ) */
|
||||
struct aiNodeAnim
|
||||
{
|
||||
struct aiNodeAnim {
|
||||
/** The name of the node affected by this animation. The node
|
||||
* must exist and it must be unique.*/
|
||||
C_STRUCT aiString mNodeName;
|
||||
|
@ -280,17 +285,19 @@ struct aiNodeAnim
|
|||
C_ENUM aiAnimBehaviour mPostState;
|
||||
|
||||
#ifdef __cplusplus
|
||||
aiNodeAnim()
|
||||
{
|
||||
mNumPositionKeys = 0; mPositionKeys = NULL;
|
||||
mNumRotationKeys = 0; mRotationKeys = NULL;
|
||||
mNumScalingKeys = 0; mScalingKeys = NULL;
|
||||
|
||||
mPreState = mPostState = aiAnimBehaviour_DEFAULT;
|
||||
aiNodeAnim()
|
||||
: mNumPositionKeys( 0 )
|
||||
, mPositionKeys( NULL )
|
||||
, mNumRotationKeys( 0 )
|
||||
, mRotationKeys( NULL )
|
||||
, mNumScalingKeys( 0 )
|
||||
, mScalingKeys( NULL )
|
||||
, mPreState( aiAnimBehaviour_DEFAULT )
|
||||
, mPostState( aiAnimBehaviour_DEFAULT ) {
|
||||
// empty
|
||||
}
|
||||
|
||||
~aiNodeAnim()
|
||||
{
|
||||
~aiNodeAnim() {
|
||||
delete [] mPositionKeys;
|
||||
delete [] mRotationKeys;
|
||||
delete [] mScalingKeys;
|
||||
|
@ -308,7 +315,7 @@ struct aiMeshAnim
|
|||
{
|
||||
/** Name of the mesh to be animated. An empty string is not allowed,
|
||||
* animated meshes need to be named (not necessarily uniquely,
|
||||
* the name can basically serve as wildcard to select a group
|
||||
* the name can basically serve as wild-card to select a group
|
||||
* of meshes with similar animation setup)*/
|
||||
C_STRUCT aiString mName;
|
||||
|
||||
|
@ -334,10 +341,9 @@ struct aiMeshAnim
|
|||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** An animation consists of keyframe data for a number of nodes. For
|
||||
/** An animation consists of key-frame data for a number of nodes. For
|
||||
* each node affected by the animation a separate series of data is given.*/
|
||||
struct aiAnimation
|
||||
{
|
||||
struct aiAnimation {
|
||||
/** The name of the animation. If the modeling package this data was
|
||||
* exported from does support only a single animation channel, this
|
||||
* name is usually empty (length is zero). */
|
||||
|
@ -368,48 +374,49 @@ struct aiAnimation
|
|||
|
||||
#ifdef __cplusplus
|
||||
aiAnimation()
|
||||
: mDuration(-1.)
|
||||
, mTicksPerSecond()
|
||||
, mNumChannels()
|
||||
, mChannels()
|
||||
, mNumMeshChannels()
|
||||
, mMeshChannels()
|
||||
{
|
||||
: mDuration(-1.)
|
||||
, mTicksPerSecond(0.)
|
||||
, mNumChannels(0)
|
||||
, mChannels(nullptr)
|
||||
, mNumMeshChannels(0)
|
||||
, mMeshChannels(nullptr) {
|
||||
// empty
|
||||
}
|
||||
|
||||
~aiAnimation()
|
||||
{
|
||||
~aiAnimation() {
|
||||
// DO NOT REMOVE THIS ADDITIONAL CHECK
|
||||
if (mNumChannels && mChannels) {
|
||||
if ( mNumChannels && mChannels ) {
|
||||
for( unsigned int a = 0; a < mNumChannels; a++) {
|
||||
delete mChannels[a];
|
||||
delete mChannels[ a ];
|
||||
}
|
||||
|
||||
delete [] mChannels;
|
||||
delete [] mChannels;
|
||||
}
|
||||
if (mNumMeshChannels && mMeshChannels) {
|
||||
for( unsigned int a = 0; a < mNumMeshChannels; a++) {
|
||||
delete mMeshChannels[a];
|
||||
}
|
||||
|
||||
delete [] mMeshChannels;
|
||||
delete [] mMeshChannels;
|
||||
}
|
||||
}
|
||||
#endif // __cplusplus
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
}
|
||||
|
||||
|
||||
// some C++ utilities for inter- and extrapolation
|
||||
/// @brief Some C++ utilities for inter- and extrapolation
|
||||
namespace Assimp {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
/** @brief CPP-API: Utility class to simplify interpolations of various data types.
|
||||
*
|
||||
* The type of interpolation is chosen automatically depending on the
|
||||
* types of the arguments. */
|
||||
/**
|
||||
* @brief CPP-API: Utility class to simplify interpolations of various data types.
|
||||
*
|
||||
* The type of interpolation is chosen automatically depending on the
|
||||
* types of the arguments.
|
||||
*/
|
||||
template <typename T>
|
||||
struct Interpolator
|
||||
{
|
||||
|
@ -445,7 +452,7 @@ struct Interpolator <unsigned int> {
|
|||
}; // ! Interpolator <aiQuaternion>
|
||||
|
||||
template <>
|
||||
struct Interpolator <aiVectorKey> {
|
||||
struct Interpolator<aiVectorKey> {
|
||||
void operator () (aiVector3D& out,const aiVectorKey& a,
|
||||
const aiVectorKey& b, ai_real d) const
|
||||
{
|
||||
|
@ -455,7 +462,7 @@ struct Interpolator <aiVectorKey> {
|
|||
}; // ! Interpolator <aiVectorKey>
|
||||
|
||||
template <>
|
||||
struct Interpolator <aiQuatKey> {
|
||||
struct Interpolator<aiQuatKey> {
|
||||
void operator () (aiQuaternion& out, const aiQuatKey& a,
|
||||
const aiQuatKey& b, ai_real d) const
|
||||
{
|
||||
|
@ -465,7 +472,7 @@ struct Interpolator <aiQuatKey> {
|
|||
}; // ! Interpolator <aiQuatKey>
|
||||
|
||||
template <>
|
||||
struct Interpolator <aiMeshKey> {
|
||||
struct Interpolator<aiMeshKey> {
|
||||
void operator () (unsigned int& out, const aiMeshKey& a,
|
||||
const aiMeshKey& b, ai_real d) const
|
||||
{
|
||||
|
@ -475,9 +482,9 @@ struct Interpolator <aiMeshKey> {
|
|||
}; // ! Interpolator <aiQuatKey>
|
||||
|
||||
//! @endcond
|
||||
|
||||
} // ! end namespace Assimp
|
||||
|
||||
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // AI_ANIM_H_INC
|
||||
|
|
|
@ -109,7 +109,8 @@ extern "C" {
|
|||
|
||||
/** Maximum dimension for strings, ASSIMP strings are zero terminated. */
|
||||
#ifdef __cplusplus
|
||||
static const size_t MAXLEN = 1024;
|
||||
static
|
||||
const size_t MAXLEN = 1024;
|
||||
#else
|
||||
# define MAXLEN 1024
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@ SOURCE_GROUP( unit FILES
|
|||
|
||||
SET( TEST_SRCS
|
||||
unit/TestIOSystem.h
|
||||
unit/utAnim.cpp
|
||||
unit/AssimpAPITest.cpp
|
||||
unit/utBatchLoader.cpp
|
||||
unit/utBlenderIntermediate.cpp
|
||||
|
@ -82,6 +83,7 @@ SET( TEST_SRCS
|
|||
unit/utMetadata.cpp
|
||||
unit/SceneDiffer.h
|
||||
unit/SceneDiffer.cpp
|
||||
unit/utSIBImporter.cpp
|
||||
unit/utObjImportExport.cpp
|
||||
unit/utPretransformVertices.cpp
|
||||
unit/utRemoveComments.cpp
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "UnitTestPCH.h"
|
||||
|
||||
#include <assimp/anim.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
class utAnim : public ::testing::Test {
|
||||
// empty
|
||||
};
|
||||
|
||||
TEST_F( utAnim, aiVectorKeyCreationTest ) {
|
||||
aiVectorKey defaultConstTest;
|
||||
EXPECT_DOUBLE_EQ( 0.0, defaultConstTest.mTime );
|
||||
|
||||
aiVector3D v( 1, 2, 3 );
|
||||
aiVectorKey constrWithValuesTest( 1, v );
|
||||
EXPECT_DOUBLE_EQ( 1.0, constrWithValuesTest.mTime );
|
||||
EXPECT_EQ( v, constrWithValuesTest.mValue );
|
||||
|
||||
EXPECT_NE( defaultConstTest, constrWithValuesTest );
|
||||
EXPECT_TRUE( defaultConstTest != constrWithValuesTest );
|
||||
defaultConstTest.mTime = 1;
|
||||
constrWithValuesTest.mTime = 2;
|
||||
EXPECT_TRUE( defaultConstTest < constrWithValuesTest );
|
||||
}
|
||||
|
||||
TEST_F( utAnim, aiQuatKeyTest ) {
|
||||
aiQuatKey defaultConstrTest;
|
||||
EXPECT_DOUBLE_EQ( 0.0, defaultConstrTest.mTime );
|
||||
|
||||
aiQuaternion q;
|
||||
aiQuatKey constrWithValuesTest( 1.0, q );
|
||||
EXPECT_DOUBLE_EQ( 1.0, constrWithValuesTest.mTime );
|
||||
EXPECT_EQ( q, constrWithValuesTest.mValue );
|
||||
}
|
||||
|
||||
TEST_F( utAnim, aiNodeAnimTest ) {
|
||||
bool ok( true );
|
||||
try {
|
||||
aiNodeAnim myAnim;
|
||||
EXPECT_EQ( aiAnimBehaviour_DEFAULT, myAnim.mPreState );
|
||||
EXPECT_EQ( aiAnimBehaviour_DEFAULT, myAnim.mPostState );
|
||||
} catch ( ... ) {
|
||||
ok = false;
|
||||
}
|
||||
EXPECT_TRUE( ok );
|
||||
}
|
||||
|
||||
TEST_F( utAnim, aiMeshAnimTest ) {
|
||||
bool ok( true );
|
||||
try {
|
||||
aiMeshAnim myMeshAnim;
|
||||
} catch ( ... ) {
|
||||
ok = false;
|
||||
}
|
||||
EXPECT_TRUE( ok );
|
||||
}
|
||||
|
||||
TEST_F( utAnim, aiAnimationTest ) {
|
||||
bool ok( true );
|
||||
try {
|
||||
aiAnimation myAnimation;
|
||||
} catch ( ... ) {
|
||||
ok = false;
|
||||
}
|
||||
EXPECT_TRUE( ok );
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "UnitTestPCH.h"
|
||||
|
||||
#include "SIBImporter.h"
|
||||
|
||||
using namespace ::Assimp;
|
||||
|
||||
class utSIBImporter : public ::testing::Test {
|
||||
// empty
|
||||
};
|
||||
|
||||
TEST_F( utSIBImporter, createTest ) {
|
||||
bool ok( true );
|
||||
try {
|
||||
SIBImporter myImporter;
|
||||
} catch ( ... ) {
|
||||
ok = false;
|
||||
}
|
||||
EXPECT_TRUE( ok );
|
||||
}
|
Loading…
Reference in New Issue