pull/575/head
Kim Kulling 2015-05-29 20:46:10 +02:00
commit 670278da82
48 changed files with 1168 additions and 217 deletions

View File

@ -62,9 +62,9 @@ if( CMAKE_COMPILER_IS_MINGW )
endif() endif()
if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) AND NOT CMAKE_COMPILER_IS_MINGW) if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) AND NOT CMAKE_COMPILER_IS_MINGW)
set(CMAKE_CXX_FLAGS "-fPIC") # this is a very important switch and some libraries seem now to have it.... set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") # this is a very important switch and some libraries seem now to have it....
# hide all not-exported symbols # hide all not-exported symbols
set(CMAKE_CXX_FLAGS "-fvisibility=hidden -Wall" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall" )
elseif(MSVC) elseif(MSVC)
# enable multi-core compilation with MSVC # enable multi-core compilation with MSVC
add_definitions(/MP) add_definitions(/MP)

View File

@ -324,6 +324,7 @@ void Discreet3DSExporter::WriteMaterials()
break; break;
default: default:
shading_mode_out = Discreet3DS::Flat;
ai_assert(false); ai_assert(false);
}; };
writer.PutU2(static_cast<uint16_t>(shading_mode_out)); writer.PutU2(static_cast<uint16_t>(shading_mode_out));

View File

@ -199,7 +199,8 @@ template <typename T> void ReadBounds( IOStream * stream, T* /*p*/, unsigned int
void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node ) void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node )
{ {
ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AINODE); uint32_t chunkID = Read<uint32_t>(stream);
ai_assert(chunkID == ASSBIN_CHUNK_AINODE);
/*uint32_t size =*/ Read<uint32_t>(stream); /*uint32_t size =*/ Read<uint32_t>(stream);
*node = new aiNode(); *node = new aiNode();
@ -230,7 +231,8 @@ void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node )
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
void AssbinImporter::ReadBinaryBone( IOStream * stream, aiBone* b ) void AssbinImporter::ReadBinaryBone( IOStream * stream, aiBone* b )
{ {
ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AIBONE ); uint32_t chunkID = Read<uint32_t>(stream);
ai_assert(chunkID == ASSBIN_CHUNK_AIBONE);
/*uint32_t size =*/ Read<uint32_t>(stream); /*uint32_t size =*/ Read<uint32_t>(stream);
b->mName = Read<aiString>(stream); b->mName = Read<aiString>(stream);
@ -253,7 +255,8 @@ void AssbinImporter::ReadBinaryBone( IOStream * stream, aiBone* b )
void AssbinImporter::ReadBinaryMesh( IOStream * stream, aiMesh* mesh ) void AssbinImporter::ReadBinaryMesh( IOStream * stream, aiMesh* mesh )
{ {
ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AIMESH); uint32_t chunkID = Read<uint32_t>(stream);
ai_assert(chunkID == ASSBIN_CHUNK_AIMESH);
/*uint32_t size =*/ Read<uint32_t>(stream); /*uint32_t size =*/ Read<uint32_t>(stream);
mesh->mPrimitiveTypes = Read<unsigned int>(stream); mesh->mPrimitiveTypes = Read<unsigned int>(stream);
@ -377,7 +380,8 @@ void AssbinImporter::ReadBinaryMesh( IOStream * stream, aiMesh* mesh )
void AssbinImporter::ReadBinaryMaterialProperty(IOStream * stream, aiMaterialProperty* prop) void AssbinImporter::ReadBinaryMaterialProperty(IOStream * stream, aiMaterialProperty* prop)
{ {
ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AIMATERIALPROPERTY); uint32_t chunkID = Read<uint32_t>(stream);
ai_assert(chunkID == ASSBIN_CHUNK_AIMATERIALPROPERTY);
/*uint32_t size =*/ Read<uint32_t>(stream); /*uint32_t size =*/ Read<uint32_t>(stream);
prop->mKey = Read<aiString>(stream); prop->mKey = Read<aiString>(stream);
@ -393,7 +397,8 @@ void AssbinImporter::ReadBinaryMaterialProperty(IOStream * stream, aiMaterialPro
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
void AssbinImporter::ReadBinaryMaterial(IOStream * stream, aiMaterial* mat) void AssbinImporter::ReadBinaryMaterial(IOStream * stream, aiMaterial* mat)
{ {
ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AIMATERIAL); uint32_t chunkID = Read<uint32_t>(stream);
ai_assert(chunkID == ASSBIN_CHUNK_AIMATERIAL);
/*uint32_t size =*/ Read<uint32_t>(stream); /*uint32_t size =*/ Read<uint32_t>(stream);
mat->mNumAllocated = mat->mNumProperties = Read<unsigned int>(stream); mat->mNumAllocated = mat->mNumProperties = Read<unsigned int>(stream);
@ -414,7 +419,8 @@ void AssbinImporter::ReadBinaryMaterial(IOStream * stream, aiMaterial* mat)
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
void AssbinImporter::ReadBinaryNodeAnim(IOStream * stream, aiNodeAnim* nd) void AssbinImporter::ReadBinaryNodeAnim(IOStream * stream, aiNodeAnim* nd)
{ {
ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AINODEANIM); uint32_t chunkID = Read<uint32_t>(stream);
ai_assert(chunkID == ASSBIN_CHUNK_AINODEANIM);
/*uint32_t size =*/ Read<uint32_t>(stream); /*uint32_t size =*/ Read<uint32_t>(stream);
nd->mNodeName = Read<aiString>(stream); nd->mNodeName = Read<aiString>(stream);
@ -462,7 +468,8 @@ void AssbinImporter::ReadBinaryNodeAnim(IOStream * stream, aiNodeAnim* nd)
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
void AssbinImporter::ReadBinaryAnim( IOStream * stream, aiAnimation* anim ) void AssbinImporter::ReadBinaryAnim( IOStream * stream, aiAnimation* anim )
{ {
ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AIANIMATION); uint32_t chunkID = Read<uint32_t>(stream);
ai_assert(chunkID == ASSBIN_CHUNK_AIANIMATION);
/*uint32_t size =*/ Read<uint32_t>(stream); /*uint32_t size =*/ Read<uint32_t>(stream);
anim->mName = Read<aiString> (stream); anim->mName = Read<aiString> (stream);
@ -482,7 +489,8 @@ void AssbinImporter::ReadBinaryAnim( IOStream * stream, aiAnimation* anim )
void AssbinImporter::ReadBinaryTexture(IOStream * stream, aiTexture* tex) void AssbinImporter::ReadBinaryTexture(IOStream * stream, aiTexture* tex)
{ {
ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AITEXTURE); uint32_t chunkID = Read<uint32_t>(stream);
ai_assert(chunkID == ASSBIN_CHUNK_AITEXTURE);
/*uint32_t size =*/ Read<uint32_t>(stream); /*uint32_t size =*/ Read<uint32_t>(stream);
tex->mWidth = Read<unsigned int>(stream); tex->mWidth = Read<unsigned int>(stream);
@ -505,7 +513,8 @@ void AssbinImporter::ReadBinaryTexture(IOStream * stream, aiTexture* tex)
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
void AssbinImporter::ReadBinaryLight( IOStream * stream, aiLight* l ) void AssbinImporter::ReadBinaryLight( IOStream * stream, aiLight* l )
{ {
ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AILIGHT); uint32_t chunkID = Read<uint32_t>(stream);
ai_assert(chunkID == ASSBIN_CHUNK_AILIGHT);
/*uint32_t size =*/ Read<uint32_t>(stream); /*uint32_t size =*/ Read<uint32_t>(stream);
l->mName = Read<aiString>(stream); l->mName = Read<aiString>(stream);
@ -531,7 +540,8 @@ void AssbinImporter::ReadBinaryLight( IOStream * stream, aiLight* l )
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
void AssbinImporter::ReadBinaryCamera( IOStream * stream, aiCamera* cam ) void AssbinImporter::ReadBinaryCamera( IOStream * stream, aiCamera* cam )
{ {
ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AICAMERA); uint32_t chunkID = Read<uint32_t>(stream);
ai_assert(chunkID == ASSBIN_CHUNK_AICAMERA);
/*uint32_t size =*/ Read<uint32_t>(stream); /*uint32_t size =*/ Read<uint32_t>(stream);
cam->mName = Read<aiString>(stream); cam->mName = Read<aiString>(stream);
@ -546,7 +556,8 @@ void AssbinImporter::ReadBinaryCamera( IOStream * stream, aiCamera* cam )
void AssbinImporter::ReadBinaryScene( IOStream * stream, aiScene* scene ) void AssbinImporter::ReadBinaryScene( IOStream * stream, aiScene* scene )
{ {
ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AISCENE); uint32_t chunkID = Read<uint32_t>(stream);
ai_assert(chunkID == ASSBIN_CHUNK_AISCENE);
/*uint32_t size =*/ Read<uint32_t>(stream); /*uint32_t size =*/ Read<uint32_t>(stream);
scene->mFlags = Read<unsigned int>(stream); scene->mFlags = Read<unsigned int>(stream);

View File

@ -423,6 +423,21 @@ const char* aiGetErrorString()
return gLastErrorString.c_str(); return gLastErrorString.c_str();
} }
// -----------------------------------------------------------------------------------------------
// Return the description of a importer given its index
const aiImporterDesc* aiGetImportFormatDescription( size_t pIndex)
{
return Importer().GetImporterInfo(pIndex);
}
// -----------------------------------------------------------------------------------------------
// Return the number of importers
size_t aiGetImportFormatCount(void)
{
return Importer().GetImporterCount();
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns the error text of the last failed import process. // Returns the error text of the last failed import process.
aiBool aiIsExtensionSupported(const char* szExtension) aiBool aiIsExtensionSupported(const char* szExtension)

View File

@ -480,7 +480,9 @@ namespace Assimp
struct Assimp::BatchData struct Assimp::BatchData
{ {
BatchData() BatchData()
: next_id(0xffff) : pIOSystem()
, pImporter()
, next_id(0xffff)
{} {}
// IO system to be used for all imports // IO system to be used for all imports

View File

@ -127,6 +127,8 @@ void ColladaExporter::WriteFile()
WriteTextures(); WriteTextures();
WriteHeader(); WriteHeader();
WriteCamerasLibrary();
WriteLightsLibrary();
WriteMaterials(); WriteMaterials();
WriteGeometryLibrary(); WriteGeometryLibrary();
@ -165,8 +167,6 @@ void ColladaExporter::WriteHeader()
std::time_t date = std::time(NULL); std::time_t date = std::time(NULL);
std::strftime(date_str, date_nb_chars, "%Y-%m-%dT%H:%M:%S", std::localtime(&date)); std::strftime(date_str, date_nb_chars, "%Y-%m-%dT%H:%M:%S", std::localtime(&date));
std::string scene_name = mScene->mRootNode->mName.C_Str();
aiVector3D scaling; aiVector3D scaling;
aiQuaternion rotation; aiQuaternion rotation;
aiVector3D position; aiVector3D position;
@ -286,6 +286,201 @@ void ColladaExporter::WriteTextures() {
} }
} }
// ------------------------------------------------------------------------------------------------
// Write the embedded textures
void ColladaExporter::WriteCamerasLibrary() {
if(mScene->HasCameras()) {
mOutput << startstr << "<library_cameras>" << endstr;
PushTag();
for( size_t a = 0; a < mScene->mNumCameras; ++a)
WriteCamera( a);
PopTag();
mOutput << startstr << "</library_cameras>" << endstr;
}
}
void ColladaExporter::WriteCamera(size_t pIndex){
const aiCamera *cam = mScene->mCameras[pIndex];
const std::string idstrEscaped = XMLEscape(cam->mName.C_Str());
mOutput << startstr << "<camera id=\"" << idstrEscaped << "-camera\" name=\"" << idstrEscaped << "_name\" >" << endstr;
PushTag();
mOutput << startstr << "<optics>" << endstr;
PushTag();
mOutput << startstr << "<technique_common>" << endstr;
PushTag();
//assimp doesn't support the import of orthographic cameras! se we write
//always perspective
mOutput << startstr << "<perspective>" << endstr;
PushTag();
mOutput << startstr << "<xfov sid=\"xfov\">"<<
AI_RAD_TO_DEG(cam->mHorizontalFOV)
<<"</xfov>" << endstr;
mOutput << startstr << "<aspect_ratio>"
<< cam->mAspect
<< "</aspect_ratio>" << endstr;
mOutput << startstr << "<znear sid=\"znear\">"
<< cam->mClipPlaneNear
<< "</znear>" << endstr;
mOutput << startstr << "<zfar sid=\"zfar\">"
<< cam->mClipPlaneFar
<< "</zfar>" << endstr;
PopTag();
mOutput << startstr << "</perspective>" << endstr;
PopTag();
mOutput << startstr << "</technique_common>" << endstr;
PopTag();
mOutput << startstr << "</optics>" << endstr;
PopTag();
mOutput << startstr << "</camera>" << endstr;
}
// ------------------------------------------------------------------------------------------------
// Write the embedded textures
void ColladaExporter::WriteLightsLibrary() {
if(mScene->HasLights()) {
mOutput << startstr << "<library_lights>" << endstr;
PushTag();
for( size_t a = 0; a < mScene->mNumLights; ++a)
WriteLight( a);
PopTag();
mOutput << startstr << "</library_lights>" << endstr;
}
}
void ColladaExporter::WriteLight(size_t pIndex){
const aiLight *light = mScene->mLights[pIndex];
const std::string idstrEscaped = XMLEscape(light->mName.C_Str());
mOutput << startstr << "<light id=\"" << idstrEscaped << "-light\" name=\""
<< idstrEscaped << "_name\" >" << endstr;
PushTag();
mOutput << startstr << "<technique_common>" << endstr;
PushTag();
switch(light->mType){
case aiLightSource_AMBIENT:
WriteAmbienttLight(light);
break;
case aiLightSource_DIRECTIONAL:
WriteDirectionalLight(light);
break;
case aiLightSource_POINT:
WritePointLight(light);
break;
case aiLightSource_SPOT:
WriteSpotLight(light);
break;
case aiLightSource_UNDEFINED:
case _aiLightSource_Force32Bit:
break;
}
PopTag();
mOutput << startstr << "</technique_common>" << endstr;
PopTag();
mOutput << startstr << "</light>" << endstr;
}
void ColladaExporter::WritePointLight(const aiLight *const light){
const aiColor3D &color= light->mColorDiffuse;
mOutput << startstr << "<point>" << endstr;
PushTag();
mOutput << startstr << "<color sid=\"color\">"
<< color.r<<" "<<color.g<<" "<<color.b
<<"</color>" << endstr;
mOutput << startstr << "<constant_attenuation>"
<< light->mAttenuationConstant
<<"</constant_attenuation>" << endstr;
mOutput << startstr << "<linear_attenuation>"
<< light->mAttenuationLinear
<<"</linear_attenuation>" << endstr;
mOutput << startstr << "<quadratic_attenuation>"
<< light->mAttenuationQuadratic
<<"</quadratic_attenuation>" << endstr;
PopTag();
mOutput << startstr << "</point>" << endstr;
}
void ColladaExporter::WriteDirectionalLight(const aiLight *const light){
const aiColor3D &color= light->mColorDiffuse;
mOutput << startstr << "<directional>" << endstr;
PushTag();
mOutput << startstr << "<color sid=\"color\">"
<< color.r<<" "<<color.g<<" "<<color.b
<<"</color>" << endstr;
PopTag();
mOutput << startstr << "</directional>" << endstr;
}
void ColladaExporter::WriteSpotLight(const aiLight *const light){
const aiColor3D &color= light->mColorDiffuse;
mOutput << startstr << "<spot>" << endstr;
PushTag();
mOutput << startstr << "<color sid=\"color\">"
<< color.r<<" "<<color.g<<" "<<color.b
<<"</color>" << endstr;
mOutput << startstr << "<constant_attenuation>"
<< light->mAttenuationConstant
<<"</constant_attenuation>" << endstr;
mOutput << startstr << "<linear_attenuation>"
<< light->mAttenuationLinear
<<"</linear_attenuation>" << endstr;
mOutput << startstr << "<quadratic_attenuation>"
<< light->mAttenuationQuadratic
<<"</quadratic_attenuation>" << endstr;
/*
out->mAngleOuterCone = AI_DEG_TO_RAD (std::acos(std::pow(0.1f,1.f/srcLight->mFalloffExponent))+
srcLight->mFalloffAngle);
*/
const float fallOffAngle = AI_RAD_TO_DEG(light->mAngleInnerCone);
mOutput << startstr <<"<falloff_angle sid=\"fall_off_angle\">"
<< fallOffAngle
<<"</falloff_angle>" << endstr;
double temp = light->mAngleOuterCone-light->mAngleInnerCone;
temp = std::cos(temp);
temp = std::log(temp)/std::log(0.1);
temp = 1/temp;
mOutput << startstr << "<falloff_exponent sid=\"fall_off_exponent\">"
<< temp
<<"</falloff_exponent>" << endstr;
PopTag();
mOutput << startstr << "</spot>" << endstr;
}
void ColladaExporter::WriteAmbienttLight(const aiLight *const light){
const aiColor3D &color= light->mColorAmbient;
mOutput << startstr << "<ambient>" << endstr;
PushTag();
mOutput << startstr << "<color sid=\"color\">"
<< color.r<<" "<<color.g<<" "<<color.b
<<"</color>" << endstr;
PopTag();
mOutput << startstr << "</ambient>" << endstr;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Reads a single surface entry from the given material keys // Reads a single surface entry from the given material keys
void ColladaExporter::ReadMaterialSurface( Surface& poSurface, const aiMaterial* pSrcMat, aiTextureType pTexture, const char* pKey, size_t pType, size_t pIndex) void ColladaExporter::ReadMaterialSurface( Surface& poSurface, const aiMaterial* pSrcMat, aiTextureType pTexture, const char* pKey, size_t pType, size_t pIndex)
@ -425,8 +620,6 @@ void ColladaExporter::WriteMaterials()
{ {
materials.resize( mScene->mNumMaterials); materials.resize( mScene->mNumMaterials);
std::set<std::string> material_names;
/// collect all materials from the scene /// collect all materials from the scene
size_t numTextures = 0; size_t numTextures = 0;
for( size_t a = 0; a < mScene->mNumMaterials; ++a ) for( size_t a = 0; a < mScene->mNumMaterials; ++a )
@ -847,6 +1040,23 @@ void ColladaExporter::WriteNode(aiNode* pNode)
mOutput << mat.d1 << " " << mat.d2 << " " << mat.d3 << " " << mat.d4; mOutput << mat.d1 << " " << mat.d2 << " " << mat.d3 << " " << mat.d4;
mOutput << "</matrix>" << endstr; mOutput << "</matrix>" << endstr;
if(pNode->mNumMeshes==0){
//check if it is a camera node
for(size_t i=0; i<mScene->mNumCameras; i++){
if(mScene->mCameras[i]->mName == pNode->mName){
mOutput << startstr <<"<instance_camera url=\"#" << node_name_escaped << "-camera\"/>" << endstr;
break;
}
}
//check if it is a light node
for(size_t i=0; i<mScene->mNumLights; i++){
if(mScene->mLights[i]->mName == pNode->mName){
mOutput << startstr <<"<instance_light url=\"#" << node_name_escaped << "-light\"/>" << endstr;
break;
}
}
}else
// instance every geometry // instance every geometry
for( size_t a = 0; a < pNode->mNumMeshes; ++a ) for( size_t a = 0; a < pNode->mNumMeshes; ++a )
{ {
@ -854,7 +1064,6 @@ void ColladaExporter::WriteNode(aiNode* pNode)
// do not instanciate mesh if empty. I wonder how this could happen // do not instanciate mesh if empty. I wonder how this could happen
if( mesh->mNumFaces == 0 || mesh->mNumVertices == 0 ) if( mesh->mNumFaces == 0 || mesh->mNumVertices == 0 )
continue; continue;
mOutput << startstr << "<instance_geometry url=\"#" << XMLEscape(GetMeshId( pNode->mMeshes[a])) << "\">" << endstr; mOutput << startstr << "<instance_geometry url=\"#" << XMLEscape(GetMeshId( pNode->mMeshes[a])) << "\">" << endstr;
PushTag(); PushTag();
mOutput << startstr << "<bind_material>" << endstr; mOutput << startstr << "<bind_material>" << endstr;

View File

@ -47,6 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../include/assimp/ai_assert.h" #include "../include/assimp/ai_assert.h"
#include "../include/assimp/material.h" #include "../include/assimp/material.h"
#include "../include/assimp/mesh.h" #include "../include/assimp/mesh.h"
#include "../include/assimp/light.h"
#include "../include/assimp/Exporter.hpp" #include "../include/assimp/Exporter.hpp"
#include <sstream> #include <sstream>
#include <vector> #include <vector>
@ -83,6 +84,22 @@ protected:
/// Writes the material setup /// Writes the material setup
void WriteMaterials(); void WriteMaterials();
/// Writes the cameras library
void WriteCamerasLibrary();
// Write a camera entry
void WriteCamera(size_t pIndex);
/// Writes the cameras library
void WriteLightsLibrary();
// Write a camera entry
void WriteLight(size_t pIndex);
void WritePointLight(const aiLight *const light);
void WriteDirectionalLight(const aiLight *const light);
void WriteSpotLight(const aiLight *const light);
void WriteAmbienttLight(const aiLight *const light);
/// Writes the geometry library /// Writes the geometry library
void WriteGeometryLibrary(); void WriteGeometryLibrary();
@ -145,7 +162,10 @@ protected:
{ {
bool exist; bool exist;
float value; float value;
Property() { exist = false; } Property()
: exist(false)
, value(0.0f)
{}
}; };
// summarize a material in an convinient way. // summarize a material in an convinient way.

View File

@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <map> #include <map>
#include <vector> #include <vector>
#include <stdint.h> #include <stdint.h>
#include "../include/assimp/types.h" #include "../include/assimp/light.h"
#include "../include/assimp/mesh.h" #include "../include/assimp/mesh.h"
#include "../include/assimp/material.h" #include "../include/assimp/material.h"
@ -134,7 +134,8 @@ struct Camera
struct Light struct Light
{ {
Light() Light()
: mAttConstant (1.f) : mType (aiLightSource_UNDEFINED)
, mAttConstant (1.f)
, mAttLinear (0.f) , mAttLinear (0.f)
, mAttQuadratic (0.f) , mAttQuadratic (0.f)
, mFalloffAngle (180.f) , mFalloffAngle (180.f)
@ -172,13 +173,14 @@ struct Light
struct InputSemanticMapEntry struct InputSemanticMapEntry
{ {
InputSemanticMapEntry() InputSemanticMapEntry()
: mSet (0) : mSet(0)
, mType(IT_Invalid)
{} {}
//! Index of set, optional //! Index of set, optional
unsigned int mSet; unsigned int mSet;
//! Name of referenced vertex input //! Type of referenced vertex input
InputType mType; InputType mType;
}; };
@ -609,7 +611,15 @@ struct ChannelEntry
const Collada::Accessor* mValueAccessor; ///> Collada accessor to the key value values const Collada::Accessor* mValueAccessor; ///> Collada accessor to the key value values
const Collada::Data* mValueData; ///> Source datat array for the key value values const Collada::Data* mValueData; ///> Source datat array for the key value values
ChannelEntry() { mChannel = NULL; mSubElement = 0; } ChannelEntry()
: mChannel()
, mTransformIndex()
, mSubElement()
, mTimeAccessor()
, mTimeData()
, mValueAccessor()
, mValueData()
{}
}; };
} // end of namespace Collada } // end of namespace Collada

View File

@ -81,7 +81,10 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
ColladaLoader::ColladaLoader() ColladaLoader::ColladaLoader()
: noSkeletonMesh(), ignoreUpDirection(false), mNodeNameCounter() : noSkeletonMesh()
, ignoreUpDirection(false)
, invertTransparency(false)
, mNodeNameCounter()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -346,8 +349,8 @@ void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Coll
{ {
// Need to rely on falloff_exponent. I don't know how to interpret it, so I need to guess .... // Need to rely on falloff_exponent. I don't know how to interpret it, so I need to guess ....
// epsilon chosen to be 0.1 // epsilon chosen to be 0.1
out->mAngleOuterCone = AI_DEG_TO_RAD (std::acos(std::pow(0.1f,1.f/srcLight->mFalloffExponent))+ out->mAngleOuterCone = std::acos(std::pow(0.1f,1.f/srcLight->mFalloffExponent))+
srcLight->mFalloffAngle); out->mAngleInnerCone;
} }
else { else {
out->mAngleOuterCone = out->mAngleInnerCone + AI_DEG_TO_RAD( srcLight->mPenumbraAngle ); out->mAngleOuterCone = out->mAngleInnerCone + AI_DEG_TO_RAD( srcLight->mPenumbraAngle );
@ -916,7 +919,7 @@ void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pPars
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructs the animations for the given source anim // Constructs the animations for the given source anim
void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string pPrefix) void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string &pPrefix)
{ {
std::string animName = pPrefix.empty() ? pSrcAnim->mName : pPrefix + "_" + pSrcAnim->mName; std::string animName = pPrefix.empty() ? pSrcAnim->mName : pPrefix + "_" + pSrcAnim->mName;

View File

@ -155,7 +155,7 @@ protected:
* @param pSrcAnim the source animation to process * @param pSrcAnim the source animation to process
* @param pPrefix Prefix to the name in case of nested animations * @param pPrefix Prefix to the name in case of nested animations
*/ */
void StoreAnimations( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string pPrefix); void StoreAnimations( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string& pPrefix);
/** Constructs the animation for the given source anim */ /** Constructs the animation for the given source anim */
void CreateAnimation( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string& pName); void CreateAnimation( aiScene* pScene, const ColladaParser& pParser, const Collada::Animation* pSrcAnim, const std::string& pName);

View File

@ -412,7 +412,7 @@ void ComputeUVMappingProcess::Execute( aiScene* pScene)
{ {
if (!DefaultLogger::isNullLogger()) if (!DefaultLogger::isNullLogger())
{ {
sprintf(buffer, "Found non-UV mapped texture (%s,%i). Mapping type: %s", sprintf(buffer, "Found non-UV mapped texture (%s,%u). Mapping type: %s",
TextureTypeToString((aiTextureType)prop->mSemantic),prop->mIndex, TextureTypeToString((aiTextureType)prop->mSemantic),prop->mIndex,
MappingTypeToString(mapping)); MappingTypeToString(mapping));

View File

@ -86,27 +86,6 @@ namespace {
} }
// ------------------------------------------------------------------------------------------------
// print warning, do return
void ParseWarning(const std::string& message, const Token& token)
{
if(DefaultLogger::get()) {
DefaultLogger::get()->warn(Util::AddTokenText("FBX-Parser",message,&token));
}
}
// ------------------------------------------------------------------------------------------------
/* void ParseWarning(const std::string& message, const Element* element = NULL)
{
if(element) {
ParseWarning(message,element->KeyToken());
return;
}
if(DefaultLogger::get()) {
DefaultLogger::get()->warn("FBX-Parser: " + message);
}
}
*/
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ParseError(const std::string& message, TokenPtr token) void ParseError(const std::string& message, TokenPtr token)
{ {

View File

@ -58,6 +58,7 @@ using namespace Assimp;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
FindInvalidDataProcess::FindInvalidDataProcess() FindInvalidDataProcess::FindInvalidDataProcess()
: configEpsilon(0.0f)
{ {
// nothing to do here // nothing to do here
} }

View File

@ -158,7 +158,7 @@ bool FixInfacingNormalsProcess::ProcessMesh( aiMesh* pcMesh, unsigned int index)
if (!DefaultLogger::isNullLogger()) if (!DefaultLogger::isNullLogger())
{ {
char buffer[128]; // should be sufficiently large char buffer[128]; // should be sufficiently large
::sprintf(buffer,"Mesh %i: Normals are facing inwards (or the mesh is planar)",index); ::sprintf(buffer,"Mesh %u: Normals are facing inwards (or the mesh is planar)",index);
DefaultLogger::get()->info(buffer); DefaultLogger::get()->info(buffer);
} }

View File

@ -173,7 +173,6 @@ public:
// -------------------------------------------------- // --------------------------------------------------
Line(const IfcLine& entity, ConversionData& conv) Line(const IfcLine& entity, ConversionData& conv)
: Curve(entity,conv) : Curve(entity,conv)
, entity(entity)
{ {
ConvertCartesianPoint(p,entity.Pnt); ConvertCartesianPoint(p,entity.Pnt);
ConvertVector(v,entity.Dir); ConvertVector(v,entity.Dir);
@ -221,7 +220,6 @@ public:
} }
private: private:
const IfcLine& entity;
IfcVector3 p,v; IfcVector3 p,v;
}; };
@ -238,7 +236,6 @@ public:
// -------------------------------------------------- // --------------------------------------------------
CompositeCurve(const IfcCompositeCurve& entity, ConversionData& conv) CompositeCurve(const IfcCompositeCurve& entity, ConversionData& conv)
: BoundedCurve(entity,conv) : BoundedCurve(entity,conv)
, entity(entity)
, total() , total()
{ {
curves.reserve(entity.Segments.size()); curves.reserve(entity.Segments.size());
@ -331,7 +328,6 @@ public:
} }
private: private:
const IfcCompositeCurve& entity;
std::vector< CurveEntry > curves; std::vector< CurveEntry > curves;
IfcFloat total; IfcFloat total;
@ -349,8 +345,6 @@ public:
// -------------------------------------------------- // --------------------------------------------------
TrimmedCurve(const IfcTrimmedCurve& entity, ConversionData& conv) TrimmedCurve(const IfcTrimmedCurve& entity, ConversionData& conv)
: BoundedCurve(entity,conv) : BoundedCurve(entity,conv)
, entity(entity)
, ok()
{ {
base = boost::shared_ptr<const Curve>(Curve::Convert(entity.BasisCurve,conv)); base = boost::shared_ptr<const Curve>(Curve::Convert(entity.BasisCurve,conv));
@ -448,11 +442,9 @@ private:
private: private:
const IfcTrimmedCurve& entity;
ParamRange range; ParamRange range;
IfcFloat maxval; IfcFloat maxval;
bool agree_sense; bool agree_sense;
bool ok;
boost::shared_ptr<const Curve> base; boost::shared_ptr<const Curve> base;
}; };
@ -469,7 +461,6 @@ public:
// -------------------------------------------------- // --------------------------------------------------
PolyLine(const IfcPolyline& entity, ConversionData& conv) PolyLine(const IfcPolyline& entity, ConversionData& conv)
: BoundedCurve(entity,conv) : BoundedCurve(entity,conv)
, entity(entity)
{ {
points.reserve(entity.Points.size()); points.reserve(entity.Points.size());
@ -507,7 +498,6 @@ public:
} }
private: private:
const IfcPolyline& entity;
std::vector<IfcVector3> points; std::vector<IfcVector3> points;
}; };

View File

@ -93,8 +93,6 @@ namespace {
void SetUnits(ConversionData& conv); void SetUnits(ConversionData& conv);
void SetCoordinateSpace(ConversionData& conv); void SetCoordinateSpace(ConversionData& conv);
void ProcessSpatialStructures(ConversionData& conv); void ProcessSpatialStructures(ConversionData& conv);
aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el ,ConversionData& conv);
void ProcessProductRepresentation(const IfcProduct& el, aiNode* nd, ConversionData& conv);
void MakeTreeRelative(ConversionData& conv); void MakeTreeRelative(ConversionData& conv);
void ConvertUnit(const EXPRESS::DataType& dt,ConversionData& conv); void ConvertUnit(const EXPRESS::DataType& dt,ConversionData& conv);
@ -421,16 +419,6 @@ void ResolveObjectPlacement(aiMatrix4x4& m, const IfcObjectPlacement& place, Con
} }
} }
// ------------------------------------------------------------------------------------------------
void GetAbsTransform(aiMatrix4x4& out, const aiNode* nd, ConversionData& conv)
{
aiMatrix4x4 t;
if (nd->mParent) {
GetAbsTransform(t,nd->mParent,conv);
}
out = t*nd->mTransformation;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector< aiNode* >& subnodes_src, unsigned int matid, ConversionData& conv) bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector< aiNode* >& subnodes_src, unsigned int matid, ConversionData& conv)
{ {
@ -682,14 +670,14 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
// skip over space and annotation nodes - usually, these have no meaning in Assimp's context // skip over space and annotation nodes - usually, these have no meaning in Assimp's context
bool skipGeometry = false; bool skipGeometry = false;
if(conv.settings.skipSpaceRepresentations) { if(conv.settings.skipSpaceRepresentations) {
if(const IfcSpace* const space = el.ToPtr<IfcSpace>()) { if(el.ToPtr<IfcSpace>()) {
IFCImporter::LogDebug("skipping IfcSpace entity due to importer settings"); IFCImporter::LogDebug("skipping IfcSpace entity due to importer settings");
skipGeometry = true; skipGeometry = true;
} }
} }
if(conv.settings.skipAnnotations) { if(conv.settings.skipAnnotations) {
if(const IfcAnnotation* const ann = el.ToPtr<IfcAnnotation>()) { if(el.ToPtr<IfcAnnotation>()) {
IFCImporter::LogDebug("skipping IfcAnnotation entity due to importer settings"); IFCImporter::LogDebug("skipping IfcAnnotation entity due to importer settings");
return NULL; return NULL;
} }
@ -764,7 +752,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
continue; continue;
} }
BOOST_FOREACH(const IfcProduct& pro, cont->RelatedElements) { BOOST_FOREACH(const IfcProduct& pro, cont->RelatedElements) {
if(const IfcOpeningElement* const open = pro.ToPtr<IfcOpeningElement>()) { if(pro.ToPtr<IfcOpeningElement>()) {
// IfcOpeningElement is handled below. Sadly we can't use it here as is: // IfcOpeningElement is handled below. Sadly we can't use it here as is:
// The docs say that opening elements are USUALLY attached to building storey, // The docs say that opening elements are USUALLY attached to building storey,
// but we want them for the building elements to which they belong. // but we want them for the building elements to which they belong.

View File

@ -114,7 +114,7 @@ void ProcessParametrizedProfile(const IfcParameterizedProfileDef& def, TempMesh&
meshout.vertcnt.push_back(4); meshout.vertcnt.push_back(4);
} }
else if( const IfcCircleProfileDef* const circle = def.ToPtr<IfcCircleProfileDef>()) { else if( const IfcCircleProfileDef* const circle = def.ToPtr<IfcCircleProfileDef>()) {
if( const IfcCircleHollowProfileDef* const hollow = def.ToPtr<IfcCircleHollowProfileDef>()) { if(def.ToPtr<IfcCircleHollowProfileDef>()) {
// TODO // TODO
} }
const size_t segments = 32; const size_t segments = 32;

View File

@ -110,7 +110,7 @@ void ImproveCacheLocalityProcess::Execute( aiScene* pScene)
} }
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
char szBuff[128]; // should be sufficiently large in every case char szBuff[128]; // should be sufficiently large in every case
::sprintf(szBuff,"Cache relevant are %i meshes (%i faces). Average output ACMR is %f", ::sprintf(szBuff,"Cache relevant are %u meshes (%u faces). Average output ACMR is %f",
numm,numf,out/numf); numm,numf,out/numf);
DefaultLogger::get()->info(szBuff); DefaultLogger::get()->info(szBuff);
@ -182,7 +182,7 @@ float ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int mesh
// the JoinIdenticalVertices process has not been executed on this // the JoinIdenticalVertices process has not been executed on this
// mesh, otherwise this value would normally be at least minimally // mesh, otherwise this value would normally be at least minimally
// smaller than 3.0 ... // smaller than 3.0 ...
sprintf(szBuff,"Mesh %i: Not suitable for vcache optimization",meshNum); sprintf(szBuff,"Mesh %u: Not suitable for vcache optimization",meshNum);
DefaultLogger::get()->warn(szBuff); DefaultLogger::get()->warn(szBuff);
return 0.f; return 0.f;
} }
@ -361,7 +361,7 @@ float ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int mesh
if ( DefaultLogger::get()->getLogSeverity() == Logger::VERBOSE) { if ( DefaultLogger::get()->getLogSeverity() == Logger::VERBOSE) {
char szBuff[128]; // should be sufficiently large in every case char szBuff[128]; // should be sufficiently large in every case
::sprintf(szBuff,"Mesh %i | ACMR in: %f out: %f | ~%.1f%%",meshNum,fACMR,fACMR2, ::sprintf(szBuff,"Mesh %u | ACMR in: %f out: %f | ~%.1f%%",meshNum,fACMR,fACMR2,
((fACMR - fACMR2) / fACMR) * 100.f); ((fACMR - fACMR2) / fACMR) * 100.f);
DefaultLogger::get()->debug(szBuff); DefaultLogger::get()->debug(szBuff);
} }

View File

@ -263,12 +263,17 @@ void ObjFileMtlImporter::createMaterial()
} }
std::vector<std::string> token; std::vector<std::string> token;
const unsigned int numToken = tokenize<std::string>( line, token, " " ); const unsigned int numToken = tokenize<std::string>( line, token, " \t" );
std::string name( "" ); std::string name( "" );
if ( numToken == 1 ) { if ( numToken == 1 ) {
name = AI_DEFAULT_MATERIAL_NAME; name = AI_DEFAULT_MATERIAL_NAME;
} else { } else {
name = token[ 1 ]; // skip newmtl and all following white spaces
std::size_t first_ws_pos = line.find_first_of(" \t");
std::size_t first_non_ws_pos = line.find_first_not_of(" \t", first_ws_pos);
if (first_non_ws_pos != std::string::npos) {
name = line.substr(first_non_ws_pos);
}
} }
std::map<std::string, ObjFile::Material*>::iterator it = m_pModel->m_MaterialMap.find( name ); std::map<std::string, ObjFile::Material*>::iterator it = m_pModel->m_MaterialMap.find( name );

View File

@ -469,7 +469,7 @@ void ObjFileParser::getMaterialDesc()
return; return;
char *pStart = &(*m_DataIt); char *pStart = &(*m_DataIt);
while( m_DataIt != m_DataItEnd && !IsSpaceOrNewLine( *m_DataIt ) ) { while( m_DataIt != m_DataItEnd && !IsLineEnd( *m_DataIt ) ) {
++m_DataIt; ++m_DataIt;
} }

View File

@ -47,6 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/scene.h> #include <assimp/scene.h>
#include <assimp/ai_assert.h> #include <assimp/ai_assert.h>
#include <algorithm>
#include <vector> #include <vector>
static const aiImporterDesc desc = { static const aiImporterDesc desc = {
@ -184,12 +185,11 @@ USE_ODDLPARSER_NS
//------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------
OpenGEXImporter::VertexContainer::VertexContainer() OpenGEXImporter::VertexContainer::VertexContainer()
: m_numVerts( 0 ) : m_numVerts( 0 )
, m_vertices() , m_vertices(NULL)
, m_numNormals( 0 ) , m_numNormals( 0 )
, m_normals() , m_normals(NULL) {
, m_textureCoords() std::fill(&m_numUVComps[0], &m_numUVComps[AI_MAX_NUMBER_OF_TEXTURECOORDS], 0U);
, m_numUVComps() { std::fill(&m_textureCoords[0], &m_textureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS], static_cast<aiVector3D *>(NULL));
// empty
} }
//------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------
@ -216,9 +216,9 @@ OpenGEXImporter::RefInfo::~RefInfo() {
//------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------
OpenGEXImporter::OpenGEXImporter() OpenGEXImporter::OpenGEXImporter()
: m_meshCache() : m_root( NULL )
, m_root( NULL )
, m_nodeChildMap() , m_nodeChildMap()
, m_meshCache()
, m_mesh2refMap() , m_mesh2refMap()
, m_ctx( NULL ) , m_ctx( NULL )
, m_currentNode( NULL ) , m_currentNode( NULL )
@ -227,7 +227,7 @@ OpenGEXImporter::OpenGEXImporter()
, m_tokenType( Grammar::NoneType ) , m_tokenType( Grammar::NoneType )
, m_nodeStack() , m_nodeStack()
, m_unresolvedRefStack() { , m_unresolvedRefStack() {
// empty std::fill(&m_metrics[0], &m_metrics[MetricInfo::Max], MetricInfo());
} }
//------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------
@ -666,7 +666,6 @@ void OpenGEXImporter::handleVertexArrayNode( ODDLParser::DDLNode *node, aiScene
} }
const size_t numItems( countDataArrayListItems( vaList ) ); const size_t numItems( countDataArrayListItems( vaList ) );
Value *next( vaList->m_dataList );
if( Position == attribType ) { if( Position == attribType ) {
m_currentVertices.m_numVerts = numItems; m_currentVertices.m_numVerts = numItems;
m_currentVertices.m_vertices = new aiVector3D[ numItems ]; m_currentVertices.m_vertices = new aiVector3D[ numItems ];

View File

@ -71,6 +71,10 @@ using namespace Assimp;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
OptimizeGraphProcess::OptimizeGraphProcess() OptimizeGraphProcess::OptimizeGraphProcess()
: mScene()
, nodes_in()
, nodes_out()
, count_merged()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -122,7 +126,7 @@ void OptimizeGraphProcess::CollectNewChildren(aiNode* nd, std::list<aiNode*>& no
++it; ++it;
} }
if (nd->mNumMeshes || child_nodes.size()) { if (nd->mNumMeshes || !child_nodes.empty()) {
nodes.push_back(nd); nodes.push_back(nd);
} }
else { else {
@ -172,7 +176,7 @@ void OptimizeGraphProcess::CollectNewChildren(aiNode* nd, std::list<aiNode*>& no
} }
++it; ++it;
} }
if (join_master && join.size()) { if (join_master && !join.empty()) {
join_master->mName.length = sprintf(join_master->mName.data,"$MergedNode_%i",count_merged++); join_master->mName.length = sprintf(join_master->mName.data,"$MergedNode_%i",count_merged++);
unsigned int out_meshes = 0; unsigned int out_meshes = 0;

View File

@ -60,9 +60,10 @@ static const unsigned int DeadBeef = 0xdeadbeef;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
OptimizeMeshesProcess::OptimizeMeshesProcess() OptimizeMeshesProcess::OptimizeMeshesProcess()
: pts (false) : mScene()
, max_verts( NotSet ) , pts(false)
, max_faces( NotSet ) { , max_verts( NotSet )
, max_faces( NotSet ) {
// empty // empty
} }

View File

@ -164,9 +164,6 @@ private:
//! Per mesh info //! Per mesh info
std::vector<MeshInfo> meshes; std::vector<MeshInfo> meshes;
//! Next output mesh
aiMesh* mesh;
//! Output meshes //! Output meshes
std::vector<aiMesh*> output; std::vector<aiMesh*> output;

View File

@ -96,7 +96,6 @@ void ExportScenePlyBinary(const char* pFile, IOSystem* pIOSystem, const aiScene*
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
PlyExporter::PlyExporter(const char* _filename, const aiScene* pScene, bool binary) PlyExporter::PlyExporter(const char* _filename, const aiScene* pScene, bool binary)
: filename(_filename) : filename(_filename)
, pScene(pScene)
, endl("\n") , endl("\n")
{ {
// make sure that all formatting happens using the standard, C locale and not the user's current locale // make sure that all formatting happens using the standard, C locale and not the user's current locale

View File

@ -78,7 +78,6 @@ private:
private: private:
const std::string filename; const std::string filename;
const aiScene* const pScene;
// obviously, this endl() doesn't flush() the stream // obviously, this endl() doesn't flush() the stream
const std::string endl; const std::string endl;

View File

@ -54,7 +54,9 @@ using namespace Assimp;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
RemoveVCProcess::RemoveVCProcess() RemoveVCProcess::RemoveVCProcess() :
configDeleteFlags()
, mScene()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -55,28 +55,6 @@ namespace EXPRESS = STEP::EXPRESS;
#include <functional> #include <functional>
// ------------------------------------------------------------------------------------------------
// From http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring
// trim from start
static inline std::string &ltrim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1( std::ptr_fun(Assimp::IsSpace<char>))));
return s;
}
// trim from end
static inline std::string &rtrim(std::string &s) {
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1( std::ptr_fun(Assimp::IsSpace<char>))).base(),s.end());
return s;
}
// trim from both ends
static inline std::string &trim(std::string &s) {
return ltrim(rtrim(s));
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::string AddLineNumber(const std::string& s,uint64_t line /*= LINE_NOT_SPECIFIED*/, const std::string& prefix = "") std::string AddLineNumber(const std::string& s,uint64_t line /*= LINE_NOT_SPECIFIED*/, const std::string& prefix = "")
{ {

View File

@ -75,7 +75,7 @@ void ExportSceneSTLBinary(const char* pFile,IOSystem* pIOSystem, const aiScene*
STLExporter exporter(pFile, pScene, true); STLExporter exporter(pFile, pScene, true);
// we're still here - export successfully completed. Write the file. // we're still here - export successfully completed. Write the file.
boost::scoped_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wt")); boost::scoped_ptr<IOStream> outfile (pIOSystem->Open(pFile,"wb"));
if(outfile == NULL) { if(outfile == NULL) {
throw DeadlyExportError("could not open output .stl file: " + std::string(pFile)); throw DeadlyExportError("could not open output .stl file: " + std::string(pFile));
} }
@ -89,7 +89,6 @@ void ExportSceneSTLBinary(const char* pFile,IOSystem* pIOSystem, const aiScene*
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
STLExporter :: STLExporter(const char* _filename, const aiScene* pScene, bool binary) STLExporter :: STLExporter(const char* _filename, const aiScene* pScene, bool binary)
: filename(_filename) : filename(_filename)
, pScene(pScene)
, endl("\n") , endl("\n")
{ {
// make sure that all formatting happens using the standard, C locale and not the user's current locale // make sure that all formatting happens using the standard, C locale and not the user's current locale

View File

@ -75,7 +75,6 @@ private:
private: private:
const std::string filename; const std::string filename;
const aiScene* const pScene;
// this endl() doesn't flush() the stream // this endl() doesn't flush() the stream
const std::string endl; const std::string endl;

View File

@ -397,11 +397,11 @@ void SortByPTypeProcess::Execute( aiScene* pScene)
if (!DefaultLogger::isNullLogger()) if (!DefaultLogger::isNullLogger())
{ {
char buffer[1024]; char buffer[1024];
::sprintf(buffer,"Points: %i%s, Lines: %i%s, Triangles: %i%s, Polygons: %i%s (Meshes, X = removed)", ::sprintf(buffer,"Points: %u%s, Lines: %u%s, Triangles: %u%s, Polygons: %u%s (Meshes, X = removed)",
aiNumMeshesPerPType[0], (configRemoveMeshes & aiPrimitiveType_POINT ? "X" : ""), aiNumMeshesPerPType[0], ((configRemoveMeshes & aiPrimitiveType_POINT) ? "X" : ""),
aiNumMeshesPerPType[1], (configRemoveMeshes & aiPrimitiveType_LINE ? "X" : ""), aiNumMeshesPerPType[1], ((configRemoveMeshes & aiPrimitiveType_LINE) ? "X" : ""),
aiNumMeshesPerPType[2], (configRemoveMeshes & aiPrimitiveType_TRIANGLE ? "X" : ""), aiNumMeshesPerPType[2], ((configRemoveMeshes & aiPrimitiveType_TRIANGLE) ? "X" : ""),
aiNumMeshesPerPType[3], (configRemoveMeshes & aiPrimitiveType_POLYGON ? "X" : "")); aiNumMeshesPerPType[3], ((configRemoveMeshes & aiPrimitiveType_POLYGON) ? "X" : ""));
DefaultLogger::get()->info(buffer); DefaultLogger::get()->info(buffer);
DefaultLogger::get()->debug("SortByPTypeProcess finished"); DefaultLogger::get()->debug("SortByPTypeProcess finished");
} }

View File

@ -115,21 +115,6 @@ void ExportSceneStep(const char* pFile,IOSystem* pIOSystem, const aiScene* pScen
namespace { namespace {
inline uint64_t toIndexHash(int32_t id1, int32_t id2)
{
// dont wonder that -1/-1 -> hash=-1
uint64_t hash = (uint32_t) id1;
hash = (hash << 32);
hash += (uint32_t) id2;
return hash;
}
inline void fromIndexHash(uint64_t hash, int32_t &id1, int32_t &id2)
{
id1 = (hash & 0xFFFFFFFF00000000) >> 32;
id2 = (hash & 0xFFFFFFFF);
}
// Collect world transformations for each node // Collect world transformations for each node
void CollectTrafos(const aiNode* node, std::map<const aiNode*, aiMatrix4x4>& trafos) { void CollectTrafos(const aiNode* node, std::map<const aiNode*, aiMatrix4x4>& trafos) {
const aiMatrix4x4& parent = node->mParent ? trafos[node->mParent] : aiMatrix4x4(); const aiMatrix4x4& parent = node->mParent ? trafos[node->mParent] : aiMatrix4x4();
@ -152,7 +137,7 @@ namespace {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor for a specific scene to export // Constructor for a specific scene to export
StepExporter::StepExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file, const ExportProperties* pProperties) : mIOSystem(pIOSystem), mPath(path), mFile(file), mProperties(pProperties) StepExporter::StepExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file, const ExportProperties* pProperties) : mProperties(pProperties), mIOSystem(pIOSystem), mFile(file), mPath(path), mScene(pScene), endstr(";\n")
{ {
CollectTrafos(pScene->mRootNode, trafos); CollectTrafos(pScene->mRootNode, trafos);
CollectMeshes(pScene->mRootNode, meshes); CollectMeshes(pScene->mRootNode, meshes);
@ -160,11 +145,6 @@ StepExporter::StepExporter(const aiScene* pScene, IOSystem* pIOSystem, const std
// make sure that all formatting happens using the standard, C locale and not the user's current locale // make sure that all formatting happens using the standard, C locale and not the user's current locale
mOutput.imbue( std::locale("C") ); mOutput.imbue( std::locale("C") );
mScene = pScene;
// set up strings
endstr = ";\n";
// start writing // start writing
WriteFile(); WriteFile();
} }

View File

@ -54,7 +54,8 @@ using namespace Assimp;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
TextureTransformStep::TextureTransformStep() TextureTransformStep::TextureTransformStep() :
configFlags()
{ {
// nothing to do here // nothing to do here
} }

View File

@ -60,7 +60,8 @@ using namespace Assimp;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
ValidateDSProcess::ValidateDSProcess() ValidateDSProcess::ValidateDSProcess() :
mScene()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -690,8 +691,7 @@ void ValidateDSProcess::Validate( const aiMaterial* pMaterial)
if (aiPTI_String == prop->mType) { if (aiPTI_String == prop->mType) {
// FIX: strings are now stored in a less expensive way, but we can't use the // FIX: strings are now stored in a less expensive way, but we can't use the
// validation routine for 'normal' aiStrings // validation routine for 'normal' aiStrings
uint32_t len; if (prop->mDataLength < 5 || prop->mDataLength < 4 + (*reinterpret_cast<uint32_t*>(prop->mData)) + 1) {
if (prop->mDataLength < 5 || prop->mDataLength < 4 + (len=*reinterpret_cast<uint32_t*>(prop->mData)) + 1) {
ReportError("aiMaterial::mProperties[%i].mDataLength is " ReportError("aiMaterial::mProperties[%i].mDataLength is "
"too small to contain a string (%i, needed: %i)", "too small to contain a string (%i, needed: %i)",
i,prop->mDataLength,sizeof(aiString)); i,prop->mDataLength,sizeof(aiString));

View File

@ -95,17 +95,18 @@ void ExportSceneXFile(const char* pFile,IOSystem* pIOSystem, const aiScene* pSce
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor for a specific scene to export // Constructor for a specific scene to export
XFileExporter::XFileExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file, const ExportProperties* pProperties) : mIOSystem(pIOSystem), mPath(path), mFile(file), mProperties(pProperties) XFileExporter::XFileExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file, const ExportProperties* pProperties)
: mProperties(pProperties),
mIOSystem(pIOSystem),
mPath(path),
mFile(file),
mScene(pScene),
mSceneOwned(false),
endstr("\n")
{ {
// make sure that all formatting happens using the standard, C locale and not the user's current locale // make sure that all formatting happens using the standard, C locale and not the user's current locale
mOutput.imbue( std::locale("C") ); mOutput.imbue( std::locale("C") );
mScene = pScene;
mSceneOwned = false;
// set up strings
endstr = "\n";
// start writing // start writing
WriteFile(); WriteFile();
} }

View File

@ -109,7 +109,14 @@ public:
mEnforcePP = pEnforcePP; mEnforcePP = pEnforcePP;
} }
ExportFormatEntry() : mExportFunction(), mEnforcePP() {} ExportFormatEntry() :
mExportFunction()
, mEnforcePP()
{
mDescription.id = NULL;
mDescription.description = NULL;
mDescription.fileExtension = NULL;
}
}; };

View File

@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_ASSIMP_H_INC #ifndef AI_ASSIMP_H_INC
#define AI_ASSIMP_H_INC #define AI_ASSIMP_H_INC
#include "types.h" #include "types.h"
#include <assimp/importerdesc.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -539,7 +540,20 @@ ASSIMP_API void aiIdentityMatrix3(
ASSIMP_API void aiIdentityMatrix4( ASSIMP_API void aiIdentityMatrix4(
C_STRUCT aiMatrix4x4* mat); C_STRUCT aiMatrix4x4* mat);
// --------------------------------------------------------------------------------
/** Returns the number of import file formats available in the current Assimp build.
* Use aiGetImportFormatDescription() to retrieve infos of a specific import format.
*/
ASSIMP_API size_t aiGetImportFormatCount(void);
// --------------------------------------------------------------------------------
/** Returns a description of the nth import file format. Use #aiGetImportFormatCount()
* to learn how many import formats are supported.
* @param pIndex Index of the import format to retrieve information for. Valid range is
* 0 to #aiGetImportFormatCount()
* @return A description of that specific import format. NULL if pIndex is out of range.
*/
ASSIMP_API const C_STRUCT aiImporterDesc* aiGetImportFormatDescription( size_t pIndex);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -209,7 +209,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if (defined(__BORLANDC__) || defined (__BCPLUSPLUS__)) #if (defined(__BORLANDC__) || defined (__BCPLUSPLUS__))
#error Currently, Borland is unsupported. Feel free to port Assimp. #error Currently, Borland is unsupported. Feel free to port Assimp.
// "W8059 Packgröße der Struktur geändert" // "W8059 Packgr<EFBFBD><EFBFBD>e der Struktur ge<67>ndert"
#endif #endif
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
@ -257,8 +257,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f) #define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f)
/* Tiny macro to convert from radians to degrees and back */ /* Tiny macro to convert from radians to degrees and back */
#define AI_DEG_TO_RAD(x) (x*0.0174532925f) #define AI_DEG_TO_RAD(x) ((x)*0.0174532925f)
#define AI_RAD_TO_DEG(x) (x*57.2957795f) #define AI_RAD_TO_DEG(x) ((x)*57.2957795f)
/* Support for big-endian builds */ /* Support for big-endian builds */
#if defined(__BYTE_ORDER__) #if defined(__BYTE_ORDER__)

View File

@ -138,6 +138,6 @@ Will return a NULL-pointer if no assigned importer desc. was found for the given
\param extension [in] The extension to look for \param extension [in] The extension to look for
\return A pointer showing to the ImporterDesc, \see aiImporterDesc. \return A pointer showing to the ImporterDesc, \see aiImporterDesc.
*/ */
ASSIMP_API C_STRUCT const aiImporterDesc* aiGetImporterDesc( const char *extension ); ASSIMP_API const C_STRUCT aiImporterDesc* aiGetImporterDesc( const char *extension );
#endif #endif

View File

@ -40,6 +40,8 @@ SET( TEST_SRCS
unit/utTriangulate.cpp unit/utTriangulate.cpp
unit/utVertexTriangleAdjacency.cpp unit/utVertexTriangleAdjacency.cpp
unit/utNoBoostTest.cpp unit/utNoBoostTest.cpp
unit/utColladaExportCamera.cpp
unit/utColladaExportLight.cpp
) )
SOURCE_GROUP( tests FILES ${TEST_SRCS} ) SOURCE_GROUP( tests FILES ${TEST_SRCS} )

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
<asset>
<contributor>
<author>Blender User</author>
<authoring_tool>Blender 2.74.0 commit date:2015-03-31, commit time:13:39, hash:000dfc0</authoring_tool>
</contributor>
<created>2015-05-17T19:24:51</created>
<modified>2015-05-17T19:24:51</modified>
<unit name="meter" meter="1"/>
<up_axis>Z_UP</up_axis>
</asset>
<library_cameras>
<camera id="Camera-camera" name="Camera.001">
<optics>
<technique_common>
<perspective>
<xfov sid="xfov">49.13434</xfov>
<aspect_ratio>1.777778</aspect_ratio>
<znear sid="znear">0.1</znear>
<zfar sid="zfar">100</zfar>
</perspective>
</technique_common>
</optics>
<extra>
<technique profile="blender">
<YF_dofdist>0</YF_dofdist>
<shiftx>0</shiftx>
<shifty>0</shifty>
</technique>
</extra>
</camera>
<camera id="Camera_002-camera" name="Camera.002">
<optics>
<technique_common>
<orthographic>
<xmag sid="xmag">3</xmag>
<aspect_ratio>1.777778</aspect_ratio>
<znear sid="znear">0.1</znear>
<zfar sid="zfar">100</zfar>
</orthographic>
</technique_common>
</optics>
<extra>
<technique profile="blender">
<YF_dofdist>0</YF_dofdist>
<shiftx>0</shiftx>
<shifty>0</shifty>
</technique>
</extra>
</camera>
<camera id="Camera_003-camera" name="Camera.003">
<optics>
<technique_common>
<perspective>
<xfov sid="xfov">29.86284</xfov>
<aspect_ratio>1.777778</aspect_ratio>
<znear sid="znear">0.1</znear>
<zfar sid="zfar">50</zfar>
</perspective>
</technique_common>
</optics>
<extra>
<technique profile="blender">
<YF_dofdist>0</YF_dofdist>
<shiftx>0</shiftx>
<shifty>0</shifty>
</technique>
</extra>
</camera>
</library_cameras>
<library_images/>
<library_controllers/>
<library_visual_scenes>
<visual_scene id="Scene" name="Scene">
<node id="Camera" name="Camera" type="NODE">
<matrix sid="transform">7.54979e-8 0 1 10 0 1 0 0 -1 0 7.54979e-8 0 0 0 0 1</matrix>
<instance_camera url="#Camera-camera"/>
</node>
<node id="Camera_002" name="Camera_002" type="NODE">
<matrix sid="transform">7.54979e-8 0 -1 -10 0 1 0 0 1 0 7.54979e-8 0 0 0 0 1</matrix>
<instance_camera url="#Camera_002-camera"/>
</node>
<node id="Camera_003" name="Camera_003" type="NODE">
<matrix sid="transform">3.09086e-8 -1 1.58933e-8 0 -3.09086e-8 1.58933e-8 1 5 -1 -3.09086e-8 -3.09086e-8 0 0 0 0 1</matrix>
<instance_camera url="#Camera_003-camera"/>
</node>
</visual_scene>
</library_visual_scenes>
<scene>
<instance_visual_scene url="#Scene"/>
</scene>
</COLLADA>

View File

@ -0,0 +1,380 @@
<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
<asset>
<contributor>
<author>Blender User</author>
<authoring_tool>Blender 2.74.0 commit date:2015-03-31, commit time:13:39, hash:000dfc0</authoring_tool>
</contributor>
<created>2015-05-17T21:55:44</created>
<modified>2015-05-17T21:55:44</modified>
<unit name="meter" meter="1"/>
<up_axis>Z_UP</up_axis>
</asset>
<library_lights>
<light id="Lamp-light" name="Lamp">
<technique_common>
<point>
<color sid="color">1 1 1</color>
<constant_attenuation>1</constant_attenuation>
<linear_attenuation>0</linear_attenuation>
<quadratic_attenuation>0.00111109</quadratic_attenuation>
</point>
</technique_common>
<extra>
<technique profile="blender">
<adapt_thresh>0.000999987</adapt_thresh>
<area_shape>1</area_shape>
<area_size>0.1</area_size>
<area_sizey>0.1</area_sizey>
<area_sizez>1</area_sizez>
<atm_distance_factor>1</atm_distance_factor>
<atm_extinction_factor>1</atm_extinction_factor>
<atm_turbidity>2</atm_turbidity>
<att1>0</att1>
<att2>1</att2>
<backscattered_light>1</backscattered_light>
<bias>1</bias>
<blue>1</blue>
<buffers>1</buffers>
<bufflag>0</bufflag>
<bufsize>2880</bufsize>
<buftype>2</buftype>
<clipend>30.002</clipend>
<clipsta>1.000799</clipsta>
<compressthresh>0.04999995</compressthresh>
<dist sid="blender_dist">29.99998</dist>
<energy sid="blender_energy">1</energy>
<falloff_type>2</falloff_type>
<filtertype>0</filtertype>
<flag>0</flag>
<gamma sid="blender_gamma">1</gamma>
<green>1</green>
<halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
<horizon_brightness>1</horizon_brightness>
<mode>8192</mode>
<ray_samp>1</ray_samp>
<ray_samp_method>1</ray_samp_method>
<ray_samp_type>0</ray_samp_type>
<ray_sampy>1</ray_sampy>
<ray_sampz>1</ray_sampz>
<red>1</red>
<samp>3</samp>
<shadhalostep>0</shadhalostep>
<shadow_b sid="blender_shadow_b">0</shadow_b>
<shadow_g sid="blender_shadow_g">0</shadow_g>
<shadow_r sid="blender_shadow_r">0</shadow_r>
<sky_colorspace>0</sky_colorspace>
<sky_exposure>1</sky_exposure>
<skyblendfac>1</skyblendfac>
<skyblendtype>1</skyblendtype>
<soft>3</soft>
<spotblend>0.15</spotblend>
<spotsize>75</spotsize>
<spread>1</spread>
<sun_brightness>1</sun_brightness>
<sun_effect_type>0</sun_effect_type>
<sun_intensity>1</sun_intensity>
<sun_size>1</sun_size>
<type>0</type>
</technique>
</extra>
</light>
<light id="Sun-light" name="Sun">
<technique_common>
<directional>
<color sid="color">1 1 1</color>
</directional>
</technique_common>
<extra>
<technique profile="blender">
<adapt_thresh>0.000999987</adapt_thresh>
<area_shape>0</area_shape>
<area_size>0.1</area_size>
<area_sizey>0.1</area_sizey>
<area_sizez>0.1</area_sizez>
<atm_distance_factor>1</atm_distance_factor>
<atm_extinction_factor>1</atm_extinction_factor>
<atm_turbidity>2</atm_turbidity>
<att1>0</att1>
<att2>1</att2>
<backscattered_light>1</backscattered_light>
<bias>1</bias>
<blue>1</blue>
<buffers>1</buffers>
<bufflag>0</bufflag>
<bufsize>512</bufsize>
<buftype>2</buftype>
<clipend>40</clipend>
<clipsta>0.5</clipsta>
<compressthresh>0.04999995</compressthresh>
<dist sid="blender_dist">25</dist>
<energy sid="blender_energy">1</energy>
<falloff_type>2</falloff_type>
<filtertype>0</filtertype>
<flag>0</flag>
<gamma sid="blender_gamma">1</gamma>
<green>1</green>
<halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
<horizon_brightness>1</horizon_brightness>
<mode>1</mode>
<ray_samp>1</ray_samp>
<ray_samp_method>1</ray_samp_method>
<ray_samp_type>0</ray_samp_type>
<ray_sampy>1</ray_sampy>
<ray_sampz>1</ray_sampz>
<red>1</red>
<samp>3</samp>
<shadhalostep>0</shadhalostep>
<shadow_b sid="blender_shadow_b">0</shadow_b>
<shadow_g sid="blender_shadow_g">0</shadow_g>
<shadow_r sid="blender_shadow_r">0</shadow_r>
<sky_colorspace>2</sky_colorspace>
<sky_exposure>1</sky_exposure>
<skyblendfac>1</skyblendfac>
<skyblendtype>1</skyblendtype>
<soft>3</soft>
<spotblend>0.15</spotblend>
<spotsize>45</spotsize>
<spread>1</spread>
<sun_brightness>1</sun_brightness>
<sun_effect_type>0</sun_effect_type>
<sun_intensity>1</sun_intensity>
<sun_size>1</sun_size>
<type>1</type>
</technique>
</extra>
</light>
<light id="Spot-light" name="Spot">
<technique_common>
<spot>
<color sid="color">1 1 1</color>
<constant_attenuation>1</constant_attenuation>
<linear_attenuation>0</linear_attenuation>
<quadratic_attenuation>0.001599967</quadratic_attenuation>
<falloff_angle sid="fall_off_angle">45</falloff_angle>
<falloff_exponent sid="fall_off_exponent">0.15</falloff_exponent>
</spot>
</technique_common>
<extra>
<technique profile="blender">
<adapt_thresh>0.000999987</adapt_thresh>
<area_shape>0</area_shape>
<area_size>0.1</area_size>
<area_sizey>0.1</area_sizey>
<area_sizez>0.1</area_sizez>
<atm_distance_factor>1</atm_distance_factor>
<atm_extinction_factor>1</atm_extinction_factor>
<atm_turbidity>2</atm_turbidity>
<att1>0</att1>
<att2>1</att2>
<backscattered_light>1</backscattered_light>
<bias>1</bias>
<blue>1</blue>
<buffers>1</buffers>
<bufflag>0</bufflag>
<bufsize>512</bufsize>
<buftype>2</buftype>
<clipend>40</clipend>
<clipsta>0.5</clipsta>
<compressthresh>0.04999995</compressthresh>
<dist sid="blender_dist">25</dist>
<energy sid="blender_energy">1</energy>
<falloff_type>2</falloff_type>
<filtertype>0</filtertype>
<flag>0</flag>
<gamma sid="blender_gamma">1</gamma>
<green>1</green>
<halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
<horizon_brightness>1</horizon_brightness>
<mode>1</mode>
<ray_samp>1</ray_samp>
<ray_samp_method>1</ray_samp_method>
<ray_samp_type>0</ray_samp_type>
<ray_sampy>1</ray_sampy>
<ray_sampz>1</ray_sampz>
<red>1</red>
<samp>3</samp>
<shadhalostep>0</shadhalostep>
<shadow_b sid="blender_shadow_b">0</shadow_b>
<shadow_g sid="blender_shadow_g">0</shadow_g>
<shadow_r sid="blender_shadow_r">0</shadow_r>
<sky_colorspace>2</sky_colorspace>
<sky_exposure>1</sky_exposure>
<skyblendfac>1</skyblendfac>
<skyblendtype>1</skyblendtype>
<soft>3</soft>
<spotblend>0.15</spotblend>
<spotsize>45</spotsize>
<spread>1</spread>
<sun_brightness>1</sun_brightness>
<sun_effect_type>0</sun_effect_type>
<sun_intensity>1</sun_intensity>
<sun_size>1</sun_size>
<type>2</type>
</technique>
</extra>
</light>
<light id="Hemi-light" name="Hemi">
<technique_common>
<ambient>
<color>1 1 1</color>
</ambient>
</technique_common>
<extra>
<technique profile="blender">
<adapt_thresh>0.000999987</adapt_thresh>
<area_shape>0</area_shape>
<area_size>0.1</area_size>
<area_sizey>0.1</area_sizey>
<area_sizez>0.1</area_sizez>
<atm_distance_factor>1</atm_distance_factor>
<atm_extinction_factor>1</atm_extinction_factor>
<atm_turbidity>2</atm_turbidity>
<att1>0</att1>
<att2>1</att2>
<backscattered_light>1</backscattered_light>
<bias>1</bias>
<blue>1</blue>
<buffers>1</buffers>
<bufflag>0</bufflag>
<bufsize>512</bufsize>
<buftype>2</buftype>
<clipend>40</clipend>
<clipsta>0.5</clipsta>
<compressthresh>0.04999995</compressthresh>
<dist sid="blender_dist">25</dist>
<energy sid="blender_energy">1</energy>
<falloff_type>2</falloff_type>
<filtertype>0</filtertype>
<flag>0</flag>
<gamma sid="blender_gamma">1</gamma>
<green>1</green>
<halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
<horizon_brightness>1</horizon_brightness>
<mode>1</mode>
<ray_samp>1</ray_samp>
<ray_samp_method>1</ray_samp_method>
<ray_samp_type>0</ray_samp_type>
<ray_sampy>1</ray_sampy>
<ray_sampz>1</ray_sampz>
<red>1</red>
<samp>3</samp>
<shadhalostep>0</shadhalostep>
<shadow_b sid="blender_shadow_b">0</shadow_b>
<shadow_g sid="blender_shadow_g">0</shadow_g>
<shadow_r sid="blender_shadow_r">0</shadow_r>
<sky_colorspace>2</sky_colorspace>
<sky_exposure>1</sky_exposure>
<skyblendfac>1</skyblendfac>
<skyblendtype>1</skyblendtype>
<soft>3</soft>
<spotblend>0.15</spotblend>
<spotsize>45</spotsize>
<spread>1</spread>
<sun_brightness>1</sun_brightness>
<sun_effect_type>0</sun_effect_type>
<sun_intensity>1</sun_intensity>
<sun_size>1</sun_size>
<type>3</type>
</technique>
</extra>
</light>
<light id="Area-light" name="Area">
<technique_common>
<point>
<color sid="color">1 1 1</color>
<constant_attenuation>1</constant_attenuation>
<linear_attenuation>0</linear_attenuation>
<quadratic_attenuation>0.001599967</quadratic_attenuation>
</point>
</technique_common>
<extra>
<technique profile="blender">
<adapt_thresh>0.000999987</adapt_thresh>
<area_shape>0</area_shape>
<area_size>0.1</area_size>
<area_sizey>0.1</area_sizey>
<area_sizez>0.1</area_sizez>
<atm_distance_factor>1</atm_distance_factor>
<atm_extinction_factor>1</atm_extinction_factor>
<atm_turbidity>2</atm_turbidity>
<att1>0</att1>
<att2>1</att2>
<backscattered_light>1</backscattered_light>
<bias>1</bias>
<blue>1</blue>
<buffers>1</buffers>
<bufflag>0</bufflag>
<bufsize>512</bufsize>
<buftype>2</buftype>
<clipend>40</clipend>
<clipsta>0.5</clipsta>
<compressthresh>0.04999995</compressthresh>
<dist sid="blender_dist">25</dist>
<energy sid="blender_energy">1</energy>
<falloff_type>2</falloff_type>
<filtertype>0</filtertype>
<flag>0</flag>
<gamma sid="blender_gamma">1</gamma>
<green>1</green>
<halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
<horizon_brightness>1</horizon_brightness>
<mode>1</mode>
<ray_samp>1</ray_samp>
<ray_samp_method>1</ray_samp_method>
<ray_samp_type>0</ray_samp_type>
<ray_sampy>1</ray_sampy>
<ray_sampz>1</ray_sampz>
<red>1</red>
<samp>3</samp>
<shadhalostep>0</shadhalostep>
<shadow_b sid="blender_shadow_b">0</shadow_b>
<shadow_g sid="blender_shadow_g">0</shadow_g>
<shadow_r sid="blender_shadow_r">0</shadow_r>
<sky_colorspace>2</sky_colorspace>
<sky_exposure>1</sky_exposure>
<skyblendfac>1</skyblendfac>
<skyblendtype>1</skyblendtype>
<soft>3</soft>
<spotblend>0.15</spotblend>
<spotsize>45</spotsize>
<spread>1</spread>
<sun_brightness>1</sun_brightness>
<sun_effect_type>0</sun_effect_type>
<sun_intensity>1</sun_intensity>
<sun_size>1</sun_size>
<type>4</type>
</technique>
</extra>
</light>
</library_lights>
<library_images/>
<library_controllers/>
<library_visual_scenes>
<visual_scene id="Scene" name="Scene">
<node id="Lamp" name="Lamp" type="NODE">
<matrix sid="transform">1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1</matrix>
<instance_light url="#Lamp-light"/>
</node>
<node id="Sun" name="Sun" type="NODE">
<matrix sid="transform">1 0 0 7.076701 0 1 0 -5.572294 0 0 1 5.147222 0 0 0 1</matrix>
<instance_light url="#Sun-light"/>
</node>
<node id="Spot" name="Spot" type="NODE">
<matrix sid="transform">1 0 0 8.888217 0 1 0 -5.016863 0 0 1 5.336025 0 0 0 1</matrix>
<instance_light url="#Spot-light"/>
</node>
<node id="Hemi" name="Hemi" type="NODE">
<matrix sid="transform">1 0 0 7.326984 0 1 0 -4.602942 0 0 1 5.554852 0 0 0 1</matrix>
<instance_light url="#Hemi-light"/>
</node>
<node id="Area" name="Area" type="NODE">
<matrix sid="transform">1 0 0 8.063721 0 1 0 -4.19857 0 0 1 5.273283 0 0 0 1</matrix>
<instance_light url="#Area-light"/>
</node>
</visual_scene>
</library_visual_scenes>
<scene>
<instance_visual_scene url="#Scene"/>
</scene>
</COLLADA>

View File

@ -0,0 +1,13 @@
# Example for github issue #545: spaces in material names.
newmtl Hard Shiny Plastic White
Ka 0 0 0
Kd 0.141176 0.184314 0.411765
Ks 0 0 0
Ni 1
Ns 400
Tf 1 1 1
d 1

View File

@ -0,0 +1,77 @@
####
#
# OBJ File Generated by LightWave3D
# LightWave3D OBJ Export v2.3
#
####
o concave_test.obj
mtllib space_in_material_name.mtl
g default
v -1.146 1.6575 2.348
v -1.146 1.67177 2.49285
v -1.146 1.67177 2.20315
v -1.146 1.7125 2.35
v -1.146 1.71402 2.63214
v -1.146 1.71402 2.06386
v -1.146 1.72571 2.48412
v -1.146 1.72571 2.21588
v -1.146 1.76483 2.61309
v -1.146 1.76483 2.08691
v -1.146 1.78263 2.76051
v -1.146 1.78263 1.93549
v -1.146 1.82836 2.73195
v -1.146 1.82836 1.96805
v -1.146 1.87497 2.87303
v -1.146 1.87497 1.82297
v -1.146 1.91386 2.83614
v -1.146 1.91386 1.86386
v -1.146 1.98749 2.96537
v -1.146 1.98749 1.73063
v -1.146 2.01805 2.92164
v -1.146 2.01805 1.77836
v -1.146 2.11586 3.03398
v -1.146 2.11586 1.66202
v -1.146 2.13691 2.98517
v -1.146 2.13691 1.71483
v -1.146 2.25515 3.07623
v -1.146 2.25515 1.61977
v -1.146 2.26588 3.02429
v -1.146 2.26588 1.67571
v -1.146 2.4 3.0905
v -1.146 2.4 3.0375
v -1.146 2.4 1.6625
v -1.146 2.4 1.6055
v -1.146 2.53412 3.02429
v -1.146 2.53412 1.67571
v -1.146 2.54485 3.07623
v -1.146 2.54485 1.61977
v -1.146 2.66309 2.98517
v -1.146 2.66309 1.71483
v -1.146 2.68414 3.03398
v -1.146 2.68414 1.66202
v -1.146 2.78195 2.92164
v -1.146 2.78195 1.77836
v -1.146 2.81251 2.96537
v -1.146 2.81251 1.73063
v -1.146 2.88614 2.83614
v -1.146 2.88614 1.86386
v -1.146 2.92503 2.87303
v -1.146 2.92503 1.82297
v -1.146 2.97164 2.73195
v -1.146 2.97164 1.96805
v -1.146 3.01737 2.76051
v -1.146 3.01737 1.93549
v -1.146 3.03517 2.61309
v -1.146 3.03517 2.08691
v -1.146 3.07429 2.48412
v -1.146 3.07429 2.21588
v -1.146 3.08598 2.63214
v -1.146 3.08598 2.06386
v -1.146 3.0875 2.35
v -1.146 3.12823 2.49285
v -1.146 3.12823 2.20315
v -1.146 3.1425 2.348
vn 1 0 -0
usemtl Hard Shiny Plastic White
s 1
f 27//1 23//1 19//1 15//1 11//1 5//1 2//1 1//1 3//1 6//1 12//1 16//1 20//1 24//1 28//1 34//1 38//1 42//1 46//1 50//1 54//1 60//1 63//1 64//1 62//1 59//1 53//1 49//1 45//1 41//1 37//1 31//1 32//1 35//1 39//1 43//1 47//1 51//1 55//1 57//1 61//1 58//1 56//1 52//1 48//1 44//1 40//1 36//1 33//1 30//1 26//1 22//1 18//1 14//1 10//1 8//1 4//1 7//1 9//1 13//1 17//1 21//1 25//1 29//1 32//1 31//1

Binary file not shown.

View File

@ -0,0 +1,80 @@
/*
* ColladaCameraExporter.cpp
*
* Created on: May 17, 2015
* Author: wise
*/
#include "UnitTestPCH.h"
#include <assimp/cexport.h>
#include <assimp/Exporter.hpp>
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#ifndef ASSIMP_BUILD_NO_EXPORT
class ColladaExportCamera : public ::testing::Test {
public:
virtual void SetUp()
{
ex = new Assimp::Exporter();
im = new Assimp::Importer();
}
virtual void TearDown()
{
delete ex;
delete im;
}
protected:
Assimp::Exporter* ex;
Assimp::Importer* im;
};
// ------------------------------------------------------------------------------------------------
TEST_F(ColladaExportCamera, testExportCamera)
{
const char* file = "cameraExp.dae";
const aiScene* pTest = im->ReadFile("../test/models/Collada/cameras.dae",0);
ASSERT_TRUE(pTest!=NULL);
ASSERT_TRUE(pTest->HasCameras());
EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file));
const aiScene* imported = im->ReadFile(file,0);
ASSERT_TRUE(imported!=NULL);
EXPECT_TRUE(imported->HasCameras());
EXPECT_EQ(pTest->mNumCameras,imported->mNumCameras);
for(size_t i=0; i< pTest->mNumCameras;i++){
const aiCamera *orig = pTest->mCameras[i];
const aiCamera *read = imported->mCameras[i];
EXPECT_TRUE(orig->mName==read->mName);
EXPECT_FLOAT_EQ(orig->mHorizontalFOV,read->mHorizontalFOV);
EXPECT_FLOAT_EQ(orig->mClipPlaneNear,read->mClipPlaneNear);
EXPECT_FLOAT_EQ(orig->mClipPlaneFar,read->mClipPlaneFar);
EXPECT_FLOAT_EQ(orig->mPosition.x,read->mPosition.x);
EXPECT_FLOAT_EQ(orig->mPosition.y,read->mPosition.y);
EXPECT_FLOAT_EQ(orig->mPosition.z,read->mPosition.z);
}
}
#endif

View File

@ -0,0 +1,92 @@
/*
* ColladaCameraExporter.cpp
*
* Created on: May 17, 2015
* Author: wise
*/
#include "UnitTestPCH.h"
#include <assimp/cexport.h>
#include <assimp/Exporter.hpp>
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#ifndef ASSIMP_BUILD_NO_EXPORT
class ColladaExportLight : public ::testing::Test {
public:
virtual void SetUp()
{
ex = new Assimp::Exporter();
im = new Assimp::Importer();
}
virtual void TearDown()
{
delete ex;
delete im;
}
protected:
Assimp::Exporter* ex;
Assimp::Importer* im;
};
// ------------------------------------------------------------------------------------------------
TEST_F(ColladaExportLight, testExportLight)
{
const char* file = "cameraExp.dae";
const aiScene* pTest = im->ReadFile("../test/models/Collada/lights.dae",0);
ASSERT_TRUE(pTest!=NULL);
ASSERT_TRUE(pTest->HasLights());
EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file));
EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada","/home/wise/lightsExp.dae"));
const aiScene* imported = im->ReadFile(file,0);
ASSERT_TRUE(imported!=NULL);
EXPECT_TRUE(imported->HasLights());
EXPECT_EQ(pTest->mNumLights,imported->mNumLights);
for(size_t i=0; i< pTest->mNumLights;i++){
const aiLight *orig = pTest->mLights[i];
const aiLight *read = imported->mLights[i];
EXPECT_TRUE(orig->mName==read->mName);
EXPECT_EQ(orig->mType,read->mType);
EXPECT_FLOAT_EQ(orig->mAttenuationConstant,read->mAttenuationConstant);
EXPECT_FLOAT_EQ(orig->mAttenuationLinear,read->mAttenuationLinear);
EXPECT_FLOAT_EQ(orig->mAttenuationQuadratic,read->mAttenuationQuadratic);
EXPECT_FLOAT_EQ(orig->mColorAmbient.r,read->mColorAmbient.r);
EXPECT_FLOAT_EQ(orig->mColorAmbient.g,read->mColorAmbient.g);
EXPECT_FLOAT_EQ(orig->mColorAmbient.b,read->mColorAmbient.b);
EXPECT_FLOAT_EQ(orig->mColorDiffuse.r,read->mColorDiffuse.r);
EXPECT_FLOAT_EQ(orig->mColorDiffuse.g,read->mColorDiffuse.g);
EXPECT_FLOAT_EQ(orig->mColorDiffuse.b,read->mColorDiffuse.b);
EXPECT_FLOAT_EQ(orig->mColorSpecular.r,read->mColorSpecular.r);
EXPECT_FLOAT_EQ(orig->mColorSpecular.g,read->mColorSpecular.g);
EXPECT_FLOAT_EQ(orig->mColorSpecular.b,read->mColorSpecular.b);
EXPECT_NEAR(orig->mAngleInnerCone,read->mAngleInnerCone,0.001);
EXPECT_NEAR(orig->mAngleOuterCone,read->mAngleOuterCone,0.001);
}
}
#endif

View File

@ -219,13 +219,13 @@ TEST_F(ImporterTest, testMultipleReads)
aiProcess_OptimizeMeshes | aiProcess_OptimizeMeshes |
aiProcess_OptimizeGraph; aiProcess_OptimizeGraph;
EXPECT_TRUE(pImp->ReadFile("../../test/models/X/test.x",flags)); EXPECT_TRUE(pImp->ReadFile("../test/models/X/test.x",flags));
//EXPECT_TRUE(pImp->ReadFile("../../test/models/X/dwarf.x",flags)); # is in nonbsd //EXPECT_TRUE(pImp->ReadFile("../../test/models/X/dwarf.x",flags)); # is in nonbsd
EXPECT_TRUE(pImp->ReadFile("../../test/models/X/Testwuson.X",flags)); EXPECT_TRUE(pImp->ReadFile("../test/models/X/Testwuson.X",flags));
EXPECT_TRUE(pImp->ReadFile("../../test/models/X/anim_test.x",flags)); EXPECT_TRUE(pImp->ReadFile("../test/models/X/anim_test.x",flags));
//EXPECT_TRUE(pImp->ReadFile("../../test/models/X/dwarf.x",flags)); # is in nonbsd //EXPECT_TRUE(pImp->ReadFile("../../test/models/X/dwarf.x",flags)); # is in nonbsd
EXPECT_TRUE(pImp->ReadFile("../../test/models/X/anim_test.x",flags)); EXPECT_TRUE(pImp->ReadFile("../test/models/X/anim_test.x",flags));
EXPECT_TRUE(pImp->ReadFile("../../test/models/X/BCN_Epileptic.X",flags)); EXPECT_TRUE(pImp->ReadFile("../test/models/X/BCN_Epileptic.X",flags));
//EXPECT_TRUE(pImp->ReadFile("../../test/models/X/dwarf.x",flags)); # is in nonbsd //EXPECT_TRUE(pImp->ReadFile("../../test/models/X/dwarf.x",flags)); # is in nonbsd
} }