Refactor: Trim trailing whitespace

pull/566/head
Richard 2015-05-18 21:52:10 -06:00
parent 4c1a0507fe
commit a96a595a7a
313 changed files with 7022 additions and 7022 deletions

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -59,7 +59,7 @@ using namespace Assimp;
// Setup final material indices, generae a default material if necessary // Setup final material indices, generae a default material if necessary
void Discreet3DSImporter::ReplaceDefaultMaterial() void Discreet3DSImporter::ReplaceDefaultMaterial()
{ {
// Try to find an existing material that matches the // Try to find an existing material that matches the
// typical default material setting: // typical default material setting:
// - no textures // - no textures
@ -81,7 +81,7 @@ void Discreet3DSImporter::ReplaceDefaultMaterial()
mScene->mMaterials[i].mDiffuse.b)continue; mScene->mMaterials[i].mDiffuse.b)continue;
if (mScene->mMaterials[i].sTexDiffuse.mMapName.length() != 0 || if (mScene->mMaterials[i].sTexDiffuse.mMapName.length() != 0 ||
mScene->mMaterials[i].sTexBump.mMapName.length() != 0 || mScene->mMaterials[i].sTexBump.mMapName.length() != 0 ||
mScene->mMaterials[i].sTexOpacity.mMapName.length() != 0 || mScene->mMaterials[i].sTexOpacity.mMapName.length() != 0 ||
mScene->mMaterials[i].sTexEmissive.mMapName.length() != 0 || mScene->mMaterials[i].sTexEmissive.mMapName.length() != 0 ||
mScene->mMaterials[i].sTexSpecular.mMapName.length() != 0 || mScene->mMaterials[i].sTexSpecular.mMapName.length() != 0 ||
@ -159,7 +159,7 @@ void Discreet3DSImporter::CheckIndices(D3DS::Mesh& sMesh)
void Discreet3DSImporter::MakeUnique(D3DS::Mesh& sMesh) void Discreet3DSImporter::MakeUnique(D3DS::Mesh& sMesh)
{ {
// TODO: really necessary? I don't think. Just a waste of memory and time // TODO: really necessary? I don't think. Just a waste of memory and time
// to do it now in a separate buffer. // to do it now in a separate buffer.
// Allocate output storage // Allocate output storage
std::vector<aiVector3D> vNew (sMesh.mFaces.size() * 3); std::vector<aiVector3D> vNew (sMesh.mFaces.size() * 3);
@ -202,7 +202,7 @@ void CopyTexture(aiMaterial& mat, D3DS::Texture& texture, aiTextureType type)
mat.AddProperty<int>((int*)&texture.mMapMode,1,AI_MATKEY_MAPPINGMODE_U(type,0)); mat.AddProperty<int>((int*)&texture.mMapMode,1,AI_MATKEY_MAPPINGMODE_U(type,0));
mat.AddProperty<int>((int*)&texture.mMapMode,1,AI_MATKEY_MAPPINGMODE_V(type,0)); mat.AddProperty<int>((int*)&texture.mMapMode,1,AI_MATKEY_MAPPINGMODE_V(type,0));
// Mirroring - double the scaling values // Mirroring - double the scaling values
// FIXME: this is not really correct ... // FIXME: this is not really correct ...
if (texture.mMapMode == aiTextureMapMode_Mirror) if (texture.mMapMode == aiTextureMapMode_Mirror)
{ {
@ -211,7 +211,7 @@ void CopyTexture(aiMaterial& mat, D3DS::Texture& texture, aiTextureType type)
texture.mOffsetU /= 2.f; texture.mOffsetU /= 2.f;
texture.mOffsetV /= 2.f; texture.mOffsetV /= 2.f;
} }
// Setup texture UV transformations // Setup texture UV transformations
mat.AddProperty<float>(&texture.mOffsetU,5,AI_MATKEY_UVTRANSFORM(type,0)); mat.AddProperty<float>(&texture.mOffsetU,5,AI_MATKEY_UVTRANSFORM(type,0));
} }
@ -249,7 +249,7 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material& oldMat,
mat.AddProperty( &oldMat.mEmissive, 1, AI_MATKEY_COLOR_EMISSIVE); mat.AddProperty( &oldMat.mEmissive, 1, AI_MATKEY_COLOR_EMISSIVE);
// Phong shininess and shininess strength // Phong shininess and shininess strength
if (D3DS::Discreet3DS::Phong == oldMat.mShading || if (D3DS::Discreet3DS::Phong == oldMat.mShading ||
D3DS::Discreet3DS::Metal == oldMat.mShading) D3DS::Discreet3DS::Metal == oldMat.mShading)
{ {
if (!oldMat.mSpecularExponent || !oldMat.mShininessStrength) if (!oldMat.mSpecularExponent || !oldMat.mShininessStrength)
@ -456,7 +456,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut,
} }
if (!iArray.empty()) if (!iArray.empty())
{ {
// The matrix should be identical for all meshes with the // The matrix should be identical for all meshes with the
// same name. It HAS to be identical for all meshes ..... // same name. It HAS to be identical for all meshes .....
D3DS::Mesh* imesh = ((D3DS::Mesh*)pcSOut->mMeshes[iArray[0]]->mColors[0]); D3DS::Mesh* imesh = ((D3DS::Mesh*)pcSOut->mMeshes[iArray[0]]->mColors[0]);
@ -537,7 +537,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut,
pcOut->mTransformation = aiMatrix4x4( pcIn->aRotationKeys[0].mValue.GetMatrix() ); pcOut->mTransformation = aiMatrix4x4( pcIn->aRotationKeys[0].mValue.GetMatrix() );
} }
else if (pcIn->aCameraRollKeys.size()) else if (pcIn->aCameraRollKeys.size())
{ {
aiMatrix4x4::RotationZ(AI_DEG_TO_RAD(- pcIn->aCameraRollKeys[0].mValue), aiMatrix4x4::RotationZ(AI_DEG_TO_RAD(- pcIn->aCameraRollKeys[0].mValue),
pcOut->mTransformation); pcOut->mTransformation);
@ -684,7 +684,7 @@ void Discreet3DSImporter::AddNodeToGraph(aiScene* pcSOut,aiNode* pcOut,
} }
} }
// Allocate storage for children // Allocate storage for children
pcOut->mNumChildren = (unsigned int)pcIn->mChildren.size(); pcOut->mNumChildren = (unsigned int)pcIn->mChildren.size();
pcOut->mChildren = new aiNode*[pcIn->mChildren.size()]; pcOut->mChildren = new aiNode*[pcIn->mChildren.size()];
@ -735,12 +735,12 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene* pcOut)
// ROOT_NODE // ROOT_NODE
// | // |
// ---------------------------------------- // ----------------------------------------
// | | | | | // | | | | |
// MESH_0 MESH_1 MESH_2 ... MESH_N CAMERA_0 .... // MESH_0 MESH_1 MESH_2 ... MESH_N CAMERA_0 ....
// //
DefaultLogger::get()->warn("No hierarchy information has been found in the file. "); DefaultLogger::get()->warn("No hierarchy information has been found in the file. ");
pcOut->mRootNode->mNumChildren = pcOut->mNumMeshes + pcOut->mRootNode->mNumChildren = pcOut->mNumMeshes +
mScene->mCameras.size() + mScene->mLights.size(); mScene->mCameras.size() + mScene->mLights.size();
pcOut->mRootNode->mChildren = new aiNode* [ pcOut->mRootNode->mNumChildren ]; pcOut->mRootNode->mChildren = new aiNode* [ pcOut->mRootNode->mNumChildren ];
@ -757,7 +757,7 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene* pcOut)
pcNode->mNumMeshes = 1; pcNode->mNumMeshes = 1;
// Build a name for the node // Build a name for the node
pcNode->mName.length = sprintf(pcNode->mName.data,"3DSMesh_%u",i); pcNode->mName.length = sprintf(pcNode->mName.data,"3DSMesh_%u",i);
} }
// Build dummy nodes for all cameras // Build dummy nodes for all cameras
@ -796,7 +796,7 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene* pcOut)
anim->mName.Set("3DSMasterAnim"); anim->mName.Set("3DSMasterAnim");
// Allocate enough storage for all node animation channels, // Allocate enough storage for all node animation channels,
// but don't set the mNumChannels member - we'll use it to // but don't set the mNumChannels member - we'll use it to
// index into the array // index into the array
anim->mChannels = new aiNodeAnim*[numChannel]; anim->mChannels = new aiNodeAnim*[numChannel];

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -88,7 +88,7 @@ namespace {
writer.PutU4(chunk_size); writer.PutU4(chunk_size);
writer.SetCurrentPos(head_pos); writer.SetCurrentPos(head_pos);
} }
private: private:
StreamWriterLE& writer; StreamWriterLE& writer;
std::size_t chunk_start_pos; std::size_t chunk_start_pos;
@ -153,7 +153,7 @@ void ExportScene3DS(const char* pFile, IOSystem* pIOSystem, const aiScene* pScen
boost::shared_ptr<IOStream> outfile (pIOSystem->Open(pFile, "wb")); boost::shared_ptr<IOStream> outfile (pIOSystem->Open(pFile, "wb"));
if(!outfile) { if(!outfile) {
throw DeadlyExportError("Could not open output .3ds file: " + std::string(pFile)); throw DeadlyExportError("Could not open output .3ds file: " + std::string(pFile));
} }
// TODO: This extra copy should be avoided and all of this made a preprocess // TODO: This extra copy should be avoided and all of this made a preprocess
// requirement of the 3DS exporter. // requirement of the 3DS exporter.
@ -174,7 +174,7 @@ void ExportScene3DS(const char* pFile, IOSystem* pIOSystem, const aiScene* pScen
vert_splitter.SetLimit(0xffff); vert_splitter.SetLimit(0xffff);
vert_splitter.Execute(scenecopy.get()); vert_splitter.Execute(scenecopy.get());
// Invoke the actual exporter // Invoke the actual exporter
Discreet3DSExporter exporter(outfile, scenecopy.get()); Discreet3DSExporter exporter(outfile, scenecopy.get());
} }
@ -347,7 +347,7 @@ void Discreet3DSExporter::WriteMaterials()
ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAT_TWO_SIDE); ChunkWriter chunk(writer, Discreet3DS::CHUNK_MAT_TWO_SIDE);
writer.PutI2(1); writer.PutI2(1);
} }
WriteTexture(mat, aiTextureType_DIFFUSE, Discreet3DS::CHUNK_MAT_TEXTURE); WriteTexture(mat, aiTextureType_DIFFUSE, Discreet3DS::CHUNK_MAT_TEXTURE);
WriteTexture(mat, aiTextureType_HEIGHT, Discreet3DS::CHUNK_MAT_BUMPMAP); WriteTexture(mat, aiTextureType_HEIGHT, Discreet3DS::CHUNK_MAT_BUMPMAP);
WriteTexture(mat, aiTextureType_OPACITY, Discreet3DS::CHUNK_MAT_OPACMAP); WriteTexture(mat, aiTextureType_OPACITY, Discreet3DS::CHUNK_MAT_OPACMAP);
@ -359,7 +359,7 @@ void Discreet3DSExporter::WriteMaterials()
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Discreet3DSExporter::WriteTexture(const aiMaterial& mat, aiTextureType type, uint16_t chunk_flags) void Discreet3DSExporter::WriteTexture(const aiMaterial& mat, aiTextureType type, uint16_t chunk_flags)
{ {
aiString path; aiString path;
aiTextureMapMode map_mode[2] = { aiTextureMapMode map_mode[2] = {

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -55,7 +55,7 @@ struct aiNode;
struct aiMaterial; struct aiMaterial;
struct aiMesh; struct aiMesh;
namespace Assimp namespace Assimp
{ {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -113,7 +113,7 @@ public:
KEY_USE_EASE_FROM = 0x10 KEY_USE_EASE_FROM = 0x10
} ; } ;
enum enum
{ {
// ******************************************************************** // ********************************************************************
@ -153,7 +153,7 @@ public:
// Specifies the background image for the whole scene // Specifies the background image for the whole scene
// This value is passed through the material system // This value is passed through the material system
// to the viewer // to the viewer
CHUNK_BIT_MAP = 0x1100, CHUNK_BIT_MAP = 0x1100,
CHUNK_BIT_MAP_EXISTS = 0x1101, CHUNK_BIT_MAP_EXISTS = 0x1101,
@ -195,33 +195,33 @@ public:
CHUNK_MAT_MATERIAL = 0xAFFF, CHUNK_MAT_MATERIAL = 0xAFFF,
// asciiz containing the name of the material // asciiz containing the name of the material
CHUNK_MAT_MATNAME = 0xA000, CHUNK_MAT_MATNAME = 0xA000,
CHUNK_MAT_AMBIENT = 0xA010, // followed by color chunk CHUNK_MAT_AMBIENT = 0xA010, // followed by color chunk
CHUNK_MAT_DIFFUSE = 0xA020, // followed by color chunk CHUNK_MAT_DIFFUSE = 0xA020, // followed by color chunk
CHUNK_MAT_SPECULAR = 0xA030, // followed by color chunk CHUNK_MAT_SPECULAR = 0xA030, // followed by color chunk
// Specifies the shininess of the material // Specifies the shininess of the material
// followed by percentage chunk // followed by percentage chunk
CHUNK_MAT_SHININESS = 0xA040, CHUNK_MAT_SHININESS = 0xA040,
CHUNK_MAT_SHININESS_PERCENT = 0xA041 , CHUNK_MAT_SHININESS_PERCENT = 0xA041 ,
// Specifies the shading mode to be used // Specifies the shading mode to be used
// followed by a short // followed by a short
CHUNK_MAT_SHADING = 0xA100, CHUNK_MAT_SHADING = 0xA100,
// NOTE: Emissive color (self illumination) seems not // NOTE: Emissive color (self illumination) seems not
// to be a color but a single value, type is unknown. // to be a color but a single value, type is unknown.
// Make the parser accept both of them. // Make the parser accept both of them.
// followed by percentage chunk (?) // followed by percentage chunk (?)
CHUNK_MAT_SELF_ILLUM = 0xA080, CHUNK_MAT_SELF_ILLUM = 0xA080,
// Always followed by percentage chunk (?) // Always followed by percentage chunk (?)
CHUNK_MAT_SELF_ILPCT = 0xA084, CHUNK_MAT_SELF_ILPCT = 0xA084,
// Always followed by percentage chunk // Always followed by percentage chunk
CHUNK_MAT_TRANSPARENCY = 0xA050, CHUNK_MAT_TRANSPARENCY = 0xA050,
// Diffuse texture channel 0 // Diffuse texture channel 0
CHUNK_MAT_TEXTURE = 0xA200, CHUNK_MAT_TEXTURE = 0xA200,
// Contains opacity information for each texel // Contains opacity information for each texel
@ -232,7 +232,7 @@ public:
CHUNK_MAT_REFLMAP = 0xA220, CHUNK_MAT_REFLMAP = 0xA220,
// Self Illumination map (emissive colors) // Self Illumination map (emissive colors)
CHUNK_MAT_SELFIMAP = 0xA33d, CHUNK_MAT_SELFIMAP = 0xA33d,
// Bumpmap. Not specified whether it is a heightmap // Bumpmap. Not specified whether it is a heightmap
// or a normal map. Assme it is a heightmap since // or a normal map. Assme it is a heightmap since
@ -242,17 +242,17 @@ public:
// Specular map. Seems to influence the specular color // Specular map. Seems to influence the specular color
CHUNK_MAT_SPECMAP = 0xA204, CHUNK_MAT_SPECMAP = 0xA204,
// Holds shininess data. // Holds shininess data.
CHUNK_MAT_MAT_SHINMAP = 0xA33C, CHUNK_MAT_MAT_SHINMAP = 0xA33C,
// Scaling in U/V direction. // Scaling in U/V direction.
// (need to gen separate UV coordinate set // (need to gen separate UV coordinate set
// and do this by hand) // and do this by hand)
CHUNK_MAT_MAP_USCALE = 0xA354, CHUNK_MAT_MAP_USCALE = 0xA354,
CHUNK_MAT_MAP_VSCALE = 0xA356, CHUNK_MAT_MAP_VSCALE = 0xA356,
// Translation in U/V direction. // Translation in U/V direction.
// (need to gen separate UV coordinate set // (need to gen separate UV coordinate set
// and do this by hand) // and do this by hand)
CHUNK_MAT_MAP_UOFFSET = 0xA358, CHUNK_MAT_MAP_UOFFSET = 0xA358,
CHUNK_MAT_MAP_VOFFSET = 0xA35a, CHUNK_MAT_MAP_VOFFSET = 0xA35a,
@ -268,7 +268,7 @@ public:
CHUNK_MAPFILE = 0xA300, CHUNK_MAPFILE = 0xA300,
// Specifies whether a materail requires two-sided rendering // Specifies whether a materail requires two-sided rendering
CHUNK_MAT_TWO_SIDE = 0xA081, CHUNK_MAT_TWO_SIDE = 0xA081,
// ******************************************************************** // ********************************************************************
// Main keyframer chunk. Contains translation/rotation/scaling data // Main keyframer chunk. Contains translation/rotation/scaling data
@ -366,7 +366,7 @@ struct Material
{ {
//! Default constructor. Builds a default name for the material //! Default constructor. Builds a default name for the material
Material() Material()
: :
mDiffuse (0.6f,0.6f,0.6f), // FIX ... we won't want object to be black mDiffuse (0.6f,0.6f,0.6f), // FIX ... we won't want object to be black
mSpecularExponent (0.0f), mSpecularExponent (0.0f),
mShininessStrength (1.0f), mShininessStrength (1.0f),
@ -376,7 +376,7 @@ struct Material
mTwoSided (false) mTwoSided (false)
{ {
static int iCnt = 0; static int iCnt = 0;
char szTemp[128]; char szTemp[128];
sprintf(szTemp,"UNNAMED_%i",iCnt++); sprintf(szTemp,"UNNAMED_%i",iCnt++);
mName = szTemp; mName = szTemp;
@ -431,7 +431,7 @@ struct Mesh : public MeshWithSmoothingGroups<D3DS::Face>
Mesh() Mesh()
{ {
static int iCnt = 0; static int iCnt = 0;
// Generate a default name for the mesh // Generate a default name for the mesh
char szTemp[128]; char szTemp[128];
::sprintf(szTemp,"UNNAMED_%i",iCnt++); ::sprintf(szTemp,"UNNAMED_%i",iCnt++);
@ -454,7 +454,7 @@ struct Mesh : public MeshWithSmoothingGroups<D3DS::Face>
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** Float key - quite similar to aiVectorKey and aiQuatKey. Both are in the /** Float key - quite similar to aiVectorKey and aiQuatKey. Both are in the
C-API, so it would be difficult to make them a template. */ C-API, so it would be difficult to make them a template. */
struct aiFloatKey struct aiFloatKey
{ {
double mTime; ///< The time of this key double mTime; ///< The time of this key
float mValue; ///< The value of this key float mValue; ///< The value of this key
@ -491,7 +491,7 @@ struct Node
{ {
static int iCnt = 0; static int iCnt = 0;
// Generate a default name for the node // Generate a default name for the node
char szTemp[128]; char szTemp[128];
::sprintf(szTemp,"UNNAMED_%i",iCnt++); ::sprintf(szTemp,"UNNAMED_%i",iCnt++);
@ -520,7 +520,7 @@ struct Node
//! InstanceNumber of the node //! InstanceNumber of the node
int32_t mInstanceNumber; int32_t mInstanceNumber;
//! Dummy nodes: real name to be combined with the $$$DUMMY //! Dummy nodes: real name to be combined with the $$$DUMMY
std::string mDummyName; std::string mDummyName;
//! Position of the node in the hierarchy (tree depth) //! Position of the node in the hierarchy (tree depth)

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -68,10 +68,10 @@ static const aiImporterDesc desc = {
0, 0,
0, 0,
0, 0,
"3ds prj" "3ds prj"
}; };
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Begins a new parsing block // Begins a new parsing block
// - Reads the current chunk and validates it // - Reads the current chunk and validates it
@ -88,7 +88,7 @@ static const aiImporterDesc desc = {
continue; \ continue; \
const int oldReadLimit = stream->GetReadLimit(); \ const int oldReadLimit = stream->GetReadLimit(); \
stream->SetReadLimit(stream->GetCurrentPos() + chunkSize); \ stream->SetReadLimit(stream->GetCurrentPos() + chunkSize); \
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// End a parsing block // End a parsing block
@ -106,12 +106,12 @@ Discreet3DSImporter::Discreet3DSImporter()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor, private as well // Destructor, private as well
Discreet3DSImporter::~Discreet3DSImporter() Discreet3DSImporter::~Discreet3DSImporter()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool Discreet3DSImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const bool Discreet3DSImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
{ {
std::string extension = GetExtension(pFile); std::string extension = GetExtension(pFile);
@ -143,8 +143,8 @@ void Discreet3DSImporter::SetupProperties(const Importer* /*pImp*/)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure. // Imports the given file into the given scene structure.
void Discreet3DSImporter::InternReadFile( const std::string& pFile, void Discreet3DSImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler) aiScene* pScene, IOSystem* pIOHandler)
{ {
StreamReaderLE stream(pIOHandler->Open(pFile,"rb")); StreamReaderLE stream(pIOHandler->Open(pFile,"rb"));
@ -174,7 +174,7 @@ void Discreet3DSImporter::InternReadFile( const std::string& pFile,
ParseMainChunk(); ParseMainChunk();
// Process all meshes in the file. First check whether all // Process all meshes in the file. First check whether all
// face indices haev valid values. The generate our // face indices haev valid values. The generate our
// internal verbose representation. Finally compute normal // internal verbose representation. Finally compute normal
// vectors from the smoothing groups we read from the // vectors from the smoothing groups we read from the
// file. // file.
@ -225,7 +225,7 @@ void Discreet3DSImporter::ApplyMasterScale(aiScene* pScene)
else mMasterScale = 1.0f / mMasterScale; else mMasterScale = 1.0f / mMasterScale;
// Construct an uniform scaling matrix and multiply with it // Construct an uniform scaling matrix and multiply with it
pScene->mRootNode->mTransformation *= aiMatrix4x4( pScene->mRootNode->mTransformation *= aiMatrix4x4(
mMasterScale,0.0f, 0.0f, 0.0f, mMasterScale,0.0f, 0.0f, 0.0f,
0.0f, mMasterScale,0.0f, 0.0f, 0.0f, mMasterScale,0.0f, 0.0f,
0.0f, 0.0f, mMasterScale,0.0f, 0.0f, 0.0f, mMasterScale,0.0f,
@ -245,7 +245,7 @@ void Discreet3DSImporter::ReadChunk(Discreet3DS::Chunk* pcOut)
if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSize()) if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSize())
throw DeadlyImportError("Chunk is too large"); throw DeadlyImportError("Chunk is too large");
if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSizeToLimit()) if (pcOut->Size - sizeof(Discreet3DS::Chunk) > stream->GetRemainingSizeToLimit())
DefaultLogger::get()->error("3DS: Chunk overflow"); DefaultLogger::get()->error("3DS: Chunk overflow");
} }
@ -256,7 +256,7 @@ void Discreet3DSImporter::SkipChunk()
{ {
Discreet3DS::Chunk psChunk; Discreet3DS::Chunk psChunk;
ReadChunk(&psChunk); ReadChunk(&psChunk);
stream->IncPtr(psChunk.Size-sizeof(Discreet3DS::Chunk)); stream->IncPtr(psChunk.Size-sizeof(Discreet3DS::Chunk));
return; return;
} }
@ -270,7 +270,7 @@ void Discreet3DSImporter::ParseMainChunk()
// get chunk type // get chunk type
switch (chunk.Flag) switch (chunk.Flag)
{ {
case Discreet3DS::CHUNK_PRJ: case Discreet3DS::CHUNK_PRJ:
bIsPrj = true; bIsPrj = true;
case Discreet3DS::CHUNK_MAIN: case Discreet3DS::CHUNK_MAIN:
@ -356,7 +356,7 @@ void Discreet3DSImporter::ParseObjectChunk()
case Discreet3DS::CHUNK_BIT_MAP: case Discreet3DS::CHUNK_BIT_MAP:
{ {
// Specifies the background image. The string should already be // Specifies the background image. The string should already be
// properly 0 terminated but we need to be sure // properly 0 terminated but we need to be sure
unsigned int cnt = 0; unsigned int cnt = 0;
const char* sz = (const char*)stream->GetPtr(); const char* sz = (const char*)stream->GetPtr();
@ -404,7 +404,7 @@ void Discreet3DSImporter::ParseChunk(const char* name, unsigned int num)
} }
break; break;
case Discreet3DS::CHUNK_LIGHT: case Discreet3DS::CHUNK_LIGHT:
{ {
// This starts a new light // This starts a new light
aiLight* light = new aiLight(); aiLight* light = new aiLight();
@ -453,7 +453,7 @@ void Discreet3DSImporter::ParseChunk(const char* name, unsigned int num)
camera->mLookAt.z = stream->GetF4() - camera->mPosition.z; camera->mLookAt.z = stream->GetF4() - camera->mPosition.z;
float len = camera->mLookAt.Length(); float len = camera->mLookAt.Length();
if (len < 1e-5f) { if (len < 1e-5f) {
// There are some files with lookat == position. Don't know why or whether it's ok or not. // There are some files with lookat == position. Don't know why or whether it's ok or not.
DefaultLogger::get()->error("3DS: Unable to read proper camera look-at vector"); DefaultLogger::get()->error("3DS: Unable to read proper camera look-at vector");
camera->mLookAt = aiVector3D(0.f,1.f,0.f); camera->mLookAt = aiVector3D(0.f,1.f,0.f);
@ -461,7 +461,7 @@ void Discreet3DSImporter::ParseChunk(const char* name, unsigned int num)
} }
else camera->mLookAt /= len; else camera->mLookAt /= len;
// And finally - the camera rotation angle, in counter clockwise direction // And finally - the camera rotation angle, in counter clockwise direction
const float angle = AI_DEG_TO_RAD( stream->GetF4() ); const float angle = AI_DEG_TO_RAD( stream->GetF4() );
aiQuaternion quat(camera->mLookAt,angle); aiQuaternion quat(camera->mLookAt,angle);
camera->mUp = quat.GetMatrix() * aiVector3D(0.f,1.f,0.f); camera->mUp = quat.GetMatrix() * aiVector3D(0.f,1.f,0.f);
@ -472,7 +472,7 @@ void Discreet3DSImporter::ParseChunk(const char* name, unsigned int num)
camera->mHorizontalFOV = AI_DEG_TO_RAD(45.f); camera->mHorizontalFOV = AI_DEG_TO_RAD(45.f);
} }
// Now check for further subchunks // Now check for further subchunks
if (!bIsPrj) /* fixme */ { if (!bIsPrj) /* fixme */ {
ParseCameraChunk(); ParseCameraChunk();
}} }}
@ -505,7 +505,7 @@ void Discreet3DSImporter::ParseLightChunk()
// FIX: the falloff angle is just an offset // FIX: the falloff angle is just an offset
light->mAngleOuterCone = light->mAngleInnerCone+AI_DEG_TO_RAD( stream->GetF4() ); light->mAngleOuterCone = light->mAngleInnerCone+AI_DEG_TO_RAD( stream->GetF4() );
break; break;
// intensity multiplier // intensity multiplier
case Discreet3DS::CHUNK_DL_MULTIPLIER: case Discreet3DS::CHUNK_DL_MULTIPLIER:
@ -521,7 +521,7 @@ void Discreet3DSImporter::ParseLightChunk()
break; break;
// light attenuation // light attenuation
case Discreet3DS::CHUNK_DL_ATTENUATE: case Discreet3DS::CHUNK_DL_ATTENUATE:
light->mAttenuationLinear = stream->GetF4(); light->mAttenuationLinear = stream->GetF4();
break; break;
}; };
@ -665,7 +665,7 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent)
while (stream->GetI1())++cnt; while (stream->GetI1())++cnt;
std::string name = std::string(sz,cnt); std::string name = std::string(sz,cnt);
// Now find out whether we have this node already (target animation channels // Now find out whether we have this node already (target animation channels
// are stored with a separate object ID) // are stored with a separate object ID)
D3DS::Node* pcNode = FindNode(mRootNode,name); D3DS::Node* pcNode = FindNode(mRootNode,name);
int instanceNumber = 1; int instanceNumber = 1;
@ -698,7 +698,7 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent)
// add to the parent of the last touched node // add to the parent of the last touched node
mCurrentNode->mParent->push_back(pcNode); mCurrentNode->mParent->push_back(pcNode);
mLastNodeIndex++; mLastNodeIndex++;
} }
else if(hierarchy >= mLastNodeIndex) { else if(hierarchy >= mLastNodeIndex) {
@ -709,7 +709,7 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent)
else { else {
// need to go back to the specified position in the hierarchy. // need to go back to the specified position in the hierarchy.
InverseNodeSearch(pcNode,mCurrentNode); InverseNodeSearch(pcNode,mCurrentNode);
mLastNodeIndex++; mLastNodeIndex++;
} }
// Make this node the current node // Make this node the current node
mCurrentNode = pcNode; mCurrentNode = pcNode;
@ -734,7 +734,7 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent)
case Discreet3DS::CHUNK_TRACKPIVOT: case Discreet3DS::CHUNK_TRACKPIVOT:
if ( Discreet3DS::CHUNK_TRACKINFO != parent) if ( Discreet3DS::CHUNK_TRACKINFO != parent)
{ {
DefaultLogger::get()->warn("3DS: Skipping pivot subchunk for non usual object"); DefaultLogger::get()->warn("3DS: Skipping pivot subchunk for non usual object");
break; break;
@ -814,7 +814,7 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent)
aiFloatKey v; aiFloatKey v;
v.mTime = (double)fidx; v.mTime = (double)fidx;
// This is just a single float // This is just a single float
SkipTCBInfo(); SkipTCBInfo();
v.mValue = stream->GetF4(); v.mValue = stream->GetF4();
@ -917,7 +917,7 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent)
// check whether we'll need to sort the keys // check whether we'll need to sort the keys
if (!l->empty() && v.mTime <= l->back().mTime) if (!l->empty() && v.mTime <= l->back().mTime)
sortKeys = true; sortKeys = true;
// Remove zero-scalings on singular axes - they've been reported to be there erroneously in some strange files // Remove zero-scalings on singular axes - they've been reported to be there erroneously in some strange files
if (!v.mValue.x) v.mValue.x = 1.f; if (!v.mValue.x) v.mValue.x = 1.f;
if (!v.mValue.y) v.mValue.y = 1.f; if (!v.mValue.y) v.mValue.y = 1.f;
@ -950,7 +950,7 @@ void Discreet3DSImporter::ParseFaceChunk()
{ {
case Discreet3DS::CHUNK_SMOOLIST: case Discreet3DS::CHUNK_SMOOLIST:
{ {
// This is the list of smoothing groups - a bitfield for every face. // This is the list of smoothing groups - a bitfield for every face.
// Up to 32 smoothing groups assigned to a single face. // Up to 32 smoothing groups assigned to a single face.
unsigned int num = chunkSize/4, m = 0; unsigned int num = chunkSize/4, m = 0;
if (num > mMesh.mFaces.size()) { if (num > mMesh.mFaces.size()) {
@ -1071,7 +1071,7 @@ void Discreet3DSImporter::ParseMeshChunk()
stream->IncPtr(2); // skip edge visibility flag stream->IncPtr(2); // skip edge visibility flag
} }
// Resize the material array (0xcdcdcdcd marks the default material; so if a face is // Resize the material array (0xcdcdcdcd marks the default material; so if a face is
// not referenced by a material, $$DEFAULT will be assigned to it) // not referenced by a material, $$DEFAULT will be assigned to it)
mMesh.mFaceMaterials.resize(mMesh.mFaces.size(),0xcdcdcdcd); mMesh.mFaceMaterials.resize(mMesh.mFaces.size(),0xcdcdcdcd);
@ -1314,10 +1314,10 @@ void Discreet3DSImporter::ParseTextureChunk(D3DS::Texture* pcOut)
// Get the mapping mode (for both axes) // Get the mapping mode (for both axes)
if (iFlags & 0x2u) if (iFlags & 0x2u)
pcOut->mMapMode = aiTextureMapMode_Mirror; pcOut->mMapMode = aiTextureMapMode_Mirror;
else if (iFlags & 0x10u) else if (iFlags & 0x10u)
pcOut->mMapMode = aiTextureMapMode_Decal; pcOut->mMapMode = aiTextureMapMode_Decal;
// wrapping in all remaining cases // wrapping in all remaining cases
else pcOut->mMapMode = aiTextureMapMode_Wrap; else pcOut->mMapMode = aiTextureMapMode_Wrap;
} }

View File

@ -6,8 +6,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -24,16 +24,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -73,8 +73,8 @@ public:
public: public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Returns whether the class can handle the format of the given file. /** Returns whether the class can handle the format of the given file.
* See BaseImporter::CanRead() for details. * See BaseImporter::CanRead() for details.
*/ */
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
bool checkSig) const; bool checkSig) const;
@ -95,14 +95,14 @@ protected:
const aiImporterDesc* GetInfo () const; const aiImporterDesc* GetInfo () const;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Imports the given file into the given scene structure. /** Imports the given file into the given scene structure.
* See BaseImporter::InternReadFile() for details * See BaseImporter::InternReadFile() for details
*/ */
void InternReadFile( const std::string& pFile, aiScene* pScene, void InternReadFile( const std::string& pFile, aiScene* pScene,
IOSystem* pIOHandler); IOSystem* pIOHandler);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Converts a temporary material to the outer representation /** Converts a temporary material to the outer representation
*/ */
void ConvertMaterial(D3DS::Material& p_cMat, void ConvertMaterial(D3DS::Material& p_cMat,
aiMaterial& p_pcOut); aiMaterial& p_pcOut);

View File

@ -8,8 +8,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -26,16 +26,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -84,7 +84,7 @@ static const aiImporterDesc desc = {
{ \ { \
DefaultLogger::get()->error("AC3D: Unexpected EOF/EOL"); \ DefaultLogger::get()->error("AC3D: Unexpected EOF/EOL"); \
continue; \ continue; \
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// read a string (may be enclosed in double quotation marks). buffer must point to " // read a string (may be enclosed in double quotation marks). buffer must point to "
@ -107,7 +107,7 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// read 1 to n floats prefixed with an optional predefined identifier // read 1 to n floats prefixed with an optional predefined identifier
#define AI_AC_CHECKED_LOAD_FLOAT_ARRAY(name,name_length,num,out) \ #define AI_AC_CHECKED_LOAD_FLOAT_ARRAY(name,name_length,num,out) \
AI_AC_SKIP_TO_NEXT_TOKEN(); \ AI_AC_SKIP_TO_NEXT_TOKEN(); \
if (name_length) \ if (name_length) \
@ -134,14 +134,14 @@ AC3DImporter::AC3DImporter()
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor, private as well // Destructor, private as well
AC3DImporter::~AC3DImporter() AC3DImporter::~AC3DImporter()
{ {
// nothing to be done here // nothing to be done here
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool AC3DImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const bool AC3DImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
{ {
std::string extension = GetExtension(pFile); std::string extension = GetExtension(pFile);
@ -168,7 +168,7 @@ const aiImporterDesc* AC3DImporter::GetInfo () const
// Get a pointer to the next line from the file // Get a pointer to the next line from the file
bool AC3DImporter::GetNextLine( ) bool AC3DImporter::GetNextLine( )
{ {
SkipLine(&buffer); SkipLine(&buffer);
return SkipSpaces(&buffer); return SkipSpaces(&buffer);
} }
@ -309,7 +309,7 @@ void AC3DImporter::LoadObjectSection(std::vector<Object>& objects)
else if (TokenMatch(buffer,"numsurf",7)) else if (TokenMatch(buffer,"numsurf",7))
{ {
SkipSpaces(&buffer); SkipSpaces(&buffer);
bool Q3DWorkAround = false; bool Q3DWorkAround = false;
const unsigned int t = strtoul10(buffer,&buffer); const unsigned int t = strtoul10(buffer,&buffer);
@ -319,7 +319,7 @@ void AC3DImporter::LoadObjectSection(std::vector<Object>& objects)
GetNextLine(); GetNextLine();
if (!TokenMatch(buffer,"SURF",4)) if (!TokenMatch(buffer,"SURF",4))
{ {
// FIX: this can occur for some files - Quick 3D for // FIX: this can occur for some files - Quick 3D for
// example writes no surf chunks // example writes no surf chunks
if (!Q3DWorkAround) if (!Q3DWorkAround)
{ {
@ -335,7 +335,7 @@ void AC3DImporter::LoadObjectSection(std::vector<Object>& objects)
obj.surfaces.push_back(Surface()); obj.surfaces.push_back(Surface());
Surface& surf = obj.surfaces.back(); Surface& surf = obj.surfaces.back();
surf.flags = strtoul_cppstyle(buffer); surf.flags = strtoul_cppstyle(buffer);
while (1) while (1)
{ {
if(!GetNextLine()) if(!GetNextLine())
@ -381,7 +381,7 @@ void AC3DImporter::LoadObjectSection(std::vector<Object>& objects)
AI_AC_CHECKED_LOAD_FLOAT_ARRAY("",0,2,&entry.second); AI_AC_CHECKED_LOAD_FLOAT_ARRAY("",0,2,&entry.second);
} }
} }
else else
{ {
--buffer; // make sure the line is processed a second time --buffer; // make sure the line is processed a second time
@ -455,8 +455,8 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
{ {
if (!object.surfaces.size() || !object.numRefs) if (!object.surfaces.size() || !object.numRefs)
{ {
/* " An object with 7 vertices (no surfaces, no materials defined). /* " An object with 7 vertices (no surfaces, no materials defined).
This is a good way of getting point data into AC3D. This is a good way of getting point data into AC3D.
The Vertex->create convex-surface/object can be used on these The Vertex->create convex-surface/object can be used on these
vertices to 'wrap' a 3d shape around them " vertices to 'wrap' a 3d shape around them "
(http://www.opencity.info/html/ac3dfileformat.html) (http://www.opencity.info/html/ac3dfileformat.html)
@ -598,7 +598,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
const Surface& src = *it; const Surface& src = *it;
// closed polygon // closed polygon
unsigned int type = (*it).flags & 0xf; unsigned int type = (*it).flags & 0xf;
if (!type) if (!type)
{ {
aiFace& face = *faces++; aiFace& face = *faces++;
@ -617,7 +617,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
*vertices = object.vertices[entry.first] + object.translation; *vertices = object.vertices[entry.first] + object.translation;
// copy texture coordinates // copy texture coordinates
if (uv) if (uv)
{ {
uv->x = entry.second.x; uv->x = entry.second.x;
@ -629,7 +629,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
} }
else else
{ {
it2 = (*it).entries.begin(); it2 = (*it).entries.begin();
// either a closed or an unclosed line // either a closed or an unclosed line
@ -650,8 +650,8 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
} }
ai_assert((*it2).first < object.vertices.size()); ai_assert((*it2).first < object.vertices.size());
*vertices++ = object.vertices[(*it2).first]; *vertices++ = object.vertices[(*it2).first];
// copy texture coordinates // copy texture coordinates
if (uv) if (uv)
{ {
uv->x = (*it2).second.x; uv->x = (*it2).second.x;
@ -722,7 +722,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
break; break;
// there shouldn't be more than one world, but we don't care // there shouldn't be more than one world, but we don't care
case Object::World: case Object::World:
node->mName.length = ::sprintf(node->mName.data,"ACWorld_%i",worlds++); node->mName.length = ::sprintf(node->mName.data,"ACWorld_%i",worlds++);
break; break;
} }
@ -762,8 +762,8 @@ void AC3DImporter::SetupProperties(const Importer* pImp)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure. // Imports the given file into the given scene structure.
void AC3DImporter::InternReadFile( const std::string& pFile, void AC3DImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler) aiScene* pScene, IOSystem* pIOHandler)
{ {
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb")); boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -129,7 +129,7 @@ public:
, vertices() , vertices()
, surfaces() , surfaces()
, numRefs (0) , numRefs (0)
, subDiv (0) , subDiv (0)
{} {}
// Type description // Type description
@ -168,7 +168,7 @@ public:
// number of indices (= num verts in verbose format) // number of indices (= num verts in verbose format)
unsigned int numRefs; unsigned int numRefs;
// number of subdivisions to be performed on the // number of subdivisions to be performed on the
// imported data // imported data
unsigned int subDiv; unsigned int subDiv;
@ -180,7 +180,7 @@ public:
public: public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Returns whether the class can handle the format of the given file. /** Returns whether the class can handle the format of the given file.
* See BaseImporter::CanRead() for details. * See BaseImporter::CanRead() for details.
*/ */
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
@ -194,9 +194,9 @@ protected:
const aiImporterDesc* GetInfo () const; const aiImporterDesc* GetInfo () const;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Imports the given file into the given scene structure. /** Imports the given file into the given scene structure.
* See BaseImporter::InternReadFile() for details*/ * See BaseImporter::InternReadFile() for details*/
void InternReadFile( const std::string& pFile, aiScene* pScene, void InternReadFile( const std::string& pFile, aiScene* pScene,
IOSystem* pIOHandler); IOSystem* pIOHandler);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -214,7 +214,7 @@ private:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Load the object section. This method is called recursively to /** Load the object section. This method is called recursively to
* load subobjects, the method returns after a 'kids 0' was * load subobjects, the method returns after a 'kids 0' was
* encountered. * encountered.
* @objects List of output objects*/ * @objects List of output objects*/
void LoadObjectSection(std::vector<Object>& objects); void LoadObjectSection(std::vector<Object>& objects);
@ -248,7 +248,7 @@ private:
const char* buffer; const char* buffer;
// Configuration option: if enabled, up to two meshes // Configuration option: if enabled, up to two meshes
// are generated per material: those faces who have // are generated per material: those faces who have
// their bf cull flags set are separated. // their bf cull flags set are separated.
bool configSplitBFCull; bool configSplitBFCull;

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -73,7 +73,7 @@ static const aiImporterDesc desc = {
0, 0,
0, 0,
0, 0,
"ase ask" "ase ask"
}; };
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -83,17 +83,17 @@ ASEImporter::ASEImporter()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor, private as well // Destructor, private as well
ASEImporter::~ASEImporter() ASEImporter::~ASEImporter()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool ASEImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool cs) const bool ASEImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool cs) const
{ {
// check file extension // check file extension
const std::string extension = GetExtension(pFile); const std::string extension = GetExtension(pFile);
if( extension == "ase" || extension == "ask") if( extension == "ase" || extension == "ask")
return true; return true;
@ -122,8 +122,8 @@ void ASEImporter::SetupProperties(const Importer* pImp)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure. // Imports the given file into the given scene structure.
void ASEImporter::InternReadFile( const std::string& pFile, void ASEImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler) aiScene* pScene, IOSystem* pIOHandler)
{ {
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb")); boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
@ -164,7 +164,7 @@ void ASEImporter::InternReadFile( const std::string& pFile,
//------------------------------------------------------------------ //------------------------------------------------------------------
// Check whether we god at least one mesh. If we did - generate // Check whether we god at least one mesh. If we did - generate
// materials and copy meshes. // materials and copy meshes.
// ------------------------------------------------------------------ // ------------------------------------------------------------------
if ( !mParser->m_vMeshes.empty()) { if ( !mParser->m_vMeshes.empty()) {
@ -221,10 +221,10 @@ void ASEImporter::InternReadFile( const std::string& pFile,
+ mParser->m_vCameras.size() + mParser->m_vDummies.size()); + mParser->m_vCameras.size() + mParser->m_vDummies.size());
// Lights // Lights
for (std::vector<ASE::Light>::iterator it = mParser->m_vLights.begin(), for (std::vector<ASE::Light>::iterator it = mParser->m_vLights.begin(),
end = mParser->m_vLights.end();it != end; ++it)nodes.push_back(&(*it)); end = mParser->m_vLights.end();it != end; ++it)nodes.push_back(&(*it));
// Cameras // Cameras
for (std::vector<ASE::Camera>::iterator it = mParser->m_vCameras.begin(), for (std::vector<ASE::Camera>::iterator it = mParser->m_vCameras.begin(),
end = mParser->m_vCameras.end();it != end; ++it)nodes.push_back(&(*it)); end = mParser->m_vCameras.end();it != end; ++it)nodes.push_back(&(*it));
// Meshes // Meshes
for (std::vector<ASE::Mesh>::iterator it = mParser->m_vMeshes.begin(), for (std::vector<ASE::Mesh>::iterator it = mParser->m_vMeshes.begin(),
@ -325,7 +325,7 @@ void ASEImporter::BuildAnimations(const std::vector<BaseNode*>& nodes)
pcAnim->mTicksPerSecond = mParser->iFrameSpeed * mParser->iTicksPerFrame; pcAnim->mTicksPerSecond = mParser->iFrameSpeed * mParser->iTicksPerFrame;
iNum = 0; iNum = 0;
// Now iterate through all meshes and collect all data we can find // Now iterate through all meshes and collect all data we can find
for (i = nodes.begin();i != nodes.end();++i) { for (i = nodes.begin();i != nodes.end();++i) {
@ -349,7 +349,7 @@ void ASEImporter::BuildAnimations(const std::vector<BaseNode*>& nodes)
} }
else helper.SetMainAnimationChannel (&me->mAnim.akeyPositions); else helper.SetMainAnimationChannel (&me->mAnim.akeyPositions);
helper.SetTargetAnimationChannel (&me->mTargetAnim.akeyPositions); helper.SetTargetAnimationChannel (&me->mTargetAnim.akeyPositions);
helper.Process(&me->mTargetAnim.akeyPositions);*/ helper.Process(&me->mTargetAnim.akeyPositions);*/
// Allocate the key array and fill it // Allocate the key array and fill it
@ -383,7 +383,7 @@ void ASEImporter::BuildAnimations(const std::vector<BaseNode*>& nodes)
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Rotation keys are offsets to the previous keys. // Rotation keys are offsets to the previous keys.
// We have the quaternion representations of all // We have the quaternion representations of all
// of them, so we just need to concatenate all // of them, so we just need to concatenate all
// (unit-length) quaternions to get the absolute // (unit-length) quaternions to get the absolute
// rotations. // rotations.
@ -398,7 +398,7 @@ void ASEImporter::BuildAnimations(const std::vector<BaseNode*>& nodes)
cur = (a ? cur*q.mValue : q.mValue); cur = (a ? cur*q.mValue : q.mValue);
q.mValue = cur.Normalize(); q.mValue = cur.Normalize();
} }
nd->mRotationKeys[a] = q; nd->mRotationKeys[a] = q;
// need this to get to Assimp quaternion conventions // need this to get to Assimp quaternion conventions
nd->mRotationKeys[a].mValue.w *= -1.f; nd->mRotationKeys[a].mValue.w *= -1.f;
@ -432,7 +432,7 @@ void ASEImporter::BuildCameras()
// copy members // copy members
out->mClipPlaneFar = in.mFar; out->mClipPlaneFar = in.mFar;
out->mClipPlaneNear = (in.mNear ? in.mNear : 0.1f); out->mClipPlaneNear = (in.mNear ? in.mNear : 0.1f);
out->mHorizontalFOV = in.mFOV; out->mHorizontalFOV = in.mFOV;
out->mName.Set(in.mName); out->mName.Set(in.mName);
@ -452,9 +452,9 @@ void ASEImporter::BuildLights()
aiLight* out = pcScene->mLights[i] = new aiLight(); aiLight* out = pcScene->mLights[i] = new aiLight();
ASE::Light& in = mParser->m_vLights[i]; ASE::Light& in = mParser->m_vLights[i];
// The direction is encoded in the transformation matrix of the node. // The direction is encoded in the transformation matrix of the node.
// In 3DS MAX the light source points into negative Z direction if // In 3DS MAX the light source points into negative Z direction if
// the node transformation is the identity. // the node transformation is the identity.
out->mDirection = aiVector3D(0.f,0.f,-1.f); out->mDirection = aiVector3D(0.f,0.f,-1.f);
out->mName.Set(in.mName); out->mName.Set(in.mName);
@ -511,7 +511,7 @@ void ASEImporter::AddMeshes(const ASE::BaseNode* snode,aiNode* node)
if (mesh == snode) { if (mesh == snode) {
node->mMeshes[p++] = i; node->mMeshes[p++] = i;
// Transform all vertices of the mesh back into their local space -> // Transform all vertices of the mesh back into their local space ->
// at the moment they are pretransformed // at the moment they are pretransformed
aiMatrix4x4 m = mesh->mTransform; aiMatrix4x4 m = mesh->mTransform;
m.Inverse(); m.Inverse();
@ -612,10 +612,10 @@ void ASEImporter::AddNodes (const std::vector<BaseNode*>& nodes,
nd->mParent = node; nd->mParent = node;
// The .Target node is always the first child node // The .Target node is always the first child node
for (unsigned int m = 0; m < node->mNumChildren;++m) for (unsigned int m = 0; m < node->mNumChildren;++m)
node->mChildren[m+1] = node->mChildren[m]; node->mChildren[m+1] = node->mChildren[m];
node->mChildren[0] = nd; node->mChildren[0] = nd;
node->mNumChildren++; node->mNumChildren++;
@ -671,7 +671,7 @@ void ASEImporter::BuildNodes(std::vector<BaseNode*>& nodes) {
// check whether our parent is known // check whether our parent is known
bool bKnowParent = false; bool bKnowParent = false;
// search the list another time, starting *here* and try to find out whether // search the list another time, starting *here* and try to find out whether
// there is a node that references *us* as a parent // there is a node that references *us* as a parent
for (std::vector<BaseNode*>::const_iterator it2 = nodes.begin();it2 != end; ++it2) { for (std::vector<BaseNode*>::const_iterator it2 = nodes.begin();it2 != end; ++it2) {
@ -701,7 +701,7 @@ void ASEImporter::BuildNodes(std::vector<BaseNode*>& nodes) {
for (std::vector<const BaseNode*>::/*const_*/iterator i = aiList.begin();i != aiList.end();++i) { for (std::vector<const BaseNode*>::/*const_*/iterator i = aiList.begin();i != aiList.end();++i) {
const ASE::BaseNode* src = *i; const ASE::BaseNode* src = *i;
// The parent is not known, so we can assume that we must add // The parent is not known, so we can assume that we must add
// this node to the root node of the whole scene // this node to the root node of the whole scene
aiNode* pcNode = new aiNode(); aiNode* pcNode = new aiNode();
pcNode->mParent = pcScene->mRootNode; pcNode->mParent = pcScene->mRootNode;
@ -727,7 +727,7 @@ void ASEImporter::BuildNodes(std::vector<BaseNode*>& nodes) {
if (!pcScene->mRootNode->mNumChildren) { if (!pcScene->mRootNode->mNumChildren) {
throw DeadlyImportError("ASE: No nodes loaded. The file is either empty or corrupt"); throw DeadlyImportError("ASE: No nodes loaded. The file is either empty or corrupt");
} }
// Now rotate the whole scene 90 degrees around the x axis to convert to internal coordinate system // Now rotate the whole scene 90 degrees around the x axis to convert to internal coordinate system
pcScene->mRootNode->mTransformation = aiMatrix4x4(1.f,0.f,0.f,0.f, pcScene->mRootNode->mTransformation = aiMatrix4x4(1.f,0.f,0.f,0.f,
0.f,0.f,1.f,0.f,0.f,-1.f,0.f,0.f,0.f,0.f,0.f,1.f); 0.f,0.f,1.f,0.f,0.f,-1.f,0.f,0.f,0.f,0.f,0.f,1.f);
@ -994,7 +994,7 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, std::vector<aiMesh*>& avOutMesh
if (!mesh.mBones.empty()) { if (!mesh.mBones.empty()) {
avOutputBones = new std::vector<std::pair<unsigned int, float> >[mesh.mBones.size()]; avOutputBones = new std::vector<std::pair<unsigned int, float> >[mesh.mBones.size()];
} }
// allocate enough storage for faces // allocate enough storage for faces
p_pcOut->mFaces = new aiFace[p_pcOut->mNumFaces]; p_pcOut->mFaces = new aiFace[p_pcOut->mNumFaces];
@ -1102,7 +1102,7 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, std::vector<aiMesh*>& avOutMesh
{ {
// Otherwise we can simply copy the data to one output mesh // Otherwise we can simply copy the data to one output mesh
// This codepath needs less memory and uses fast memcpy()s // This codepath needs less memory and uses fast memcpy()s
// to do the actual copying. So I think it is worth the // to do the actual copying. So I think it is worth the
// effort here. // effort here.
aiMesh* p_pcOut = new aiMesh(); aiMesh* p_pcOut = new aiMesh();
@ -1167,7 +1167,7 @@ void ASEImporter::ConvertMeshes(ASE::Mesh& mesh, std::vector<aiMesh*>& avOutMesh
p_pcOut->mFaces[iFace].mNumIndices = 3; p_pcOut->mFaces[iFace].mNumIndices = 3;
p_pcOut->mFaces[iFace].mIndices = new unsigned int[3]; p_pcOut->mFaces[iFace].mIndices = new unsigned int[3];
// copy indices // copy indices
p_pcOut->mFaces[iFace].mIndices[0] = mesh.mFaces[iFace].mIndices[0]; p_pcOut->mFaces[iFace].mIndices[0] = mesh.mFaces[iFace].mIndices[0];
p_pcOut->mFaces[iFace].mIndices[1] = mesh.mFaces[iFace].mIndices[1]; p_pcOut->mFaces[iFace].mIndices[1] = mesh.mFaces[iFace].mIndices[1];
p_pcOut->mFaces[iFace].mIndices[2] = mesh.mFaces[iFace].mIndices[2]; p_pcOut->mFaces[iFace].mIndices[2] = mesh.mFaces[iFace].mIndices[2];

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -66,8 +66,8 @@ public:
public: public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Returns whether the class can handle the format of the given file. /** Returns whether the class can handle the format of the given file.
* See BaseImporter::CanRead() for details. * See BaseImporter::CanRead() for details.
*/ */
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
bool checkSig) const; bool checkSig) const;
@ -82,7 +82,7 @@ protected:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Imports the given file into the given scene structure. /** Imports the given file into the given scene structure.
* See BaseImporter::InternReadFile() for details * See BaseImporter::InternReadFile() for details
*/ */
void InternReadFile( const std::string& pFile, aiScene* pScene, void InternReadFile( const std::string& pFile, aiScene* pScene,

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,22 +25,22 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
/** @file ASEParser.cpp /** @file ASEParser.cpp
* @brief Implementation of the ASE parser class * @brief Implementation of the ASE parser class
*/ */
@ -86,7 +86,7 @@ using namespace Assimp::ASE;
++iLineNumber; \ ++iLineNumber; \
bLastWasEndLine = true; \ bLastWasEndLine = true; \
} else bLastWasEndLine = false; \ } else bLastWasEndLine = false; \
++filePtr; ++filePtr;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Handle a nested section in the file. EOF is an error in this case // Handle a nested section in the file. EOF is an error in this case
@ -114,7 +114,7 @@ using namespace Assimp::ASE;
++iLineNumber; \ ++iLineNumber; \
bLastWasEndLine = true; \ bLastWasEndLine = true; \
} else bLastWasEndLine = false; \ } else bLastWasEndLine = false; \
++filePtr; ++filePtr;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Parser::Parser (const char* szFile, unsigned int fileFormatDefault) Parser::Parser (const char* szFile, unsigned int fileFormatDefault)
@ -229,7 +229,7 @@ bool Parser::SkipSection()
} }
else if ('\0' == *filePtr) else if ('\0' == *filePtr)
{ {
LogWarning("Unable to parse block: Unexpected EOF, closing bracket \'}\' was expected [#1]"); LogWarning("Unable to parse block: Unexpected EOF, closing bracket \'}\' was expected [#1]");
return false; return false;
} }
else if(IsLineEnd(*filePtr))++iLineNumber; else if(IsLineEnd(*filePtr))++iLineNumber;
@ -276,50 +276,50 @@ void Parser::Parse()
} }
// "group" - no implementation yet, in facte // "group" - no implementation yet, in facte
// we're just ignoring them for the moment // we're just ignoring them for the moment
if (TokenMatch(filePtr,"GROUP",5)) if (TokenMatch(filePtr,"GROUP",5))
{ {
Parse(); Parse();
continue; continue;
} }
// material list // material list
if (TokenMatch(filePtr,"MATERIAL_LIST",13)) if (TokenMatch(filePtr,"MATERIAL_LIST",13))
{ {
ParseLV1MaterialListBlock(); ParseLV1MaterialListBlock();
continue; continue;
} }
// geometric object (mesh) // geometric object (mesh)
if (TokenMatch(filePtr,"GEOMOBJECT",10)) if (TokenMatch(filePtr,"GEOMOBJECT",10))
{ {
m_vMeshes.push_back(Mesh()); m_vMeshes.push_back(Mesh());
ParseLV1ObjectBlock(m_vMeshes.back()); ParseLV1ObjectBlock(m_vMeshes.back());
continue; continue;
} }
// helper object = dummy in the hierarchy // helper object = dummy in the hierarchy
if (TokenMatch(filePtr,"HELPEROBJECT",12)) if (TokenMatch(filePtr,"HELPEROBJECT",12))
{ {
m_vDummies.push_back(Dummy()); m_vDummies.push_back(Dummy());
ParseLV1ObjectBlock(m_vDummies.back()); ParseLV1ObjectBlock(m_vDummies.back());
continue; continue;
} }
// light object // light object
if (TokenMatch(filePtr,"LIGHTOBJECT",11)) if (TokenMatch(filePtr,"LIGHTOBJECT",11))
{ {
m_vLights.push_back(Light()); m_vLights.push_back(Light());
ParseLV1ObjectBlock(m_vLights.back()); ParseLV1ObjectBlock(m_vLights.back());
continue; continue;
} }
// camera object // camera object
if (TokenMatch(filePtr,"CAMERAOBJECT",12)) if (TokenMatch(filePtr,"CAMERAOBJECT",12))
{ {
m_vCameras.push_back(Camera()); m_vCameras.push_back(Camera());
ParseLV1ObjectBlock(m_vCameras.back()); ParseLV1ObjectBlock(m_vCameras.back());
continue; continue;
} }
// comment - print it on the console // comment - print it on the console
if (TokenMatch(filePtr,"COMMENT",7)) if (TokenMatch(filePtr,"COMMENT",7))
{ {
std::string out = "<unknown>"; std::string out = "<unknown>";
ParseString(out,"*COMMENT"); ParseString(out,"*COMMENT");
@ -327,7 +327,7 @@ void Parser::Parse()
continue; continue;
} }
// ASC bone weights // ASC bone weights
if (AI_ASE_IS_OLD_FILE_FORMAT() && TokenMatch(filePtr,"MESH_SOFTSKINVERTS",18)) if (AI_ASE_IS_OLD_FILE_FORMAT() && TokenMatch(filePtr,"MESH_SOFTSKINVERTS",18))
{ {
ParseLV1SoftSkinBlock(); ParseLV1SoftSkinBlock();
} }
@ -347,7 +347,7 @@ void Parser::ParseLV1SoftSkinBlock()
// nested sections supported and the single elements aren't // nested sections supported and the single elements aren't
// marked by keywords starting with an asterisk. // marked by keywords starting with an asterisk.
/** /**
FORMAT BEGIN FORMAT BEGIN
*MESH_SOFTSKINVERTS { *MESH_SOFTSKINVERTS {
@ -358,7 +358,7 @@ void Parser::ParseLV1SoftSkinBlock()
<number of weights> [for <number of weights> times:] <bone name> <weight> <number of weights> [for <number of weights> times:] <bone name> <weight>
} }
FORMAT END FORMAT END
*/ */
// ************************************************************** // **************************************************************
while (true) while (true)
@ -433,7 +433,7 @@ void Parser::ParseLV1SoftSkinBlock()
// Find the bone in the mesh's list // Find the bone in the mesh's list
std::pair<int,float> me; std::pair<int,float> me;
me.first = -1; me.first = -1;
for (unsigned int n = 0; n < curMesh->mBones.size();++n) for (unsigned int n = 0; n < curMesh->mBones.size();++n)
{ {
if (curMesh->mBones[n].mName == bone) if (curMesh->mBones[n].mName == bone)
@ -471,21 +471,21 @@ void Parser::ParseLV1SceneBlock()
if ('*' == *filePtr) if ('*' == *filePtr)
{ {
++filePtr; ++filePtr;
if (TokenMatch(filePtr,"SCENE_BACKGROUND_STATIC",23)) if (TokenMatch(filePtr,"SCENE_BACKGROUND_STATIC",23))
{ {
// parse a color triple and assume it is really the bg color // parse a color triple and assume it is really the bg color
ParseLV4MeshFloatTriple( &m_clrBackground.r ); ParseLV4MeshFloatTriple( &m_clrBackground.r );
continue; continue;
} }
if (TokenMatch(filePtr,"SCENE_AMBIENT_STATIC",20)) if (TokenMatch(filePtr,"SCENE_AMBIENT_STATIC",20))
{ {
// parse a color triple and assume it is really the bg color // parse a color triple and assume it is really the bg color
ParseLV4MeshFloatTriple( &m_clrAmbient.r ); ParseLV4MeshFloatTriple( &m_clrAmbient.r );
continue; continue;
} }
if (TokenMatch(filePtr,"SCENE_FIRSTFRAME",16)) if (TokenMatch(filePtr,"SCENE_FIRSTFRAME",16))
{ {
ParseLV4MeshLong(iFirstFrame); ParseLV4MeshLong(iFirstFrame);
continue; continue;
@ -495,7 +495,7 @@ void Parser::ParseLV1SceneBlock()
ParseLV4MeshLong(iLastFrame); ParseLV4MeshLong(iLastFrame);
continue; continue;
} }
if (TokenMatch(filePtr,"SCENE_FRAMESPEED",16)) if (TokenMatch(filePtr,"SCENE_FRAMESPEED",16))
{ {
ParseLV4MeshLong(iFrameSpeed); ParseLV4MeshLong(iFrameSpeed);
continue; continue;
@ -709,7 +709,7 @@ void Parser::ParseLV2MaterialBlock(ASE::Material& mat)
// submaterial chunks // submaterial chunks
if (TokenMatch(filePtr,"SUBMATERIAL",11)) if (TokenMatch(filePtr,"SUBMATERIAL",11))
{ {
unsigned int iIndex = 0; unsigned int iIndex = 0;
ParseLV4MeshLong(iIndex); ParseLV4MeshLong(iIndex);
@ -741,7 +741,7 @@ void Parser::ParseLV3MapBlock(Texture& map)
// but we need to expect that case ... if the path is // but we need to expect that case ... if the path is
// empty the texture won't be used later. // empty the texture won't be used later.
// *********************************************************** // ***********************************************************
bool parsePath = true; bool parsePath = true;
while (true) while (true)
{ {
if ('*' == *filePtr) if ('*' == *filePtr)
@ -756,7 +756,7 @@ void Parser::ParseLV3MapBlock(Texture& map)
if (temp != "Bitmap" && temp != "Normal Bump") if (temp != "Bitmap" && temp != "Normal Bump")
{ {
DefaultLogger::get()->warn("ASE: Skipping unknown map type: " + temp); DefaultLogger::get()->warn("ASE: Skipping unknown map type: " + temp);
parsePath = false; parsePath = false;
} }
continue; continue;
} }
@ -844,7 +844,7 @@ bool Parser::ParseString(std::string& out,const char* szName)
{ {
if ('\"' == *sz)break; if ('\"' == *sz)break;
else if ('\0' == *sz) else if ('\0' == *sz)
{ {
sprintf(szBuffer,"Unable to parse %s block: Strings are expected to " sprintf(szBuffer,"Unable to parse %s block: Strings are expected to "
"be enclosed in double quotation marks but EOF was reached before " "be enclosed in double quotation marks but EOF was reached before "
"a closing quotation mark was encountered",szName); "a closing quotation mark was encountered",szName);
@ -959,7 +959,7 @@ void Parser::ParseLV1ObjectBlock(ASE::BaseNode& node)
{ {
// mesh data // mesh data
// FIX: Older files use MESH_SOFTSKIN // FIX: Older files use MESH_SOFTSKIN
if (TokenMatch(filePtr,"MESH" ,4) || if (TokenMatch(filePtr,"MESH" ,4) ||
TokenMatch(filePtr,"MESH_SOFTSKIN",13)) TokenMatch(filePtr,"MESH_SOFTSKIN",13))
{ {
ParseLV2MeshBlock((ASE::Mesh&)node); ParseLV2MeshBlock((ASE::Mesh&)node);
@ -1060,14 +1060,14 @@ void Parser::ParseLV2AnimationBlock(ASE::BaseNode& mesh)
if(!ParseString(temp,"*NODE_NAME")) if(!ParseString(temp,"*NODE_NAME"))
SkipToNextToken(); SkipToNextToken();
// If the name of the node contains .target it // If the name of the node contains .target it
// represents an animated camera or spot light // represents an animated camera or spot light
// target. // target.
if (std::string::npos != temp.find(".Target")) if (std::string::npos != temp.find(".Target"))
{ {
if ((mesh.mType != BaseNode::Camera || ((ASE::Camera&)mesh).mCameraType != ASE::Camera::TARGET) && if ((mesh.mType != BaseNode::Camera || ((ASE::Camera&)mesh).mCameraType != ASE::Camera::TARGET) &&
( mesh.mType != BaseNode::Light || ((ASE::Light&)mesh).mLightType != ASE::Light::TARGET)) ( mesh.mType != BaseNode::Light || ((ASE::Light&)mesh).mLightType != ASE::Light::TARGET))
{ {
DefaultLogger::get()->error("ASE: Found target animation channel " DefaultLogger::get()->error("ASE: Found target animation channel "
"but the node is neither a camera nor a spot light"); "but the node is neither a camera nor a spot light");
@ -1176,7 +1176,7 @@ void Parser::ParseLV3PosAnimationBlock(ASE::Animation& anim)
if ('*' == *filePtr) if ('*' == *filePtr)
{ {
++filePtr; ++filePtr;
bool b = false; bool b = false;
// For the moment we're just reading the three floats - // For the moment we're just reading the three floats -
@ -1265,7 +1265,7 @@ void Parser::ParseLV3RotAnimationBlock(ASE::Animation& anim)
void Parser::ParseLV2NodeTransformBlock(ASE::BaseNode& mesh) void Parser::ParseLV2NodeTransformBlock(ASE::BaseNode& mesh)
{ {
AI_ASE_PARSER_INIT(); AI_ASE_PARSER_INIT();
int mode = 0; int mode = 0;
while (true) while (true)
{ {
if ('*' == *filePtr) if ('*' == *filePtr)
@ -1304,7 +1304,7 @@ void Parser::ParseLV2NodeTransformBlock(ASE::BaseNode& mesh)
} }
if (mode) if (mode)
{ {
// fourth row of the transformation matrix - and also the // fourth row of the transformation matrix - and also the
// only information here that is interesting for targets // only information here that is interesting for targets
if (TokenMatch(filePtr,"TM_ROW3" ,7)) if (TokenMatch(filePtr,"TM_ROW3" ,7))
{ {
@ -1491,7 +1491,7 @@ void Parser::ParseLV2MeshBlock(ASE::Mesh& mesh)
// mesh animation keyframe. Not supported // mesh animation keyframe. Not supported
if (TokenMatch(filePtr,"MESH_ANIMATION" ,14)) if (TokenMatch(filePtr,"MESH_ANIMATION" ,14))
{ {
LogWarning("Found *MESH_ANIMATION element in ASE/ASK file. " LogWarning("Found *MESH_ANIMATION element in ASE/ASK file. "
"Keyframe animation is not supported by Assimp, this element " "Keyframe animation is not supported by Assimp, this element "
"will be ignored"); "will be ignored");
@ -1571,7 +1571,7 @@ void Parser::ParseLV4MeshBones(unsigned int iNumBones,ASE::Mesh& mesh)
LogWarning("Bone index is out of bounds"); LogWarning("Bone index is out of bounds");
continue; continue;
} }
if (!ParseString(mesh.mBones[iIndex].mName,"*MESH_BONE_NAME")) if (!ParseString(mesh.mBones[iIndex].mName,"*MESH_BONE_NAME"))
SkipToNextToken(); SkipToNextToken();
continue; continue;
} }
@ -1648,7 +1648,7 @@ void Parser::ParseLV3MeshVertexListBlock(
// Vertex entry // Vertex entry
if (TokenMatch(filePtr,"MESH_VERTEX" ,11)) if (TokenMatch(filePtr,"MESH_VERTEX" ,11))
{ {
aiVector3D vTemp; aiVector3D vTemp;
unsigned int iIndex; unsigned int iIndex;
ParseLV4MeshFloatTriple(&vTemp.x,iIndex); ParseLV4MeshFloatTriple(&vTemp.x,iIndex);
@ -1904,7 +1904,7 @@ void Parser::ParseLV3MeshNormalListBlock(ASE::Mesh& sMesh)
ParseLV4MeshFloatTriple(&vNormal.x,index); ParseLV4MeshFloatTriple(&vNormal.x,index);
if (faceIdx >= sMesh.mFaces.size()) if (faceIdx >= sMesh.mFaces.size())
continue; continue;
// Make sure we assign it to the correct face // Make sure we assign it to the correct face
const ASE::Face& face = sMesh.mFaces[faceIdx]; const ASE::Face& face = sMesh.mFaces[faceIdx];
if (index == face.mIndices[0]) if (index == face.mIndices[0])
@ -1943,7 +1943,7 @@ void Parser::ParseLV3MeshNormalListBlock(ASE::Mesh& sMesh)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Parser::ParseLV4MeshFace(ASE::Face& out) void Parser::ParseLV4MeshFace(ASE::Face& out)
{ {
// skip spaces and tabs // skip spaces and tabs
if(!SkipSpaces(&filePtr)) if(!SkipSpaces(&filePtr))
{ {
@ -1963,7 +1963,7 @@ void Parser::ParseLV4MeshFace(ASE::Face& out)
SkipToNextToken(); SkipToNextToken();
return; return;
} }
// FIX: There are some ASE files which haven't got ':' here // FIX: There are some ASE files which haven't got ':' here
if(':' == *filePtr)++filePtr; if(':' == *filePtr)++filePtr;
// Parse all mesh indices // Parse all mesh indices
@ -1989,7 +1989,7 @@ void Parser::ParseLV4MeshFace(ASE::Face& out)
case 'c': case 'c':
iIndex = 2; iIndex = 2;
break; break;
default: default:
LogWarning("Unable to parse *MESH_FACE Element: Unexpected EOL. " LogWarning("Unable to parse *MESH_FACE Element: Unexpected EOL. "
"A,B or C expected [#3]"); "A,B or C expected [#3]");
SkipToNextToken(); SkipToNextToken();
@ -2017,7 +2017,7 @@ void Parser::ParseLV4MeshFace(ASE::Face& out)
out.mIndices[iIndex] = strtoul10(filePtr,&filePtr); out.mIndices[iIndex] = strtoul10(filePtr,&filePtr);
} }
// now we need to skip the AB, BC, CA blocks. // now we need to skip the AB, BC, CA blocks.
while (true) while (true)
{ {
if ('*' == *filePtr)break; if ('*' == *filePtr)break;
@ -2039,7 +2039,7 @@ void Parser::ParseLV4MeshFace(ASE::Face& out)
SkipToNextToken(); SkipToNextToken();
return; return;
} }
// Parse smoothing groups until we don't anymore see commas // Parse smoothing groups until we don't anymore see commas
// FIX: There needn't always be a value, sad but true // FIX: There needn't always be a value, sad but true
while (true) while (true)
@ -2108,7 +2108,7 @@ void Parser::ParseLV4MeshFloatTriple(float* apOut, unsigned int& rIndexOut)
// parse the index // parse the index
ParseLV4MeshLong(rIndexOut); ParseLV4MeshLong(rIndexOut);
// parse the three others // parse the three others
ParseLV4MeshFloatTriple(apOut); ParseLV4MeshFloatTriple(apOut);
} }
@ -2126,7 +2126,7 @@ void Parser::ParseLV4MeshFloat(float& fOut)
// skip spaces and tabs // skip spaces and tabs
if(!SkipSpaces(&filePtr)) if(!SkipSpaces(&filePtr))
{ {
// LOG // LOG
LogWarning("Unable to parse float: unexpected EOL [#1]"); LogWarning("Unable to parse float: unexpected EOL [#1]");
fOut = 0.0f; fOut = 0.0f;
++iLineNumber; ++iLineNumber;
@ -2141,7 +2141,7 @@ void Parser::ParseLV4MeshLong(unsigned int& iOut)
// Skip spaces and tabs // Skip spaces and tabs
if(!SkipSpaces(&filePtr)) if(!SkipSpaces(&filePtr))
{ {
// LOG // LOG
LogWarning("Unable to parse long: unexpected EOL [#1]"); LogWarning("Unable to parse long: unexpected EOL [#1]");
iOut = 0; iOut = 0;
++iLineNumber; ++iLineNumber;

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -130,7 +130,7 @@ struct Bone
Bone() Bone()
{ {
static int iCnt = 0; static int iCnt = 0;
// Generate a default name for the bone // Generate a default name for the bone
char szTemp[128]; char szTemp[128];
::sprintf(szTemp,"UNNAMED_%i",iCnt++); ::sprintf(szTemp,"UNNAMED_%i",iCnt++);
@ -263,7 +263,7 @@ struct BaseNode
struct Mesh : public MeshWithSmoothingGroups<ASE::Face>, public BaseNode struct Mesh : public MeshWithSmoothingGroups<ASE::Face>, public BaseNode
{ {
//! Constructor. //! Constructor.
Mesh() Mesh()
: BaseNode (BaseNode::Mesh) : BaseNode (BaseNode::Mesh)
, bSkip (false) , bSkip (false)
{ {
@ -309,15 +309,15 @@ struct Light : public BaseNode
DIRECTIONAL DIRECTIONAL
}; };
//! Constructor. //! Constructor.
Light() Light()
: BaseNode (BaseNode::Light) : BaseNode (BaseNode::Light)
, mLightType (OMNI) , mLightType (OMNI)
, mColor (1.f,1.f,1.f) , mColor (1.f,1.f,1.f)
, mIntensity (1.f) // light is white by default , mIntensity (1.f) // light is white by default
, mAngle (45.f) , mAngle (45.f)
, mFalloff (0.f) , mFalloff (0.f)
{ {
} }
LightType mLightType; LightType mLightType;
@ -338,10 +338,10 @@ struct Camera : public BaseNode
}; };
//! Constructor //! Constructor
Camera() Camera()
: BaseNode (BaseNode::Camera) : BaseNode (BaseNode::Camera)
, mFOV (0.75f) // in radians , mFOV (0.75f) // in radians
, mNear (0.1f) , mNear (0.1f)
, mFar (1000.f) // could be zero , mFar (1000.f) // could be zero
, mCameraType (FREE) , mCameraType (FREE)
{ {
@ -356,7 +356,7 @@ struct Camera : public BaseNode
struct Dummy : public BaseNode struct Dummy : public BaseNode
{ {
//! Constructor //! Constructor
Dummy() Dummy()
: BaseNode (BaseNode::Dummy) : BaseNode (BaseNode::Dummy)
{ {
} }
@ -492,7 +492,7 @@ private:
unsigned int iNumFaces,Mesh& mesh, unsigned int iChannel = 0); unsigned int iNumFaces,Mesh& mesh, unsigned int iChannel = 0);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
//! Parse an additional mapping channel //! Parse an additional mapping channel
//! (specified via *MESH_MAPPINGCHANNEL) //! (specified via *MESH_MAPPINGCHANNEL)
//! \param iChannel Channel index to be filled //! \param iChannel Channel index to be filled
//! \param mesh Mesh object to be filled //! \param mesh Mesh object to be filled
@ -571,12 +571,12 @@ private:
void ParseLV4MeshLongTriple(unsigned int* apOut); void ParseLV4MeshLongTriple(unsigned int* apOut);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
//! Parse a single float element //! Parse a single float element
//! \param fOut Output float //! \param fOut Output float
void ParseLV4MeshFloat(float& fOut); void ParseLV4MeshFloat(float& fOut);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
//! Parse a single int element //! Parse a single int element
//! \param iOut Output integer //! \param iOut Output integer
void ParseLV4MeshLong(unsigned int& iOut); void ParseLV4MeshLong(unsigned int& iOut);

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -65,7 +65,7 @@ using namespace Assimp;
namespace Assimp { namespace Assimp {
template <typename T> template <typename T>
size_t Write(IOStream * stream, const T& v) size_t Write(IOStream * stream, const T& v)
{ {
return stream->Write( &v, sizeof(T), 1 ); return stream->Write( &v, sizeof(T), 1 );
@ -245,7 +245,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
private: private:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
void Grow(size_t need = 0) void Grow(size_t need = 0)
{ {
size_t new_size = std::max(initial, std::max( need, cur_size+(cur_size>>1) )); size_t new_size = std::max(initial, std::max( need, cur_size+(cur_size>>1) ));
@ -262,12 +262,12 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
public: public:
AssbinChunkWriter( IOStream * container, uint32_t magic, size_t initial = 4096) AssbinChunkWriter( IOStream * container, uint32_t magic, size_t initial = 4096)
: buffer(NULL), magic(magic), container(container), cur_size(0), cursor(0), initial(initial) : buffer(NULL), magic(magic), container(container), cur_size(0), cursor(0), initial(initial)
{ {
} }
virtual ~AssbinChunkWriter() virtual ~AssbinChunkWriter()
{ {
if (container) { if (container) {
container->Write( &magic, sizeof(uint32_t), 1 ); container->Write( &magic, sizeof(uint32_t), 1 );
@ -291,7 +291,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
} }
// ------------------------------------------------------------------- // -------------------------------------------------------------------
virtual size_t Write(const void* pvBuffer, size_t pSize, size_t pCount) virtual size_t Write(const void* pvBuffer, size_t pSize, size_t pCount)
{ {
pSize *= pCount; pSize *= pCount;
if (cursor + pSize > cur_size) { if (cursor + pSize > cur_size) {
@ -301,7 +301,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
memcpy(buffer+cursor, pvBuffer, pSize); memcpy(buffer+cursor, pvBuffer, pSize);
cursor += pSize; cursor += pSize;
return pCount; return pCount;
} }
}; };
@ -580,7 +580,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
for (unsigned int a = 0; a < anim->mNumChannels;++a) { for (unsigned int a = 0; a < anim->mNumChannels;++a) {
const aiNodeAnim* nd = anim->mChannels[a]; const aiNodeAnim* nd = anim->mChannels[a];
WriteBinaryNodeAnim(&chunk,nd); WriteBinaryNodeAnim(&chunk,nd);
} }
} }
@ -592,7 +592,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
Write<aiString>(&chunk,l->mName); Write<aiString>(&chunk,l->mName);
Write<unsigned int>(&chunk,l->mType); Write<unsigned int>(&chunk,l->mType);
if (l->mType != aiLightSource_DIRECTIONAL) { if (l->mType != aiLightSource_DIRECTIONAL) {
Write<float>(&chunk,l->mAttenuationConstant); Write<float>(&chunk,l->mAttenuationConstant);
Write<float>(&chunk,l->mAttenuationLinear); Write<float>(&chunk,l->mAttenuationLinear);
Write<float>(&chunk,l->mAttenuationQuadratic); Write<float>(&chunk,l->mAttenuationQuadratic);
@ -681,7 +681,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
} }
public: public:
AssbinExport() AssbinExport()
: shortened(false), compressed(false) // temporary settings until properties are introduced for exporters : shortened(false), compressed(false) // temporary settings until properties are introduced for exporters
{ {
} }
@ -715,7 +715,7 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
Write<uint16_t>( out, compressed ); Write<uint16_t>( out, compressed );
// == 20 bytes // == 20 bytes
char buff[256]; char buff[256];
strncpy(buff,pFile,256); strncpy(buff,pFile,256);
out->Write(buff,sizeof(char),256); out->Write(buff,sizeof(char),256);

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -74,7 +74,7 @@ static const aiImporterDesc desc = {
0, 0,
0, 0,
0, 0,
"assbin" "assbin"
}; };
const aiImporterDesc* AssbinImporter::GetInfo() const const aiImporterDesc* AssbinImporter::GetInfo() const
@ -187,7 +187,7 @@ aiQuatKey Read<aiQuatKey>(IOStream * stream)
template <typename T> template <typename T>
void ReadArray(IOStream * stream, T * out, unsigned int size) void ReadArray(IOStream * stream, T * out, unsigned int size)
{ {
for (unsigned int i=0; i<size; i++) out[i] = Read<T>(stream); for (unsigned int i=0; i<size; i++) out[i] = Read<T>(stream);
} }
@ -241,11 +241,11 @@ void AssbinImporter::ReadBinaryBone( IOStream * stream, aiBone* b )
// for the moment we write dumb min/max values for the bones, too. // for the moment we write dumb min/max values for the bones, too.
// maybe I'll add a better, hash-like solution later // maybe I'll add a better, hash-like solution later
if (shortened) if (shortened)
{ {
ReadBounds(stream,b->mWeights,b->mNumWeights); ReadBounds(stream,b->mWeights,b->mNumWeights);
} // else write as usual } // else write as usual
else else
{ {
b->mWeights = new aiVertexWeight[b->mNumWeights]; b->mWeights = new aiVertexWeight[b->mNumWeights];
ReadArray<aiVertexWeight>(stream,b->mWeights,b->mNumWeights); ReadArray<aiVertexWeight>(stream,b->mWeights,b->mNumWeights);
@ -268,35 +268,35 @@ void AssbinImporter::ReadBinaryMesh( IOStream * stream, aiMesh* mesh )
// first of all, write bits for all existent vertex components // first of all, write bits for all existent vertex components
unsigned int c = Read<unsigned int>(stream); unsigned int c = Read<unsigned int>(stream);
if (c & ASSBIN_MESH_HAS_POSITIONS) if (c & ASSBIN_MESH_HAS_POSITIONS)
{ {
if (shortened) { if (shortened) {
ReadBounds(stream,mesh->mVertices,mesh->mNumVertices); ReadBounds(stream,mesh->mVertices,mesh->mNumVertices);
} // else write as usual } // else write as usual
else else
{ {
mesh->mVertices = new aiVector3D[mesh->mNumVertices]; mesh->mVertices = new aiVector3D[mesh->mNumVertices];
ReadArray<aiVector3D>(stream,mesh->mVertices,mesh->mNumVertices); ReadArray<aiVector3D>(stream,mesh->mVertices,mesh->mNumVertices);
} }
} }
if (c & ASSBIN_MESH_HAS_NORMALS) if (c & ASSBIN_MESH_HAS_NORMALS)
{ {
if (shortened) { if (shortened) {
ReadBounds(stream,mesh->mNormals,mesh->mNumVertices); ReadBounds(stream,mesh->mNormals,mesh->mNumVertices);
} // else write as usual } // else write as usual
else else
{ {
mesh->mNormals = new aiVector3D[mesh->mNumVertices]; mesh->mNormals = new aiVector3D[mesh->mNumVertices];
ReadArray<aiVector3D>(stream,mesh->mNormals,mesh->mNumVertices); ReadArray<aiVector3D>(stream,mesh->mNormals,mesh->mNumVertices);
} }
} }
if (c & ASSBIN_MESH_HAS_TANGENTS_AND_BITANGENTS) if (c & ASSBIN_MESH_HAS_TANGENTS_AND_BITANGENTS)
{ {
if (shortened) { if (shortened) {
ReadBounds(stream,mesh->mTangents,mesh->mNumVertices); ReadBounds(stream,mesh->mTangents,mesh->mNumVertices);
ReadBounds(stream,mesh->mBitangents,mesh->mNumVertices); ReadBounds(stream,mesh->mBitangents,mesh->mNumVertices);
} // else write as usual } // else write as usual
else else
{ {
mesh->mTangents = new aiVector3D[mesh->mNumVertices]; mesh->mTangents = new aiVector3D[mesh->mNumVertices];
ReadArray<aiVector3D>(stream,mesh->mTangents,mesh->mNumVertices); ReadArray<aiVector3D>(stream,mesh->mTangents,mesh->mNumVertices);
@ -304,22 +304,22 @@ void AssbinImporter::ReadBinaryMesh( IOStream * stream, aiMesh* mesh )
ReadArray<aiVector3D>(stream,mesh->mBitangents,mesh->mNumVertices); ReadArray<aiVector3D>(stream,mesh->mBitangents,mesh->mNumVertices);
} }
} }
for (unsigned int n = 0; n < AI_MAX_NUMBER_OF_COLOR_SETS;++n) for (unsigned int n = 0; n < AI_MAX_NUMBER_OF_COLOR_SETS;++n)
{ {
if (!(c & ASSBIN_MESH_HAS_COLOR(n))) if (!(c & ASSBIN_MESH_HAS_COLOR(n)))
break; break;
if (shortened) if (shortened)
{ {
ReadBounds(stream,mesh->mColors[n],mesh->mNumVertices); ReadBounds(stream,mesh->mColors[n],mesh->mNumVertices);
} // else write as usual } // else write as usual
else else
{ {
mesh->mColors[n] = new aiColor4D[mesh->mNumVertices]; mesh->mColors[n] = new aiColor4D[mesh->mNumVertices];
ReadArray<aiColor4D>(stream,mesh->mColors[n],mesh->mNumVertices); ReadArray<aiColor4D>(stream,mesh->mColors[n],mesh->mNumVertices);
} }
} }
for (unsigned int n = 0; n < AI_MAX_NUMBER_OF_TEXTURECOORDS;++n) for (unsigned int n = 0; n < AI_MAX_NUMBER_OF_TEXTURECOORDS;++n)
{ {
if (!(c & ASSBIN_MESH_HAS_TEXCOORD(n))) if (!(c & ASSBIN_MESH_HAS_TEXCOORD(n)))
break; break;
@ -330,7 +330,7 @@ void AssbinImporter::ReadBinaryMesh( IOStream * stream, aiMesh* mesh )
if (shortened) { if (shortened) {
ReadBounds(stream,mesh->mTextureCoords[n],mesh->mNumVertices); ReadBounds(stream,mesh->mTextureCoords[n],mesh->mNumVertices);
} // else write as usual } // else write as usual
else else
{ {
mesh->mTextureCoords[n] = new aiVector3D[mesh->mNumVertices]; mesh->mTextureCoords[n] = new aiVector3D[mesh->mNumVertices];
ReadArray<aiVector3D>(stream,mesh->mTextureCoords[n],mesh->mNumVertices); ReadArray<aiVector3D>(stream,mesh->mTextureCoords[n],mesh->mNumVertices);
@ -356,11 +356,11 @@ void AssbinImporter::ReadBinaryMesh( IOStream * stream, aiMesh* mesh )
f.mIndices = new unsigned int[f.mNumIndices]; f.mIndices = new unsigned int[f.mNumIndices];
for (unsigned int a = 0; a < f.mNumIndices;++a) { for (unsigned int a = 0; a < f.mNumIndices;++a) {
if (mesh->mNumVertices < (1u<<16)) if (mesh->mNumVertices < (1u<<16))
{ {
f.mIndices[a] = Read<uint16_t>(stream); f.mIndices[a] = Read<uint16_t>(stream);
} }
else else
{ {
f.mIndices[a] = Read<unsigned int>(stream); f.mIndices[a] = Read<unsigned int>(stream);
} }
@ -404,7 +404,7 @@ void AssbinImporter::ReadBinaryMaterial(IOStream * stream, aiMaterial* mat)
mat->mNumAllocated = mat->mNumProperties = Read<unsigned int>(stream); mat->mNumAllocated = mat->mNumProperties = Read<unsigned int>(stream);
if (mat->mNumProperties) if (mat->mNumProperties)
{ {
if (mat->mProperties) if (mat->mProperties)
{ {
delete[] mat->mProperties; delete[] mat->mProperties;
} }
@ -445,7 +445,7 @@ void AssbinImporter::ReadBinaryNodeAnim(IOStream * stream, aiNodeAnim* nd)
ReadBounds(stream,nd->mRotationKeys,nd->mNumRotationKeys); ReadBounds(stream,nd->mRotationKeys,nd->mNumRotationKeys);
} // else write as usual } // else write as usual
else else
{ {
nd->mRotationKeys = new aiQuatKey[nd->mNumRotationKeys]; nd->mRotationKeys = new aiQuatKey[nd->mNumRotationKeys];
ReadArray<aiQuatKey>(stream,nd->mRotationKeys,nd->mNumRotationKeys); ReadArray<aiQuatKey>(stream,nd->mRotationKeys,nd->mNumRotationKeys);
@ -456,7 +456,7 @@ void AssbinImporter::ReadBinaryNodeAnim(IOStream * stream, aiNodeAnim* nd)
ReadBounds(stream,nd->mScalingKeys,nd->mNumScalingKeys); ReadBounds(stream,nd->mScalingKeys,nd->mNumScalingKeys);
} // else write as usual } // else write as usual
else else
{ {
nd->mScalingKeys = new aiVectorKey[nd->mNumScalingKeys]; nd->mScalingKeys = new aiVectorKey[nd->mNumScalingKeys];
ReadArray<aiVectorKey>(stream,nd->mScalingKeys,nd->mNumScalingKeys); ReadArray<aiVectorKey>(stream,nd->mScalingKeys,nd->mNumScalingKeys);
@ -520,7 +520,7 @@ void AssbinImporter::ReadBinaryLight( IOStream * stream, aiLight* l )
l->mName = Read<aiString>(stream); l->mName = Read<aiString>(stream);
l->mType = (aiLightSourceType)Read<unsigned int>(stream); l->mType = (aiLightSourceType)Read<unsigned int>(stream);
if (l->mType != aiLightSource_DIRECTIONAL) { if (l->mType != aiLightSource_DIRECTIONAL) {
l->mAttenuationConstant = Read<float>(stream); l->mAttenuationConstant = Read<float>(stream);
l->mAttenuationLinear = Read<float>(stream); l->mAttenuationLinear = Read<float>(stream);
l->mAttenuationQuadratic = Read<float>(stream); l->mAttenuationQuadratic = Read<float>(stream);
@ -680,7 +680,7 @@ void AssbinImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
{ {
ReadBinaryScene(stream,pScene); ReadBinaryScene(stream,pScene);
} }
pIOHandler->Close(stream); pIOHandler->Close(stream);
} }

View File

@ -6,8 +6,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -24,16 +24,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -74,15 +74,15 @@ private:
protected: protected:
public: public:
virtual bool CanRead( virtual bool CanRead(
const std::string& pFile, const std::string& pFile,
IOSystem* pIOHandler, IOSystem* pIOHandler,
bool checkSig bool checkSig
) const; ) const;
virtual const aiImporterDesc* GetInfo() const; virtual const aiImporterDesc* GetInfo() const;
virtual void InternReadFile( virtual void InternReadFile(
const std::string& pFile, const std::string& pFile,
aiScene* pScene, aiScene* pScene,
IOSystem* pIOHandler IOSystem* pIOHandler
); );
void ReadBinaryScene( IOStream * stream, aiScene* pScene ); void ReadBinaryScene( IOStream * stream, aiScene* pScene );

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -110,7 +110,7 @@ static boost::mutex gLogStreamMutex;
class LogToCallbackRedirector : public LogStream class LogToCallbackRedirector : public LogStream
{ {
public: public:
LogToCallbackRedirector(const aiLogStream& s) LogToCallbackRedirector(const aiLogStream& s)
: stream (s) { : stream (s) {
ai_assert(NULL != s.callback); ai_assert(NULL != s.callback);
} }
@ -121,10 +121,10 @@ public:
#endif #endif
// (HACK) Check whether the 'stream.user' pointer points to a // (HACK) Check whether the 'stream.user' pointer points to a
// custom LogStream allocated by #aiGetPredefinedLogStream. // custom LogStream allocated by #aiGetPredefinedLogStream.
// In this case, we need to delete it, too. Of course, this // In this case, we need to delete it, too. Of course, this
// might cause strange problems, but the chance is quite low. // might cause strange problems, but the chance is quite low.
PredefLogStreamMap::iterator it = std::find(gPredefinedStreams.begin(), PredefLogStreamMap::iterator it = std::find(gPredefinedStreams.begin(),
gPredefinedStreams.end(), (Assimp::LogStream*)stream.user); gPredefinedStreams.end(), (Assimp::LogStream*)stream.user);
if (it != gPredefinedStreams.end()) { if (it != gPredefinedStreams.end()) {
@ -152,7 +152,7 @@ void ReportSceneNotFoundError()
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Reads the given file and returns its content. // Reads the given file and returns its content.
const aiScene* aiImportFile( const char* pFile, unsigned int pFlags) const aiScene* aiImportFile( const char* pFile, unsigned int pFlags)
{ {
return aiImportFileEx(pFile,pFlags,NULL); return aiImportFileEx(pFile,pFlags,NULL);
@ -165,7 +165,7 @@ const aiScene* aiImportFileEx( const char* pFile, unsigned int pFlags, aiFileIO
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFlags, const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFlags,
aiFileIO* pFS, aiFileIO* pFS,
const aiPropertyStore* props) const aiPropertyStore* props)
{ {
@ -198,7 +198,7 @@ const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFl
if( scene) { if( scene) {
ScenePrivateData* priv = const_cast<ScenePrivateData*>( ScenePriv(scene) ); ScenePrivateData* priv = const_cast<ScenePrivateData*>( ScenePriv(scene) );
priv->mOrigImporter = imp; priv->mOrigImporter = imp;
} }
else { else {
// if failed, extract error code and destroy the import // if failed, extract error code and destroy the import
gLastErrorString = imp->GetErrorString(); gLastErrorString = imp->GetErrorString();
@ -211,7 +211,7 @@ const aiScene* aiImportFileExWithProperties( const char* pFile, unsigned int pFl
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
const aiScene* aiImportFileFromMemory( const aiScene* aiImportFileFromMemory(
const char* pBuffer, const char* pBuffer,
unsigned int pLength, unsigned int pLength,
unsigned int pFlags, unsigned int pFlags,
@ -221,7 +221,7 @@ const aiScene* aiImportFileFromMemory(
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
const aiScene* aiImportFileFromMemoryWithProperties( const aiScene* aiImportFileFromMemoryWithProperties(
const char* pBuffer, const char* pBuffer,
unsigned int pLength, unsigned int pLength,
unsigned int pFlags, unsigned int pFlags,
@ -253,7 +253,7 @@ const aiScene* aiImportFileFromMemoryWithProperties(
if( scene) { if( scene) {
ScenePrivateData* priv = const_cast<ScenePrivateData*>( ScenePriv(scene) ); ScenePrivateData* priv = const_cast<ScenePrivateData*>( ScenePriv(scene) );
priv->mOrigImporter = imp; priv->mOrigImporter = imp;
} }
else { else {
// if failed, extract error code and destroy the import // if failed, extract error code and destroy the import
gLastErrorString = imp->GetErrorString(); gLastErrorString = imp->GetErrorString();
@ -265,7 +265,7 @@ const aiScene* aiImportFileFromMemoryWithProperties(
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Releases all resources associated with the given import process. // Releases all resources associated with the given import process.
void aiReleaseImport( const aiScene* pScene) void aiReleaseImport( const aiScene* pScene)
{ {
if (!pScene) { if (!pScene) {
@ -273,7 +273,7 @@ void aiReleaseImport( const aiScene* pScene)
} }
ASSIMP_BEGIN_EXCEPTION_REGION(); ASSIMP_BEGIN_EXCEPTION_REGION();
// find the importer associated with this data // find the importer associated with this data
const ScenePrivateData* priv = ScenePriv(pScene); const ScenePrivateData* priv = ScenePriv(pScene);
if( !priv || !priv->mOrigImporter) { if( !priv || !priv->mOrigImporter) {
@ -286,7 +286,7 @@ void aiReleaseImport( const aiScene* pScene)
Importer* importer = priv->mOrigImporter; Importer* importer = priv->mOrigImporter;
delete importer; delete importer;
} }
ASSIMP_END_EXCEPTION_REGION(void); ASSIMP_END_EXCEPTION_REGION(void);
} }
@ -295,7 +295,7 @@ ASSIMP_API const aiScene* aiApplyPostProcessing(const aiScene* pScene,
unsigned int pFlags) unsigned int pFlags)
{ {
const aiScene* sc = NULL; const aiScene* sc = NULL;
ASSIMP_BEGIN_EXCEPTION_REGION(); ASSIMP_BEGIN_EXCEPTION_REGION();
@ -417,7 +417,7 @@ ASSIMP_API void aiEnableVerboseLogging(aiBool d)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns the error text of the last failed import process. // Returns the error text of the last failed import process.
const char* aiGetErrorString() const char* aiGetErrorString()
{ {
return gLastErrorString.c_str(); return gLastErrorString.c_str();
@ -439,14 +439,14 @@ size_t aiGetImportFormatCount(void)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// 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)
{ {
ai_assert(NULL != szExtension); ai_assert(NULL != szExtension);
aiBool candoit=AI_FALSE; aiBool candoit=AI_FALSE;
ASSIMP_BEGIN_EXCEPTION_REGION(); ASSIMP_BEGIN_EXCEPTION_REGION();
// FIXME: no need to create a temporary Importer instance just for that .. // FIXME: no need to create a temporary Importer instance just for that ..
Assimp::Importer tmp; Assimp::Importer tmp;
candoit = tmp.IsExtensionSupported(std::string(szExtension)) ? AI_TRUE : AI_FALSE; candoit = tmp.IsExtensionSupported(std::string(szExtension)) ? AI_TRUE : AI_FALSE;
@ -461,7 +461,7 @@ void aiGetExtensionList(aiString* szOut)
ai_assert(NULL != szOut); ai_assert(NULL != szOut);
ASSIMP_BEGIN_EXCEPTION_REGION(); ASSIMP_BEGIN_EXCEPTION_REGION();
// FIXME: no need to create a temporary Importer instance just for that .. // FIXME: no need to create a temporary Importer instance just for that ..
Assimp::Importer tmp; Assimp::Importer tmp;
tmp.GetExtensionList(*szOut); tmp.GetExtensionList(*szOut);
@ -582,7 +582,7 @@ ASSIMP_API void aiTransposeMatrix4(aiMatrix4x4* mat)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Vector transformation // Vector transformation
ASSIMP_API void aiTransformVecByMatrix3(aiVector3D* vec, ASSIMP_API void aiTransformVecByMatrix3(aiVector3D* vec,
const aiMatrix3x3* mat) const aiMatrix3x3* mat)
{ {
ai_assert(NULL != mat && NULL != vec); ai_assert(NULL != mat && NULL != vec);
@ -590,7 +590,7 @@ ASSIMP_API void aiTransformVecByMatrix3(aiVector3D* vec,
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
ASSIMP_API void aiTransformVecByMatrix4(aiVector3D* vec, ASSIMP_API void aiTransformVecByMatrix4(aiVector3D* vec,
const aiMatrix4x4* mat) const aiMatrix4x4* mat)
{ {
ai_assert(NULL != mat && NULL != vec); ai_assert(NULL != mat && NULL != vec);
@ -600,7 +600,7 @@ ASSIMP_API void aiTransformVecByMatrix4(aiVector3D* vec,
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Matrix multiplication // Matrix multiplication
ASSIMP_API void aiMultiplyMatrix4( ASSIMP_API void aiMultiplyMatrix4(
aiMatrix4x4* dst, aiMatrix4x4* dst,
const aiMatrix4x4* src) const aiMatrix4x4* src)
{ {
ai_assert(NULL != dst && NULL != src); ai_assert(NULL != dst && NULL != src);
@ -609,7 +609,7 @@ ASSIMP_API void aiMultiplyMatrix4(
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
ASSIMP_API void aiMultiplyMatrix3( ASSIMP_API void aiMultiplyMatrix3(
aiMatrix3x3* dst, aiMatrix3x3* dst,
const aiMatrix3x3* src) const aiMatrix3x3* src)
{ {
ai_assert(NULL != dst && NULL != src); ai_assert(NULL != dst && NULL != src);

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -193,7 +193,7 @@ void WriteDump(const aiScene* scene, IOStream* io, bool shortened)
"-->" "-->"
" \n\n" " \n\n"
"<Scene flags=\"%i\" postprocessing=\"%i\">\n", "<Scene flags=\"%i\" postprocessing=\"%i\">\n",
aiGetVersionMajor(),aiGetVersionMinor(),aiGetVersionRevision(),asctime(p), aiGetVersionMajor(),aiGetVersionMinor(),aiGetVersionRevision(),asctime(p),
scene->mFlags, scene->mFlags,
0 /*globalImporter->GetEffectivePostProcessing()*/); 0 /*globalImporter->GetEffectivePostProcessing()*/);
@ -578,7 +578,7 @@ void WriteDump(const aiScene* scene, IOStream* io, bool shortened)
ioprintf(io,"\t\t<TextureCoords num=\"%i\" set=\"%i\" num_components=\"%i\"> \n",mesh->mNumVertices, ioprintf(io,"\t\t<TextureCoords num=\"%i\" set=\"%i\" num_components=\"%i\"> \n",mesh->mNumVertices,
a,mesh->mNumUVComponents[a]); a,mesh->mNumUVComponents[a]);
if (!shortened) { if (!shortened) {
if (mesh->mNumUVComponents[a] == 3) { if (mesh->mNumUVComponents[a] == 3) {
for (unsigned int n = 0; n < mesh->mNumVertices; ++n) { for (unsigned int n = 0; n < mesh->mNumVertices; ++n) {

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -70,11 +70,11 @@ static const aiImporterDesc desc = {
0, 0,
0, 0,
0, 0,
"b3d" "b3d"
}; };
// (fixme, Aramis) quick workaround to get rid of all those signed to unsigned warnings // (fixme, Aramis) quick workaround to get rid of all those signed to unsigned warnings
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning (disable: 4018) # pragma warning (disable: 4018)
#endif #endif
@ -279,12 +279,12 @@ void B3DImporter::ReadBRUS(){
aiMaterial *mat=new aiMaterial; aiMaterial *mat=new aiMaterial;
_materials.push_back( mat ); _materials.push_back( mat );
// Name // Name
aiString ainame( name ); aiString ainame( name );
mat->AddProperty( &ainame,AI_MATKEY_NAME ); mat->AddProperty( &ainame,AI_MATKEY_NAME );
// Diffuse color // Diffuse color
mat->AddProperty( &color,1,AI_MATKEY_COLOR_DIFFUSE ); mat->AddProperty( &color,1,AI_MATKEY_COLOR_DIFFUSE );
// Opacity // Opacity
@ -293,16 +293,16 @@ void B3DImporter::ReadBRUS(){
// Specular color // Specular color
aiColor3D speccolor( shiny,shiny,shiny ); aiColor3D speccolor( shiny,shiny,shiny );
mat->AddProperty( &speccolor,1,AI_MATKEY_COLOR_SPECULAR ); mat->AddProperty( &speccolor,1,AI_MATKEY_COLOR_SPECULAR );
// Specular power // Specular power
float specpow=shiny*128; float specpow=shiny*128;
mat->AddProperty( &specpow,1,AI_MATKEY_SHININESS ); mat->AddProperty( &specpow,1,AI_MATKEY_SHININESS );
// Double sided // Double sided
if( fx & 0x10 ){ if( fx & 0x10 ){
int i=1; int i=1;
mat->AddProperty( &i,1,AI_MATKEY_TWOSIDED ); mat->AddProperty( &i,1,AI_MATKEY_TWOSIDED );
} }
//Textures //Textures
for( int i=0;i<n_texs;++i ){ for( int i=0;i<n_texs;++i ){
@ -568,7 +568,7 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
string t=ReadChunk(); string t=ReadChunk();
if( t=="BB3D" ){ if( t=="BB3D" ){
int version=ReadInt(); int version=ReadInt();
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
char dmp[128]; char dmp[128];
sprintf(dmp,"B3D file format version: %i",version); sprintf(dmp,"B3D file format version: %i",version);
@ -668,7 +668,7 @@ void B3DImporter::ReadBB3D( aiScene *scene ){
} }
scene->mNumMaterials=_materials.size(); scene->mNumMaterials=_materials.size();
scene->mMaterials=to_array( _materials ); scene->mMaterials=to_array( _materials );
//meshes //meshes
scene->mNumMeshes=_meshes.size(); scene->mNumMeshes=_meshes.size();
scene->mMeshes=to_array( _meshes ); scene->mMeshes=to_array( _meshes );

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -112,7 +112,7 @@ private:
// unsigned _size; // unsigned _size;
std::vector<unsigned char> _buf; std::vector<unsigned char> _buf;
std::vector<unsigned> _stack; std::vector<unsigned> _stack;
std::vector<std::string> _textures; std::vector<std::string> _textures;
std::vector<aiMaterial*> _materials; std::vector<aiMaterial*> _materials;

View File

@ -8,8 +8,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -26,16 +26,16 @@ contributors may be used to endorse or promote products
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -79,12 +79,12 @@ BVHLoader::~BVHLoader()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool BVHLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool cs) const bool BVHLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool cs) const
{ {
// check file extension // check file extension
const std::string extension = GetExtension(pFile); const std::string extension = GetExtension(pFile);
if( extension == "bvh") if( extension == "bvh")
return true; return true;
@ -109,7 +109,7 @@ const aiImporterDesc* BVHLoader::GetInfo () const
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure. // Imports the given file into the given scene structure.
void BVHLoader::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) void BVHLoader::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
{ {
mFileName = pFile; mFileName = pFile;
@ -207,7 +207,7 @@ aiNode* BVHLoader::ReadNode()
aiNode* child = ReadNode(); aiNode* child = ReadNode();
child->mParent = node; child->mParent = node;
childNodes.push_back( child); childNodes.push_back( child);
} }
else if( token == "End") else if( token == "End")
{ {
// The real symbol is "End Site". Second part comes in a separate token // The real symbol is "End Site". Second part comes in a separate token
@ -218,7 +218,7 @@ aiNode* BVHLoader::ReadNode()
aiNode* child = ReadEndSite( nodeName); aiNode* child = ReadEndSite( nodeName);
child->mParent = node; child->mParent = node;
childNodes.push_back( child); childNodes.push_back( child);
} }
else if( token == "}") else if( token == "}")
{ {
// we're done with that part of the hierarchy // we're done with that part of the hierarchy
@ -263,7 +263,7 @@ aiNode* BVHLoader::ReadEndSite( const std::string& pParentName)
if( token == "OFFSET") if( token == "OFFSET")
{ {
ReadNodeOffset( node); ReadNodeOffset( node);
} }
else if( token == "}") else if( token == "}")
{ {
// we're done with the end node // we're done with the end node
@ -468,7 +468,7 @@ void BVHLoader::CreateAnimation( aiScene* pScene)
for( unsigned int channel = 0; channel < 3; ++channel) for( unsigned int channel = 0; channel < 3; ++channel)
{ {
switch( node.mChannels[channel]) switch( node.mChannels[channel])
{ {
case Channel_PositionX: poskey->mValue.x = node.mChannelValues[fr * node.mChannels.size() + channel]; break; case Channel_PositionX: poskey->mValue.x = node.mChannelValues[fr * node.mChannels.size() + channel]; break;
case Channel_PositionY: poskey->mValue.y = node.mChannelValues[fr * node.mChannels.size() + channel]; break; case Channel_PositionY: poskey->mValue.y = node.mChannelValues[fr * node.mChannels.size() + channel]; break;
case Channel_PositionZ: poskey->mValue.z = node.mChannelValues[fr * node.mChannels.size() + channel]; break; case Channel_PositionZ: poskey->mValue.z = node.mChannelValues[fr * node.mChannels.size() + channel]; break;
@ -494,7 +494,7 @@ void BVHLoader::CreateAnimation( aiScene* pScene)
{ {
// Offset all further calculations // Offset all further calculations
rotOffset = 3; rotOffset = 3;
} }
// Then create the number of rotation keys // Then create the number of rotation keys
nodeAnim->mNumRotationKeys = mAnimNumFrames; nodeAnim->mNumRotationKeys = mAnimNumFrames;
@ -511,7 +511,7 @@ void BVHLoader::CreateAnimation( aiScene* pScene)
const float angle = node.mChannelValues[fr * node.mChannels.size() + rotOffset + channel] * float( AI_MATH_PI) / 180.0f; const float angle = node.mChannelValues[fr * node.mChannels.size() + rotOffset + channel] * float( AI_MATH_PI) / 180.0f;
// Compute rotation transformations in the right order // Compute rotation transformations in the right order
switch (node.mChannels[rotOffset+channel]) switch (node.mChannels[rotOffset+channel])
{ {
case Channel_RotationX: aiMatrix4x4::RotationX( angle, temp); rotMatrix *= aiMatrix3x3( temp); break; case Channel_RotationX: aiMatrix4x4::RotationX( angle, temp); rotMatrix *= aiMatrix3x3( temp); break;
case Channel_RotationY: aiMatrix4x4::RotationY( angle, temp); rotMatrix *= aiMatrix3x3( temp); break; case Channel_RotationY: aiMatrix4x4::RotationY( angle, temp); rotMatrix *= aiMatrix3x3( temp); break;

View File

@ -7,8 +7,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ contributors may be used to endorse or promote products
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -55,7 +55,7 @@ namespace Assimp
{ {
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
/** Loader class to read Motion Capturing data from a .bvh file. /** Loader class to read Motion Capturing data from a .bvh file.
* *
* This format only contains a hierarchy of joints and a series of keyframes for * This format only contains a hierarchy of joints and a series of keyframes for
* the hierarchy. It contains no actual mesh data, but we generate a dummy mesh * the hierarchy. It contains no actual mesh data, but we generate a dummy mesh
@ -92,7 +92,7 @@ public:
~BVHLoader(); ~BVHLoader();
public: public:
/** Returns whether the class can handle the format of the given file. /** Returns whether the class can handle the format of the given file.
* See BaseImporter::CanRead() for details. */ * See BaseImporter::CanRead() for details. */
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool cs) const; bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool cs) const;
@ -102,7 +102,7 @@ public:
protected: protected:
/** Imports the given file into the given scene structure. /** Imports the given file into the given scene structure.
* See BaseImporter::InternReadFile() for details * See BaseImporter::InternReadFile() for details
*/ */
void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler); void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,22 +25,22 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
/** @file BaseImporter.cpp /** @file BaseImporter.cpp
* @brief Implementation of BaseImporter * @brief Implementation of BaseImporter
*/ */
#include "BaseImporter.h" #include "BaseImporter.h"
@ -103,7 +103,7 @@ aiScene* BaseImporter::ReadFile(const Importer* pImp, const std::string& pFile,
return NULL; return NULL;
} }
// return what we gathered from the import. // return what we gathered from the import.
sc.dismiss(); sc.dismiss();
return sc; return sc;
} }
@ -140,7 +140,7 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
/*static*/ bool BaseImporter::SearchFileHeaderForToken(IOSystem* pIOHandler, /*static*/ bool BaseImporter::SearchFileHeaderForToken(IOSystem* pIOHandler,
const std::string& pFile, const std::string& pFile,
const char** tokens, const char** tokens,
unsigned int numTokens, unsigned int numTokens,
unsigned int searchBytes /* = 200 */, unsigned int searchBytes /* = 200 */,
bool tokensSol /* false */) bool tokensSol /* false */)
@ -200,7 +200,7 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Simple check for file extension // Simple check for file extension
/*static*/ bool BaseImporter::SimpleExtensionCheck (const std::string& pFile, /*static*/ bool BaseImporter::SimpleExtensionCheck (const std::string& pFile,
const char* ext0, const char* ext0,
const char* ext1, const char* ext1,
const char* ext2) const char* ext2)
@ -210,7 +210,7 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions)
// no file extension - can't read // no file extension - can't read
if( pos == std::string::npos) if( pos == std::string::npos)
return false; return false;
const char* ext_real = & pFile[ pos+1 ]; const char* ext_real = & pFile[ pos+1 ];
if( !ASSIMP_stricmp(ext_real,ext0) ) if( !ASSIMP_stricmp(ext_real,ext0) )
return true; return true;
@ -242,7 +242,7 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Check for magic bytes at the beginning of the file. // Check for magic bytes at the beginning of the file.
/* static */ bool BaseImporter::CheckMagicToken(IOSystem* pIOHandler, const std::string& pFile, /* static */ bool BaseImporter::CheckMagicToken(IOSystem* pIOHandler, const std::string& pFile,
const void* _magic, unsigned int num, unsigned int offset, unsigned int size) const void* _magic, unsigned int num, unsigned int offset, unsigned int size)
{ {
ai_assert(size <= 16 && _magic); ai_assert(size <= 16 && _magic);
@ -277,7 +277,7 @@ void BaseImporter::GetExtensionList(std::set<std::string>& extensions)
// that's just for convinience, the chance that we cause conflicts // that's just for convinience, the chance that we cause conflicts
// is quite low and it can save some lines and prevent nasty bugs // is quite low and it can save some lines and prevent nasty bugs
if (2 == size) { if (2 == size) {
uint16_t rev = *magic_u16; uint16_t rev = *magic_u16;
ByteSwap::Swap(&rev); ByteSwap::Swap(&rev);
if (data_u16[0] == *magic_u16 || data_u16[0] == rev) { if (data_u16[0] == *magic_u16 || data_u16[0] == rev) {
return true; return true;
@ -335,13 +335,13 @@ void BaseImporter::ConvertToUTF8(std::vector<char>& data)
// UTF 32 BE with BOM // UTF 32 BE with BOM
if(*((uint32_t*)&data.front()) == 0xFFFE0000) { if(*((uint32_t*)&data.front()) == 0xFFFE0000) {
// swap the endianess .. // swap the endianess ..
for(uint32_t* p = (uint32_t*)&data.front(), *end = (uint32_t*)&data.back(); p <= end; ++p) { for(uint32_t* p = (uint32_t*)&data.front(), *end = (uint32_t*)&data.back(); p <= end; ++p) {
AI_SWAP4P(p); AI_SWAP4P(p);
} }
} }
// UTF 32 LE with BOM // UTF 32 LE with BOM
if(*((uint32_t*)&data.front()) == 0x0000FFFE) { if(*((uint32_t*)&data.front()) == 0x0000FFFE) {
DefaultLogger::get()->debug("Found UTF-32 BOM ..."); DefaultLogger::get()->debug("Found UTF-32 BOM ...");
@ -358,7 +358,7 @@ void BaseImporter::ConvertToUTF8(std::vector<char>& data)
ReportResult(result); ReportResult(result);
// copy to output buffer. // copy to output buffer.
const size_t outlen = (size_t)(dstart-&output.front()); const size_t outlen = (size_t)(dstart-&output.front());
data.assign(output.begin(),output.begin()+outlen); data.assign(output.begin(),output.begin()+outlen);
return; return;
@ -366,13 +366,13 @@ void BaseImporter::ConvertToUTF8(std::vector<char>& data)
// UTF 16 BE with BOM // UTF 16 BE with BOM
if(*((uint16_t*)&data.front()) == 0xFFFE) { if(*((uint16_t*)&data.front()) == 0xFFFE) {
// swap the endianess .. // swap the endianess ..
for(uint16_t* p = (uint16_t*)&data.front(), *end = (uint16_t*)&data.back(); p <= end; ++p) { for(uint16_t* p = (uint16_t*)&data.front(), *end = (uint16_t*)&data.back(); p <= end; ++p) {
ByteSwap::Swap2(p); ByteSwap::Swap2(p);
} }
} }
// UTF 16 LE with BOM // UTF 16 LE with BOM
if(*((uint16_t*)&data.front()) == 0xFEFF) { if(*((uint16_t*)&data.front()) == 0xFEFF) {
DefaultLogger::get()->debug("Found UTF-16 BOM ..."); DefaultLogger::get()->debug("Found UTF-16 BOM ...");
@ -444,8 +444,8 @@ void BaseImporter::TextFileToBuffer(IOStream* stream,
throw DeadlyImportError("File is empty"); throw DeadlyImportError("File is empty");
} }
data.reserve(fileSize+1); data.reserve(fileSize+1);
data.resize(fileSize); data.resize(fileSize);
if(fileSize != stream->Read( &data[0], 1, fileSize)) { if(fileSize != stream->Read( &data[0], 1, fileSize)) {
throw DeadlyImportError("File read error"); throw DeadlyImportError("File read error");
} }
@ -540,7 +540,7 @@ unsigned int BatchLoader::AddLoadRequest (const std::string& file,
unsigned int steps /*= 0*/, const PropertyMap* map /*= NULL*/) unsigned int steps /*= 0*/, const PropertyMap* map /*= NULL*/)
{ {
ai_assert(!file.empty()); ai_assert(!file.empty());
// check whether we have this loading request already // check whether we have this loading request already
std::list<LoadRequest>::iterator it; std::list<LoadRequest>::iterator it;
for (it = data->requests.begin();it != data->requests.end(); ++it) { for (it = data->requests.begin();it != data->requests.end(); ++it) {

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -76,7 +76,7 @@ struct ScopeGuard
delete obj; delete obj;
} }
obj = NULL; obj = NULL;
} }
T* dismiss() { T* dismiss() {
mdismiss=true; mdismiss=true;
@ -104,13 +104,13 @@ private:
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** FOR IMPORTER PLUGINS ONLY: The BaseImporter defines a common interface /** FOR IMPORTER PLUGINS ONLY: The BaseImporter defines a common interface
* for all importer worker classes. * for all importer worker classes.
* *
* The interface defines two functions: CanRead() is used to check if the * The interface defines two functions: CanRead() is used to check if the
* importer can handle the format of the given file. If an implementation of * importer can handle the format of the given file. If an implementation of
* this function returns true, the importer then calls ReadFile() which * this function returns true, the importer then calls ReadFile() which
* imports the given file. ReadFile is not overridable, it just calls * imports the given file. ReadFile is not overridable, it just calls
* InternReadFile() and catches any ImportErrorException that might occur. * InternReadFile() and catches any ImportErrorException that might occur.
*/ */
class ASSIMP_API BaseImporter class ASSIMP_API BaseImporter
@ -144,39 +144,39 @@ public:
* to be able to load files with unknown/not existent file extensions. * to be able to load files with unknown/not existent file extensions.
* @return true if the class can read this file, false if not. * @return true if the class can read this file, false if not.
*/ */
virtual bool CanRead( virtual bool CanRead(
const std::string& pFile, const std::string& pFile,
IOSystem* pIOHandler, IOSystem* pIOHandler,
bool checkSig bool checkSig
) const = 0; ) const = 0;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Imports the given file and returns the imported data. /** Imports the given file and returns the imported data.
* If the import succeeds, ownership of the data is transferred to * If the import succeeds, ownership of the data is transferred to
* the caller. If the import fails, NULL is returned. The function * the caller. If the import fails, NULL is returned. The function
* takes care that any partially constructed data is destroyed * takes care that any partially constructed data is destroyed
* beforehand. * beforehand.
* *
* @param pImp #Importer object hosting this loader. * @param pImp #Importer object hosting this loader.
* @param pFile Path of the file to be imported. * @param pFile Path of the file to be imported.
* @param pIOHandler IO-Handler used to open this and possible other files. * @param pIOHandler IO-Handler used to open this and possible other files.
* @return The imported data or NULL if failed. If it failed a * @return The imported data or NULL if failed. If it failed a
* human-readable error description can be retrieved by calling * human-readable error description can be retrieved by calling
* GetErrorText() * GetErrorText()
* *
* @note This function is not intended to be overridden. Implement * @note This function is not intended to be overridden. Implement
* InternReadFile() to do the import. If an exception is thrown somewhere * InternReadFile() to do the import. If an exception is thrown somewhere
* in InternReadFile(), this function will catch it and transform it into * in InternReadFile(), this function will catch it and transform it into
* a suitable response to the caller. * a suitable response to the caller.
*/ */
aiScene* ReadFile( aiScene* ReadFile(
const Importer* pImp, const Importer* pImp,
const std::string& pFile, const std::string& pFile,
IOSystem* pIOHandler IOSystem* pIOHandler
); );
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Returns the error description of the last error that occured. /** Returns the error description of the last error that occured.
* @return A description of the last error that occured. An empty * @return A description of the last error that occured. An empty
* string if there was no error. * string if there was no error.
*/ */
@ -194,9 +194,9 @@ public:
const Importer* pImp const Importer* pImp
); );
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Called by #Importer::GetImporterInfo to get a description of /** Called by #Importer::GetImporterInfo to get a description of
* some loader features. Importers must provide this information. */ * some loader features. Importers must provide this information. */
virtual const aiImporterDesc* GetInfo() const = 0; virtual const aiImporterDesc* GetInfo() const = 0;
@ -212,10 +212,10 @@ public:
protected: protected:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Imports the given file into the given scene structure. The /** Imports the given file into the given scene structure. The
* function is expected to throw an ImportErrorException if there is * function is expected to throw an ImportErrorException if there is
* an error. If it terminates normally, the data in aiScene is * an error. If it terminates normally, the data in aiScene is
* expected to be correct. Override this function to implement the * expected to be correct. Override this function to implement the
* actual importing. * actual importing.
* <br> * <br>
* The output scene must meet the following requirements:<br> * The output scene must meet the following requirements:<br>
@ -240,7 +240,7 @@ protected:
* default material setting for the file format better than Assimp's * default material setting for the file format better than Assimp's
* generic default material. Note that default materials *should* * generic default material. Note that default materials *should*
* be named AI_DEFAULT_MATERIAL_NAME if they're just color-shaded * be named AI_DEFAULT_MATERIAL_NAME if they're just color-shaded
* or AI_DEFAULT_TEXTURED_MATERIAL_NAME if they define a (dummy) * or AI_DEFAULT_TEXTURED_MATERIAL_NAME if they define a (dummy)
* texture. </li> * texture. </li>
* </ul> * </ul>
* If the AI_SCENE_FLAGS_INCOMPLETE-Flag is <b>not</b> set:<ul> * If the AI_SCENE_FLAGS_INCOMPLETE-Flag is <b>not</b> set:<ul>
@ -255,9 +255,9 @@ protected:
* NULL is not a valid parameter. * NULL is not a valid parameter.
* @param pIOHandler The IO handler to use for any file access. * @param pIOHandler The IO handler to use for any file access.
* NULL is not a valid parameter. */ * NULL is not a valid parameter. */
virtual void InternReadFile( virtual void InternReadFile(
const std::string& pFile, const std::string& pFile,
aiScene* pScene, aiScene* pScene,
IOSystem* pIOHandler IOSystem* pIOHandler
) = 0; ) = 0;
@ -278,9 +278,9 @@ public: // static utilities
* @param searchBytes Number of bytes to be searched for the tokens. * @param searchBytes Number of bytes to be searched for the tokens.
*/ */
static bool SearchFileHeaderForToken( static bool SearchFileHeaderForToken(
IOSystem* pIOSystem, IOSystem* pIOSystem,
const std::string& file, const std::string& file,
const char** tokens, const char** tokens,
unsigned int numTokens, unsigned int numTokens,
unsigned int searchBytes = 200, unsigned int searchBytes = 200,
bool tokensSol = false); bool tokensSol = false);
@ -294,7 +294,7 @@ public: // static utilities
* @note Case-insensitive * @note Case-insensitive
*/ */
static bool SimpleExtensionCheck ( static bool SimpleExtensionCheck (
const std::string& pFile, const std::string& pFile,
const char* ext0, const char* ext0,
const char* ext1 = NULL, const char* ext1 = NULL,
const char* ext2 = NULL); const char* ext2 = NULL);
@ -322,8 +322,8 @@ public: // static utilities
* tokens of size 2,4. * tokens of size 2,4.
*/ */
static bool CheckMagicToken( static bool CheckMagicToken(
IOSystem* pIOHandler, IOSystem* pIOHandler,
const std::string& pFile, const std::string& pFile,
const void* magic, const void* magic,
unsigned int num, unsigned int num,
unsigned int offset = 0, unsigned int offset = 0,
@ -333,7 +333,7 @@ public: // static utilities
/** An utility for all text file loaders. It converts a file to our /** An utility for all text file loaders. It converts a file to our
* UTF8 character set. Errors are reported, but ignored. * UTF8 character set. Errors are reported, but ignored.
* *
* @param data File buffer to be converted to UTF8 data. The buffer * @param data File buffer to be converted to UTF8 data. The buffer
* is resized as appropriate. */ * is resized as appropriate. */
static void ConvertToUTF8( static void ConvertToUTF8(
std::vector<char>& data); std::vector<char>& data);
@ -351,7 +351,7 @@ public: // static utilities
/** Utility for text file loaders which copies the contents of the /** Utility for text file loaders which copies the contents of the
* file into a memory buffer and converts it to our UTF8 * file into a memory buffer and converts it to our UTF8
* representation. * representation.
* @param stream Stream to read from. * @param stream Stream to read from.
* @param data Output buffer to be resized and filled with the * @param data Output buffer to be resized and filled with the
* converted text file data. The buffer is terminated with * converted text file data. The buffer is terminated with
* a binary 0. */ * a binary 0. */

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -106,7 +106,7 @@ public:
public: public:
//! Destructor //! Destructor
~SharedPostProcessInfo() ~SharedPostProcessInfo()
{ {
Clean(); Clean();
} }
@ -188,7 +188,7 @@ private:
* *
* For future use. * For future use.
*/ */
struct PPDependencyTable struct PPDependencyTable
{ {
unsigned int execute_me_before_these; unsigned int execute_me_before_these;
unsigned int execute_me_after_these; unsigned int execute_me_after_these;
@ -204,14 +204,14 @@ private:
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** The BaseProcess defines a common interface for all post processing steps. /** The BaseProcess defines a common interface for all post processing steps.
* A post processing step is run after a successful import if the caller * A post processing step is run after a successful import if the caller
* specified the corresponding flag when calling ReadFile(). * specified the corresponding flag when calling ReadFile().
* Enum #aiPostProcessSteps defines which flags are available. * Enum #aiPostProcessSteps defines which flags are available.
* After a successful import the Importer iterates over its internal array * After a successful import the Importer iterates over its internal array
* of processes and calls IsActive() on each process to evaluate if the step * of processes and calls IsActive() on each process to evaluate if the step
* should be executed. If the function returns true, the class' Execute() * should be executed. If the function returns true, the class' Execute()
* function is called subsequently. * function is called subsequently.
*/ */
class ASSIMP_API_WINONLY BaseProcess class ASSIMP_API_WINONLY BaseProcess
{ {
friend class Importer; friend class Importer;
@ -229,13 +229,13 @@ public:
/** Returns whether the processing step is present in the given flag. /** Returns whether the processing step is present in the given flag.
* @param pFlags The processing flags the importer was called with. A * @param pFlags The processing flags the importer was called with. A
* bitwise combination of #aiPostProcessSteps. * bitwise combination of #aiPostProcessSteps.
* @return true if the process is present in this flag fields, * @return true if the process is present in this flag fields,
* false if not. * false if not.
*/ */
virtual bool IsActive( unsigned int pFlags) const = 0; virtual bool IsActive( unsigned int pFlags) const = 0;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Check whether this step expects its input vertex data to be /** Check whether this step expects its input vertex data to be
* in verbose format. */ * in verbose format. */
virtual bool RequireVerboseFormat() const; virtual bool RequireVerboseFormat() const;

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2013, assimp team Copyright (c) 2006-2013, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -190,12 +190,12 @@ void BlenderBMeshConverter::AddTFace( const float* uv1, const float *uv2, const
memcpy( &mtface.uv[ 0 ], uv1, sizeof(float) * 2 ); memcpy( &mtface.uv[ 0 ], uv1, sizeof(float) * 2 );
memcpy( &mtface.uv[ 1 ], uv2, sizeof(float) * 2 ); memcpy( &mtface.uv[ 1 ], uv2, sizeof(float) * 2 );
memcpy( &mtface.uv[ 2 ], uv3, sizeof(float) * 2 ); memcpy( &mtface.uv[ 2 ], uv3, sizeof(float) * 2 );
if ( uv4 ) if ( uv4 )
{ {
memcpy( &mtface.uv[ 3 ], uv4, sizeof(float) * 2 ); memcpy( &mtface.uv[ 3 ], uv4, sizeof(float) * 2 );
} }
triMesh->mtface.push_back( mtface ); triMesh->mtface.push_back( mtface );
} }

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2013, assimp team Copyright (c) 2006-2013, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -56,10 +56,10 @@ using namespace Assimp::Formatter;
#define for_each BOOST_FOREACH #define for_each BOOST_FOREACH
bool match4(StreamReaderAny& stream, const char* string) { bool match4(StreamReaderAny& stream, const char* string) {
char tmp[] = { char tmp[] = {
(stream).GetI1(), (stream).GetI1(),
(stream).GetI1(), (stream).GetI1(),
(stream).GetI1(), (stream).GetI1(),
(stream).GetI1() (stream).GetI1()
}; };
return (tmp[0]==string[0] && tmp[1]==string[1] && tmp[2]==string[2] && tmp[3]==string[3]); return (tmp[0]==string[0] && tmp[1]==string[1] && tmp[2]==string[2] && tmp[3]==string[3]);
@ -71,7 +71,7 @@ struct Type {
}; };
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void DNAParser :: Parse () void DNAParser :: Parse ()
{ {
StreamReaderAny& stream = *db.reader.get(); StreamReaderAny& stream = *db.reader.get();
DNA& dna = db.dna; DNA& dna = db.dna;
@ -84,7 +84,7 @@ void DNAParser :: Parse ()
if(!match4(stream,"NAME")) { if(!match4(stream,"NAME")) {
throw DeadlyImportError("BlenderDNA: Expected NAME field"); throw DeadlyImportError("BlenderDNA: Expected NAME field");
} }
std::vector<std::string> names (stream.GetI4()); std::vector<std::string> names (stream.GetI4());
for_each(std::string& s, names) { for_each(std::string& s, names) {
while (char c = stream.GetI1()) { while (char c = stream.GetI1()) {
@ -97,7 +97,7 @@ void DNAParser :: Parse ()
if(!match4(stream,"TYPE")) { if(!match4(stream,"TYPE")) {
throw DeadlyImportError("BlenderDNA: Expected TYPE field"); throw DeadlyImportError("BlenderDNA: Expected TYPE field");
} }
std::vector<Type> types (stream.GetI4()); std::vector<Type> types (stream.GetI4());
for_each(Type& s, types) { for_each(Type& s, types) {
while (char c = stream.GetI1()) { while (char c = stream.GetI1()) {
@ -110,7 +110,7 @@ void DNAParser :: Parse ()
if(!match4(stream,"TLEN")) { if(!match4(stream,"TLEN")) {
throw DeadlyImportError("BlenderDNA: Expected TLEN field"); throw DeadlyImportError("BlenderDNA: Expected TLEN field");
} }
for_each(Type& s, types) { for_each(Type& s, types) {
s.size = stream.GetI2(); s.size = stream.GetI2();
} }
@ -125,11 +125,11 @@ void DNAParser :: Parse ()
dna.structures.reserve(end); dna.structures.reserve(end);
for(size_t i = 0; i != end; ++i) { for(size_t i = 0; i != end; ++i) {
uint16_t n = stream.GetI2(); uint16_t n = stream.GetI2();
if (n >= types.size()) { if (n >= types.size()) {
throw DeadlyImportError((format(), throw DeadlyImportError((format(),
"BlenderDNA: Invalid type index in structure name" ,n, "BlenderDNA: Invalid type index in structure name" ,n,
" (there are only ", types.size(), " entries)" " (there are only ", types.size(), " entries)"
)); ));
} }
@ -150,8 +150,8 @@ void DNAParser :: Parse ()
uint16_t j = stream.GetI2(); uint16_t j = stream.GetI2();
if (j >= types.size()) { if (j >= types.size()) {
throw DeadlyImportError((format(), throw DeadlyImportError((format(),
"BlenderDNA: Invalid type index in structure field ", j, "BlenderDNA: Invalid type index in structure field ", j,
" (there are only ", types.size(), " entries)" " (there are only ", types.size(), " entries)"
)); ));
} }
@ -164,15 +164,15 @@ void DNAParser :: Parse ()
j = stream.GetI2(); j = stream.GetI2();
if (j >= names.size()) { if (j >= names.size()) {
throw DeadlyImportError((format(), throw DeadlyImportError((format(),
"BlenderDNA: Invalid name index in structure field ", j, "BlenderDNA: Invalid name index in structure field ", j,
" (there are only ", names.size(), " entries)" " (there are only ", names.size(), " entries)"
)); ));
} }
f.name = names[j]; f.name = names[j];
f.flags = 0u; f.flags = 0u;
// pointers always specify the size of the pointee instead of their own. // pointers always specify the size of the pointee instead of their own.
// The pointer asterisk remains a property of the lookup name. // The pointer asterisk remains a property of the lookup name.
if (f.name[0] == '*') { if (f.name[0] == '*') {
@ -184,18 +184,18 @@ void DNAParser :: Parse ()
// need to parse the (possibly multi-dimensional) array declaration // need to parse the (possibly multi-dimensional) array declaration
// in order to obtain the actual size of the array in the file. // in order to obtain the actual size of the array in the file.
// Also we need to alter the lookup name to include no array // Also we need to alter the lookup name to include no array
// brackets anymore or size fixup won't work (if our size does // brackets anymore or size fixup won't work (if our size does
// not match the size read from the DNA). // not match the size read from the DNA).
if (*f.name.rbegin() == ']') { if (*f.name.rbegin() == ']') {
const std::string::size_type rb = f.name.find('['); const std::string::size_type rb = f.name.find('[');
if (rb == std::string::npos) { if (rb == std::string::npos) {
throw DeadlyImportError((format(), throw DeadlyImportError((format(),
"BlenderDNA: Encountered invalid array declaration ", "BlenderDNA: Encountered invalid array declaration ",
f.name f.name
)); ));
} }
f.flags |= FieldFlag_Array; f.flags |= FieldFlag_Array;
DNA::ExtractArraySize(f.name,f.array_sizes); DNA::ExtractArraySize(f.name,f.array_sizes);
f.name = f.name.substr(0,rb); f.name = f.name.substr(0,rb);
@ -251,7 +251,7 @@ void DNA :: DumpToFile()
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
/*static*/ void DNA :: ExtractArraySize( /*static*/ void DNA :: ExtractArraySize(
const std::string& out, const std::string& out,
size_t array_sizes[2] size_t array_sizes[2]
) )
{ {
@ -273,7 +273,7 @@ void DNA :: DumpToFile()
boost::shared_ptr< ElemBase > DNA :: ConvertBlobToStructure( boost::shared_ptr< ElemBase > DNA :: ConvertBlobToStructure(
const Structure& structure, const Structure& structure,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
std::map<std::string, FactoryPair >::const_iterator it = converters.find(structure.name); std::map<std::string, FactoryPair >::const_iterator it = converters.find(structure.name);
if (it == converters.end()) { if (it == converters.end()) {
@ -282,7 +282,7 @@ boost::shared_ptr< ElemBase > DNA :: ConvertBlobToStructure(
boost::shared_ptr< ElemBase > ret = (structure.*((*it).second.first))(); boost::shared_ptr< ElemBase > ret = (structure.*((*it).second.first))();
(structure.*((*it).second.second))(ret,db); (structure.*((*it).second.second))(ret,db);
return ret; return ret;
} }
@ -290,7 +290,7 @@ boost::shared_ptr< ElemBase > DNA :: ConvertBlobToStructure(
DNA::FactoryPair DNA :: GetBlobToStructureConverter( DNA::FactoryPair DNA :: GetBlobToStructureConverter(
const Structure& structure, const Structure& structure,
const FileDatabase& /*db*/ const FileDatabase& /*db*/
) const ) const
{ {
std::map<std::string, FactoryPair>::const_iterator it = converters.find(structure.name); std::map<std::string, FactoryPair>::const_iterator it = converters.find(structure.name);
return it == converters.end() ? FactoryPair() : (*it).second; return it == converters.end() ? FactoryPair() : (*it).second;
@ -302,7 +302,7 @@ void DNA :: AddPrimitiveStructures()
{ {
// NOTE: these are just dummies. Their presence enforces // NOTE: these are just dummies. Their presence enforces
// Structure::Convert<target_type> to be called on these // Structure::Convert<target_type> to be called on these
// empty structures. These converters are special // empty structures. These converters are special
// overloads which scan the name of the structure and // overloads which scan the name of the structure and
// perform the required data type conversion if one // perform the required data type conversion if one
// of these special names is found in the structure // of these special names is found in the structure

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,23 +23,23 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
*/ */
/** @file BlenderDNA.h /** @file BlenderDNA.h
* @brief Blender `DNA` (file format specification embedded in * @brief Blender `DNA` (file format specification embedded in
* blend file itself) loader. * blend file itself) loader.
*/ */
#ifndef INCLUDED_AI_BLEND_DNA_H #ifndef INCLUDED_AI_BLEND_DNA_H
@ -89,16 +89,16 @@ struct Error : DeadlyImportError
/** The only purpose of this structure is to feed a virtual dtor into its /** The only purpose of this structure is to feed a virtual dtor into its
* descendents. It serves as base class for all data structure fields. */ * descendents. It serves as base class for all data structure fields. */
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct ElemBase struct ElemBase
{ {
virtual ~ElemBase() {} virtual ~ElemBase() {}
/** Type name of the element. The type /** Type name of the element. The type
* string points is the `c_str` of the `name` attribute of the * string points is the `c_str` of the `name` attribute of the
* corresponding `Structure`, that is, it is only valid as long * corresponding `Structure`, that is, it is only valid as long
* as the DNA is not modified. The dna_type is only set if the * as the DNA is not modified. The dna_type is only set if the
* data type is not static, i.e. a boost::shared_ptr<ElemBase> * data type is not static, i.e. a boost::shared_ptr<ElemBase>
* in the scene description would have its type resolved * in the scene description would have its type resolved
* at runtime, so this member is always set. */ * at runtime, so this member is always set. */
const char* dna_type; const char* dna_type;
}; };
@ -107,7 +107,7 @@ struct ElemBase
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
/** Represents a generic pointer to a memory location, which can be either 32 /** Represents a generic pointer to a memory location, which can be either 32
* or 64 bits. These pointers are loaded from the BLEND file and finally * or 64 bits. These pointers are loaded from the BLEND file and finally
* fixed to point to the real, converted representation of the objects * fixed to point to the real, converted representation of the objects
* they used to point to.*/ * they used to point to.*/
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct Pointer struct Pointer
@ -127,7 +127,7 @@ struct FileOffset
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
/** Dummy derivate of std::vector to be able to use it in templates simultaenously /** Dummy derivate of std::vector to be able to use it in templates simultaenously
* with boost::shared_ptr, which takes only one template argument * with boost::shared_ptr, which takes only one template argument
* while std::vector takes three. Also we need to provide some special member * while std::vector takes three. Also we need to provide some special member
* functions of shared_ptr */ * functions of shared_ptr */
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
@ -150,7 +150,7 @@ public:
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
/** Mixed flags for use in #Field */ /** Mixed flags for use in #Field */
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
enum FieldFlags enum FieldFlags
{ {
FieldFlag_Pointer = 0x1, FieldFlag_Pointer = 0x1,
FieldFlag_Array = 0x2 FieldFlag_Array = 0x2
@ -159,8 +159,8 @@ enum FieldFlags
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
/** Represents a single member of a data structure in a BLEND file */ /** Represents a single member of a data structure in a BLEND file */
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct Field struct Field
{ {
std::string name; std::string name;
std::string type; std::string type;
@ -180,7 +180,7 @@ struct Field
* mission critical so we need them, while others can silently be default * mission critical so we need them, while others can silently be default
* initialized and no animations are harmed. */ * initialized and no animations are harmed. */
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
enum ErrorPolicy enum ErrorPolicy
{ {
/** Substitute default value and ignore */ /** Substitute default value and ignore */
ErrorPolicy_Igno, ErrorPolicy_Igno,
@ -202,7 +202,7 @@ enum ErrorPolicy
* binary `blob` read from the file to such a structure instance with * binary `blob` read from the file to such a structure instance with
* meaningful contents. */ * meaningful contents. */
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
class Structure class Structure
{ {
template <template <typename> class> friend class ObjectCache; template <template <typename> class> friend class ObjectCache;
@ -271,7 +271,7 @@ public:
// -------------------------------------------------------- // --------------------------------------------------------
// field parsing for 1d arrays // field parsing for 1d arrays
template <int error_policy, typename T, size_t M> template <int error_policy, typename T, size_t M>
void ReadFieldArray(T (& out)[M], const char* name, void ReadFieldArray(T (& out)[M], const char* name,
const FileDatabase& db) const; const FileDatabase& db) const;
// -------------------------------------------------------- // --------------------------------------------------------
@ -281,11 +281,11 @@ public:
const FileDatabase& db) const; const FileDatabase& db) const;
// -------------------------------------------------------- // --------------------------------------------------------
// field parsing for pointer or dynamic array types // field parsing for pointer or dynamic array types
// (boost::shared_ptr or boost::shared_array) // (boost::shared_ptr or boost::shared_array)
// The return value indicates whether the data was already cached. // The return value indicates whether the data was already cached.
template <int error_policy, template <typename> class TOUT, typename T> template <int error_policy, template <typename> class TOUT, typename T>
bool ReadFieldPtr(TOUT<T>& out, const char* name, bool ReadFieldPtr(TOUT<T>& out, const char* name,
const FileDatabase& db, const FileDatabase& db,
bool non_recursive = false) const; bool non_recursive = false) const;
@ -294,31 +294,31 @@ public:
// array types (boost::shared_ptr[] or boost::shared_array[]) // array types (boost::shared_ptr[] or boost::shared_array[])
// The return value indicates whether the data was already cached. // The return value indicates whether the data was already cached.
template <int error_policy, template <typename> class TOUT, typename T, size_t N> template <int error_policy, template <typename> class TOUT, typename T, size_t N>
bool ReadFieldPtr(TOUT<T> (&out)[N], const char* name, bool ReadFieldPtr(TOUT<T> (&out)[N], const char* name,
const FileDatabase& db) const; const FileDatabase& db) const;
// -------------------------------------------------------- // --------------------------------------------------------
// field parsing for `normal` values // field parsing for `normal` values
// The return value indicates whether the data was already cached. // The return value indicates whether the data was already cached.
template <int error_policy, typename T> template <int error_policy, typename T>
void ReadField(T& out, const char* name, void ReadField(T& out, const char* name,
const FileDatabase& db) const; const FileDatabase& db) const;
private: private:
// -------------------------------------------------------- // --------------------------------------------------------
template <template <typename> class TOUT, typename T> template <template <typename> class TOUT, typename T>
bool ResolvePointer(TOUT<T>& out, const Pointer & ptrval, bool ResolvePointer(TOUT<T>& out, const Pointer & ptrval,
const FileDatabase& db, const Field& f, const FileDatabase& db, const Field& f,
bool non_recursive = false) const; bool non_recursive = false) const;
// -------------------------------------------------------- // --------------------------------------------------------
template <template <typename> class TOUT, typename T> template <template <typename> class TOUT, typename T>
bool ResolvePointer(vector< TOUT<T> >& out, const Pointer & ptrval, bool ResolvePointer(vector< TOUT<T> >& out, const Pointer & ptrval,
const FileDatabase& db, const Field& f, bool) const; const FileDatabase& db, const Field& f, bool) const;
// -------------------------------------------------------- // --------------------------------------------------------
bool ResolvePointer( boost::shared_ptr< FileOffset >& out, const Pointer & ptrval, bool ResolvePointer( boost::shared_ptr< FileOffset >& out, const Pointer & ptrval,
const FileDatabase& db, const Field& f, bool) const; const FileDatabase& db, const Field& f, bool) const;
// -------------------------------------------------------- // --------------------------------------------------------
@ -347,7 +347,7 @@ private:
template <typename T, unsigned int N> template <typename T, unsigned int N>
void operator ()(T (& out)[N], const char* = NULL) { void operator ()(T (& out)[N], const char* = NULL) {
for (unsigned int i = 0; i < N; ++i) { for (unsigned int i = 0; i < N; ++i) {
out[i] = T(); out[i] = T();
} }
} }
@ -355,7 +355,7 @@ private:
void operator ()(T (& out)[N][M], const char* = NULL) { void operator ()(T (& out)[N][M], const char* = NULL) {
for (unsigned int i = 0; i < N; ++i) { for (unsigned int i = 0; i < N; ++i) {
for (unsigned int j = 0; j < M; ++j) { for (unsigned int j = 0; j < M; ++j) {
out[i][j] = T(); out[i][j] = T();
} }
} }
} }
@ -387,16 +387,16 @@ template <> struct Structure :: _defaultInitializer<ErrorPolicy_Fail> {
template <typename T> template <typename T>
void operator ()(T& /*out*/,const char* = "") { void operator ()(T& /*out*/,const char* = "") {
// obviously, it is crucial that _DefaultInitializer is used // obviously, it is crucial that _DefaultInitializer is used
// only from within a catch clause. // only from within a catch clause.
throw; throw;
} }
}; };
// ------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------
template <> inline bool Structure :: ResolvePointer<boost::shared_ptr,ElemBase>(boost::shared_ptr<ElemBase>& out, template <> inline bool Structure :: ResolvePointer<boost::shared_ptr,ElemBase>(boost::shared_ptr<ElemBase>& out,
const Pointer & ptrval, const Pointer & ptrval,
const FileDatabase& db, const FileDatabase& db,
const Field& f, const Field& f,
bool bool
) const; ) const;
@ -405,7 +405,7 @@ template <> inline bool Structure :: ResolvePointer<boost::shared_ptr,ElemBase>(
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
/** Represents the full data structure information for a single BLEND file. /** Represents the full data structure information for a single BLEND file.
* This data is extracted from the DNA1 chunk in the file. * This data is extracted from the DNA1 chunk in the file.
* #DNAParser does the reading and represents currently the only place where * #DNAParser does the reading and represents currently the only place where
* DNA is altered.*/ * DNA is altered.*/
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
class DNA class DNA
@ -413,13 +413,13 @@ class DNA
public: public:
typedef void (Structure::*ConvertProcPtr) ( typedef void (Structure::*ConvertProcPtr) (
boost::shared_ptr<ElemBase> in, boost::shared_ptr<ElemBase> in,
const FileDatabase& const FileDatabase&
) const; ) const;
typedef boost::shared_ptr<ElemBase> ( typedef boost::shared_ptr<ElemBase> (
Structure::*AllocProcPtr) () const; Structure::*AllocProcPtr) () const;
typedef std::pair< AllocProcPtr, ConvertProcPtr > FactoryPair; typedef std::pair< AllocProcPtr, ConvertProcPtr > FactoryPair;
public: public:
@ -431,7 +431,7 @@ public:
public: public:
// -------------------------------------------------------- // --------------------------------------------------------
/** Access a structure by its canonical name, the pointer version returns NULL on failure /** Access a structure by its canonical name, the pointer version returns NULL on failure
* while the reference version raises an error. */ * while the reference version raises an error. */
inline const Structure& operator [] (const std::string& ss) const; inline const Structure& operator [] (const std::string& ss) const;
inline const Structure* Get (const std::string& ss) const; inline const Structure* Get (const std::string& ss) const;
@ -448,19 +448,19 @@ public:
void AddPrimitiveStructures(); void AddPrimitiveStructures();
// -------------------------------------------------------- // --------------------------------------------------------
/** Fill the @c converters member with converters for all /** Fill the @c converters member with converters for all
* known data types. The implementation of this method is * known data types. The implementation of this method is
* in BlenderScene.cpp and is machine-generated. * in BlenderScene.cpp and is machine-generated.
* Converters are used to quickly handle objects whose * Converters are used to quickly handle objects whose
* exact data type is a runtime-property and not yet * exact data type is a runtime-property and not yet
* known at compile time (consier Object::data).*/ * known at compile time (consier Object::data).*/
void RegisterConverters(); void RegisterConverters();
// -------------------------------------------------------- // --------------------------------------------------------
/** Take an input blob from the stream, interpret it according to /** Take an input blob from the stream, interpret it according to
* a its structure name and convert it to the intermediate * a its structure name and convert it to the intermediate
* representation. * representation.
* @param structure Destination structure definition * @param structure Destination structure definition
* @param db File database. * @param db File database.
* @return A null pointer if no appropriate converter is available.*/ * @return A null pointer if no appropriate converter is available.*/
@ -471,7 +471,7 @@ public:
// -------------------------------------------------------- // --------------------------------------------------------
/** Find a suitable conversion function for a given Structure. /** Find a suitable conversion function for a given Structure.
* Such a converter function takes a blob from the input * Such a converter function takes a blob from the input
* stream, reads as much as it needs, and builds up a * stream, reads as much as it needs, and builds up a
* complete object in intermediate representation. * complete object in intermediate representation.
* @param structure Destination structure definition * @param structure Destination structure definition
@ -485,7 +485,7 @@ public:
#ifdef ASSIMP_BUILD_BLENDER_DEBUG #ifdef ASSIMP_BUILD_BLENDER_DEBUG
// -------------------------------------------------------- // --------------------------------------------------------
/** Dump the DNA to a text file. This is for debugging purposes. /** Dump the DNA to a text file. This is for debugging purposes.
* The output file is `dna.txt` in the current working folder*/ * The output file is `dna.txt` in the current working folder*/
void DumpToFile(); void DumpToFile();
#endif #endif
@ -500,7 +500,7 @@ public:
* @throw DeadlyImportError if more than 2 dimensions are * @throw DeadlyImportError if more than 2 dimensions are
* encountered. */ * encountered. */
static void ExtractArraySize( static void ExtractArraySize(
const std::string& out, const std::string& out,
size_t array_sizes[2] size_t array_sizes[2]
); );
}; };
@ -517,7 +517,7 @@ template <> inline void Structure :: Convert<Pointer> (Pointer& dest,const FileD
/** Describes a master file block header. Each master file sections holds n /** Describes a master file block header. Each master file sections holds n
* elements of a certain SDNA structure (or otherwise unspecified data). */ * elements of a certain SDNA structure (or otherwise unspecified data). */
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct FileBlockHead struct FileBlockHead
{ {
// points right after the header of the file block // points right after the header of the file block
StreamReaderAny::pos start; StreamReaderAny::pos start;
@ -555,14 +555,14 @@ inline bool operator< (const Pointer& a, const Pointer& b) {
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
/** Utility to read all master file blocks in turn. */ /** Utility to read all master file blocks in turn. */
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
class SectionParser class SectionParser
{ {
public: public:
// -------------------------------------------------------- // --------------------------------------------------------
/** @param stream Inout stream, must point to the /** @param stream Inout stream, must point to the
* first section in the file. Call Next() once * first section in the file. Call Next() once
* to have it read. * to have it read.
* @param ptr64 Pointer size in file is 64 bits? */ * @param ptr64 Pointer size in file is 64 bits? */
SectionParser(StreamReaderAny& stream,bool ptr64) SectionParser(StreamReaderAny& stream,bool ptr64)
: stream(stream) : stream(stream)
@ -577,12 +577,12 @@ public:
const FileBlockHead& GetCurrent() const { const FileBlockHead& GetCurrent() const {
return current; return current;
} }
public: public:
// -------------------------------------------------------- // --------------------------------------------------------
/** Advance to the next section. /** Advance to the next section.
* @throw DeadlyImportError if the last chunk was passed. */ * @throw DeadlyImportError if the last chunk was passed. */
void Next(); void Next();
@ -602,7 +602,7 @@ class Statistics {
public: public:
Statistics () Statistics ()
: fields_read () : fields_read ()
, pointers_resolved () , pointers_resolved ()
, cache_hits () , cache_hits ()
@ -621,7 +621,7 @@ public:
/** number of pointers resolved from the cache */ /** number of pointers resolved from the cache */
unsigned int cache_hits; unsigned int cache_hits;
/** number of blocks (from FileDatabase::entries) /** number of blocks (from FileDatabase::entries)
we did actually read from. */ we did actually read from. */
// unsigned int blocks_read; // unsigned int blocks_read;
@ -635,7 +635,7 @@ public:
* avoids circular references and avoids object duplication. */ * avoids circular references and avoids object duplication. */
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
template <template <typename> class TOUT> template <template <typename> class TOUT>
class ObjectCache class ObjectCache
{ {
public: public:
@ -661,21 +661,21 @@ public:
* cache doens't know the item yet. * cache doens't know the item yet.
* @param ptr Item address to look for. */ * @param ptr Item address to look for. */
template <typename T> void get ( template <typename T> void get (
const Structure& s, const Structure& s,
TOUT<T>& out, TOUT<T>& out,
const Pointer& ptr) const; const Pointer& ptr) const;
// -------------------------------------------------------- // --------------------------------------------------------
/** Add an item to the cache after the item has /** Add an item to the cache after the item has
* been fully read. Do not insert anything that * been fully read. Do not insert anything that
* may be faulty or might cause the loading * may be faulty or might cause the loading
* to abort. * to abort.
* @param s Data type of the item * @param s Data type of the item
* @param out Item to insert into the cache * @param out Item to insert into the cache
* @param ptr address (cache key) of the item. */ * @param ptr address (cache key) of the item. */
template <typename T> void set template <typename T> void set
(const Structure& s, (const Structure& s,
const TOUT<T>& out, const TOUT<T>& out,
const Pointer& ptr); const Pointer& ptr);
private: private:
@ -686,7 +686,7 @@ private:
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
template <> class ObjectCache<Blender::vector> template <> class ObjectCache<Blender::vector>
{ {
public: public:
@ -704,7 +704,7 @@ public:
/** Memory representation of a full BLEND file and all its dependencies. The /** Memory representation of a full BLEND file and all its dependencies. The
* output aiScene is constructed from an instance of this data structure. */ * output aiScene is constructed from an instance of this data structure. */
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
class FileDatabase class FileDatabase
{ {
template <template <typename> class TOUT> friend class ObjectCache; template <template <typename> class TOUT> friend class ObjectCache;
@ -715,7 +715,7 @@ public:
: _cacheArrays(*this) : _cacheArrays(*this)
, _cache(*this) , _cache(*this)
, next_cache_idx() , next_cache_idx()
{} {}
public: public:
@ -735,7 +735,7 @@ public:
// For all our templates to work on both shared_ptr's and vector's // For all our templates to work on both shared_ptr's and vector's
// using the same code, a dummy cache for arrays is provided. Actually, // using the same code, a dummy cache for arrays is provided. Actually,
// arrays of objects are never cached because we can't easily // arrays of objects are never cached because we can't easily
// ensure their proper destruction. // ensure their proper destruction.
template <typename T> template <typename T>
ObjectCache<boost::shared_ptr>& cache(boost::shared_ptr<T>& /*in*/) const { ObjectCache<boost::shared_ptr>& cache(boost::shared_ptr<T>& /*in*/) const {
@ -749,7 +749,7 @@ public:
private: private:
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS #ifndef ASSIMP_BUILD_BLENDER_NO_STATS
mutable Statistics _stats; mutable Statistics _stats;
#endif #endif
@ -767,7 +767,7 @@ private:
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
/** Factory to extract a #DNA from the DNA1 file block in a BLEND file. */ /** Factory to extract a #DNA from the DNA1 file block in a BLEND file. */
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
class DNAParser class DNAParser
{ {
public: public:

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -119,7 +119,7 @@ namespace Blender {
private: private:
mywrap arr; mywrap arr;
}; };
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning(disable:4351) # pragma warning(disable:4351)
#endif #endif
@ -137,7 +137,7 @@ namespace Blender {
/** ConversionData acts as intermediate storage location for /** ConversionData acts as intermediate storage location for
* the various ConvertXXX routines in BlenderImporter.*/ * the various ConvertXXX routines in BlenderImporter.*/
// -------------------------------------------------------------------- // --------------------------------------------------------------------
struct ConversionData struct ConversionData
{ {
ConversionData(const FileDatabase& db) ConversionData(const FileDatabase& db)
: sentinel_cnt() : sentinel_cnt()
@ -179,20 +179,20 @@ namespace Blender {
inline const char* GetTextureTypeDisplayString(Tex::Type t) inline const char* GetTextureTypeDisplayString(Tex::Type t)
{ {
switch (t) { switch (t) {
case Tex::Type_CLOUDS : return "Clouds"; case Tex::Type_CLOUDS : return "Clouds";
case Tex::Type_WOOD : return "Wood"; case Tex::Type_WOOD : return "Wood";
case Tex::Type_MARBLE : return "Marble"; case Tex::Type_MARBLE : return "Marble";
case Tex::Type_MAGIC : return "Magic"; case Tex::Type_MAGIC : return "Magic";
case Tex::Type_BLEND : return "Blend"; case Tex::Type_BLEND : return "Blend";
case Tex::Type_STUCCI : return "Stucci"; case Tex::Type_STUCCI : return "Stucci";
case Tex::Type_NOISE : return "Noise"; case Tex::Type_NOISE : return "Noise";
case Tex::Type_PLUGIN : return "Plugin"; case Tex::Type_PLUGIN : return "Plugin";
case Tex::Type_MUSGRAVE : return "Musgrave"; case Tex::Type_MUSGRAVE : return "Musgrave";
case Tex::Type_VORONOI : return "Voronoi"; case Tex::Type_VORONOI : return "Voronoi";
case Tex::Type_DISTNOISE : return "DistortedNoise"; case Tex::Type_DISTNOISE : return "DistortedNoise";
case Tex::Type_ENVMAP : return "EnvMap"; case Tex::Type_ENVMAP : return "EnvMap";
case Tex::Type_IMAGE : return "Image"; case Tex::Type_IMAGE : return "Image";
default: default:
break; break;
} }
return "<Unknown>"; return "<Unknown>";

View File

@ -6,8 +6,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -24,16 +24,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -60,7 +60,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <cctype> #include <cctype>
// zlib is needed for compressed blend files // zlib is needed for compressed blend files
#ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND #ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND
# ifdef ASSIMP_BUILD_NO_OWN_ZLIB # ifdef ASSIMP_BUILD_NO_OWN_ZLIB
# include <zlib.h> # include <zlib.h>
@ -98,14 +98,14 @@ BlenderImporter::BlenderImporter()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor, private as well // Destructor, private as well
BlenderImporter::~BlenderImporter() BlenderImporter::~BlenderImporter()
{ {
delete modifier_cache; delete modifier_cache;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool BlenderImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const bool BlenderImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
{ {
const std::string& extension = GetExtension(pFile); const std::string& extension = GetExtension(pFile);
@ -123,7 +123,7 @@ bool BlenderImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, b
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// List all extensions handled by this loader // List all extensions handled by this loader
void BlenderImporter::GetExtensionList(std::set<std::string>& app) void BlenderImporter::GetExtensionList(std::set<std::string>& app)
{ {
app.insert("blend"); app.insert("blend");
} }
@ -153,8 +153,8 @@ struct free_it
}; };
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure. // Imports the given file into the given scene structure.
void BlenderImporter::InternReadFile( const std::string& pFile, void BlenderImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler) aiScene* pScene, IOSystem* pIOHandler)
{ {
#ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND #ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND
@ -162,7 +162,7 @@ void BlenderImporter::InternReadFile( const std::string& pFile,
free_it free_it_really(dest); free_it free_it_really(dest);
#endif #endif
FileDatabase file; FileDatabase file;
boost::shared_ptr<IOStream> stream(pIOHandler->Open(pFile,"rb")); boost::shared_ptr<IOStream> stream(pIOHandler->Open(pFile,"rb"));
if (!stream) { if (!stream) {
ThrowException("Could not open file for reading"); ThrowException("Could not open file for reading");
@ -222,14 +222,14 @@ void BlenderImporter::InternReadFile( const std::string& pFile,
total += have; total += have;
dest = reinterpret_cast<Bytef*>( realloc(dest,total) ); dest = reinterpret_cast<Bytef*>( realloc(dest,total) );
memcpy(dest + total - have,block,have); memcpy(dest + total - have,block,have);
} }
while (ret != Z_STREAM_END); while (ret != Z_STREAM_END);
// terminate zlib // terminate zlib
inflateEnd(&zstream); inflateEnd(&zstream);
// replace the input stream with a memory stream // replace the input stream with a memory stream
stream.reset(new MemoryIOStream(reinterpret_cast<uint8_t*>(dest),total)); stream.reset(new MemoryIOStream(reinterpret_cast<uint8_t*>(dest),total));
// .. and retry // .. and retry
stream->Read(magic,7,1); stream->Read(magic,7,1);
@ -259,7 +259,7 @@ void BlenderImporter::InternReadFile( const std::string& pFile,
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderImporter::ParseBlendFile(FileDatabase& out, boost::shared_ptr<IOStream> stream) void BlenderImporter::ParseBlendFile(FileDatabase& out, boost::shared_ptr<IOStream> stream)
{ {
out.reader = boost::shared_ptr<StreamReaderAny>(new StreamReaderAny(stream,out.little)); out.reader = boost::shared_ptr<StreamReaderAny>(new StreamReaderAny(stream,out.little));
@ -293,7 +293,7 @@ void BlenderImporter::ParseBlendFile(FileDatabase& out, boost::shared_ptr<IOStre
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderImporter::ExtractScene(Scene& out, const FileDatabase& file) void BlenderImporter::ExtractScene(Scene& out, const FileDatabase& file)
{ {
const FileBlockHead* block = NULL; const FileBlockHead* block = NULL;
std::map<std::string,size_t>::const_iterator it = file.dna.indices.find("Scene"); std::map<std::string,size_t>::const_iterator it = file.dna.indices.find("Scene");
@ -303,7 +303,7 @@ void BlenderImporter::ExtractScene(Scene& out, const FileDatabase& file)
const Structure& ss = file.dna.structures[(*it).second]; const Structure& ss = file.dna.structures[(*it).second];
// we need a scene somewhere to start with. // we need a scene somewhere to start with.
for_each(const FileBlockHead& bl,file.entries) { for_each(const FileBlockHead& bl,file.entries) {
// Fix: using the DNA index is more reliable to locate scenes // Fix: using the DNA index is more reliable to locate scenes
@ -325,15 +325,15 @@ void BlenderImporter::ExtractScene(Scene& out, const FileDatabase& file)
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS #ifndef ASSIMP_BUILD_BLENDER_NO_STATS
DefaultLogger::get()->info((format(), DefaultLogger::get()->info((format(),
"(Stats) Fields read: " ,file.stats().fields_read, "(Stats) Fields read: " ,file.stats().fields_read,
", pointers resolved: " ,file.stats().pointers_resolved, ", pointers resolved: " ,file.stats().pointers_resolved,
", cache hits: " ,file.stats().cache_hits, ", cache hits: " ,file.stats().cache_hits,
", cached objects: " ,file.stats().cached_objects ", cached objects: " ,file.stats().cached_objects
)); ));
#endif #endif
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderImporter::ConvertBlendFile(aiScene* out, const Scene& in,const FileDatabase& file) void BlenderImporter::ConvertBlendFile(aiScene* out, const Scene& in,const FileDatabase& file)
{ {
ConversionData conv(file); ConversionData conv(file);
@ -366,7 +366,7 @@ void BlenderImporter::ConvertBlendFile(aiScene* out, const Scene& in,const FileD
root->mNumChildren = static_cast<unsigned int>(no_parents.size()); root->mNumChildren = static_cast<unsigned int>(no_parents.size());
root->mChildren = new aiNode*[root->mNumChildren](); root->mChildren = new aiNode*[root->mNumChildren]();
for (unsigned int i = 0; i < root->mNumChildren; ++i) { for (unsigned int i = 0; i < root->mNumChildren; ++i) {
root->mChildren[i] = ConvertNode(in, no_parents[i], conv, aiMatrix4x4()); root->mChildren[i] = ConvertNode(in, no_parents[i], conv, aiMatrix4x4());
root->mChildren[i]->mParent = root; root->mChildren[i]->mParent = root;
} }
@ -511,29 +511,29 @@ void BlenderImporter::ResolveTexture(aiMaterial* out, const Material* mat, const
if(!rtex || !rtex->type) { if(!rtex || !rtex->type) {
return; return;
} }
// We can't support most of the texture types because they're mostly procedural. // We can't support most of the texture types because they're mostly procedural.
// These are substituted by a dummy texture. // These are substituted by a dummy texture.
const char* dispnam = ""; const char* dispnam = "";
switch( rtex->type ) switch( rtex->type )
{ {
// these are listed in blender's UI // these are listed in blender's UI
case Tex::Type_CLOUDS : case Tex::Type_CLOUDS :
case Tex::Type_WOOD : case Tex::Type_WOOD :
case Tex::Type_MARBLE : case Tex::Type_MARBLE :
case Tex::Type_MAGIC : case Tex::Type_MAGIC :
case Tex::Type_BLEND : case Tex::Type_BLEND :
case Tex::Type_STUCCI : case Tex::Type_STUCCI :
case Tex::Type_NOISE : case Tex::Type_NOISE :
case Tex::Type_PLUGIN : case Tex::Type_PLUGIN :
case Tex::Type_MUSGRAVE : case Tex::Type_MUSGRAVE :
case Tex::Type_VORONOI : case Tex::Type_VORONOI :
case Tex::Type_DISTNOISE : case Tex::Type_DISTNOISE :
case Tex::Type_ENVMAP : case Tex::Type_ENVMAP :
// these do no appear in the UI, why? // these do no appear in the UI, why?
case Tex::Type_POINTDENSITY : case Tex::Type_POINTDENSITY :
case Tex::Type_VOXELDATA : case Tex::Type_VOXELDATA :
LogWarn(std::string("Encountered a texture with an unsupported type: ")+dispnam); LogWarn(std::string("Encountered a texture with an unsupported type: ")+dispnam);
AddSentinelTexture(out, mat, tex, conv_data); AddSentinelTexture(out, mat, tex, conv_data);
@ -553,7 +553,7 @@ void BlenderImporter::ResolveTexture(aiMaterial* out, const Material* mat, const
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderImporter::BuildMaterials(ConversionData& conv_data) void BlenderImporter::BuildMaterials(ConversionData& conv_data)
{ {
conv_data.materials->reserve(conv_data.materials_raw.size()); conv_data.materials->reserve(conv_data.materials_raw.size());
@ -594,7 +594,7 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data)
for (size_t i = 0; i < sizeof(conv_data.next_texture)/sizeof(conv_data.next_texture[0]);++i) { for (size_t i = 0; i < sizeof(conv_data.next_texture)/sizeof(conv_data.next_texture[0]);++i) {
conv_data.next_texture[i] = 0 ; conv_data.next_texture[i] = 0 ;
} }
aiMaterial* mout = new aiMaterial(); aiMaterial* mout = new aiMaterial();
conv_data.materials->push_back(mout); conv_data.materials->push_back(mout);
// For any new material field handled here, the default material above must be updated with an appropriate default value. // For any new material field handled here, the default material above must be updated with an appropriate default value.
@ -607,7 +607,7 @@ void BlenderImporter::BuildMaterials(ConversionData& conv_data)
// basic material colors // basic material colors
aiColor3D col(mat->r,mat->g,mat->b); aiColor3D col(mat->r,mat->g,mat->b);
if (mat->r || mat->g || mat->b ) { if (mat->r || mat->g || mat->b ) {
// Usually, zero diffuse color means no diffuse color at all in the equation. // Usually, zero diffuse color means no diffuse color at all in the equation.
// So we omit this member to express this intent. // So we omit this member to express this intent.
mout->AddProperty(&col,1,AI_MATKEY_COLOR_DIFFUSE); mout->AddProperty(&col,1,AI_MATKEY_COLOR_DIFFUSE);
@ -649,7 +649,7 @@ void BlenderImporter::CheckActualType(const ElemBase* dt, const char* check)
ai_assert(dt); ai_assert(dt);
if (strcmp(dt->dna_type,check)) { if (strcmp(dt->dna_type,check)) {
ThrowException((format(), ThrowException((format(),
"Expected object at ",std::hex,dt," to be of type `",check, "Expected object at ",std::hex,dt," to be of type `",check,
"`, but it claims to be a `",dt->dna_type,"`instead" "`, but it claims to be a `",dt->dna_type,"`instead"
)); ));
} }
@ -664,7 +664,7 @@ void BlenderImporter::NotSupportedObjectType(const Object* obj, const char* type
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, const Mesh* mesh, void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, const Mesh* mesh,
ConversionData& conv_data, TempArray<std::vector,aiMesh>& temp ConversionData& conv_data, TempArray<std::vector,aiMesh>& temp
) )
{ {
// TODO: Resolve various problems with BMesh triangluation before re-enabling. // TODO: Resolve various problems with BMesh triangluation before re-enabling.
// See issues #400, #373, #318 #315 and #132. // See issues #400, #373, #318 #315 and #132.
@ -730,11 +730,11 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
// all submeshes created from this mesh are named equally. this allows // all submeshes created from this mesh are named equally. this allows
// curious users to recover the original adjacency. // curious users to recover the original adjacency.
out->mName = aiString(mesh->id.name+2); out->mName = aiString(mesh->id.name+2);
// skip over the name prefix 'ME' // skip over the name prefix 'ME'
// resolve the material reference and add this material to the set of // resolve the material reference and add this material to the set of
// output materials. The (temporary) material index is the index // output materials. The (temporary) material index is the index
// of the material entry within the list of resolved materials. // of the material entry within the list of resolved materials.
if (mesh->mat) { if (mesh->mat) {
@ -771,7 +771,7 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
aiVector3D* vn = out->mNormals + out->mNumVertices; aiVector3D* vn = out->mNormals + out->mNumVertices;
// XXX we can't fold this easily, because we are restricted // XXX we can't fold this easily, because we are restricted
// to the member names from the BLEND file (v1,v2,v3,v4) // to the member names from the BLEND file (v1,v2,v3,v4)
// which are assigned by the genblenddna.py script and // which are assigned by the genblenddna.py script and
// cannot be changed without breaking the entire // cannot be changed without breaking the entire
// import process. // import process.
@ -846,16 +846,16 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
} }
for (int i = 0; i < mesh->totpoly; ++i) { for (int i = 0; i < mesh->totpoly; ++i) {
const MPoly& mf = mesh->mpoly[i]; const MPoly& mf = mesh->mpoly[i];
aiMesh* const out = temp[ mat_num_to_mesh_idx[ mf.mat_nr ] ]; aiMesh* const out = temp[ mat_num_to_mesh_idx[ mf.mat_nr ] ];
aiFace& f = out->mFaces[out->mNumFaces++]; aiFace& f = out->mFaces[out->mNumFaces++];
f.mIndices = new unsigned int[ f.mNumIndices = mf.totloop ]; f.mIndices = new unsigned int[ f.mNumIndices = mf.totloop ];
aiVector3D* vo = out->mVertices + out->mNumVertices; aiVector3D* vo = out->mVertices + out->mNumVertices;
aiVector3D* vn = out->mNormals + out->mNumVertices; aiVector3D* vn = out->mNormals + out->mNumVertices;
// XXX we can't fold this easily, because we are restricted // XXX we can't fold this easily, because we are restricted
// to the member names from the BLEND file (v1,v2,v3,v4) // to the member names from the BLEND file (v1,v2,v3,v4)
// which are assigned by the genblenddna.py script and // which are assigned by the genblenddna.py script and
@ -870,7 +870,7 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
} }
const MVert& v = mesh->mvert[loop.v]; const MVert& v = mesh->mvert[loop.v];
vo->x = v.co[0]; vo->x = v.co[0];
vo->y = v.co[1]; vo->y = v.co[1];
vo->z = v.co[2]; vo->z = v.co[2];
@ -878,10 +878,10 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
vn->y = v.no[1]; vn->y = v.no[1];
vn->z = v.no[2]; vn->z = v.no[2];
f.mIndices[j] = out->mNumVertices++; f.mIndices[j] = out->mNumVertices++;
++vo; ++vo;
++vn; ++vn;
} }
if (mf.totloop == 3) if (mf.totloop == 3)
{ {
@ -892,7 +892,7 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
out->mPrimitiveTypes |= aiPrimitiveType_POLYGON; out->mPrimitiveTypes |= aiPrimitiveType_POLYGON;
} }
} }
// collect texture coordinates, they're stored in a separate per-face buffer // collect texture coordinates, they're stored in a separate per-face buffer
if (mesh->mtface || mesh->mloopuv) { if (mesh->mtface || mesh->mloopuv) {
if (mesh->totface > static_cast<int> ( mesh->mtface.size())) { if (mesh->totface > static_cast<int> ( mesh->mtface.size())) {
@ -910,26 +910,26 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
aiMesh* const out = temp[ mat_num_to_mesh_idx[ mesh->mface[i].mat_nr ] ]; aiMesh* const out = temp[ mat_num_to_mesh_idx[ mesh->mface[i].mat_nr ] ];
const aiFace& f = out->mFaces[out->mNumFaces++]; const aiFace& f = out->mFaces[out->mNumFaces++];
aiVector3D* vo = &out->mTextureCoords[0][out->mNumVertices]; aiVector3D* vo = &out->mTextureCoords[0][out->mNumVertices];
for (unsigned int i = 0; i < f.mNumIndices; ++i,++vo,++out->mNumVertices) { for (unsigned int i = 0; i < f.mNumIndices; ++i,++vo,++out->mNumVertices) {
vo->x = v->uv[i][0]; vo->x = v->uv[i][0];
vo->y = v->uv[i][1]; vo->y = v->uv[i][1];
} }
} }
for (int i = 0; i < mesh->totpoly; ++i) { for (int i = 0; i < mesh->totpoly; ++i) {
const MPoly& v = mesh->mpoly[i]; const MPoly& v = mesh->mpoly[i];
aiMesh* const out = temp[ mat_num_to_mesh_idx[ v.mat_nr ] ]; aiMesh* const out = temp[ mat_num_to_mesh_idx[ v.mat_nr ] ];
const aiFace& f = out->mFaces[out->mNumFaces++]; const aiFace& f = out->mFaces[out->mNumFaces++];
aiVector3D* vo = &out->mTextureCoords[0][out->mNumVertices]; aiVector3D* vo = &out->mTextureCoords[0][out->mNumVertices];
for (unsigned int j = 0; j < f.mNumIndices; ++j,++vo,++out->mNumVertices) { for (unsigned int j = 0; j < f.mNumIndices; ++j,++vo,++out->mNumVertices) {
const MLoopUV& uv = mesh->mloopuv[v.loopstart + j]; const MLoopUV& uv = mesh->mloopuv[v.loopstart + j];
vo->x = uv.uv[0]; vo->x = uv.uv[0];
vo->y = uv.uv[1]; vo->y = uv.uv[1];
} }
} }
} }
@ -950,7 +950,7 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
aiMesh* const out = temp[ mat_num_to_mesh_idx[ mesh->mface[i].mat_nr ] ]; aiMesh* const out = temp[ mat_num_to_mesh_idx[ mesh->mface[i].mat_nr ] ];
const aiFace& f = out->mFaces[out->mNumFaces++]; const aiFace& f = out->mFaces[out->mNumFaces++];
aiVector3D* vo = &out->mTextureCoords[0][out->mNumVertices]; aiVector3D* vo = &out->mTextureCoords[0][out->mNumVertices];
for (unsigned int i = 0; i < f.mNumIndices; ++i,++vo,++out->mNumVertices) { for (unsigned int i = 0; i < f.mNumIndices; ++i,++vo,++out->mNumVertices) {
vo->x = v->uv[i][0]; vo->x = v->uv[i][0];
@ -975,7 +975,7 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
aiMesh* const out = temp[ mat_num_to_mesh_idx[ mesh->mface[i].mat_nr ] ]; aiMesh* const out = temp[ mat_num_to_mesh_idx[ mesh->mface[i].mat_nr ] ];
const aiFace& f = out->mFaces[out->mNumFaces++]; const aiFace& f = out->mFaces[out->mNumFaces++];
aiColor4D* vo = &out->mColors[0][out->mNumVertices]; aiColor4D* vo = &out->mColors[0][out->mNumVertices];
for (unsigned int n = 0; n < f.mNumIndices; ++n, ++vo,++out->mNumVertices) { for (unsigned int n = 0; n < f.mNumIndices; ++n, ++vo,++out->mNumVertices) {
const MCol* col = &mesh->mcol[(i<<2)+n]; const MCol* col = &mesh->mcol[(i<<2)+n];
@ -987,12 +987,12 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
} }
for (unsigned int n = f.mNumIndices; n < 4; ++n); for (unsigned int n = f.mNumIndices; n < 4; ++n);
} }
for (int i = 0; i < mesh->totpoly; ++i) { for (int i = 0; i < mesh->totpoly; ++i) {
const MPoly& v = mesh->mpoly[i]; const MPoly& v = mesh->mpoly[i];
aiMesh* const out = temp[ mat_num_to_mesh_idx[ v.mat_nr ] ]; aiMesh* const out = temp[ mat_num_to_mesh_idx[ v.mat_nr ] ];
const aiFace& f = out->mFaces[out->mNumFaces++]; const aiFace& f = out->mFaces[out->mNumFaces++];
aiColor4D* vo = &out->mColors[0][out->mNumVertices]; aiColor4D* vo = &out->mColors[0][out->mNumVertices];
for (unsigned int j = 0; j < f.mNumIndices; ++j,++vo,++out->mNumVertices) { for (unsigned int j = 0; j < f.mNumIndices; ++j,++vo,++out->mNumVertices) {
const MLoopCol& col = mesh->mloopcol[v.loopstart + j]; const MLoopCol& col = mesh->mloopcol[v.loopstart + j];
@ -1001,7 +1001,7 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
vo->b = col.b; vo->b = col.b;
vo->a = col.a; vo->a = col.a;
} }
} }
} }
@ -1140,7 +1140,7 @@ aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, Convers
m = m.Inverse(); m = m.Inverse();
node->mTransformation = m*node->mTransformation; node->mTransformation = m*node->mTransformation;
if (children.size()) { if (children.size()) {
node->mNumChildren = static_cast<unsigned int>(children.size()); node->mNumChildren = static_cast<unsigned int>(children.size());
aiNode** nd = node->mChildren = new aiNode*[node->mNumChildren](); aiNode** nd = node->mChildren = new aiNode*[node->mNumChildren]();

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -55,7 +55,7 @@ struct aiCamera;
struct aiMaterial; struct aiMaterial;
namespace Assimp { namespace Assimp {
// TinyFormatter.h // TinyFormatter.h
namespace Formatter { namespace Formatter {
template <typename T,typename TR, typename A> class basic_formatter; template <typename T,typename TR, typename A> class basic_formatter;
@ -109,7 +109,7 @@ public:
public: public:
// -------------------- // --------------------
bool CanRead( const std::string& pFile, bool CanRead( const std::string& pFile,
IOSystem* pIOHandler, IOSystem* pIOHandler,
bool checkSig bool checkSig
) const; ) const;
@ -126,20 +126,20 @@ protected:
void SetupProperties(const Importer* pImp); void SetupProperties(const Importer* pImp);
// -------------------- // --------------------
void InternReadFile( const std::string& pFile, void InternReadFile( const std::string& pFile,
aiScene* pScene, aiScene* pScene,
IOSystem* pIOHandler IOSystem* pIOHandler
); );
// -------------------- // --------------------
void ParseBlendFile(Blender::FileDatabase& out, void ParseBlendFile(Blender::FileDatabase& out,
boost::shared_ptr<IOStream> stream boost::shared_ptr<IOStream> stream
); );
// -------------------- // --------------------
void ExtractScene(Blender::Scene& out, void ExtractScene(Blender::Scene& out,
const Blender::FileDatabase& file const Blender::FileDatabase& file
); );
// -------------------- // --------------------
void ConvertBlendFile(aiScene* out, void ConvertBlendFile(aiScene* out,
@ -150,33 +150,33 @@ protected:
private: private:
// -------------------- // --------------------
aiNode* ConvertNode(const Blender::Scene& in, aiNode* ConvertNode(const Blender::Scene& in,
const Blender::Object* obj, const Blender::Object* obj,
Blender::ConversionData& conv_info, Blender::ConversionData& conv_info,
const aiMatrix4x4& parentTransform const aiMatrix4x4& parentTransform
); );
// -------------------- // --------------------
void ConvertMesh(const Blender::Scene& in, void ConvertMesh(const Blender::Scene& in,
const Blender::Object* obj, const Blender::Object* obj,
const Blender::Mesh* mesh, const Blender::Mesh* mesh,
Blender::ConversionData& conv_data, Blender::ConversionData& conv_data,
Blender::TempArray<std::vector,aiMesh>& temp Blender::TempArray<std::vector,aiMesh>& temp
); );
// -------------------- // --------------------
aiLight* ConvertLight(const Blender::Scene& in, aiLight* ConvertLight(const Blender::Scene& in,
const Blender::Object* obj, const Blender::Object* obj,
const Blender::Lamp* mesh, const Blender::Lamp* mesh,
Blender::ConversionData& conv_data Blender::ConversionData& conv_data
); );
// -------------------- // --------------------
aiCamera* ConvertCamera(const Blender::Scene& in, aiCamera* ConvertCamera(const Blender::Scene& in,
const Blender::Object* obj, const Blender::Object* obj,
const Blender::Camera* mesh, const Blender::Camera* mesh,
Blender::ConversionData& conv_data Blender::ConversionData& conv_data
); );
// -------------------- // --------------------
void BuildMaterials( void BuildMaterials(
@ -185,37 +185,37 @@ private:
// -------------------- // --------------------
void ResolveTexture( void ResolveTexture(
aiMaterial* out, aiMaterial* out,
const Blender::Material* mat, const Blender::Material* mat,
const Blender::MTex* tex, const Blender::MTex* tex,
Blender::ConversionData& conv_data Blender::ConversionData& conv_data
); );
// -------------------- // --------------------
void ResolveImage( void ResolveImage(
aiMaterial* out, aiMaterial* out,
const Blender::Material* mat, const Blender::Material* mat,
const Blender::MTex* tex, const Blender::MTex* tex,
const Blender::Image* img, const Blender::Image* img,
Blender::ConversionData& conv_data Blender::ConversionData& conv_data
); );
void AddSentinelTexture( void AddSentinelTexture(
aiMaterial* out, aiMaterial* out,
const Blender::Material* mat, const Blender::Material* mat,
const Blender::MTex* tex, const Blender::MTex* tex,
Blender::ConversionData& conv_data Blender::ConversionData& conv_data
); );
private: // static stuff, mostly logging and error reporting. private: // static stuff, mostly logging and error reporting.
// -------------------- // --------------------
static void CheckActualType(const Blender::ElemBase* dt, static void CheckActualType(const Blender::ElemBase* dt,
const char* check const char* check
); );
// -------------------- // --------------------
static void NotSupportedObjectType(const Blender::Object* obj, static void NotSupportedObjectType(const Blender::Object* obj,
const char* type const char* type
); );

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -105,7 +105,7 @@ struct SharedModifierData : ElemBase
}; };
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderModifierShowcase::ApplyModifiers(aiNode& out, ConversionData& conv_data, const Scene& in, const Object& orig_object ) void BlenderModifierShowcase::ApplyModifiers(aiNode& out, ConversionData& conv_data, const Scene& in, const Object& orig_object )
{ {
size_t cnt = 0u, ful = 0u; size_t cnt = 0u, ful = 0u;
@ -183,9 +183,9 @@ bool BlenderModifier_Mirror :: IsActive (const ModifierData& modin)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderModifier_Mirror :: DoIt(aiNode& out, ConversionData& conv_data, const ElemBase& orig_modifier, void BlenderModifier_Mirror :: DoIt(aiNode& out, ConversionData& conv_data, const ElemBase& orig_modifier,
const Scene& /*in*/, const Scene& /*in*/,
const Object& orig_object ) const Object& orig_object )
{ {
// hijacking the ABI, see the big note in BlenderModifierShowcase::ApplyModifiers() // hijacking the ABI, see the big note in BlenderModifierShowcase::ApplyModifiers()
const MirrorModifierData& mir = static_cast<const MirrorModifierData&>(orig_modifier); const MirrorModifierData& mir = static_cast<const MirrorModifierData&>(orig_modifier);
@ -208,7 +208,7 @@ void BlenderModifier_Mirror :: DoIt(aiNode& out, ConversionData& conv_data, co
const aiVector3D center( mir.mirror_ob->obmat[3][0],mir.mirror_ob->obmat[3][1],mir.mirror_ob->obmat[3][2] ); const aiVector3D center( mir.mirror_ob->obmat[3][0],mir.mirror_ob->obmat[3][1],mir.mirror_ob->obmat[3][2] );
for (unsigned int i = 0; i < mesh->mNumVertices; ++i) { for (unsigned int i = 0; i < mesh->mNumVertices; ++i) {
aiVector3D& v = mesh->mVertices[i]; aiVector3D& v = mesh->mVertices[i];
v.x = center.x + xs*(center.x - v.x); v.x = center.x + xs*(center.x - v.x);
v.y = center.y + ys*(center.y - v.y); v.y = center.y + ys*(center.y - v.y);
v.z = center.z + zs*(center.z - v.z); v.z = center.z + zs*(center.z - v.z);
@ -287,16 +287,16 @@ bool BlenderModifier_Subdivision :: IsActive (const ModifierData& modin)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderModifier_Subdivision :: DoIt(aiNode& out, ConversionData& conv_data, const ElemBase& orig_modifier, void BlenderModifier_Subdivision :: DoIt(aiNode& out, ConversionData& conv_data, const ElemBase& orig_modifier,
const Scene& /*in*/, const Scene& /*in*/,
const Object& orig_object ) const Object& orig_object )
{ {
// hijacking the ABI, see the big note in BlenderModifierShowcase::ApplyModifiers() // hijacking the ABI, see the big note in BlenderModifierShowcase::ApplyModifiers()
const SubsurfModifierData& mir = static_cast<const SubsurfModifierData&>(orig_modifier); const SubsurfModifierData& mir = static_cast<const SubsurfModifierData&>(orig_modifier);
ai_assert(mir.modifier.type == ModifierData::eModifierType_Subsurf); ai_assert(mir.modifier.type == ModifierData::eModifierType_Subsurf);
Subdivider::Algorithm algo; Subdivider::Algorithm algo;
switch (mir.subdivType) switch (mir.subdivType)
{ {
case SubsurfModifierData::TYPE_CatmullClarke: case SubsurfModifierData::TYPE_CatmullClarke:
algo = Subdivider::CATMULL_CLARKE; algo = Subdivider::CATMULL_CLARKE;

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -53,7 +53,7 @@ namespace Assimp {
/** Dummy base class for all blender modifiers. Modifiers are reused between imports, so /** Dummy base class for all blender modifiers. Modifiers are reused between imports, so
* they should be stateless and not try to cache model data. */ * they should be stateless and not try to cache model data. */
// ------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------
class BlenderModifier class BlenderModifier
{ {
public: public:
@ -74,7 +74,7 @@ public:
* was called and gave positive response. */ * was called and gave positive response. */
virtual void DoIt(aiNode& /*out*/, virtual void DoIt(aiNode& /*out*/,
ConversionData& /*conv_data*/, ConversionData& /*conv_data*/,
const ElemBase& orig_modifier, const ElemBase& orig_modifier,
const Scene& /*in*/, const Scene& /*in*/,
const Object& /*orig_object*/ const Object& /*orig_object*/
) { ) {
@ -94,9 +94,9 @@ public:
// -------------------- // --------------------
/** Apply all requested modifiers provided we support them. */ /** Apply all requested modifiers provided we support them. */
void ApplyModifiers(aiNode& out, void ApplyModifiers(aiNode& out,
ConversionData& conv_data, ConversionData& conv_data,
const Scene& in, const Scene& in,
const Object& orig_object const Object& orig_object
); );
private: private:
@ -121,13 +121,13 @@ public:
// -------------------- // --------------------
virtual bool IsActive( const ModifierData& modin); virtual bool IsActive( const ModifierData& modin);
// -------------------- // --------------------
virtual void DoIt(aiNode& out, virtual void DoIt(aiNode& out,
ConversionData& conv_data, ConversionData& conv_data,
const ElemBase& orig_modifier, const ElemBase& orig_modifier,
const Scene& in, const Scene& in,
const Object& orig_object const Object& orig_object
) ; ) ;
}; };
@ -140,13 +140,13 @@ public:
// -------------------- // --------------------
virtual bool IsActive( const ModifierData& modin); virtual bool IsActive( const ModifierData& modin);
// -------------------- // --------------------
virtual void DoIt(aiNode& out, virtual void DoIt(aiNode& out,
ConversionData& conv_data, ConversionData& conv_data,
const ElemBase& orig_modifier, const ElemBase& orig_modifier,
const Scene& in, const Scene& in,
const Object& orig_object const Object& orig_object
) ; ) ;
}; };

View File

@ -5,8 +5,8 @@ Open Asset Import Library (ASSIMP)
Copyright (c) 2006-2010, ASSIMP Development Team Copyright (c) 2006-2010, ASSIMP Development Team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the ASSIMP Development Team. written permission of the ASSIMP Development Team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -56,7 +56,7 @@ template <> void Structure :: Convert<Object> (
Object& dest, Object& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.id,"id",db); ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
ReadField<ErrorPolicy_Fail>((int&)dest.type,"type",db); ReadField<ErrorPolicy_Fail>((int&)dest.type,"type",db);
@ -84,7 +84,7 @@ template <> void Structure :: Convert<Group> (
Group& dest, Group& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.id,"id",db); ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
ReadField<ErrorPolicy_Igno>(dest.layer,"layer",db); ReadField<ErrorPolicy_Igno>(dest.layer,"layer",db);
@ -98,7 +98,7 @@ template <> void Structure :: Convert<MTex> (
MTex& dest, MTex& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Igno>((short&)dest.mapto,"mapto",db); ReadField<ErrorPolicy_Igno>((short&)dest.mapto,"mapto",db);
ReadField<ErrorPolicy_Igno>((int&)dest.blendtype,"blendtype",db); ReadField<ErrorPolicy_Igno>((int&)dest.blendtype,"blendtype",db);
@ -137,7 +137,7 @@ template <> void Structure :: Convert<TFace> (
TFace& dest, TFace& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadFieldArray2<ErrorPolicy_Fail>(dest.uv,"uv",db); ReadFieldArray2<ErrorPolicy_Fail>(dest.uv,"uv",db);
ReadFieldArray<ErrorPolicy_Fail>(dest.col,"col",db); ReadFieldArray<ErrorPolicy_Fail>(dest.col,"col",db);
@ -154,7 +154,7 @@ template <> void Structure :: Convert<SubsurfModifierData> (
SubsurfModifierData& dest, SubsurfModifierData& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.modifier,"modifier",db); ReadField<ErrorPolicy_Fail>(dest.modifier,"modifier",db);
ReadField<ErrorPolicy_Warn>(dest.subdivType,"subdivType",db); ReadField<ErrorPolicy_Warn>(dest.subdivType,"subdivType",db);
@ -170,7 +170,7 @@ template <> void Structure :: Convert<MFace> (
MFace& dest, MFace& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.v1,"v1",db); ReadField<ErrorPolicy_Fail>(dest.v1,"v1",db);
ReadField<ErrorPolicy_Fail>(dest.v2,"v2",db); ReadField<ErrorPolicy_Fail>(dest.v2,"v2",db);
@ -187,7 +187,7 @@ template <> void Structure :: Convert<Lamp> (
Lamp& dest, Lamp& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.id,"id",db); ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
ReadField<ErrorPolicy_Fail>((int&)dest.type,"type",db); ReadField<ErrorPolicy_Fail>((int&)dest.type,"type",db);
@ -215,7 +215,7 @@ template <> void Structure :: Convert<MDeformWeight> (
MDeformWeight& dest, MDeformWeight& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.def_nr,"def_nr",db); ReadField<ErrorPolicy_Fail>(dest.def_nr,"def_nr",db);
ReadField<ErrorPolicy_Fail>(dest.weight,"weight",db); ReadField<ErrorPolicy_Fail>(dest.weight,"weight",db);
@ -228,7 +228,7 @@ template <> void Structure :: Convert<PackedFile> (
PackedFile& dest, PackedFile& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Warn>(dest.size,"size",db); ReadField<ErrorPolicy_Warn>(dest.size,"size",db);
ReadField<ErrorPolicy_Warn>(dest.seek,"seek",db); ReadField<ErrorPolicy_Warn>(dest.seek,"seek",db);
@ -242,7 +242,7 @@ template <> void Structure :: Convert<Base> (
Base& dest, Base& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
// note: as per https://github.com/assimp/assimp/issues/128, // note: as per https://github.com/assimp/assimp/issues/128,
// reading the Object linked list recursively is prone to stack overflow. // reading the Object linked list recursively is prone to stack overflow.
// This structure converter is therefore an hand-written exception that // This structure converter is therefore an hand-written exception that
@ -252,7 +252,7 @@ template <> void Structure :: Convert<Base> (
std::pair<Base*, int> todo = std::make_pair(&dest, initial_pos); std::pair<Base*, int> todo = std::make_pair(&dest, initial_pos);
for ( ;; ) { for ( ;; ) {
Base& cur_dest = *todo.first; Base& cur_dest = *todo.first;
db.reader->SetCurrentPos(todo.second); db.reader->SetCurrentPos(todo.second);
@ -262,7 +262,7 @@ template <> void Structure :: Convert<Base> (
ReadFieldPtr<ErrorPolicy_Warn>(cur_dest.object,"*object",db); ReadFieldPtr<ErrorPolicy_Warn>(cur_dest.object,"*object",db);
// the return value of ReadFieldPtr indicates whether the object // the return value of ReadFieldPtr indicates whether the object
// was already cached. In this case, we don't need to resolve // was already cached. In this case, we don't need to resolve
// it again. // it again.
if(!ReadFieldPtr<ErrorPolicy_Warn>(cur_dest.next,"*next",db, true) && cur_dest.next) { if(!ReadFieldPtr<ErrorPolicy_Warn>(cur_dest.next,"*next",db, true) && cur_dest.next) {
@ -271,7 +271,7 @@ template <> void Structure :: Convert<Base> (
} }
break; break;
} }
db.reader->SetCurrentPos(initial_pos + size); db.reader->SetCurrentPos(initial_pos + size);
} }
@ -280,7 +280,7 @@ template <> void Structure :: Convert<MTFace> (
MTFace& dest, MTFace& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadFieldArray2<ErrorPolicy_Fail>(dest.uv,"uv",db); ReadFieldArray2<ErrorPolicy_Fail>(dest.uv,"uv",db);
ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db); ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
@ -296,7 +296,7 @@ template <> void Structure :: Convert<Material> (
Material& dest, Material& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.id,"id",db); ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
ReadField<ErrorPolicy_Warn>(dest.r,"r",db); ReadField<ErrorPolicy_Warn>(dest.r,"r",db);
@ -332,7 +332,7 @@ template <> void Structure :: Convert<MTexPoly> (
MTexPoly& dest, MTexPoly& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
{ {
boost::shared_ptr<Image> tpage; boost::shared_ptr<Image> tpage;
@ -353,7 +353,7 @@ template <> void Structure :: Convert<Mesh> (
Mesh& dest, Mesh& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.id,"id",db); ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
ReadField<ErrorPolicy_Fail>(dest.totface,"totface",db); ReadField<ErrorPolicy_Fail>(dest.totface,"totface",db);
@ -387,7 +387,7 @@ template <> void Structure :: Convert<MDeformVert> (
MDeformVert& dest, MDeformVert& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadFieldPtr<ErrorPolicy_Warn>(dest.dw,"*dw",db); ReadFieldPtr<ErrorPolicy_Warn>(dest.dw,"*dw",db);
ReadField<ErrorPolicy_Igno>(dest.totweight,"totweight",db); ReadField<ErrorPolicy_Igno>(dest.totweight,"totweight",db);
@ -400,7 +400,7 @@ template <> void Structure :: Convert<World> (
World& dest, World& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.id,"id",db); ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
@ -412,7 +412,7 @@ template <> void Structure :: Convert<MLoopCol> (
MLoopCol& dest, MLoopCol& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Igno>(dest.r,"r",db); ReadField<ErrorPolicy_Igno>(dest.r,"r",db);
ReadField<ErrorPolicy_Igno>(dest.g,"g",db); ReadField<ErrorPolicy_Igno>(dest.g,"g",db);
@ -427,7 +427,7 @@ template <> void Structure :: Convert<MVert> (
MVert& dest, MVert& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadFieldArray<ErrorPolicy_Fail>(dest.co,"co",db); ReadFieldArray<ErrorPolicy_Fail>(dest.co,"co",db);
ReadFieldArray<ErrorPolicy_Fail>(dest.no,"no",db); ReadFieldArray<ErrorPolicy_Fail>(dest.no,"no",db);
@ -443,7 +443,7 @@ template <> void Structure :: Convert<MEdge> (
MEdge& dest, MEdge& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.v1,"v1",db); ReadField<ErrorPolicy_Fail>(dest.v1,"v1",db);
ReadField<ErrorPolicy_Fail>(dest.v2,"v2",db); ReadField<ErrorPolicy_Fail>(dest.v2,"v2",db);
@ -459,7 +459,7 @@ template <> void Structure :: Convert<MLoopUV> (
MLoopUV& dest, MLoopUV& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadFieldArray<ErrorPolicy_Igno>(dest.uv,"uv",db); ReadFieldArray<ErrorPolicy_Igno>(dest.uv,"uv",db);
ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db); ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
@ -472,7 +472,7 @@ template <> void Structure :: Convert<GroupObject> (
GroupObject& dest, GroupObject& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadFieldPtr<ErrorPolicy_Fail>(dest.prev,"*prev",db); ReadFieldPtr<ErrorPolicy_Fail>(dest.prev,"*prev",db);
ReadFieldPtr<ErrorPolicy_Fail>(dest.next,"*next",db); ReadFieldPtr<ErrorPolicy_Fail>(dest.next,"*next",db);
@ -486,7 +486,7 @@ template <> void Structure :: Convert<ListBase> (
ListBase& dest, ListBase& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadFieldPtr<ErrorPolicy_Igno>(dest.first,"*first",db); ReadFieldPtr<ErrorPolicy_Igno>(dest.first,"*first",db);
ReadFieldPtr<ErrorPolicy_Igno>(dest.last,"*last",db); ReadFieldPtr<ErrorPolicy_Igno>(dest.last,"*last",db);
@ -499,7 +499,7 @@ template <> void Structure :: Convert<MLoop> (
MLoop& dest, MLoop& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Igno>(dest.v,"v",db); ReadField<ErrorPolicy_Igno>(dest.v,"v",db);
ReadField<ErrorPolicy_Igno>(dest.e,"e",db); ReadField<ErrorPolicy_Igno>(dest.e,"e",db);
@ -512,7 +512,7 @@ template <> void Structure :: Convert<ModifierData> (
ModifierData& dest, ModifierData& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadFieldPtr<ErrorPolicy_Warn>(dest.next,"*next",db); ReadFieldPtr<ErrorPolicy_Warn>(dest.next,"*next",db);
ReadFieldPtr<ErrorPolicy_Warn>(dest.prev,"*prev",db); ReadFieldPtr<ErrorPolicy_Warn>(dest.prev,"*prev",db);
@ -528,7 +528,7 @@ template <> void Structure :: Convert<ID> (
ID& dest, ID& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadFieldArray<ErrorPolicy_Warn>(dest.name,"name",db); ReadFieldArray<ErrorPolicy_Warn>(dest.name,"name",db);
ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db); ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
@ -541,7 +541,7 @@ template <> void Structure :: Convert<MCol> (
MCol& dest, MCol& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.r,"r",db); ReadField<ErrorPolicy_Fail>(dest.r,"r",db);
ReadField<ErrorPolicy_Fail>(dest.g,"g",db); ReadField<ErrorPolicy_Fail>(dest.g,"g",db);
@ -556,7 +556,7 @@ template <> void Structure :: Convert<MPoly> (
MPoly& dest, MPoly& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Igno>(dest.loopstart,"loopstart",db); ReadField<ErrorPolicy_Igno>(dest.loopstart,"loopstart",db);
ReadField<ErrorPolicy_Igno>(dest.totloop,"totloop",db); ReadField<ErrorPolicy_Igno>(dest.totloop,"totloop",db);
@ -571,7 +571,7 @@ template <> void Structure :: Convert<Scene> (
Scene& dest, Scene& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.id,"id",db); ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
ReadFieldPtr<ErrorPolicy_Warn>(dest.camera,"*camera",db); ReadFieldPtr<ErrorPolicy_Warn>(dest.camera,"*camera",db);
@ -587,7 +587,7 @@ template <> void Structure :: Convert<Library> (
Library& dest, Library& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.id,"id",db); ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
ReadFieldArray<ErrorPolicy_Warn>(dest.name,"name",db); ReadFieldArray<ErrorPolicy_Warn>(dest.name,"name",db);
@ -602,7 +602,7 @@ template <> void Structure :: Convert<Tex> (
Tex& dest, Tex& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Igno>((short&)dest.imaflag,"imaflag",db); ReadField<ErrorPolicy_Igno>((short&)dest.imaflag,"imaflag",db);
ReadField<ErrorPolicy_Fail>((int&)dest.type,"type",db); ReadField<ErrorPolicy_Fail>((int&)dest.type,"type",db);
ReadFieldPtr<ErrorPolicy_Warn>(dest.ima,"*ima",db); ReadFieldPtr<ErrorPolicy_Warn>(dest.ima,"*ima",db);
@ -615,7 +615,7 @@ template <> void Structure :: Convert<Camera> (
Camera& dest, Camera& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.id,"id",db); ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
ReadField<ErrorPolicy_Warn>((int&)dest.type,"type",db); ReadField<ErrorPolicy_Warn>((int&)dest.type,"type",db);
@ -630,7 +630,7 @@ template <> void Structure :: Convert<MirrorModifierData> (
MirrorModifierData& dest, MirrorModifierData& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.modifier,"modifier",db); ReadField<ErrorPolicy_Fail>(dest.modifier,"modifier",db);
ReadField<ErrorPolicy_Igno>(dest.axis,"axis",db); ReadField<ErrorPolicy_Igno>(dest.axis,"axis",db);
@ -646,7 +646,7 @@ template <> void Structure :: Convert<Image> (
Image& dest, Image& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.id,"id",db); ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
ReadFieldArray<ErrorPolicy_Warn>(dest.name,"name",db); ReadFieldArray<ErrorPolicy_Warn>(dest.name,"name",db);

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -58,13 +58,13 @@ namespace Assimp {
// this file serves as input data to the `./scripts/genblenddna.py` // this file serves as input data to the `./scripts/genblenddna.py`
// script. This script generates the actual binding code to read a // script. This script generates the actual binding code to read a
// blender file with a possibly different DNA into our structures. // blender file with a possibly different DNA into our structures.
// Only `struct` declarations are considered and the following // Only `struct` declarations are considered and the following
// rules must be obeyed in order for the script to work properly: // rules must be obeyed in order for the script to work properly:
// //
// * C++ style comments only // * C++ style comments only
// //
// * Structures may include the primitive types char, int, short, // * Structures may include the primitive types char, int, short,
// float, double. Signedness specifiers are not allowed on // float, double. Signedness specifiers are not allowed on
// integers. Enum types are allowed, but they must have been // integers. Enum types are allowed, but they must have been
// defined in this header. // defined in this header.
// //
@ -103,13 +103,13 @@ struct Image;
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct ID : ElemBase { struct ID : ElemBase {
char name[24] WARN; char name[24] WARN;
short flag; short flag;
}; };
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct ListBase : ElemBase { struct ListBase : ElemBase {
boost::shared_ptr<ElemBase> first; boost::shared_ptr<ElemBase> first;
boost::shared_ptr<ElemBase> last; boost::shared_ptr<ElemBase> last;
}; };
@ -124,7 +124,7 @@ struct PackedFile : ElemBase {
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct GroupObject : ElemBase { struct GroupObject : ElemBase {
boost::shared_ptr<GroupObject> prev,next FAIL; boost::shared_ptr<GroupObject> prev,next FAIL;
boost::shared_ptr<Object> ob; boost::shared_ptr<Object> ob;
}; };
@ -140,7 +140,7 @@ struct Group : ElemBase {
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct World : ElemBase { struct World : ElemBase {
ID id FAIL; ID id FAIL;
}; };
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
@ -297,7 +297,7 @@ struct Mesh : ElemBase {
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct Library : ElemBase { struct Library : ElemBase {
ID id FAIL; ID id FAIL;
char name[240] WARN; char name[240] WARN;
char filename[240] FAIL; char filename[240] FAIL;
boost::shared_ptr<Library> parent WARN; boost::shared_ptr<Library> parent WARN;
@ -312,7 +312,7 @@ struct Camera : ElemBase {
ID id FAIL; ID id FAIL;
// struct AnimData *adt; // struct AnimData *adt;
Type type,flag WARN; Type type,flag WARN;
float angle WARN; float angle WARN;
@ -348,29 +348,29 @@ struct Lamp : ElemBase {
}; };
ID id FAIL; ID id FAIL;
//AnimData *adt; //AnimData *adt;
Type type FAIL; Type type FAIL;
short flags; short flags;
//int mode; //int mode;
short colormodel, totex; short colormodel, totex;
float r,g,b,k WARN; float r,g,b,k WARN;
//float shdwr, shdwg, shdwb; //float shdwr, shdwg, shdwb;
float energy, dist, spotsize, spotblend; float energy, dist, spotsize, spotblend;
//float haint; //float haint;
float att1, att2; float att1, att2;
//struct CurveMapping *curfalloff; //struct CurveMapping *curfalloff;
FalloffType falloff_type; FalloffType falloff_type;
//float clipsta, clipend, shadspotsize; //float clipsta, clipend, shadspotsize;
//float bias, soft, compressthresh; //float bias, soft, compressthresh;
//short bufsize, samp, buffers, filtertype; //short bufsize, samp, buffers, filtertype;
//char bufflag, buftype; //char bufflag, buftype;
//short ray_samp, ray_sampy, ray_sampz; //short ray_samp, ray_sampy, ray_sampz;
//short ray_samp_type; //short ray_samp_type;
//short area_shape; //short area_shape;
@ -402,11 +402,11 @@ struct Lamp : ElemBase {
// float YF_glowint, YF_glowofs; // float YF_glowint, YF_glowofs;
// short YF_glowtype, YF_pad2; // short YF_glowtype, YF_pad2;
//struct Ipo *ipo; //struct Ipo *ipo;
//struct MTex *mtex[18]; //struct MTex *mtex[18];
// short pr_texture; // short pr_texture;
//struct PreviewImage *preview; //struct PreviewImage *preview;
}; };
@ -459,7 +459,7 @@ struct ModifierData : ElemBase {
struct SubsurfModifierData : ElemBase { struct SubsurfModifierData : ElemBase {
enum Type { enum Type {
TYPE_CatmullClarke = 0x0, TYPE_CatmullClarke = 0x0,
TYPE_Simple = 0x1 TYPE_Simple = 0x1
}; };
@ -519,7 +519,7 @@ struct Object : ElemBase {
float obmat[4][4] WARN; float obmat[4][4] WARN;
float parentinv[4][4] WARN; float parentinv[4][4] WARN;
char parsubstr[32] WARN; char parsubstr[32] WARN;
Object* parent WARN; Object* parent WARN;
boost::shared_ptr<Object> track WARN; boost::shared_ptr<Object> track WARN;
@ -554,7 +554,7 @@ struct Scene : ElemBase {
struct Image : ElemBase { struct Image : ElemBase {
ID id FAIL; ID id FAIL;
char name[240] WARN; char name[240] WARN;
//struct anim *anim; //struct anim *anim;
@ -565,8 +565,8 @@ struct Image : ElemBase {
short tpageflag, totbind; short tpageflag, totbind;
short xrep, yrep; short xrep, yrep;
short twsta, twend; short twsta, twend;
//unsigned int bindcode; //unsigned int bindcode;
//unsigned int *repbind; //unsigned int *repbind;
boost::shared_ptr<PackedFile> packedfile; boost::shared_ptr<PackedFile> packedfile;
//struct PreviewImage * preview; //struct PreviewImage * preview;
@ -575,7 +575,7 @@ struct Image : ElemBase {
int lastused; int lastused;
short animspeed; short animspeed;
short gen_x, gen_y, gen_type; short gen_x, gen_y, gen_type;
}; };
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
@ -613,7 +613,7 @@ struct Tex : ElemBase {
}; };
ID id FAIL; ID id FAIL;
// AnimData *adt; // AnimData *adt;
//float noisesize, turbul; //float noisesize, turbul;
//float bright, contrast, rfac, gfac, bfac; //float bright, contrast, rfac, gfac, bfac;
@ -639,7 +639,7 @@ struct Tex : ElemBase {
//float cropxmin, cropymin, cropxmax, cropymax; //float cropxmin, cropymin, cropxmax, cropymax;
//int texfilter; //int texfilter;
//int afmax; //int afmax;
//short xrepeat, yrepeat; //short xrepeat, yrepeat;
//short extend; //short extend;
@ -653,7 +653,7 @@ struct Tex : ElemBase {
//ImageUser iuser; //ImageUser iuser;
//bNodeTree *nodetree; //bNodeTree *nodetree;
//Ipo *ipo; //Ipo *ipo;
boost::shared_ptr<Image> ima WARN; boost::shared_ptr<Image> ima WARN;
//PluginTex *plugin; //PluginTex *plugin;
//ColorBand *coba; //ColorBand *coba;

View File

@ -5,8 +5,8 @@ Open Asset Import Library (ASSIMP)
Copyright (c) 2006-2010, ASSIMP Development Team Copyright (c) 2006-2010, ASSIMP Development Team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the ASSIMP Development Team. written permission of the ASSIMP Development Team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2013, assimp team Copyright (c) 2006-2013, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -465,7 +465,7 @@ aiVector3D BlenderTessellatorP2T::GetEigenVectorFromLargestEigenValue( const aiM
lastV = v; lastV = v;
} }
return v; return v;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Adapted from: http://missingbytes.blogspot.co.uk/2012/06/fitting-plane-to-point-cloud.html // Adapted from: http://missingbytes.blogspot.co.uk/2012/06/fitting-plane-to-point-cloud.html

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2013, assimp team Copyright (c) 2006-2013, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Use these to toggle between GLU Tessellate or poly2tri // Use these to toggle between GLU Tessellate or poly2tri
// Note (acg) keep GLU Tesselate disabled by default - if it is turned on, // Note (acg) keep GLU Tesselate disabled by default - if it is turned on,
// assimp needs to be linked against GLU, which is currently not yet // assimp needs to be linked against GLU, which is currently not yet
// made configurable in CMake and potentially not wanted by most users // made configurable in CMake and potentially not wanted by most users
// as it requires a Gl environment. // as it requires a Gl environment.
#ifndef ASSIMP_BLEND_WITH_GLU_TESSELLATE #ifndef ASSIMP_BLEND_WITH_GLU_TESSELLATE

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -97,17 +97,17 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
virtual size_t Read( void *, virtual size_t Read( void *,
size_t, size_t,
size_t ) size_t )
{ {
return 0; return 0;
} }
// ------------------------------------------------------------------- // -------------------------------------------------------------------
virtual size_t Write(const void* pvBuffer, virtual size_t Write(const void* pvBuffer,
size_t pSize, size_t pSize,
size_t pCount) size_t pCount)
{ {
pSize *= pCount; pSize *= pCount;
if (cursor + pSize > cur_size) { if (cursor + pSize > cur_size) {
@ -118,14 +118,14 @@ public:
cursor += pSize; cursor += pSize;
file_size = std::max(file_size,cursor); file_size = std::max(file_size,cursor);
return pCount; return pCount;
} }
// ------------------------------------------------------------------- // -------------------------------------------------------------------
virtual aiReturn Seek(size_t pOffset, virtual aiReturn Seek(size_t pOffset,
aiOrigin pOrigin) aiOrigin pOrigin)
{ {
switch(pOrigin) switch(pOrigin)
{ {
case aiOrigin_CUR: case aiOrigin_CUR:
cursor += pOffset; cursor += pOffset;
@ -164,7 +164,7 @@ public:
} }
// ------------------------------------------------------------------- // -------------------------------------------------------------------
virtual void Flush() virtual void Flush()
{ {
// ignore // ignore
} }
@ -174,12 +174,12 @@ public:
private: private:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
void Grow(size_t need = 0) void Grow(size_t need = 0)
{ {
// 1.5 and phi are very heap-friendly growth factors (the first // 1.5 and phi are very heap-friendly growth factors (the first
// allows for frequent re-use of heap blocks, the second // allows for frequent re-use of heap blocks, the second
// forms a fibonacci sequence with similar characteristics - // forms a fibonacci sequence with similar characteristics -
// since this heavily depends on the heap implementation // since this heavily depends on the heap implementation
// and other factors as well, i'll just go with 1.5 since // and other factors as well, i'll just go with 1.5 since
// it is quicker to compute). // it is quicker to compute).
size_t new_size = std::max(initial, std::max( need, cur_size+(cur_size>>1) )); size_t new_size = std::max(initial, std::max( need, cur_size+(cur_size>>1) ));
@ -232,7 +232,7 @@ public:
public: public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
const char* GetMagicFileName() const const char* GetMagicFileName() const
{ {
return AI_BLOBIO_MAGIC; return AI_BLOBIO_MAGIC;
} }
@ -302,7 +302,7 @@ public:
} }
// ------------------------------------------------------------------- // -------------------------------------------------------------------
virtual void Close( IOStream* pFile) virtual void Close( IOStream* pFile)
{ {
delete pFile; delete pFile;
} }
@ -310,10 +310,10 @@ public:
private: private:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
void OnDestruct(const std::string& filename, BlobIOStream* child) void OnDestruct(const std::string& filename, BlobIOStream* child)
{ {
// we don't know in which the files are closed, so we // we don't know in which the files are closed, so we
// can't reliably say that the first must be the master // can't reliably say that the first must be the master
// file ... // file ...
blobs.push_back( BlobEntry(filename,child->GetBlob()) ); blobs.push_back( BlobEntry(filename,child->GetBlob()) );
} }
@ -325,13 +325,13 @@ private:
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
BlobIOStream :: ~BlobIOStream() BlobIOStream :: ~BlobIOStream()
{ {
creator->OnDestruct(file,this); creator->OnDestruct(file,this);
delete[] buffer; delete[] buffer;
} }
} // end Assimp } // end Assimp
#endif #endif

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2012, assimp team Copyright (c) 2006-2012, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -44,11 +44,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_C4D_IMPORTER #ifndef ASSIMP_BUILD_NO_C4D_IMPORTER
// no #ifdefing here, Cinema4D support is carried out in a branch of assimp // no #ifdefing here, Cinema4D support is carried out in a branch of assimp
// where it is turned on in the CMake settings. // where it is turned on in the CMake settings.
#ifndef _MSC_VER #ifndef _MSC_VER
# error C4D support is currently MSVC only # error C4D support is currently MSVC only
#endif #endif
#include "C4DImporter.h" #include "C4DImporter.h"
#include "TinyFormatter.h" #include "TinyFormatter.h"
@ -57,7 +57,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# define __C4D_64BIT # define __C4D_64BIT
#endif #endif
#define __PC #define __PC
#include "c4d_file.h" #include "c4d_file.h"
#include "default_alien_overloads.h" #include "default_alien_overloads.h"
@ -66,7 +66,7 @@ using namespace _melange_;
// overload this function and fill in your own unique data // overload this function and fill in your own unique data
void GetWriterInfo(LONG &id, String &appname) void GetWriterInfo(LONG &id, String &appname)
{ {
id = 2424226; id = 2424226;
appname = "Open Asset Import Library"; appname = "Open Asset Import Library";
} }
@ -127,8 +127,8 @@ void C4DImporter::SetupProperties(const Importer* /*pImp*/)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure. // Imports the given file into the given scene structure.
void C4DImporter::InternReadFile( const std::string& pFile, void C4DImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler) aiScene* pScene, IOSystem* pIOHandler)
{ {
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile)); boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile));
@ -141,7 +141,7 @@ void C4DImporter::InternReadFile( const std::string& pFile,
std::vector<uint8_t> mBuffer(file_size); std::vector<uint8_t> mBuffer(file_size);
file->Read(&mBuffer[0], 1, file_size); file->Read(&mBuffer[0], 1, file_size);
Filename f; Filename f;
f.SetMemoryReadMode(&mBuffer[0], file_size); f.SetMemoryReadMode(&mBuffer[0], file_size);
@ -197,7 +197,7 @@ void C4DImporter::InternReadFile( const std::string& pFile,
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool C4DImporter::ReadShader(aiMaterial* out, _melange_::BaseShader* shader) bool C4DImporter::ReadShader(aiMaterial* out, _melange_::BaseShader* shader)
{ {
// based on Melange sample code (C4DImportExport.cpp) // based on Melange sample code (C4DImportExport.cpp)
while(shader) { while(shader) {
@ -220,13 +220,13 @@ bool C4DImporter::ReadShader(aiMaterial* out, _melange_::BaseShader* shader)
{ {
if (lsl->GetType() == TypeFolder) if (lsl->GetType() == TypeFolder)
{ {
BlendFolder* const folder = dynamic_cast<BlendFolder*>(lsl); BlendFolder* const folder = dynamic_cast<BlendFolder*>(lsl);
LayerShaderLayer *subLsl = dynamic_cast<LayerShaderLayer*>(folder->m_Children.GetObject(0)); LayerShaderLayer *subLsl = dynamic_cast<LayerShaderLayer*>(folder->m_Children.GetObject(0));
while (subLsl) while (subLsl)
{ {
if (subLsl->GetType() == TypeShader) { if (subLsl->GetType() == TypeShader) {
BlendShader* const shader = dynamic_cast<BlendShader*>(subLsl); BlendShader* const shader = dynamic_cast<BlendShader*>(subLsl);
if(ReadShader(out, static_cast<BaseShader*>(shader->m_pLink->GetLink()))) { if(ReadShader(out, static_cast<BaseShader*>(shader->m_pLink->GetLink()))) {
return true; return true;
} }
@ -236,13 +236,13 @@ bool C4DImporter::ReadShader(aiMaterial* out, _melange_::BaseShader* shader)
} }
} }
else if (lsl->GetType() == TypeShader) { else if (lsl->GetType() == TypeShader) {
BlendShader* const shader = dynamic_cast<BlendShader*>(lsl); BlendShader* const shader = dynamic_cast<BlendShader*>(lsl);
if(ReadShader(out, static_cast<BaseShader*>(shader->m_pLink->GetLink()))) { if(ReadShader(out, static_cast<BaseShader*>(shader->m_pLink->GetLink()))) {
return true; return true;
} }
} }
lsl = lsl->GetNext(); lsl = lsl->GetNext();
} }
} }
else if ( shader->GetType() == Xbitmap ) else if ( shader->GetType() == Xbitmap )
@ -322,8 +322,8 @@ void C4DImporter::RecurseHierarchy(BaseObject* object, aiNode* parent)
while (object) while (object)
{ {
const String& name = object->GetName(); const String& name = object->GetName();
const LONG type = object->GetType(); const LONG type = object->GetType();
const Matrix& ml = object->GetMl(); const Matrix& ml = object->GetMl();
aiString string; aiString string;
name.GetCString(string.data, MAXLEN-1); name.GetCString(string.data, MAXLEN-1);
@ -350,8 +350,8 @@ void C4DImporter::RecurseHierarchy(BaseObject* object, aiNode* parent)
nd->mTransformation.c4 = ml.off.z; nd->mTransformation.c4 = ml.off.z;
nodes.push_back(nd); nodes.push_back(nd);
GeData data; GeData data;
if (type == Ocamera) if (type == Ocamera)
{ {
object->GetParameter(CAMERAOBJECT_FOV, data); object->GetParameter(CAMERAOBJECT_FOV, data);
@ -374,7 +374,7 @@ void C4DImporter::RecurseHierarchy(BaseObject* object, aiNode* parent)
else { else {
LogWarn("ignoring object: " + std::string(GetObjectTypeName(type))); LogWarn("ignoring object: " + std::string(GetObjectTypeName(type)));
} }
RecurseHierarchy(object->GetDown(), nd); RecurseHierarchy(object->GetDown(), nd);
object = object->GetNext(); object = object->GetNext();
} }
@ -421,7 +421,7 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object)
for (LONG i = 0; i < polyCount; i++) for (LONG i = 0; i < polyCount; i++)
{ {
vcount += 3; vcount += 3;
// TODO: do we also need to handle lines or points with similar checks? // TODO: do we also need to handle lines or points with similar checks?
if (polys[i].c != polys[i].d) if (polys[i].c != polys[i].d)
{ {
@ -538,7 +538,7 @@ aiMesh* C4DImporter::ReadMesh(BaseObject* object)
// copy tangents and bitangents // copy tangents and bitangents
if (tangents_src) { if (tangents_src) {
for(unsigned int k = 0; k < face->mNumIndices; ++k) { for(unsigned int k = 0; k < face->mNumIndices; ++k) {
LONG l; LONG l;
switch(k) { switch(k) {

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2012, assimp team Copyright (c) 2006-2012, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -98,7 +98,7 @@ protected:
void SetupProperties(const Importer* pImp); void SetupProperties(const Importer* pImp);
// -------------------- // --------------------
void InternReadFile( const std::string& pFile, aiScene* pScene, void InternReadFile( const std::string& pFile, aiScene* pScene,
IOSystem* pIOHandler); IOSystem* pIOHandler);
private: private:

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../include/assimp/IOSystem.hpp" #include "../include/assimp/IOSystem.hpp"
namespace Assimp { namespace Assimp {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Custom IOStream implementation for the C-API // Custom IOStream implementation for the C-API
class CIOStreamWrapper : public IOStream class CIOStreamWrapper : public IOStream
@ -62,8 +62,8 @@ public:
{} {}
// ................................................................... // ...................................................................
size_t Read(void* pvBuffer, size_t Read(void* pvBuffer,
size_t pSize, size_t pSize,
size_t pCount size_t pCount
){ ){
// need to typecast here as C has no void* // need to typecast here as C has no void*
@ -71,7 +71,7 @@ public:
} }
// ................................................................... // ...................................................................
size_t Write(const void* pvBuffer, size_t Write(const void* pvBuffer,
size_t pSize, size_t pSize,
size_t pCount size_t pCount
){ ){
@ -116,7 +116,7 @@ public:
// ................................................................... // ...................................................................
bool Exists( const char* pFile) const { bool Exists( const char* pFile) const {
aiFile* p = mFileSystem->OpenProc(mFileSystem,pFile,"rb"); aiFile* p = mFileSystem->OpenProc(mFileSystem,pFile,"rb");
if (p){ if (p){
mFileSystem->CloseProc(mFileSystem,p); mFileSystem->CloseProc(mFileSystem,p);
return true; return true;

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -76,7 +76,7 @@ static const float units[] = {
1.f/0.3048f, 1.f/0.3048f,
1.f/0.9144f, 1.f/0.9144f,
1.f/1609.344f 1.f/1609.344f
}; };
static const aiImporterDesc desc = { static const aiImporterDesc desc = {
"TrueSpace Object Importer", "TrueSpace Object Importer",
@ -98,12 +98,12 @@ COBImporter::COBImporter()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor, private as well // Destructor, private as well
COBImporter::~COBImporter() COBImporter::~COBImporter()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool COBImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const bool COBImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
{ {
const std::string& extension = GetExtension(pFile); const std::string& extension = GetExtension(pFile);
@ -139,8 +139,8 @@ void COBImporter::SetupProperties(const Importer* /*pImp*/)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure. // Imports the given file into the given scene structure.
void COBImporter::InternReadFile( const std::string& pFile, void COBImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler) aiScene* pScene, IOSystem* pIOHandler)
{ {
COB::Scene scene; COB::Scene scene;
@ -157,7 +157,7 @@ void COBImporter::InternReadFile( const std::string& pFile,
if (head[16]!='L') { if (head[16]!='L') {
ThrowException("File is big-endian, which is not supported"); ThrowException("File is big-endian, which is not supported");
} }
// load data into intermediate structures // load data into intermediate structures
if (head[15]=='A') { if (head[15]=='A') {
ReadAsciiFile(scene, stream.get()); ReadAsciiFile(scene, stream.get());
@ -176,7 +176,7 @@ void COBImporter::InternReadFile( const std::string& pFile,
for_each(Face& f,mesh.faces) { for_each(Face& f,mesh.faces) {
mesh.temp_map[f.material].push_back(&f); mesh.temp_map[f.material].push_back(&f);
} }
} }
} }
// count meshes // count meshes
@ -186,7 +186,7 @@ void COBImporter::InternReadFile( const std::string& pFile,
if (mesh.vertex_positions.size() && mesh.texture_coords.size()) { if (mesh.vertex_positions.size() && mesh.texture_coords.size()) {
pScene->mNumMeshes += mesh.temp_map.size(); pScene->mNumMeshes += mesh.temp_map.size();
} }
} }
} }
pScene->mMeshes = new aiMesh*[pScene->mNumMeshes](); pScene->mMeshes = new aiMesh*[pScene->mNumMeshes]();
pScene->mMaterials = new aiMaterial*[pScene->mNumMeshes](); pScene->mMaterials = new aiMaterial*[pScene->mNumMeshes]();
@ -282,8 +282,8 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
if (v.uv_idx >= ndmesh.texture_coords.size()) { if (v.uv_idx >= ndmesh.texture_coords.size()) {
ThrowException("UV index out of range"); ThrowException("UV index out of range");
} }
outmesh->mVertices[outmesh->mNumVertices] = ndmesh.vertex_positions[ v.pos_idx ]; outmesh->mVertices[outmesh->mNumVertices] = ndmesh.vertex_positions[ v.pos_idx ];
outmesh->mTextureCoords[0][outmesh->mNumVertices] = aiVector3D( outmesh->mTextureCoords[0][outmesh->mNumVertices] = aiVector3D(
ndmesh.texture_coords[ v.uv_idx ].x, ndmesh.texture_coords[ v.uv_idx ].x,
ndmesh.texture_coords[ v.uv_idx ].y, ndmesh.texture_coords[ v.uv_idx ].y,
0.f 0.f
@ -320,7 +320,7 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
} }
{ int shader; { int shader;
switch(min->shader) switch(min->shader)
{ {
case Material::FLAT: case Material::FLAT:
shader = aiShadingMode_Gouraud; shader = aiShadingMode_Gouraud;
@ -369,7 +369,7 @@ aiNode* COBImporter::BuildNodes(const Node& root,const Scene& scin,aiScene* fill
else if (Node::TYPE_LIGHT == root.type) { else if (Node::TYPE_LIGHT == root.type) {
const Light& ndlight = (const Light&)(root); const Light& ndlight = (const Light&)(root);
aiLight* outlight = fill->mLights[fill->mNumLights++] = new aiLight(); aiLight* outlight = fill->mLights[fill->mNumLights++] = new aiLight();
outlight->mName.Set(ndlight.name); outlight->mName.Set(ndlight.name);
outlight->mColorDiffuse = outlight->mColorAmbient = outlight->mColorSpecular = ndlight.color; outlight->mColorDiffuse = outlight->mColorAmbient = outlight->mColorSpecular = ndlight.color;
@ -479,7 +479,7 @@ void COBImporter::UnsupportedChunk_Ascii(LineSplitter& splitter, const ChunkInfo
// (HACK) - our current position in the stream is the beginning of the // (HACK) - our current position in the stream is the beginning of the
// head line of the next chunk. That's fine, but the caller is going // head line of the next chunk. That's fine, but the caller is going
// to call ++ on `splitter`, which we need to swallow to avoid // to call ++ on `splitter`, which we need to swallow to avoid
// missing the next line. // missing the next line.
splitter.get_stream().IncPtr(nfo.size); splitter.get_stream().IncPtr(nfo.size);
splitter.swallow_next_increment(); splitter.swallow_next_increment();
@ -554,14 +554,14 @@ void COBImporter::ReadBasicNodeInfo_Ascii(Node& msh, LineSplitter& splitter, con
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
template <typename T> template <typename T>
void COBImporter::ReadFloat3Tuple_Ascii(T& fill, const char** in) void COBImporter::ReadFloat3Tuple_Ascii(T& fill, const char** in)
{ {
const char* rgb = *in; const char* rgb = *in;
for(unsigned int i = 0; i < 3; ++i) { for(unsigned int i = 0; i < 3; ++i) {
SkipSpaces(&rgb); SkipSpaces(&rgb);
if (*rgb == ',')++rgb; if (*rgb == ',')++rgb;
SkipSpaces(&rgb); SkipSpaces(&rgb);
fill[i] = fast_atof(&rgb); fill[i] = fast_atof(&rgb);
} }
*in = rgb; *in = rgb;
@ -650,7 +650,7 @@ void COBImporter::ReadUnit_Ascii(Scene& out, LineSplitter& splitter, const Chunk
for_each(boost::shared_ptr< Node >& nd, out.nodes) { for_each(boost::shared_ptr< Node >& nd, out.nodes) {
if (nd->id == nfo.parent_id) { if (nd->id == nfo.parent_id) {
const unsigned int t=strtoul10(splitter[1]); const unsigned int t=strtoul10(splitter[1]);
nd->unit_scale = t>=sizeof(units)/sizeof(units[0])?( nd->unit_scale = t>=sizeof(units)/sizeof(units[0])?(
LogWarn_Ascii(splitter,format()<<t<<" is not a valid value for `Units` attribute in `Unit chunk` "<<nfo.id) LogWarn_Ascii(splitter,format()<<t<<" is not a valid value for `Units` attribute in `Unit chunk` "<<nfo.id)
,1.f):units[t]; ,1.f):units[t];
@ -696,7 +696,7 @@ void COBImporter::ReadLght_Ascii(Scene& out, LineSplitter& splitter, const Chunk
"Unknown kind of light source in `Lght` chunk "<<nfo.id<<" : "<<*splitter); "Unknown kind of light source in `Lght` chunk "<<nfo.id<<" : "<<*splitter);
msh.ltype = Light::SPOT; msh.ltype = Light::SPOT;
} }
++splitter; ++splitter;
if (!splitter.match_start("color ")) { if (!splitter.match_start("color ")) {
LogWarn_Ascii(splitter,format()<< LogWarn_Ascii(splitter,format()<<
@ -797,7 +797,7 @@ void COBImporter::ReadPolH_Ascii(Scene& out, LineSplitter& splitter, const Chunk
for(unsigned int cur = 0;cur < cnt && ++splitter;++cur) { for(unsigned int cur = 0;cur < cnt && ++splitter;++cur) {
const char* s = splitter->c_str(); const char* s = splitter->c_str();
aiVector3D& v = msh.vertex_positions[cur]; aiVector3D& v = msh.vertex_positions[cur];
SkipSpaces(&s); SkipSpaces(&s);
v.x = fast_atof(&s); v.x = fast_atof(&s);
@ -814,7 +814,7 @@ void COBImporter::ReadPolH_Ascii(Scene& out, LineSplitter& splitter, const Chunk
for(unsigned int cur = 0;cur < cnt && ++splitter;++cur) { for(unsigned int cur = 0;cur < cnt && ++splitter;++cur) {
const char* s = splitter->c_str(); const char* s = splitter->c_str();
aiVector2D& v = msh.texture_coords[cur]; aiVector2D& v = msh.texture_coords[cur];
SkipSpaces(&s); SkipSpaces(&s);
v.x = fast_atof(&s); v.x = fast_atof(&s);
@ -881,8 +881,8 @@ void COBImporter::ReadBitM_Ascii(Scene& /*out*/, LineSplitter& splitter, const C
/* /*
"\nThumbNailHdrSize %ld" "\nThumbNailHdrSize %ld"
"\nThumbHeader: %02hx 02hx %02hx " "\nThumbHeader: %02hx 02hx %02hx "
"\nColorBufSize %ld" "\nColorBufSize %ld"
"\nColorBufZipSize %ld" "\nColorBufZipSize %ld"
"\nZippedThumbnail: %02hx 02hx %02hx " "\nZippedThumbnail: %02hx 02hx %02hx "
*/ */
@ -1068,7 +1068,7 @@ void COBImporter::ReadPolH_Binary(COB::Scene& out, StreamReaderLE& reader, const
// with holes. Test data specific to COB is needed to confirm it. // with holes. Test data specific to COB is needed to confirm it.
if (msh.faces.empty()) { if (msh.faces.empty()) {
ThrowException(format("A hole is the first entity in the `PolH` chunk with id ") << nfo.id); ThrowException(format("A hole is the first entity in the `PolH` chunk with id ") << nfo.id);
} }
} }
else msh.faces.push_back(Face()); else msh.faces.push_back(Face());
Face& f = msh.faces.back(); Face& f = msh.faces.back();
@ -1094,7 +1094,7 @@ void COBImporter::ReadPolH_Binary(COB::Scene& out, StreamReaderLE& reader, const
} }
} }
if (nfo.version>4) { if (nfo.version>4) {
msh.draw_flags = reader.GetI4(); msh.draw_flags = reader.GetI4();
} }
nfo.version>5 && nfo.version<8 ? reader.GetI4() : 0; nfo.version>5 && nfo.version<8 ? reader.GetI4() : 0;
} }

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -51,7 +51,7 @@ struct aiNode;
namespace Assimp { namespace Assimp {
class LineSplitter; class LineSplitter;
// TinyFormatter.h // TinyFormatter.h
namespace Formatter { namespace Formatter {
template <typename T,typename TR, typename A> class basic_formatter; template <typename T,typename TR, typename A> class basic_formatter;
@ -66,7 +66,7 @@ namespace Assimp {
} }
// ------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------
/** Importer class to load TrueSpace files (cob,scn) up to v6. /** Importer class to load TrueSpace files (cob,scn) up to v6.
* *
* Currently relatively limited, loads only ASCII files and needs more test coverage. */ * Currently relatively limited, loads only ASCII files and needs more test coverage. */
// ------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------
@ -92,7 +92,7 @@ protected:
void SetupProperties(const Importer* pImp); void SetupProperties(const Importer* pImp);
// -------------------- // --------------------
void InternReadFile( const std::string& pFile, aiScene* pScene, void InternReadFile( const std::string& pFile, aiScene* pScene,
IOSystem* pIOHandler); IOSystem* pIOHandler);
private: private:

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ contributors may be used to endorse or promote products
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -137,9 +137,9 @@ struct Mesh : public Node
HIDE = 0x10 HIDE = 0x10
}; };
Mesh() Mesh()
: Node(TYPE_MESH) : Node(TYPE_MESH)
, draw_flags(SOLID) , draw_flags(SOLID)
{} {}
// vertex elements // vertex elements
@ -232,7 +232,7 @@ struct Material : ChunkInfo
float alpha, exp, ior,ka,ks; float alpha, exp, ior,ka,ks;
unsigned int matnum; unsigned int matnum;
Shader shader; Shader shader;
AutoFacet autofacet; AutoFacet autofacet;
float autofacet_angle; float autofacet_angle;
@ -245,7 +245,7 @@ struct Material : ChunkInfo
struct Bitmap : ChunkInfo struct Bitmap : ChunkInfo
{ {
Bitmap() : orig_size() {} Bitmap() : orig_size() {}
struct BitmapHeader struct BitmapHeader
{ {
}; };

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -71,7 +71,7 @@ static const aiImporterDesc desc = {
0, 0,
0, 0,
0, 0,
"csm" "csm"
}; };
@ -82,17 +82,17 @@ CSMImporter::CSMImporter()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor, private as well // Destructor, private as well
CSMImporter::~CSMImporter() CSMImporter::~CSMImporter()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool CSMImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const bool CSMImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
{ {
// check file extension // check file extension
const std::string extension = GetExtension(pFile); const std::string extension = GetExtension(pFile);
if( extension == "csm") if( extension == "csm")
return true; return true;
@ -118,8 +118,8 @@ void CSMImporter::SetupProperties(const Importer* pImp)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure. // Imports the given file into the given scene structure.
void CSMImporter::InternReadFile( const std::string& pFile, void CSMImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler) aiScene* pScene, IOSystem* pIOHandler)
{ {
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb")); boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
@ -281,7 +281,7 @@ void CSMImporter::InternReadFile( const std::string& pFile,
pScene->mRootNode->mChildren = new aiNode* [anim->mNumChannels]; pScene->mRootNode->mChildren = new aiNode* [anim->mNumChannels];
for (unsigned int i = 0; i < anim->mNumChannels;++i) { for (unsigned int i = 0; i < anim->mNumChannels;++i) {
aiNodeAnim* na = anim->mChannels[i]; aiNodeAnim* na = anim->mChannels[i];
aiNode* nd = pScene->mRootNode->mChildren[i] = new aiNode(); aiNode* nd = pScene->mRootNode->mChildren[i] = new aiNode();
nd->mName = anim->mChannels[i]->mNodeName; nd->mName = anim->mChannels[i]->mNodeName;
@ -297,7 +297,7 @@ void CSMImporter::InternReadFile( const std::string& pFile,
// mark the scene as incomplete and run SkeletonMeshBuilder on it // mark the scene as incomplete and run SkeletonMeshBuilder on it
pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE; pScene->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
if (!noSkeletonMesh) { if (!noSkeletonMesh) {
SkeletonMeshBuilder maker(pScene,pScene->mRootNode,true); SkeletonMeshBuilder maker(pScene,pScene->mRootNode,true);
} }

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -66,7 +66,7 @@ public:
public: public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
bool checkSig) const; bool checkSig) const;
protected: protected:
@ -78,7 +78,7 @@ protected:
void SetupProperties(const Importer* pImp); void SetupProperties(const Importer* pImp);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
void InternReadFile( const std::string& pFile, aiScene* pScene, void InternReadFile( const std::string& pFile, aiScene* pScene,
IOSystem* pIOHandler); IOSystem* pIOHandler);
private: private:

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,21 +25,21 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
/** @file Implementation of the post processing step to calculate /** @file Implementation of the post processing step to calculate
* tangents and bitangents for all imported meshes * tangents and bitangents for all imported meshes
*/ */
@ -112,7 +112,7 @@ void CalcTangentsProcess::Execute( aiScene* pScene)
bool CalcTangentsProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) bool CalcTangentsProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
{ {
// we assume that the mesh is still in the verbose vertex format where each face has its own set // we assume that the mesh is still in the verbose vertex format where each face has its own set
// of vertices and no vertices are shared between faces. Sadly I don't know any quick test to // of vertices and no vertices are shared between faces. Sadly I don't know any quick test to
// assert() it here. // assert() it here.
// assert( must be verbose, dammit); // assert( must be verbose, dammit);
@ -139,7 +139,7 @@ bool CalcTangentsProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
DefaultLogger::get()->error((Formatter::format("Failed to compute tangents; need UV data in channel"),configSourceUV)); DefaultLogger::get()->error((Formatter::format("Failed to compute tangents; need UV data in channel"),configSourceUV));
return false; return false;
} }
const float angleEpsilon = 0.9999f; const float angleEpsilon = 0.9999f;
std::vector<bool> vertexDone( pMesh->mNumVertices, false); std::vector<bool> vertexDone( pMesh->mNumVertices, false);
@ -154,7 +154,7 @@ bool CalcTangentsProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
const aiVector3D* meshTex = pMesh->mTextureCoords[configSourceUV]; const aiVector3D* meshTex = pMesh->mTextureCoords[configSourceUV];
aiVector3D* meshTang = pMesh->mTangents; aiVector3D* meshTang = pMesh->mTangents;
aiVector3D* meshBitang = pMesh->mBitangents; aiVector3D* meshBitang = pMesh->mBitangents;
// calculate the tangent and bitangent for every face // calculate the tangent and bitangent for every face
for( unsigned int a = 0; a < pMesh->mNumFaces; a++) for( unsigned int a = 0; a < pMesh->mNumFaces; a++)
{ {
@ -220,7 +220,7 @@ bool CalcTangentsProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
localTangent = meshNorm[p] ^ localBitangent; localTangent = meshNorm[p] ^ localBitangent;
localTangent.Normalize(); localTangent.Normalize();
} else { } else {
localBitangent = localTangent ^ meshNorm[p]; localBitangent = localTangent ^ meshNorm[p];
localBitangent.Normalize(); localBitangent.Normalize();
} }
} }
@ -256,10 +256,10 @@ bool CalcTangentsProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
} }
std::vector<unsigned int> verticesFound; std::vector<unsigned int> verticesFound;
const float fLimit = cosf(configMaxAngle); const float fLimit = cosf(configMaxAngle);
std::vector<unsigned int> closeVertices; std::vector<unsigned int> closeVertices;
// in the second pass we now smooth out all tangents and bitangents at the same local position // in the second pass we now smooth out all tangents and bitangents at the same local position
// if they are not too far off. // if they are not too far off.
for( unsigned int a = 0; a < pMesh->mNumVertices; a++) for( unsigned int a = 0; a < pMesh->mNumVertices; a++)
{ {

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,23 +23,23 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
*/ */
/** @file Defines a post processing step to calculate tangents and /** @file Defines a post processing step to calculate tangents and
bitangents on all imported meshes.*/ bitangents on all imported meshes.*/
#ifndef AI_CALCTANGENTSPROCESS_H_INC #ifndef AI_CALCTANGENTSPROCESS_H_INC
#define AI_CALCTANGENTSPROCESS_H_INC #define AI_CALCTANGENTSPROCESS_H_INC
@ -54,7 +54,7 @@ namespace Assimp
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** The CalcTangentsProcess calculates the tangent and bitangent for any vertex /** The CalcTangentsProcess calculates the tangent and bitangent for any vertex
* of all meshes. It is expected to be run before the JoinVerticesProcess runs * of all meshes. It is expected to be run before the JoinVerticesProcess runs
* because the joining of vertices also considers tangents and bitangents for * because the joining of vertices also considers tangents and bitangents for
* uniqueness. * uniqueness.
*/ */
class ASSIMP_API_WINONLY CalcTangentsProcess : public BaseProcess class ASSIMP_API_WINONLY CalcTangentsProcess : public BaseProcess

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -71,7 +71,7 @@ void ExportSceneCollada(const char* pFile, IOSystem* pIOSystem, const aiScene* p
std::string path = DefaultIOSystem::absolutePath(std::string(pFile)); std::string path = DefaultIOSystem::absolutePath(std::string(pFile));
std::string file = DefaultIOSystem::completeBaseName(std::string(pFile)); std::string file = DefaultIOSystem::completeBaseName(std::string(pFile));
// invoke the exporter // invoke the exporter
ColladaExporter iDoTheExportThing( pScene, pIOSystem, path, file); ColladaExporter iDoTheExportThing( pScene, pIOSystem, path, file);
// we're still here - export successfully completed. Write result to the given IOSYstem // we're still here - export successfully completed. Write result to the given IOSYstem
@ -99,7 +99,7 @@ ColladaExporter::ColladaExporter( const aiScene* pScene, IOSystem* pIOSystem, co
mSceneOwned = false; mSceneOwned = false;
// set up strings // set up strings
endstr = "\n"; endstr = "\n";
// start writing // start writing
WriteFile(); WriteFile();
@ -134,7 +134,7 @@ void ColladaExporter::WriteFile()
WriteSceneLibrary(); WriteSceneLibrary();
// useless Collada fu at the end, just in case we haven't had enough indirections, yet. // useless Collada fu at the end, just in case we haven't had enough indirections, yet.
mOutput << startstr << "<scene>" << endstr; mOutput << startstr << "<scene>" << endstr;
PushTag(); PushTag();
mOutput << startstr << "<instance_visual_scene url=\"#" + XMLEscape(mScene->mRootNode->mName.C_Str()) + "\" />" << endstr; mOutput << startstr << "<instance_visual_scene url=\"#" + XMLEscape(mScene->mRootNode->mName.C_Str()) + "\" />" << endstr;
@ -149,7 +149,7 @@ void ColladaExporter::WriteFile()
void ColladaExporter::WriteHeader() void ColladaExporter::WriteHeader()
{ {
static const float epsilon = 0.00001f; static const float epsilon = 0.00001f;
static const aiQuaternion x_rot(aiMatrix3x3( static const aiQuaternion x_rot(aiMatrix3x3(
0, -1, 0, 0, -1, 0,
1, 0, 0, 1, 0, 0,
0, 0, 1)); 0, 0, 1));
@ -228,19 +228,19 @@ void ColladaExporter::WriteHeader()
aiMetadata* meta = mScene->mRootNode->mMetaData; aiMetadata* meta = mScene->mRootNode->mMetaData;
aiString value; aiString value;
if (!meta || !meta->Get("Author", value)) if (!meta || !meta->Get("Author", value))
mOutput << startstr << "<author>" << "Assimp" << "</author>" << endstr; mOutput << startstr << "<author>" << "Assimp" << "</author>" << endstr;
else else
mOutput << startstr << "<author>" << XMLEscape(value.C_Str()) << "</author>" << endstr; mOutput << startstr << "<author>" << XMLEscape(value.C_Str()) << "</author>" << endstr;
if (!meta || !meta->Get("AuthoringTool", value)) if (!meta || !meta->Get("AuthoringTool", value))
mOutput << startstr << "<authoring_tool>" << "Assimp Exporter" << "</authoring_tool>" << endstr; mOutput << startstr << "<authoring_tool>" << "Assimp Exporter" << "</authoring_tool>" << endstr;
else else
mOutput << startstr << "<authoring_tool>" << XMLEscape(value.C_Str()) << "</authoring_tool>" << endstr; mOutput << startstr << "<authoring_tool>" << XMLEscape(value.C_Str()) << "</authoring_tool>" << endstr;
//mOutput << startstr << "<author>" << mScene->author.C_Str() << "</author>" << endstr; //mOutput << startstr << "<author>" << mScene->author.C_Str() << "</author>" << endstr;
//mOutput << startstr << "<authoring_tool>" << mScene->authoringTool.C_Str() << "</authoring_tool>" << endstr; //mOutput << startstr << "<authoring_tool>" << mScene->authoringTool.C_Str() << "</authoring_tool>" << endstr;
PopTag(); PopTag();
mOutput << startstr << "</contributor>" << endstr; mOutput << startstr << "</contributor>" << endstr;
mOutput << startstr << "<created>" << date_str << "</created>" << endstr; mOutput << startstr << "<created>" << date_str << "</created>" << endstr;
@ -533,9 +533,9 @@ void ColladaExporter::WriteImageEntry( const Surface& pSurface, const std::strin
if( !pSurface.texture.empty() ) if( !pSurface.texture.empty() )
{ {
mOutput << startstr << "<image id=\"" << XMLEscape(pNameAdd) << "\">" << endstr; mOutput << startstr << "<image id=\"" << XMLEscape(pNameAdd) << "\">" << endstr;
PushTag(); PushTag();
mOutput << startstr << "<init_from>"; mOutput << startstr << "<init_from>";
// URL encode image file name first, then XML encode on top // URL encode image file name first, then XML encode on top
std::stringstream imageUrlEncoded; std::stringstream imageUrlEncoded;
for( std::string::const_iterator it = pSurface.texture.begin(); it != pSurface.texture.end(); ++it ) for( std::string::const_iterator it = pSurface.texture.begin(); it != pSurface.texture.end(); ++it )
@ -676,10 +676,10 @@ void ColladaExporter::WriteMaterials()
// output textures if present // output textures if present
if( numTextures > 0 ) if( numTextures > 0 )
{ {
mOutput << startstr << "<library_images>" << endstr; mOutput << startstr << "<library_images>" << endstr;
PushTag(); PushTag();
for( std::vector<Material>::const_iterator it = materials.begin(); it != materials.end(); ++it ) for( std::vector<Material>::const_iterator it = materials.begin(); it != materials.end(); ++it )
{ {
const Material& mat = *it; const Material& mat = *it;
WriteImageEntry( mat.ambient, mat.name + "-ambient-image"); WriteImageEntry( mat.ambient, mat.name + "-ambient-image");
WriteImageEntry( mat.diffuse, mat.name + "-diffuse-image"); WriteImageEntry( mat.diffuse, mat.name + "-diffuse-image");
@ -835,7 +835,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
if( mesh->HasVertexColors( a) ) if( mesh->HasVertexColors( a) )
mOutput << startstr << "<input semantic=\"COLOR\" source=\"#" << idstrEscaped << "-color" << a << "\" " /*<< set=\"" << a << "\"" */ << " />" << endstr; mOutput << startstr << "<input semantic=\"COLOR\" source=\"#" << idstrEscaped << "-color" << a << "\" " /*<< set=\"" << a << "\"" */ << " />" << endstr;
} }
PopTag(); PopTag();
mOutput << startstr << "</vertices>" << endstr; mOutput << startstr << "</vertices>" << endstr;
@ -871,11 +871,11 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
// polygons // polygons
if (countPoly) if (countPoly)
{ {
mOutput << startstr << "<polylist count=\"" << countPoly << "\" material=\"defaultMaterial\">" << endstr; mOutput << startstr << "<polylist count=\"" << countPoly << "\" material=\"defaultMaterial\">" << endstr;
PushTag(); PushTag();
mOutput << startstr << "<input offset=\"0\" semantic=\"VERTEX\" source=\"#" << idstrEscaped << "-vertices\" />" << endstr; mOutput << startstr << "<input offset=\"0\" semantic=\"VERTEX\" source=\"#" << idstrEscaped << "-vertices\" />" << endstr;
mOutput << startstr << "<vcount>"; mOutput << startstr << "<vcount>";
for( size_t a = 0; a < mesh->mNumFaces; ++a ) for( size_t a = 0; a < mesh->mNumFaces; ++a )
{ {
@ -883,7 +883,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex)
mOutput << mesh->mFaces[a].mNumIndices << " "; mOutput << mesh->mFaces[a].mNumIndices << " ";
} }
mOutput << "</vcount>" << endstr; mOutput << "</vcount>" << endstr;
mOutput << startstr << "<p>"; mOutput << startstr << "<p>";
for( size_t a = 0; a < mesh->mNumFaces; ++a ) for( size_t a = 0; a < mesh->mNumFaces; ++a )
{ {
@ -935,7 +935,7 @@ void ColladaExporter::WriteFloatArray( const std::string& pIdString, FloatDataTy
mOutput << pData[a*3+0] << " "; mOutput << pData[a*3+0] << " ";
mOutput << pData[a*3+1] << " "; mOutput << pData[a*3+1] << " ";
} }
} }
else if( pType == FloatType_Color ) else if( pType == FloatType_Color )
{ {
for( size_t a = 0; a < pElementCount; ++a ) for( size_t a = 0; a < pElementCount; ++a )
@ -950,7 +950,7 @@ void ColladaExporter::WriteFloatArray( const std::string& pIdString, FloatDataTy
for( size_t a = 0; a < pElementCount * floatsPerElement; ++a ) for( size_t a = 0; a < pElementCount * floatsPerElement; ++a )
mOutput << pData[a] << " "; mOutput << pData[a] << " ";
} }
mOutput << "</float_array>" << endstr; mOutput << "</float_array>" << endstr;
PopTag(); PopTag();
// the usual Collada fun. Let's bloat it even more! // the usual Collada fun. Let's bloat it even more!
@ -1020,7 +1020,7 @@ void ColladaExporter::WriteNode(aiNode* pNode)
{ {
// the must have a name // the must have a name
if (pNode->mName.length == 0) if (pNode->mName.length == 0)
{ {
std::stringstream ss; std::stringstream ss;
ss << "Node_" << pNode; ss << "Node_" << pNode;
pNode->mName.Set(ss.str()); pNode->mName.Set(ss.str());

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -57,7 +57,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
struct aiScene; struct aiScene;
struct aiNode; struct aiNode;
namespace Assimp namespace Assimp
{ {
/// Helper class to export a given scene to a Collada file. Just for my personal /// Helper class to export a given scene to a Collada file. Just for my personal
@ -149,12 +149,12 @@ protected:
std::string endstr; std::string endstr;
// pair of color and texture - texture precedences color // pair of color and texture - texture precedences color
struct Surface struct Surface
{ {
bool exist; bool exist;
aiColor4D color; aiColor4D color;
std::string texture; std::string texture;
size_t channel; size_t channel;
Surface() { exist = false; channel = 0; } Surface() { exist = false; channel = 0; }
}; };
@ -168,7 +168,7 @@ protected:
{} {}
}; };
// summarize a material in an convinient way. // summarize a material in an convinient way.
struct Material struct Material
{ {
std::string name; std::string name;

View File

@ -7,8 +7,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ contributors may be used to endorse or promote products
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -94,7 +94,7 @@ struct Transform
{ {
std::string mID; ///< SID of the transform step, by which anim channels address their target node std::string mID; ///< SID of the transform step, by which anim channels address their target node
TransformType mType; TransformType mType;
float f[16]; ///< Interpretation of data depends on the type of the transformation float f[16]; ///< Interpretation of data depends on the type of the transformation
}; };
/** A collada camera. */ /** A collada camera. */
@ -132,7 +132,7 @@ struct Camera
/** A collada light source. */ /** A collada light source. */
struct Light struct Light
{ {
Light() Light()
: mType (aiLightSource_UNDEFINED) : mType (aiLightSource_UNDEFINED)
, mAttConstant (1.f) , mAttConstant (1.f)
@ -245,13 +245,13 @@ struct Node
std::vector<Transform> mTransforms; std::vector<Transform> mTransforms;
/** Meshes at this node */ /** Meshes at this node */
std::vector<MeshInstance> mMeshes; std::vector<MeshInstance> mMeshes;
/** Lights at this node */ /** Lights at this node */
std::vector<LightInstance> mLights; std::vector<LightInstance> mLights;
/** Cameras at this node */ /** Cameras at this node */
std::vector<CameraInstance> mCameras; std::vector<CameraInstance> mCameras;
/** Node instances at this node */ /** Node instances at this node */
std::vector<NodeInstance> mNodeInstances; std::vector<NodeInstance> mNodeInstances;
@ -260,14 +260,14 @@ struct Node
std::string mPrimaryCamera; std::string mPrimaryCamera;
//! Constructor. Begin with a zero parent //! Constructor. Begin with a zero parent
Node() { Node() {
mParent = NULL; mParent = NULL;
} }
//! Destructor: delete all children subsequently //! Destructor: delete all children subsequently
~Node() { ~Node() {
for( std::vector<Node*>::iterator it = mChildren.begin(); it != mChildren.end(); ++it) for( std::vector<Node*>::iterator it = mChildren.begin(); it != mChildren.end(); ++it)
delete *it; delete *it;
} }
}; };
@ -286,15 +286,15 @@ struct Accessor
size_t mSize; // size of an object, in elements (floats or strings, mostly 1) size_t mSize; // size of an object, in elements (floats or strings, mostly 1)
size_t mOffset; // in number of values size_t mOffset; // in number of values
size_t mStride; // Stride in number of values size_t mStride; // Stride in number of values
std::vector<std::string> mParams; // names of the data streams in the accessors. Empty string tells to ignore. std::vector<std::string> mParams; // names of the data streams in the accessors. Empty string tells to ignore.
size_t mSubOffset[4]; // Suboffset inside the object for the common 4 elements. For a vector, thats XYZ, for a color RGBA and so on. size_t mSubOffset[4]; // Suboffset inside the object for the common 4 elements. For a vector, thats XYZ, for a color RGBA and so on.
// For example, SubOffset[0] denotes which of the values inside the object is the vector X component. // For example, SubOffset[0] denotes which of the values inside the object is the vector X component.
std::string mSource; // URL of the source array std::string mSource; // URL of the source array
mutable const Data* mData; // Pointer to the source array, if resolved. NULL else mutable const Data* mData; // Pointer to the source array, if resolved. NULL else
Accessor() Accessor()
{ {
mCount = 0; mSize = 0; mOffset = 0; mStride = 0; mData = NULL; mCount = 0; mSize = 0; mOffset = 0; mStride = 0; mData = NULL;
mSubOffset[0] = mSubOffset[1] = mSubOffset[2] = mSubOffset[3] = 0; mSubOffset[0] = mSubOffset[1] = mSubOffset[2] = mSubOffset[3] = 0;
} }
}; };
@ -332,15 +332,15 @@ struct Mesh
for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS;++i) for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS;++i)
mNumUVComponents[i] = 2; mNumUVComponents[i] = 2;
} }
std::string mName; std::string mName;
// just to check if there's some sophisticated addressing involved... // just to check if there's some sophisticated addressing involved...
// which we don't support, and therefore should warn about. // which we don't support, and therefore should warn about.
std::string mVertexID; std::string mVertexID;
// Vertex data addressed by vertex indices // Vertex data addressed by vertex indices
std::vector<InputChannel> mPerVertexData; std::vector<InputChannel> mPerVertexData;
// actual mesh data, assembled on encounter of a <p> element. Verbose format, not indexed // actual mesh data, assembled on encounter of a <p> element. Verbose format, not indexed
std::vector<aiVector3D> mPositions; std::vector<aiVector3D> mPositions;
@ -355,8 +355,8 @@ struct Mesh
// Faces. Stored are only the number of vertices for each face. // Faces. Stored are only the number of vertices for each face.
// 1 == point, 2 == line, 3 == triangle, 4+ == poly // 1 == point, 2 == line, 3 == triangle, 4+ == poly
std::vector<size_t> mFaceSize; std::vector<size_t> mFaceSize;
// Position indices for all faces in the sequence given in mFaceSize - // Position indices for all faces in the sequence given in mFaceSize -
// necessary for bone weight assignment // necessary for bone weight assignment
std::vector<size_t> mFacePosIndices; std::vector<size_t> mFacePosIndices;
@ -381,7 +381,7 @@ enum PrimitiveType
struct Controller struct Controller
{ {
// the URL of the mesh deformed by the controller. // the URL of the mesh deformed by the controller.
std::string mMeshId; std::string mMeshId;
// accessor URL of the joint names // accessor URL of the joint names
std::string mJointNameSource; std::string mJointNameSource;
@ -392,7 +392,7 @@ struct Controller
// accessor URL of the joint inverse bind matrices // accessor URL of the joint inverse bind matrices
std::string mJointOffsetMatrixSource; std::string mJointOffsetMatrixSource;
// input channel: joint names. // input channel: joint names.
InputChannel mWeightInputJoints; InputChannel mWeightInputJoints;
// input channel: joint weights // input channel: joint weights
InputChannel mWeightInputWeights; InputChannel mWeightInputWeights;
@ -422,7 +422,7 @@ enum ParamType
struct EffectParam struct EffectParam
{ {
ParamType mType; ParamType mType;
std::string mReference; // to which other thing the param is referring to. std::string mReference; // to which other thing the param is referring to.
}; };
/** Shading type supported by the standard effect spec of Collada */ /** Shading type supported by the standard effect spec of Collada */
@ -526,7 +526,7 @@ struct Effect
// --------------------------------------------------------- // ---------------------------------------------------------
// Double-sided? // Double-sided?
bool mDoubleSided, mWireframe, mFaceted; bool mDoubleSided, mWireframe, mFaceted;
Effect() Effect()
: mShadeType (Shade_Phong) : mShadeType (Shade_Phong)
, mEmissive ( 0, 0, 0, 1) , mEmissive ( 0, 0, 0, 1)
@ -543,7 +543,7 @@ struct Effect
, mDoubleSided (false) , mDoubleSided (false)
, mWireframe (false) , mWireframe (false)
, mFaceted (false) , mFaceted (false)
{ {
} }
}; };
@ -566,8 +566,8 @@ struct Image
/** An animation channel. */ /** An animation channel. */
struct AnimationChannel struct AnimationChannel
{ {
/** URL of the data to animate. Could be about anything, but we support only the /** URL of the data to animate. Could be about anything, but we support only the
* "NodeID/TransformID.SubElement" notation * "NodeID/TransformID.SubElement" notation
*/ */
std::string mTarget; std::string mTarget;

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ contributors may be used to endorse or promote products
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -74,7 +74,7 @@ static const aiImporterDesc desc = {
3, 3,
1, 1,
5, 5,
"dae" "dae"
}; };
@ -93,12 +93,12 @@ ColladaLoader::~ColladaLoader()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool ColladaLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const bool ColladaLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
{ {
// check file extension // check file extension
std::string extension = GetExtension(pFile); std::string extension = GetExtension(pFile);
if( extension == "dae") if( extension == "dae")
return true; return true;
@ -132,7 +132,7 @@ const aiImporterDesc* ColladaLoader::GetInfo () const
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure. // Imports the given file into the given scene structure.
void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler)
{ {
mFileName = pFile; mFileName = pFile;
@ -170,21 +170,21 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I
FillMaterials(parser, pScene); FillMaterials(parser, pScene);
// Apply unitsize scale calculation // Apply unitsize scale calculation
pScene->mRootNode->mTransformation *= aiMatrix4x4(parser.mUnitSize, 0, 0, 0, pScene->mRootNode->mTransformation *= aiMatrix4x4(parser.mUnitSize, 0, 0, 0,
0, parser.mUnitSize, 0, 0, 0, parser.mUnitSize, 0, 0,
0, 0, parser.mUnitSize, 0, 0, 0, parser.mUnitSize, 0,
0, 0, 0, 1); 0, 0, 0, 1);
if( !ignoreUpDirection ) { if( !ignoreUpDirection ) {
// Convert to Y_UP, if different orientation // Convert to Y_UP, if different orientation
if( parser.mUpDirection == ColladaParser::UP_X) if( parser.mUpDirection == ColladaParser::UP_X)
pScene->mRootNode->mTransformation *= aiMatrix4x4( pScene->mRootNode->mTransformation *= aiMatrix4x4(
0, -1, 0, 0, 0, -1, 0, 0,
1, 0, 0, 0, 1, 0, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0,
0, 0, 0, 1); 0, 0, 0, 1);
else if( parser.mUpDirection == ColladaParser::UP_Z) else if( parser.mUpDirection == ColladaParser::UP_Z)
pScene->mRootNode->mTransformation *= aiMatrix4x4( pScene->mRootNode->mTransformation *= aiMatrix4x4(
1, 0, 0, 0, 1, 0, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0,
0, -1, 0, 0, 0, -1, 0, 0,
0, 0, 0, 1); 0, 0, 0, 1);
@ -207,7 +207,7 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I
// If no meshes have been loaded, it's probably just an animated skeleton. // If no meshes have been loaded, it's probably just an animated skeleton.
if (!pScene->mNumMeshes) { if (!pScene->mNumMeshes) {
if (!noSkeletonMesh) { if (!noSkeletonMesh) {
SkeletonMeshBuilder hero(pScene); SkeletonMeshBuilder hero(pScene);
} }
@ -282,9 +282,9 @@ void ColladaLoader::ResolveNodeInstances( const ColladaParser& pParser, const Co
if (!nd) { if (!nd) {
nd = FindNode(pParser.mRootNode,(*it).mNode); nd = FindNode(pParser.mRootNode,(*it).mNode);
} }
if (!nd) if (!nd)
DefaultLogger::get()->error("Collada: Unable to resolve reference to instanced node " + (*it).mNode); DefaultLogger::get()->error("Collada: Unable to resolve reference to instanced node " + (*it).mNode);
else { else {
// attach this node to the list of children // attach this node to the list of children
resolved.push_back(nd); resolved.push_back(nd);
@ -320,7 +320,7 @@ void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Coll
continue; continue;
} }
const Collada::Light* srcLight = &srcLightIt->second; const Collada::Light* srcLight = &srcLightIt->second;
// now fill our ai data structure // now fill our ai data structure
aiLight* out = new aiLight(); aiLight* out = new aiLight();
out->mName = pTarget->mName; out->mName = pTarget->mName;
@ -338,13 +338,13 @@ void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Coll
// convert falloff angle and falloff exponent in our representation, if given // convert falloff angle and falloff exponent in our representation, if given
if (out->mType == aiLightSource_SPOT) { if (out->mType == aiLightSource_SPOT) {
out->mAngleInnerCone = AI_DEG_TO_RAD( srcLight->mFalloffAngle ); out->mAngleInnerCone = AI_DEG_TO_RAD( srcLight->mFalloffAngle );
// ... some extension magic. // ... some extension magic.
if (srcLight->mOuterAngle >= ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET*(1-1e-6f)) if (srcLight->mOuterAngle >= ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET*(1-1e-6f))
{ {
// ... some deprecation magic. // ... some deprecation magic.
if (srcLight->mPenumbraAngle >= ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET*(1-1e-6f)) if (srcLight->mPenumbraAngle >= ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET*(1-1e-6f))
{ {
// 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 ....
@ -397,13 +397,13 @@ void ColladaLoader::BuildCamerasForNode( const ColladaParser& pParser, const Col
out->mClipPlaneFar = srcCamera->mZFar; out->mClipPlaneFar = srcCamera->mZFar;
out->mClipPlaneNear = srcCamera->mZNear; out->mClipPlaneNear = srcCamera->mZNear;
// ... but for the rest some values are optional // ... but for the rest some values are optional
// and we need to compute the others in any combination. // and we need to compute the others in any combination.
if (srcCamera->mAspect != 10e10f) if (srcCamera->mAspect != 10e10f)
out->mAspect = srcCamera->mAspect; out->mAspect = srcCamera->mAspect;
if (srcCamera->mHorFov != 10e10f) { if (srcCamera->mHorFov != 10e10f) {
out->mHorizontalFOV = srcCamera->mHorFov; out->mHorizontalFOV = srcCamera->mHorFov;
if (srcCamera->mVerFov != 10e10f && srcCamera->mAspect == 10e10f) { if (srcCamera->mVerFov != 10e10f && srcCamera->mAspect == 10e10f) {
out->mAspect = tan(AI_DEG_TO_RAD(srcCamera->mHorFov)) / out->mAspect = tan(AI_DEG_TO_RAD(srcCamera->mHorFov)) /
@ -480,7 +480,7 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
table = &meshMatIt->second; table = &meshMatIt->second;
meshMaterial = table->mMatName; meshMaterial = table->mMatName;
} }
else else
{ {
DefaultLogger::get()->warn( boost::str( boost::format( "Collada: No material specified for subgroup <%s> in geometry <%s>.") % submesh.mMaterial % mid.mMeshOrController)); DefaultLogger::get()->warn( boost::str( boost::format( "Collada: No material specified for subgroup <%s> in geometry <%s>.") % submesh.mMaterial % mid.mMeshOrController));
if( !mid.mMaterials.empty() ) if( !mid.mMaterials.empty() )
@ -516,7 +516,7 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
std::map<ColladaMeshIndex, size_t>::const_iterator dstMeshIt = mMeshIndexByID.find( index); std::map<ColladaMeshIndex, size_t>::const_iterator dstMeshIt = mMeshIndexByID.find( index);
if( dstMeshIt != mMeshIndexByID.end()) { if( dstMeshIt != mMeshIndexByID.end()) {
newMeshRefs.push_back( dstMeshIt->second); newMeshRefs.push_back( dstMeshIt->second);
} }
else else
{ {
// else we have to add the mesh to the collection and store its newly assigned index at the node // else we have to add the mesh to the collection and store its newly assigned index at the node
@ -549,11 +549,11 @@ void ColladaLoader::BuildMeshesForNode( const ColladaParser& pParser, const Coll
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Creates a mesh for the given ColladaMesh face subset and returns the newly created mesh // Creates a mesh for the given ColladaMesh face subset and returns the newly created mesh
aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::Mesh* pSrcMesh, const Collada::SubMesh& pSubMesh, aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::Mesh* pSrcMesh, const Collada::SubMesh& pSubMesh,
const Collada::Controller* pSrcController, size_t pStartVertex, size_t pStartFace) const Collada::Controller* pSrcController, size_t pStartVertex, size_t pStartFace)
{ {
aiMesh* dstMesh = new aiMesh; aiMesh* dstMesh = new aiMesh;
dstMesh->mName = pSrcMesh->mName; dstMesh->mName = pSrcMesh->mName;
// count the vertices addressed by its faces // count the vertices addressed by its faces
@ -563,11 +563,11 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
// copy positions // copy positions
dstMesh->mNumVertices = numVertices; dstMesh->mNumVertices = numVertices;
dstMesh->mVertices = new aiVector3D[numVertices]; dstMesh->mVertices = new aiVector3D[numVertices];
std::copy( pSrcMesh->mPositions.begin() + pStartVertex, pSrcMesh->mPositions.begin() + std::copy( pSrcMesh->mPositions.begin() + pStartVertex, pSrcMesh->mPositions.begin() +
pStartVertex + numVertices, dstMesh->mVertices); pStartVertex + numVertices, dstMesh->mVertices);
// normals, if given. HACK: (thom) Due to the glorious Collada spec we never // normals, if given. HACK: (thom) Due to the glorious Collada spec we never
// know if we have the same number of normals as there are positions. So we // know if we have the same number of normals as there are positions. So we
// also ignore any vertex attribute if it has a different count // also ignore any vertex attribute if it has a different count
if( pSrcMesh->mNormals.size() >= pStartVertex + numVertices) if( pSrcMesh->mNormals.size() >= pStartVertex + numVertices)
{ {
@ -576,19 +576,19 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
pStartVertex + numVertices, dstMesh->mNormals); pStartVertex + numVertices, dstMesh->mNormals);
} }
// tangents, if given. // tangents, if given.
if( pSrcMesh->mTangents.size() >= pStartVertex + numVertices) if( pSrcMesh->mTangents.size() >= pStartVertex + numVertices)
{ {
dstMesh->mTangents = new aiVector3D[numVertices]; dstMesh->mTangents = new aiVector3D[numVertices];
std::copy( pSrcMesh->mTangents.begin() + pStartVertex, pSrcMesh->mTangents.begin() + std::copy( pSrcMesh->mTangents.begin() + pStartVertex, pSrcMesh->mTangents.begin() +
pStartVertex + numVertices, dstMesh->mTangents); pStartVertex + numVertices, dstMesh->mTangents);
} }
// bitangents, if given. // bitangents, if given.
if( pSrcMesh->mBitangents.size() >= pStartVertex + numVertices) if( pSrcMesh->mBitangents.size() >= pStartVertex + numVertices)
{ {
dstMesh->mBitangents = new aiVector3D[numVertices]; dstMesh->mBitangents = new aiVector3D[numVertices];
std::copy( pSrcMesh->mBitangents.begin() + pStartVertex, pSrcMesh->mBitangents.begin() + std::copy( pSrcMesh->mBitangents.begin() + pStartVertex, pSrcMesh->mBitangents.begin() +
pStartVertex + numVertices, dstMesh->mBitangents); pStartVertex + numVertices, dstMesh->mBitangents);
} }
@ -601,7 +601,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
dstMesh->mTextureCoords[real] = new aiVector3D[numVertices]; dstMesh->mTextureCoords[real] = new aiVector3D[numVertices];
for( size_t b = 0; b < numVertices; ++b) for( size_t b = 0; b < numVertices; ++b)
dstMesh->mTextureCoords[real][b] = pSrcMesh->mTexCoords[a][pStartVertex+b]; dstMesh->mTextureCoords[real][b] = pSrcMesh->mTexCoords[a][pStartVertex+b];
dstMesh->mNumUVComponents[real] = pSrcMesh->mNumUVComponents[a]; dstMesh->mNumUVComponents[real] = pSrcMesh->mNumUVComponents[a];
++real; ++real;
} }
@ -848,7 +848,7 @@ void ColladaLoader::StoreSceneMaterials( aiScene* pScene)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Stores all animations // Stores all animations
void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pParser) void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pParser)
{ {
// recursivly collect all animations from the collada scene // recursivly collect all animations from the collada scene
@ -918,7 +918,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;
@ -989,7 +989,7 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
entry.mSubElement = 1; entry.mSubElement = 1;
else if( subElement == "Z") else if( subElement == "Z")
entry.mSubElement = 2; entry.mSubElement = 2;
else else
DefaultLogger::get()->warn( boost::str( boost::format( "Unknown anim subelement <%s>. Ignoring") % subElement)); DefaultLogger::get()->warn( boost::str( boost::format( "Unknown anim subelement <%s>. Ignoring") % subElement));
} else } else
{ {
@ -1002,9 +1002,9 @@ void ColladaLoader::CreateAnimation( aiScene* pScene, const ColladaParser& pPars
{ {
entry.mTransformId = srcChannel.mTarget.substr(slashPos + 1, bracketPos - slashPos - 1); entry.mTransformId = srcChannel.mTarget.substr(slashPos + 1, bracketPos - slashPos - 1);
std::string subElement = srcChannel.mTarget.substr(bracketPos); std::string subElement = srcChannel.mTarget.substr(bracketPos);
if (subElement == "(0)(0)") if (subElement == "(0)(0)")
entry.mSubElement = 0; entry.mSubElement = 0;
else if (subElement == "(1)(0)") else if (subElement == "(1)(0)")
entry.mSubElement = 1; entry.mSubElement = 1;
else if (subElement == "(2)(0)") else if (subElement == "(2)(0)")
@ -1259,7 +1259,7 @@ void ColladaLoader::AddTexture ( aiMaterial& mat, const ColladaParser& pParser,
mat.AddProperty((float*)&sampler.mWeighting , 1, mat.AddProperty((float*)&sampler.mWeighting , 1,
_AI_MATKEY_TEXBLEND_BASE, type, idx); _AI_MATKEY_TEXBLEND_BASE, type, idx);
// UV source index ... if we didn't resolve the mapping, it is actually just // UV source index ... if we didn't resolve the mapping, it is actually just
// a guess but it works in most cases. We search for the frst occurence of a // a guess but it works in most cases. We search for the frst occurence of a
// number in the channel name. We assume it is the zero-based index into the // number in the channel name. We assume it is the zero-based index into the
// UV channel array of all corresponding meshes. It could also be one-based // UV channel array of all corresponding meshes. It could also be one-based
@ -1289,7 +1289,7 @@ void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* /*pSce
for (std::vector<std::pair<Collada::Effect*, aiMaterial*> >::iterator it = newMats.begin(), for (std::vector<std::pair<Collada::Effect*, aiMaterial*> >::iterator it = newMats.begin(),
end = newMats.end(); it != end; ++it) end = newMats.end(); it != end; ++it)
{ {
aiMaterial& mat = (aiMaterial&)*it->second; aiMaterial& mat = (aiMaterial&)*it->second;
Collada::Effect& effect = *it->first; Collada::Effect& effect = *it->first;
// resolve shading mode // resolve shading mode
@ -1299,22 +1299,22 @@ void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* /*pSce
else { else {
switch( effect.mShadeType) switch( effect.mShadeType)
{ {
case Collada::Shade_Constant: case Collada::Shade_Constant:
shadeMode = aiShadingMode_NoShading; shadeMode = aiShadingMode_NoShading;
break; break;
case Collada::Shade_Lambert: case Collada::Shade_Lambert:
shadeMode = aiShadingMode_Gouraud; shadeMode = aiShadingMode_Gouraud;
break; break;
case Collada::Shade_Blinn: case Collada::Shade_Blinn:
shadeMode = aiShadingMode_Blinn; shadeMode = aiShadingMode_Blinn;
break; break;
case Collada::Shade_Phong: case Collada::Shade_Phong:
shadeMode = aiShadingMode_Phong; shadeMode = aiShadingMode_Phong;
break; break;
default: default:
DefaultLogger::get()->warn("Collada: Unrecognized shading mode, using gouraud shading"); DefaultLogger::get()->warn("Collada: Unrecognized shading mode, using gouraud shading");
shadeMode = aiShadingMode_Gouraud; shadeMode = aiShadingMode_Gouraud;
break; break;
} }
} }
@ -1350,7 +1350,7 @@ void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* /*pSce
if(effect.mRGBTransparency) { if(effect.mRGBTransparency) {
effect.mTransparency = 1.f - effect.mTransparent.a; effect.mTransparency = 1.f - effect.mTransparent.a;
} }
// Global option // Global option
if(invertTransparency) { if(invertTransparency) {
effect.mTransparency = 1.f - effect.mTransparency; effect.mTransparency = 1.f - effect.mTransparency;
@ -1364,7 +1364,7 @@ void ColladaLoader::FillMaterials( const ColladaParser& pParser, aiScene* /*pSce
} }
// add textures, if given // add textures, if given
if( !effect.mTexAmbient.mName.empty()) if( !effect.mTexAmbient.mName.empty())
/* It is merely a lightmap */ /* It is merely a lightmap */
AddTexture( mat, pParser, effect, effect.mTexAmbient, aiTextureType_LIGHTMAP); AddTexture( mat, pParser, effect, effect.mTexAmbient, aiTextureType_LIGHTMAP);
@ -1455,16 +1455,16 @@ aiString ColladaLoader::FindFilenameForEffectTexture( const ColladaParser& pPars
// find the image referred by this name in the image library of the scene // find the image referred by this name in the image library of the scene
ColladaParser::ImageLibrary::const_iterator imIt = pParser.mImageLibrary.find( name); ColladaParser::ImageLibrary::const_iterator imIt = pParser.mImageLibrary.find( name);
if( imIt == pParser.mImageLibrary.end()) if( imIt == pParser.mImageLibrary.end())
{ {
throw DeadlyImportError( boost::str( boost::format( throw DeadlyImportError( boost::str( boost::format(
"Collada: Unable to resolve effect texture entry \"%s\", ended up at ID \"%s\".") % pName % name)); "Collada: Unable to resolve effect texture entry \"%s\", ended up at ID \"%s\".") % pName % name));
} }
aiString result; aiString result;
// if this is an embedded texture image setup an aiTexture for it // if this is an embedded texture image setup an aiTexture for it
if (imIt->second.mFileName.empty()) if (imIt->second.mFileName.empty())
{ {
if (imIt->second.mImageData.empty()) { if (imIt->second.mImageData.empty()) {
throw DeadlyImportError("Collada: Invalid texture, no data or file reference given"); throw DeadlyImportError("Collada: Invalid texture, no data or file reference given");
@ -1491,7 +1491,7 @@ aiString ColladaLoader::FindFilenameForEffectTexture( const ColladaParser& pPars
// and add this texture to the list // and add this texture to the list
mTextures.push_back(tex); mTextures.push_back(tex);
} }
else else
{ {
result.Set( imIt->second.mFileName ); result.Set( imIt->second.mFileName );
ConvertPath(result); ConvertPath(result);
@ -1507,14 +1507,14 @@ void ColladaLoader::ConvertPath (aiString& ss)
// For the moment we're just stripping the file:// away to make it work. // For the moment we're just stripping the file:// away to make it work.
// Windoes doesn't seem to be able to find stuff like // Windoes doesn't seem to be able to find stuff like
// 'file://..\LWO\LWO2\MappingModes\earthSpherical.jpg' // 'file://..\LWO\LWO2\MappingModes\earthSpherical.jpg'
if (0 == strncmp(ss.data,"file://",7)) if (0 == strncmp(ss.data,"file://",7))
{ {
ss.length -= 7; ss.length -= 7;
memmove(ss.data,ss.data+7,ss.length); memmove(ss.data,ss.data+7,ss.length);
ss.data[ss.length] = '\0'; ss.data[ss.length] = '\0';
} }
// Maxon Cinema Collada Export writes "file:///C:\andsoon" with three slashes... // Maxon Cinema Collada Export writes "file:///C:\andsoon" with three slashes...
// I need to filter it without destroying linux paths starting with "/somewhere" // I need to filter it without destroying linux paths starting with "/somewhere"
if( ss.data[0] == '/' && isalpha( ss.data[1]) && ss.data[2] == ':' ) if( ss.data[0] == '/' && isalpha( ss.data[1]) && ss.data[2] == ':' )
{ {

View File

@ -7,8 +7,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ contributors may be used to endorse or promote products
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -60,17 +60,17 @@ struct ColladaMeshIndex
std::string mMeshID; std::string mMeshID;
size_t mSubMesh; size_t mSubMesh;
std::string mMaterial; std::string mMaterial;
ColladaMeshIndex( const std::string& pMeshID, size_t pSubMesh, const std::string& pMaterial) ColladaMeshIndex( const std::string& pMeshID, size_t pSubMesh, const std::string& pMaterial)
: mMeshID( pMeshID), mSubMesh( pSubMesh), mMaterial( pMaterial) : mMeshID( pMeshID), mSubMesh( pSubMesh), mMaterial( pMaterial)
{ } { }
bool operator < (const ColladaMeshIndex& p) const bool operator < (const ColladaMeshIndex& p) const
{ {
if( mMeshID == p.mMeshID) if( mMeshID == p.mMeshID)
{ {
if( mSubMesh == p.mSubMesh) if( mSubMesh == p.mSubMesh)
return mMaterial < p.mMaterial; return mMaterial < p.mMaterial;
else else
return mSubMesh < p.mSubMesh; return mSubMesh < p.mSubMesh;
} else } else
{ {
@ -80,7 +80,7 @@ struct ColladaMeshIndex
}; };
/** Loader class to read Collada scenes. Collada is over-engineered to death, with every new iteration bringing /** Loader class to read Collada scenes. Collada is over-engineered to death, with every new iteration bringing
* more useless stuff, so I limited the data to what I think is useful for games. * more useless stuff, so I limited the data to what I think is useful for games.
*/ */
class ColladaLoader : public BaseImporter class ColladaLoader : public BaseImporter
{ {
@ -90,7 +90,7 @@ public:
public: public:
/** Returns whether the class can handle the format of the given file. /** Returns whether the class can handle the format of the given file.
* See BaseImporter::CanRead() for details. */ * See BaseImporter::CanRead() for details. */
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const; bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const;
@ -102,7 +102,7 @@ protected:
void SetupProperties(const Importer* pImp); void SetupProperties(const Importer* pImp);
/** Imports the given file into the given scene structure. /** Imports the given file into the given scene structure.
* See BaseImporter::InternReadFile() for details * See BaseImporter::InternReadFile() for details
*/ */
void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler); void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
@ -115,19 +115,19 @@ protected:
std::vector<const Collada::Node*>& resolved); std::vector<const Collada::Node*>& resolved);
/** Builds meshes for the given node and references them */ /** Builds meshes for the given node and references them */
void BuildMeshesForNode( const ColladaParser& pParser, const Collada::Node* pNode, void BuildMeshesForNode( const ColladaParser& pParser, const Collada::Node* pNode,
aiNode* pTarget); aiNode* pTarget);
/** Creates a mesh for the given ColladaMesh face subset and returns the newly created mesh */ /** Creates a mesh for the given ColladaMesh face subset and returns the newly created mesh */
aiMesh* CreateMesh( const ColladaParser& pParser, const Collada::Mesh* pSrcMesh, const Collada::SubMesh& pSubMesh, aiMesh* CreateMesh( const ColladaParser& pParser, const Collada::Mesh* pSrcMesh, const Collada::SubMesh& pSubMesh,
const Collada::Controller* pSrcController, size_t pStartVertex, size_t pStartFace); const Collada::Controller* pSrcController, size_t pStartVertex, size_t pStartFace);
/** Builds cameras for the given node and references them */ /** Builds cameras for the given node and references them */
void BuildCamerasForNode( const ColladaParser& pParser, const Collada::Node* pNode, void BuildCamerasForNode( const ColladaParser& pParser, const Collada::Node* pNode,
aiNode* pTarget); aiNode* pTarget);
/** Builds lights for the given node and references them */ /** Builds lights for the given node and references them */
void BuildLightsForNode( const ColladaParser& pParser, const Collada::Node* pNode, void BuildLightsForNode( const ColladaParser& pParser, const Collada::Node* pNode,
aiNode* pTarget); aiNode* pTarget);
/** Stores all meshes in the given scene */ /** Stores all meshes in the given scene */
@ -145,7 +145,7 @@ protected:
/** Stores all textures in the given scene */ /** Stores all textures in the given scene */
void StoreSceneTextures( aiScene* pScene); void StoreSceneTextures( aiScene* pScene);
/** Stores all animations /** Stores all animations
* @param pScene target scene to store the anims * @param pScene target scene to store the anims
*/ */
void StoreAnimations( aiScene* pScene, const ColladaParser& pParser); void StoreAnimations( aiScene* pScene, const ColladaParser& pParser);
@ -159,7 +159,7 @@ protected:
/** 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);
/** Constructs materials from the collada material definitions */ /** Constructs materials from the collada material definitions */
void BuildMaterials( ColladaParser& pParser, aiScene* pScene); void BuildMaterials( ColladaParser& pParser, aiScene* pScene);
@ -177,7 +177,7 @@ protected:
aiTextureType type, unsigned int idx = 0); aiTextureType type, unsigned int idx = 0);
/** Resolves the texture name for the given effect texture entry */ /** Resolves the texture name for the given effect texture entry */
aiString FindFilenameForEffectTexture( const ColladaParser& pParser, aiString FindFilenameForEffectTexture( const ColladaParser& pParser,
const Collada::Effect& pEffect, const std::string& pName); const Collada::Effect& pEffect, const std::string& pName);
/** Converts a path read from a collada file to the usual representation */ /** Converts a path read from a collada file to the usual representation */

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ contributors may be used to endorse or promote products
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -129,7 +129,7 @@ void ColladaParser::ReadContents()
const int attrib = TestAttribute("version"); const int attrib = TestAttribute("version");
if (attrib != -1) { if (attrib != -1) {
const char* version = mReader->getAttributeValue(attrib); const char* version = mReader->getAttributeValue(attrib);
if (!::strncmp(version,"1.5",3)) { if (!::strncmp(version,"1.5",3)) {
mFormat = FV_1_5_n; mFormat = FV_1_5_n;
DefaultLogger::get()->debug("Collada schema version is 1.5.n"); DefaultLogger::get()->debug("Collada schema version is 1.5.n");
@ -164,7 +164,7 @@ void ColladaParser::ReadStructure()
while( mReader->read()) while( mReader->read())
{ {
// beginning of elements // beginning of elements
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
{ {
if( IsElement( "asset")) if( IsElement( "asset"))
ReadAssetInfo(); ReadAssetInfo();
@ -192,8 +192,8 @@ void ColladaParser::ReadStructure()
ReadScene(); ReadScene();
else else
SkipElement(); SkipElement();
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{ {
break; break;
} }
@ -225,7 +225,7 @@ void ColladaParser::ReadAssetInfo()
// consume the trailing stuff // consume the trailing stuff
if( !mReader->isEmptyElement()) if( !mReader->isEmptyElement())
SkipElement(); SkipElement();
} }
else if( IsElement( "up_axis")) else if( IsElement( "up_axis"))
{ {
// read content, strip whitespace, compare // read content, strip whitespace, compare
@ -243,7 +243,7 @@ void ColladaParser::ReadAssetInfo()
{ {
SkipElement(); SkipElement();
} }
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{ {
if( strcmp( mReader->getNodeName(), "asset") != 0) if( strcmp( mReader->getNodeName(), "asset") != 0)
@ -263,7 +263,7 @@ void ColladaParser::ReadAnimationLibrary()
while( mReader->read()) while( mReader->read())
{ {
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
{ {
if( IsElement( "animation")) if( IsElement( "animation"))
{ {
@ -275,7 +275,7 @@ void ColladaParser::ReadAnimationLibrary()
SkipElement(); SkipElement();
} }
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{ {
if( strcmp( mReader->getNodeName(), "library_animations") != 0) if( strcmp( mReader->getNodeName(), "library_animations") != 0)
ThrowException( "Expected end of <library_animations> element."); ThrowException( "Expected end of <library_animations> element.");
@ -312,7 +312,7 @@ void ColladaParser::ReadAnimation( Collada::Animation* pParent)
while( mReader->read()) while( mReader->read())
{ {
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
{ {
// we have subanimations // we have subanimations
if( IsElement( "animation")) if( IsElement( "animation"))
@ -327,12 +327,12 @@ void ColladaParser::ReadAnimation( Collada::Animation* pParent)
// recurse into the subelement // recurse into the subelement
ReadAnimation( anim); ReadAnimation( anim);
} }
else if( IsElement( "source")) else if( IsElement( "source"))
{ {
// possible animation data - we'll never know. Better store it // possible animation data - we'll never know. Better store it
ReadSource(); ReadSource();
} }
else if( IsElement( "sampler")) else if( IsElement( "sampler"))
{ {
// read the ID to assign the corresponding collada channel afterwards. // read the ID to assign the corresponding collada channel afterwards.
@ -342,7 +342,7 @@ void ColladaParser::ReadAnimation( Collada::Animation* pParent)
// have it read into a channel // have it read into a channel
ReadAnimationSampler( newChannel->second); ReadAnimationSampler( newChannel->second);
} }
else if( IsElement( "channel")) else if( IsElement( "channel"))
{ {
// the binding element whose whole purpose is to provide the target to animate // the binding element whose whole purpose is to provide the target to animate
@ -359,14 +359,14 @@ void ColladaParser::ReadAnimation( Collada::Animation* pParent)
if( !mReader->isEmptyElement()) if( !mReader->isEmptyElement())
SkipElement(); SkipElement();
} }
else else
{ {
// ignore the rest // ignore the rest
SkipElement(); SkipElement();
} }
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{ {
if( strcmp( mReader->getNodeName(), "animation") != 0) if( strcmp( mReader->getNodeName(), "animation") != 0)
ThrowException( "Expected end of <animation> element."); ThrowException( "Expected end of <animation> element.");
@ -403,7 +403,7 @@ void ColladaParser::ReadAnimationSampler( Collada::AnimationChannel& pChannel)
{ {
while( mReader->read()) while( mReader->read())
{ {
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
{ {
if( IsElement( "input")) if( IsElement( "input"))
{ {
@ -414,7 +414,7 @@ void ColladaParser::ReadAnimationSampler( Collada::AnimationChannel& pChannel)
if( source[0] != '#') if( source[0] != '#')
ThrowException( "Unsupported URL format"); ThrowException( "Unsupported URL format");
source++; source++;
if( strcmp( semantic, "INPUT") == 0) if( strcmp( semantic, "INPUT") == 0)
pChannel.mSourceTimes = source; pChannel.mSourceTimes = source;
else if( strcmp( semantic, "OUTPUT") == 0) else if( strcmp( semantic, "OUTPUT") == 0)
@ -422,14 +422,14 @@ void ColladaParser::ReadAnimationSampler( Collada::AnimationChannel& pChannel)
if( !mReader->isEmptyElement()) if( !mReader->isEmptyElement())
SkipElement(); SkipElement();
} }
else else
{ {
// ignore the rest // ignore the rest
SkipElement(); SkipElement();
} }
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{ {
if( strcmp( mReader->getNodeName(), "sampler") != 0) if( strcmp( mReader->getNodeName(), "sampler") != 0)
ThrowException( "Expected end of <sampler> element."); ThrowException( "Expected end of <sampler> element.");
@ -448,7 +448,7 @@ void ColladaParser::ReadControllerLibrary()
while( mReader->read()) while( mReader->read())
{ {
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
{ {
if( IsElement( "controller")) if( IsElement( "controller"))
{ {
@ -467,7 +467,7 @@ void ColladaParser::ReadControllerLibrary()
SkipElement(); SkipElement();
} }
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{ {
if( strcmp( mReader->getNodeName(), "library_controllers") != 0) if( strcmp( mReader->getNodeName(), "library_controllers") != 0)
ThrowException( "Expected end of <library_controllers> element."); ThrowException( "Expected end of <library_controllers> element.");
@ -483,21 +483,21 @@ void ColladaParser::ReadController( Collada::Controller& pController)
{ {
while( mReader->read()) while( mReader->read())
{ {
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
{ {
// two types of controllers: "skin" and "morph". Only the first one is relevant, we skip the other // two types of controllers: "skin" and "morph". Only the first one is relevant, we skip the other
if( IsElement( "morph")) if( IsElement( "morph"))
{ {
// should skip everything inside, so there's no danger of catching elements inbetween // should skip everything inside, so there's no danger of catching elements inbetween
SkipElement(); SkipElement();
} }
else if( IsElement( "skin")) else if( IsElement( "skin"))
{ {
// read the mesh it refers to. According to the spec this could also be another // read the mesh it refers to. According to the spec this could also be another
// controller, but I refuse to implement every single idea they've come up with // controller, but I refuse to implement every single idea they've come up with
int sourceIndex = GetAttribute( "source"); int sourceIndex = GetAttribute( "source");
pController.mMeshId = mReader->getAttributeValue( sourceIndex) + 1; pController.mMeshId = mReader->getAttributeValue( sourceIndex) + 1;
} }
else if( IsElement( "bind_shape_matrix")) else if( IsElement( "bind_shape_matrix"))
{ {
// content is 16 floats to define a matrix... it seems to be important for some models // content is 16 floats to define a matrix... it seems to be important for some models
@ -513,12 +513,12 @@ void ColladaParser::ReadController( Collada::Controller& pController)
} }
TestClosing( "bind_shape_matrix"); TestClosing( "bind_shape_matrix");
} }
else if( IsElement( "source")) else if( IsElement( "source"))
{ {
// data array - we have specialists to handle this // data array - we have specialists to handle this
ReadSource(); ReadSource();
} }
else if( IsElement( "joints")) else if( IsElement( "joints"))
{ {
ReadControllerJoints( pController); ReadControllerJoints( pController);
@ -533,7 +533,7 @@ void ColladaParser::ReadController( Collada::Controller& pController)
SkipElement(); SkipElement();
} }
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{ {
if( strcmp( mReader->getNodeName(), "controller") == 0) if( strcmp( mReader->getNodeName(), "controller") == 0)
break; break;
@ -549,7 +549,7 @@ void ColladaParser::ReadControllerJoints( Collada::Controller& pController)
{ {
while( mReader->read()) while( mReader->read())
{ {
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
{ {
// Input channels for joint data. Two possible semantics: "JOINT" and "INV_BIND_MATRIX" // Input channels for joint data. Two possible semantics: "JOINT" and "INV_BIND_MATRIX"
if( IsElement( "input")) if( IsElement( "input"))
@ -582,7 +582,7 @@ void ColladaParser::ReadControllerJoints( Collada::Controller& pController)
SkipElement(); SkipElement();
} }
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{ {
if( strcmp( mReader->getNodeName(), "joints") != 0) if( strcmp( mReader->getNodeName(), "joints") != 0)
ThrowException( "Expected end of <joints> element."); ThrowException( "Expected end of <joints> element.");
@ -603,7 +603,7 @@ void ColladaParser::ReadControllerWeights( Collada::Controller& pController)
while( mReader->read()) while( mReader->read())
{ {
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
{ {
// Input channels for weight data. Two possible semantics: "JOINT" and "WEIGHT" // Input channels for weight data. Two possible semantics: "JOINT" and "WEIGHT"
if( IsElement( "input") && vertexCount > 0 ) if( IsElement( "input") && vertexCount > 0 )
@ -652,7 +652,7 @@ void ColladaParser::ReadControllerWeights( Collada::Controller& pController)
TestClosing( "vcount"); TestClosing( "vcount");
// reserve weight count // reserve weight count
pController.mWeights.resize( numWeights); pController.mWeights.resize( numWeights);
} }
else if( IsElement( "v") && vertexCount > 0 ) else if( IsElement( "v") && vertexCount > 0 )
@ -680,7 +680,7 @@ void ColladaParser::ReadControllerWeights( Collada::Controller& pController)
SkipElement(); SkipElement();
} }
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{ {
if( strcmp( mReader->getNodeName(), "vertex_weights") != 0) if( strcmp( mReader->getNodeName(), "vertex_weights") != 0)
ThrowException( "Expected end of <vertex_weights> element."); ThrowException( "Expected end of <vertex_weights> element.");
@ -739,7 +739,7 @@ void ColladaParser::ReadImage( Collada::Image& pImage)
} }
else if( IsElement( "init_from")) else if( IsElement( "init_from"))
{ {
if (mFormat == FV_1_4_n) if (mFormat == FV_1_4_n)
{ {
// FIX: C4D exporter writes empty <init_from/> tags // FIX: C4D exporter writes empty <init_from/> tags
if (!mReader->isEmptyElement()) { if (!mReader->isEmptyElement()) {
@ -752,10 +752,10 @@ void ColladaParser::ReadImage( Collada::Image& pImage)
pImage.mFileName = "unknown_texture"; pImage.mFileName = "unknown_texture";
} }
} }
else if (mFormat == FV_1_5_n) else if (mFormat == FV_1_5_n)
{ {
// make sure we skip over mip and array initializations, which // make sure we skip over mip and array initializations, which
// we don't support, but which could confuse the loader if // we don't support, but which could confuse the loader if
// they're not skipped. // they're not skipped.
int attrib = TestAttribute("array_index"); int attrib = TestAttribute("array_index");
if (attrib != -1 && mReader->getAttributeValueAsInt(attrib) > 0) { if (attrib != -1 && mReader->getAttributeValueAsInt(attrib) > 0) {
@ -772,7 +772,7 @@ void ColladaParser::ReadImage( Collada::Image& pImage)
// TODO: correctly jump over cube and volume maps? // TODO: correctly jump over cube and volume maps?
} }
} }
else if (mFormat == FV_1_5_n) else if (mFormat == FV_1_5_n)
{ {
if( IsElement( "ref")) if( IsElement( "ref"))
{ {
@ -780,12 +780,12 @@ void ColladaParser::ReadImage( Collada::Image& pImage)
const char* sz = TestTextContent(); const char* sz = TestTextContent();
if (sz)pImage.mFileName = sz; if (sz)pImage.mFileName = sz;
TestClosing( "ref"); TestClosing( "ref");
} }
else if( IsElement( "hex") && !pImage.mFileName.length()) else if( IsElement( "hex") && !pImage.mFileName.length())
{ {
// embedded image. get format // embedded image. get format
const int attrib = TestAttribute("format"); const int attrib = TestAttribute("format");
if (-1 == attrib) if (-1 == attrib)
DefaultLogger::get()->warn("Collada: Unknown image file format"); DefaultLogger::get()->warn("Collada: Unknown image file format");
else pImage.mEmbeddedFormat = mReader->getAttributeValue(attrib); else pImage.mEmbeddedFormat = mReader->getAttributeValue(attrib);
@ -798,13 +798,13 @@ void ColladaParser::ReadImage( Collada::Image& pImage)
const unsigned int size = (unsigned int)(cur-data) * 2; const unsigned int size = (unsigned int)(cur-data) * 2;
pImage.mImageData.resize(size); pImage.mImageData.resize(size);
for (unsigned int i = 0; i < size;++i) for (unsigned int i = 0; i < size;++i)
pImage.mImageData[i] = HexOctetToDecimal(data+(i<<1)); pImage.mImageData[i] = HexOctetToDecimal(data+(i<<1));
TestClosing( "hex"); TestClosing( "hex");
} }
} }
else else
{ {
// ignore the rest // ignore the rest
SkipElement(); SkipElement();
@ -827,7 +827,7 @@ void ColladaParser::ReadMaterialLibrary()
std::map<std::string, int> names; std::map<std::string, int> names;
while( mReader->read()) while( mReader->read())
{ {
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
{ {
if( IsElement( "material")) if( IsElement( "material"))
{ {
@ -867,7 +867,7 @@ void ColladaParser::ReadMaterialLibrary()
SkipElement(); SkipElement();
} }
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{ {
if( strcmp( mReader->getNodeName(), "library_materials") != 0) if( strcmp( mReader->getNodeName(), "library_materials") != 0)
ThrowException( "Expected end of <library_materials> element."); ThrowException( "Expected end of <library_materials> element.");
@ -928,9 +928,9 @@ void ColladaParser::ReadCameraLibrary()
std::string id = mReader->getAttributeValue( attrID); std::string id = mReader->getAttributeValue( attrID);
// create an entry and store it in the library under its ID // create an entry and store it in the library under its ID
Camera& cam = mCameraLibrary[id]; Camera& cam = mCameraLibrary[id];
attrID = TestAttribute( "name"); attrID = TestAttribute( "name");
if (attrID != -1) if (attrID != -1)
cam.mName = mReader->getAttributeValue( attrID); cam.mName = mReader->getAttributeValue( attrID);
ReadCamera(cam); ReadCamera(cam);
@ -1011,10 +1011,10 @@ void ColladaParser::ReadLight( Collada::Light& pLight)
else if (IsElement("color")) { else if (IsElement("color")) {
// text content contains 3 floats // text content contains 3 floats
const char* content = GetTextContent(); const char* content = GetTextContent();
content = fast_atoreal_move<float>( content, (float&)pLight.mColor.r); content = fast_atoreal_move<float>( content, (float&)pLight.mColor.r);
SkipSpacesAndLineEnd( &content); SkipSpacesAndLineEnd( &content);
content = fast_atoreal_move<float>( content, (float&)pLight.mColor.g); content = fast_atoreal_move<float>( content, (float&)pLight.mColor.g);
SkipSpacesAndLineEnd( &content); SkipSpacesAndLineEnd( &content);
@ -1043,7 +1043,7 @@ void ColladaParser::ReadLight( Collada::Light& pLight)
pLight.mFalloffExponent = ReadFloatFromTextContent(); pLight.mFalloffExponent = ReadFloatFromTextContent();
TestClosing("falloff_exponent"); TestClosing("falloff_exponent");
} }
// FCOLLADA extensions // FCOLLADA extensions
// ------------------------------------------------------- // -------------------------------------------------------
else if (IsElement("outer_cone")) { else if (IsElement("outer_cone")) {
pLight.mOuterAngle = ReadFloatFromTextContent(); pLight.mOuterAngle = ReadFloatFromTextContent();
@ -1165,7 +1165,7 @@ void ColladaParser::ReadEffect( Collada::Effect& pEffect)
else else
SkipElement(); SkipElement();
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{ {
if( strcmp( mReader->getNodeName(), "effect") != 0) if( strcmp( mReader->getNodeName(), "effect") != 0)
ThrowException( "Expected end of <effect> element."); ThrowException( "Expected end of <effect> element.");
@ -1181,7 +1181,7 @@ void ColladaParser::ReadEffectProfileCommon( Collada::Effect& pEffect)
{ {
while( mReader->read()) while( mReader->read())
{ {
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
{ {
if( IsElement( "newparam")) { if( IsElement( "newparam")) {
// save ID // save ID
@ -1189,7 +1189,7 @@ void ColladaParser::ReadEffectProfileCommon( Collada::Effect& pEffect)
std::string sid = mReader->getAttributeValue( attrSID); std::string sid = mReader->getAttributeValue( attrSID);
pEffect.mParams[sid] = EffectParam(); pEffect.mParams[sid] = EffectParam();
ReadEffectParam( pEffect.mParams[sid]); ReadEffectParam( pEffect.mParams[sid]);
} }
else if( IsElement( "technique") || IsElement( "extra")) else if( IsElement( "technique") || IsElement( "extra"))
{ {
// just syntactic sugar // just syntactic sugar
@ -1252,7 +1252,7 @@ void ColladaParser::ReadEffectProfileCommon( Collada::Effect& pEffect)
else if( IsElement( "index_of_refraction")) else if( IsElement( "index_of_refraction"))
ReadEffectFloat( pEffect.mRefractIndex); ReadEffectFloat( pEffect.mRefractIndex);
// GOOGLEEARTH/OKINO extensions // GOOGLEEARTH/OKINO extensions
// ------------------------------------------------------- // -------------------------------------------------------
else if( IsElement( "double_sided")) else if( IsElement( "double_sided"))
pEffect.mDoubleSided = ReadBoolFromTextContent(); pEffect.mDoubleSided = ReadBoolFromTextContent();
@ -1274,7 +1274,7 @@ void ColladaParser::ReadEffectProfileCommon( Collada::Effect& pEffect)
pEffect.mFaceted = ReadBoolFromTextContent(); pEffect.mFaceted = ReadBoolFromTextContent();
TestClosing( "faceted"); TestClosing( "faceted");
} }
else else
{ {
// ignore the rest // ignore the rest
SkipElement(); SkipElement();
@ -1284,7 +1284,7 @@ void ColladaParser::ReadEffectProfileCommon( Collada::Effect& pEffect)
if( strcmp( mReader->getNodeName(), "profile_COMMON") == 0) if( strcmp( mReader->getNodeName(), "profile_COMMON") == 0)
{ {
break; break;
} }
} }
} }
} }
@ -1340,17 +1340,17 @@ void ColladaParser::ReadSamplerProperties( Sampler& out )
TestClosing( "rotateUV"); TestClosing( "rotateUV");
} }
else if( IsElement( "blend_mode")) { else if( IsElement( "blend_mode")) {
const char* sz = GetTextContent(); const char* sz = GetTextContent();
// http://www.feelingsoftware.com/content/view/55/72/lang,en/ // http://www.feelingsoftware.com/content/view/55/72/lang,en/
// NONE, OVER, IN, OUT, ADD, SUBTRACT, MULTIPLY, DIFFERENCE, LIGHTEN, DARKEN, SATURATE, DESATURATE and ILLUMINATE // NONE, OVER, IN, OUT, ADD, SUBTRACT, MULTIPLY, DIFFERENCE, LIGHTEN, DARKEN, SATURATE, DESATURATE and ILLUMINATE
if (0 == ASSIMP_strincmp(sz,"ADD",3)) if (0 == ASSIMP_strincmp(sz,"ADD",3))
out.mOp = aiTextureOp_Add; out.mOp = aiTextureOp_Add;
else if (0 == ASSIMP_strincmp(sz,"SUBTRACT",8)) else if (0 == ASSIMP_strincmp(sz,"SUBTRACT",8))
out.mOp = aiTextureOp_Subtract; out.mOp = aiTextureOp_Subtract;
else if (0 == ASSIMP_strincmp(sz,"MULTIPLY",8)) else if (0 == ASSIMP_strincmp(sz,"MULTIPLY",8))
out.mOp = aiTextureOp_Multiply; out.mOp = aiTextureOp_Multiply;
else { else {
@ -1398,7 +1398,7 @@ void ColladaParser::ReadEffectColor( aiColor4D& pColor, Sampler& pSampler)
if( IsElement( "color")) if( IsElement( "color"))
{ {
// text content contains 4 floats // text content contains 4 floats
const char* content = GetTextContent(); const char* content = GetTextContent();
content = fast_atoreal_move<float>( content, (float&)pColor.r); content = fast_atoreal_move<float>( content, (float&)pColor.r);
SkipSpacesAndLineEnd( &content); SkipSpacesAndLineEnd( &content);
@ -1412,7 +1412,7 @@ void ColladaParser::ReadEffectColor( aiColor4D& pColor, Sampler& pSampler)
content = fast_atoreal_move<float>( content, (float&)pColor.a); content = fast_atoreal_move<float>( content, (float&)pColor.a);
SkipSpacesAndLineEnd( &content); SkipSpacesAndLineEnd( &content);
TestClosing( "color"); TestClosing( "color");
} }
else if( IsElement( "texture")) else if( IsElement( "texture"))
{ {
// get name of source textur/sampler // get name of source textur/sampler
@ -1484,7 +1484,7 @@ void ColladaParser::ReadEffectFloat( float& pFloat)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Reads an effect parameter specification of any kind // Reads an effect parameter specification of any kind
void ColladaParser::ReadEffectParam( Collada::EffectParam& pParam) void ColladaParser::ReadEffectParam( Collada::EffectParam& pParam)
{ {
while( mReader->read()) while( mReader->read())
@ -1501,7 +1501,7 @@ void ColladaParser::ReadEffectParam( Collada::EffectParam& pParam)
// don't care for remaining stuff // don't care for remaining stuff
SkipElement( "surface"); SkipElement( "surface");
} }
else if( IsElement( "sampler2D")) else if( IsElement( "sampler2D"))
{ {
// surface ID is given inside <source> tags // surface ID is given inside <source> tags
@ -1548,7 +1548,7 @@ void ColladaParser::ReadGeometryLibrary()
// create a mesh and store it in the library under its ID // create a mesh and store it in the library under its ID
Mesh* mesh = new Mesh; Mesh* mesh = new Mesh;
mMeshLibrary[id] = mesh; mMeshLibrary[id] = mesh;
// read the mesh name if it exists // read the mesh name if it exists
const int nameIndex = TestAttribute("name"); const int nameIndex = TestAttribute("name");
if(nameIndex != -1) if(nameIndex != -1)
@ -1627,7 +1627,7 @@ void ColladaParser::ReadMesh( Mesh* pMesh)
ReadVertexData( pMesh); ReadVertexData( pMesh);
} }
else if( IsElement( "triangles") || IsElement( "lines") || IsElement( "linestrips") else if( IsElement( "triangles") || IsElement( "lines") || IsElement( "linestrips")
|| IsElement( "polygons") || IsElement( "polylist") || IsElement( "trifans") || IsElement( "tristrips")) || IsElement( "polygons") || IsElement( "polylist") || IsElement( "trifans") || IsElement( "tristrips"))
{ {
// read per-index mesh data and faces setup // read per-index mesh data and faces setup
ReadIndexData( pMesh); ReadIndexData( pMesh);
@ -1642,7 +1642,7 @@ void ColladaParser::ReadMesh( Mesh* pMesh)
if( strcmp( mReader->getNodeName(), "technique_common") == 0) if( strcmp( mReader->getNodeName(), "technique_common") == 0)
{ {
// end of another meaningless element - read over it // end of another meaningless element - read over it
} }
else if( strcmp( mReader->getNodeName(), "mesh") == 0) else if( strcmp( mReader->getNodeName(), "mesh") == 0)
{ {
// end of <mesh> element - we're done here // end of <mesh> element - we're done here
@ -1657,7 +1657,7 @@ void ColladaParser::ReadMesh( Mesh* pMesh)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Reads a source element // Reads a source element
void ColladaParser::ReadSource() void ColladaParser::ReadSource()
{ {
int indexID = GetAttribute( "id"); int indexID = GetAttribute( "id");
@ -1673,7 +1673,7 @@ void ColladaParser::ReadSource()
} }
else if( IsElement( "technique_common")) else if( IsElement( "technique_common"))
{ {
// I don't care for your profiles // I don't care for your profiles
} }
else if( IsElement( "accessor")) else if( IsElement( "accessor"))
{ {
@ -1724,8 +1724,8 @@ void ColladaParser::ReadDataArray()
data.mIsStringArray = isStringArray; data.mIsStringArray = isStringArray;
// some exporters write empty data arrays, but we need to conserve them anyways because others might reference them // some exporters write empty data arrays, but we need to conserve them anyways because others might reference them
if (content) if (content)
{ {
if( isStringArray) if( isStringArray)
{ {
data.mStrings.reserve( count); data.mStrings.reserve( count);
@ -1827,7 +1827,7 @@ void ColladaParser::ReadAccessor( const std::string& pID)
else if( name == "S") acc.mSubOffset[0] = acc.mParams.size(); else if( name == "S") acc.mSubOffset[0] = acc.mParams.size();
else if( name == "T") acc.mSubOffset[1] = acc.mParams.size(); else if( name == "T") acc.mSubOffset[1] = acc.mParams.size();
else if( name == "P") acc.mSubOffset[2] = acc.mParams.size(); else if( name == "P") acc.mSubOffset[2] = acc.mParams.size();
// else if( name == "Q") acc.mSubOffset[3] = acc.mParams.size(); // else if( name == "Q") acc.mSubOffset[3] = acc.mParams.size();
/* 4D uv coordinates are not supported in Assimp */ /* 4D uv coordinates are not supported in Assimp */
/* Generic extra data, interpreted as UV data, too*/ /* Generic extra data, interpreted as UV data, too*/
@ -1841,13 +1841,13 @@ void ColladaParser::ReadAccessor( const std::string& pID)
int attrType = TestAttribute( "type"); int attrType = TestAttribute( "type");
if( attrType > -1) if( attrType > -1)
{ {
// for the moment we only distinguish between a 4x4 matrix and anything else. // for the moment we only distinguish between a 4x4 matrix and anything else.
// TODO: (thom) I don't have a spec here at work. Check if there are other multi-value types // TODO: (thom) I don't have a spec here at work. Check if there are other multi-value types
// which should be tested for here. // which should be tested for here.
std::string type = mReader->getAttributeValue( attrType); std::string type = mReader->getAttributeValue( attrType);
if( type == "float4x4") if( type == "float4x4")
acc.mSize += 16; acc.mSize += 16;
else else
acc.mSize += 1; acc.mSize += 1;
} }
@ -1859,7 +1859,7 @@ void ColladaParser::ReadAccessor( const std::string& pID)
{ {
ThrowException( boost::str( boost::format( "Unexpected sub element <%s> in tag <accessor>") % mReader->getNodeName())); ThrowException( boost::str( boost::format( "Unexpected sub element <%s> in tag <accessor>") % mReader->getNodeName()));
} }
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{ {
if( strcmp( mReader->getNodeName(), "accessor") != 0) if( strcmp( mReader->getNodeName(), "accessor") != 0)
@ -1889,7 +1889,7 @@ void ColladaParser::ReadVertexData( Mesh* pMesh)
{ {
ThrowException( boost::str( boost::format( "Unexpected sub element <%s> in tag <vertices>") % mReader->getNodeName())); ThrowException( boost::str( boost::format( "Unexpected sub element <%s> in tag <vertices>") % mReader->getNodeName()));
} }
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{ {
if( strcmp( mReader->getNodeName(), "vertices") != 0) if( strcmp( mReader->getNodeName(), "vertices") != 0)
@ -1948,7 +1948,7 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
if( IsElement( "input")) if( IsElement( "input"))
{ {
ReadInputChannel( perIndexData); ReadInputChannel( perIndexData);
} }
else if( IsElement( "vcount")) else if( IsElement( "vcount"))
{ {
if( !mReader->isEmptyElement()) if( !mReader->isEmptyElement())
@ -1987,7 +1987,7 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
{ {
ThrowException( boost::str( boost::format( "Unexpected sub element <%s> in tag <%s>") % mReader->getNodeName() % elementName)); ThrowException( boost::str( boost::format( "Unexpected sub element <%s> in tag <%s>") % mReader->getNodeName() % elementName));
} }
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{ {
if( mReader->getNodeName() != elementName) if( mReader->getNodeName() != elementName)
@ -1997,7 +1997,7 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
} }
} }
#ifdef ASSIMP_BUILD_DEBUG #ifdef ASSIMP_BUILD_DEBUG
if (primType != Prim_TriFans && primType != Prim_TriStrips) { if (primType != Prim_TriFans && primType != Prim_TriStrips) {
ai_assert(actualPrimitives == numPrimitives); ai_assert(actualPrimitives == numPrimitives);
} }
@ -2009,11 +2009,11 @@ void ColladaParser::ReadIndexData( Mesh* pMesh)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Reads a single input channel element and stores it in the given array, if valid // Reads a single input channel element and stores it in the given array, if valid
void ColladaParser::ReadInputChannel( std::vector<InputChannel>& poChannels) void ColladaParser::ReadInputChannel( std::vector<InputChannel>& poChannels)
{ {
InputChannel channel; InputChannel channel;
// read semantic // read semantic
int attrSemantic = GetAttribute( "semantic"); int attrSemantic = GetAttribute( "semantic");
std::string semantic = mReader->getAttributeValue( attrSemantic); std::string semantic = mReader->getAttributeValue( attrSemantic);
@ -2038,7 +2038,7 @@ void ColladaParser::ReadInputChannel( std::vector<InputChannel>& poChannels)
attrSet = mReader->getAttributeValueAsInt( attrSet); attrSet = mReader->getAttributeValueAsInt( attrSet);
if(attrSet < 0) if(attrSet < 0)
ThrowException( boost::str( boost::format( "Invalid index \"%i\" in set attribute of <input> element") % (attrSet))); ThrowException( boost::str( boost::format( "Invalid index \"%i\" in set attribute of <input> element") % (attrSet)));
channel.mIndex = attrSet; channel.mIndex = attrSet;
} }
} }
@ -2056,7 +2056,7 @@ void ColladaParser::ReadInputChannel( std::vector<InputChannel>& poChannels)
size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pPerIndexChannels, size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pPerIndexChannels,
size_t pNumPrimitives, const std::vector<size_t>& pVCount, PrimitiveType pPrimType) size_t pNumPrimitives, const std::vector<size_t>& pVCount, PrimitiveType pPrimType)
{ {
// determine number of indices coming per vertex // determine number of indices coming per vertex
// find the offset index for all per-vertex channels // find the offset index for all per-vertex channels
size_t numOffsets = 1; size_t numOffsets = 1;
size_t perVertexOffset = SIZE_MAX; // invalid value size_t perVertexOffset = SIZE_MAX; // invalid value
@ -2067,7 +2067,7 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
perVertexOffset = channel.mOffset; perVertexOffset = channel.mOffset;
} }
// determine the expected number of indices // determine the expected number of indices
size_t expectedPointCount = 0; size_t expectedPointCount = 0;
switch( pPrimType) switch( pPrimType)
{ {
@ -2098,7 +2098,7 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
const char* content = GetTextContent(); const char* content = GetTextContent();
while( *content != 0) while( *content != 0)
{ {
// read a value. // read a value.
// Hack: (thom) Some exporters put negative indices sometimes. We just try to carry on anyways. // Hack: (thom) Some exporters put negative indices sometimes. We just try to carry on anyways.
int value = std::max( 0, strtol10( content, &content)); int value = std::max( 0, strtol10( content, &content));
indices.push_back( size_t( value)); indices.push_back( size_t( value));
@ -2185,13 +2185,13 @@ size_t ColladaParser::ReadPrimitives( Mesh* pMesh, std::vector<InputChannel>& pP
numPoints = 3; numPoints = 3;
ReadPrimTriStrips(numOffsets, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices); ReadPrimTriStrips(numOffsets, perVertexOffset, pMesh, pPerIndexChannels, currentPrimitive, indices);
break; break;
case Prim_Polylist: case Prim_Polylist:
numPoints = pVCount[currentPrimitive]; numPoints = pVCount[currentPrimitive];
for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++) for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
CopyVertex(polylistStartVertex + currentVertex, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, 0, indices); CopyVertex(polylistStartVertex + currentVertex, numOffsets, 1, perVertexOffset, pMesh, pPerIndexChannels, 0, indices);
polylistStartVertex += numPoints; polylistStartVertex += numPoints;
break; break;
case Prim_TriFans: case Prim_TriFans:
case Prim_Polygon: case Prim_Polygon:
numPoints = indices.size() / numOffsets; numPoints = indices.size() / numOffsets;
for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++) for (size_t currentVertex = 0; currentVertex < numPoints; currentVertex++)
@ -2246,7 +2246,7 @@ void ColladaParser::ReadPrimTriStrips(size_t numOffsets, size_t perVertexOffset,
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Extracts a single object from an input channel and stores it in the appropriate mesh data array // Extracts a single object from an input channel and stores it in the appropriate mesh data array
void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, size_t pLocalIndex, Mesh* pMesh) void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, size_t pLocalIndex, Mesh* pMesh)
{ {
// ignore vertex referrer - we handle them that separate // ignore vertex referrer - we handle them that separate
@ -2271,67 +2271,67 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si
{ {
case IT_Position: // ignore all position streams except 0 - there can be only one position case IT_Position: // ignore all position streams except 0 - there can be only one position
if( pInput.mIndex == 0) if( pInput.mIndex == 0)
pMesh->mPositions.push_back( aiVector3D( obj[0], obj[1], obj[2])); pMesh->mPositions.push_back( aiVector3D( obj[0], obj[1], obj[2]));
else else
DefaultLogger::get()->error("Collada: just one vertex position stream supported"); DefaultLogger::get()->error("Collada: just one vertex position stream supported");
break; break;
case IT_Normal: case IT_Normal:
// pad to current vertex count if necessary // pad to current vertex count if necessary
if( pMesh->mNormals.size() < pMesh->mPositions.size()-1) if( pMesh->mNormals.size() < pMesh->mPositions.size()-1)
pMesh->mNormals.insert( pMesh->mNormals.end(), pMesh->mPositions.size() - pMesh->mNormals.size() - 1, aiVector3D( 0, 1, 0)); pMesh->mNormals.insert( pMesh->mNormals.end(), pMesh->mPositions.size() - pMesh->mNormals.size() - 1, aiVector3D( 0, 1, 0));
// ignore all normal streams except 0 - there can be only one normal // ignore all normal streams except 0 - there can be only one normal
if( pInput.mIndex == 0) if( pInput.mIndex == 0)
pMesh->mNormals.push_back( aiVector3D( obj[0], obj[1], obj[2])); pMesh->mNormals.push_back( aiVector3D( obj[0], obj[1], obj[2]));
else else
DefaultLogger::get()->error("Collada: just one vertex normal stream supported"); DefaultLogger::get()->error("Collada: just one vertex normal stream supported");
break; break;
case IT_Tangent: case IT_Tangent:
// pad to current vertex count if necessary // pad to current vertex count if necessary
if( pMesh->mTangents.size() < pMesh->mPositions.size()-1) if( pMesh->mTangents.size() < pMesh->mPositions.size()-1)
pMesh->mTangents.insert( pMesh->mTangents.end(), pMesh->mPositions.size() - pMesh->mTangents.size() - 1, aiVector3D( 1, 0, 0)); pMesh->mTangents.insert( pMesh->mTangents.end(), pMesh->mPositions.size() - pMesh->mTangents.size() - 1, aiVector3D( 1, 0, 0));
// ignore all tangent streams except 0 - there can be only one tangent // ignore all tangent streams except 0 - there can be only one tangent
if( pInput.mIndex == 0) if( pInput.mIndex == 0)
pMesh->mTangents.push_back( aiVector3D( obj[0], obj[1], obj[2])); pMesh->mTangents.push_back( aiVector3D( obj[0], obj[1], obj[2]));
else else
DefaultLogger::get()->error("Collada: just one vertex tangent stream supported"); DefaultLogger::get()->error("Collada: just one vertex tangent stream supported");
break; break;
case IT_Bitangent: case IT_Bitangent:
// pad to current vertex count if necessary // pad to current vertex count if necessary
if( pMesh->mBitangents.size() < pMesh->mPositions.size()-1) if( pMesh->mBitangents.size() < pMesh->mPositions.size()-1)
pMesh->mBitangents.insert( pMesh->mBitangents.end(), pMesh->mPositions.size() - pMesh->mBitangents.size() - 1, aiVector3D( 0, 0, 1)); pMesh->mBitangents.insert( pMesh->mBitangents.end(), pMesh->mPositions.size() - pMesh->mBitangents.size() - 1, aiVector3D( 0, 0, 1));
// ignore all bitangent streams except 0 - there can be only one bitangent // ignore all bitangent streams except 0 - there can be only one bitangent
if( pInput.mIndex == 0) if( pInput.mIndex == 0)
pMesh->mBitangents.push_back( aiVector3D( obj[0], obj[1], obj[2])); pMesh->mBitangents.push_back( aiVector3D( obj[0], obj[1], obj[2]));
else else
DefaultLogger::get()->error("Collada: just one vertex bitangent stream supported"); DefaultLogger::get()->error("Collada: just one vertex bitangent stream supported");
break; break;
case IT_Texcoord: case IT_Texcoord:
// up to 4 texture coord sets are fine, ignore the others // up to 4 texture coord sets are fine, ignore the others
if( pInput.mIndex < AI_MAX_NUMBER_OF_TEXTURECOORDS) if( pInput.mIndex < AI_MAX_NUMBER_OF_TEXTURECOORDS)
{ {
// pad to current vertex count if necessary // pad to current vertex count if necessary
if( pMesh->mTexCoords[pInput.mIndex].size() < pMesh->mPositions.size()-1) if( pMesh->mTexCoords[pInput.mIndex].size() < pMesh->mPositions.size()-1)
pMesh->mTexCoords[pInput.mIndex].insert( pMesh->mTexCoords[pInput.mIndex].end(), pMesh->mTexCoords[pInput.mIndex].insert( pMesh->mTexCoords[pInput.mIndex].end(),
pMesh->mPositions.size() - pMesh->mTexCoords[pInput.mIndex].size() - 1, aiVector3D( 0, 0, 0)); pMesh->mPositions.size() - pMesh->mTexCoords[pInput.mIndex].size() - 1, aiVector3D( 0, 0, 0));
pMesh->mTexCoords[pInput.mIndex].push_back( aiVector3D( obj[0], obj[1], obj[2])); pMesh->mTexCoords[pInput.mIndex].push_back( aiVector3D( obj[0], obj[1], obj[2]));
if (0 != acc.mSubOffset[2] || 0 != acc.mSubOffset[3]) /* hack ... consider cleaner solution */ if (0 != acc.mSubOffset[2] || 0 != acc.mSubOffset[3]) /* hack ... consider cleaner solution */
pMesh->mNumUVComponents[pInput.mIndex]=3; pMesh->mNumUVComponents[pInput.mIndex]=3;
} else } else
{ {
DefaultLogger::get()->error("Collada: too many texture coordinate sets. Skipping."); DefaultLogger::get()->error("Collada: too many texture coordinate sets. Skipping.");
} }
break; break;
case IT_Color: case IT_Color:
// up to 4 color sets are fine, ignore the others // up to 4 color sets are fine, ignore the others
if( pInput.mIndex < AI_MAX_NUMBER_OF_COLOR_SETS) if( pInput.mIndex < AI_MAX_NUMBER_OF_COLOR_SETS)
{ {
// pad to current vertex count if necessary // pad to current vertex count if necessary
if( pMesh->mColors[pInput.mIndex].size() < pMesh->mPositions.size()-1) if( pMesh->mColors[pInput.mIndex].size() < pMesh->mPositions.size()-1)
pMesh->mColors[pInput.mIndex].insert( pMesh->mColors[pInput.mIndex].end(), pMesh->mColors[pInput.mIndex].insert( pMesh->mColors[pInput.mIndex].end(),
pMesh->mPositions.size() - pMesh->mColors[pInput.mIndex].size() - 1, aiColor4D( 0, 0, 0, 1)); pMesh->mPositions.size() - pMesh->mColors[pInput.mIndex].size() - 1, aiColor4D( 0, 0, 0, 1));
aiColor4D result(0, 0, 0, 1); aiColor4D result(0, 0, 0, 1);
@ -2339,15 +2339,15 @@ void ColladaParser::ExtractDataObjectFromChannel( const InputChannel& pInput, si
{ {
result[i] = obj[pInput.mResolved->mSubOffset[i]]; result[i] = obj[pInput.mResolved->mSubOffset[i]];
} }
pMesh->mColors[pInput.mIndex].push_back(result); pMesh->mColors[pInput.mIndex].push_back(result);
} else } else
{ {
DefaultLogger::get()->error("Collada: too many vertex color sets. Skipping."); DefaultLogger::get()->error("Collada: too many vertex color sets. Skipping.");
} }
break; break;
default: default:
// IT_Invalid and IT_Vertex // IT_Invalid and IT_Vertex
ai_assert(false && "shouldn't ever get here"); ai_assert(false && "shouldn't ever get here");
} }
} }
@ -2370,7 +2370,7 @@ void ColladaParser::ReadSceneLibrary()
int indexID = GetAttribute( "id"); int indexID = GetAttribute( "id");
const char* attrID = mReader->getAttributeValue( indexID); const char* attrID = mReader->getAttributeValue( indexID);
// read name if given. // read name if given.
int indexName = TestAttribute( "name"); int indexName = TestAttribute( "name");
const char* attrName = "unnamed"; const char* attrName = "unnamed";
if( indexName > -1) if( indexName > -1)
@ -2409,7 +2409,7 @@ void ColladaParser::ReadSceneNode( Node* pNode)
while( mReader->read()) while( mReader->read())
{ {
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
{ {
if( IsElement( "node")) if( IsElement( "node"))
{ {
@ -2428,12 +2428,12 @@ void ColladaParser::ReadSceneNode( Node* pNode)
// TODO: (thom) support SIDs // TODO: (thom) support SIDs
// ai_assert( TestAttribute( "sid") == -1); // ai_assert( TestAttribute( "sid") == -1);
if (pNode) if (pNode)
{ {
pNode->mChildren.push_back( child); pNode->mChildren.push_back( child);
child->mParent = pNode; child->mParent = pNode;
} }
else else
{ {
// no parent node given, probably called from <library_nodes> element. // no parent node given, probably called from <library_nodes> element.
// create new node in node library // create new node in node library
@ -2467,43 +2467,43 @@ void ColladaParser::ReadSceneNode( Node* pNode)
// render a Collada scene. The only thing that is interesting for // render a Collada scene. The only thing that is interesting for
// us is the primary camera. // us is the primary camera.
int attrId = TestAttribute("camera_node"); int attrId = TestAttribute("camera_node");
if (-1 != attrId) if (-1 != attrId)
{ {
const char* s = mReader->getAttributeValue(attrId); const char* s = mReader->getAttributeValue(attrId);
if (s[0] != '#') if (s[0] != '#')
DefaultLogger::get()->error("Collada: Unresolved reference format of camera"); DefaultLogger::get()->error("Collada: Unresolved reference format of camera");
else else
pNode->mPrimaryCamera = s+1; pNode->mPrimaryCamera = s+1;
} }
} }
else if( IsElement( "instance_node")) else if( IsElement( "instance_node"))
{ {
// find the node in the library // find the node in the library
int attrID = TestAttribute( "url"); int attrID = TestAttribute( "url");
if( attrID != -1) if( attrID != -1)
{ {
const char* s = mReader->getAttributeValue(attrID); const char* s = mReader->getAttributeValue(attrID);
if (s[0] != '#') if (s[0] != '#')
DefaultLogger::get()->error("Collada: Unresolved reference format of node"); DefaultLogger::get()->error("Collada: Unresolved reference format of node");
else else
{ {
pNode->mNodeInstances.push_back(NodeInstance()); pNode->mNodeInstances.push_back(NodeInstance());
pNode->mNodeInstances.back().mNode = s+1; pNode->mNodeInstances.back().mNode = s+1;
} }
} }
} }
else if( IsElement( "instance_geometry") || IsElement( "instance_controller")) else if( IsElement( "instance_geometry") || IsElement( "instance_controller"))
{ {
// Reference to a mesh or controller, with possible material associations // Reference to a mesh or controller, with possible material associations
ReadNodeGeometry( pNode); ReadNodeGeometry( pNode);
} }
else if( IsElement( "instance_light")) else if( IsElement( "instance_light"))
{ {
// Reference to a light, name given in 'url' attribute // Reference to a light, name given in 'url' attribute
int attrID = TestAttribute("url"); int attrID = TestAttribute("url");
if (-1 == attrID) if (-1 == attrID)
DefaultLogger::get()->warn("Collada: Expected url attribute in <instance_light> element"); DefaultLogger::get()->warn("Collada: Expected url attribute in <instance_light> element");
else else
{ {
const char* url = mReader->getAttributeValue( attrID); const char* url = mReader->getAttributeValue( attrID);
if( url[0] != '#') if( url[0] != '#')
@ -2513,13 +2513,13 @@ void ColladaParser::ReadSceneNode( Node* pNode)
pNode->mLights.back().mLight = url+1; pNode->mLights.back().mLight = url+1;
} }
} }
else if( IsElement( "instance_camera")) else if( IsElement( "instance_camera"))
{ {
// Reference to a camera, name given in 'url' attribute // Reference to a camera, name given in 'url' attribute
int attrID = TestAttribute("url"); int attrID = TestAttribute("url");
if (-1 == attrID) if (-1 == attrID)
DefaultLogger::get()->warn("Collada: Expected url attribute in <instance_camera> element"); DefaultLogger::get()->warn("Collada: Expected url attribute in <instance_camera> element");
else else
{ {
const char* url = mReader->getAttributeValue( attrID); const char* url = mReader->getAttributeValue( attrID);
if( url[0] != '#') if( url[0] != '#')
@ -2534,7 +2534,7 @@ void ColladaParser::ReadSceneNode( Node* pNode)
// skip everything else for the moment // skip everything else for the moment
SkipElement(); SkipElement();
} }
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) { else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) {
break; break;
} }
@ -2552,7 +2552,7 @@ void ColladaParser::ReadNodeTransformation( Node* pNode, TransformType pType)
Transform tf; Transform tf;
tf.mType = pType; tf.mType = pType;
// read SID // read SID
int indexSID = TestAttribute( "sid"); int indexSID = TestAttribute( "sid");
if( indexSID >= 0) if( indexSID >= 0)
@ -2596,22 +2596,22 @@ void ColladaParser::ReadMaterialVertexInputBinding( Collada::SemanticMappingTabl
// input semantic // input semantic
n = GetAttribute("input_semantic"); n = GetAttribute("input_semantic");
vn.mType = GetTypeForSemantic( mReader->getAttributeValue(n) ); vn.mType = GetTypeForSemantic( mReader->getAttributeValue(n) );
// index of input set // index of input set
n = TestAttribute("input_set"); n = TestAttribute("input_set");
if (-1 != n) if (-1 != n)
vn.mSet = mReader->getAttributeValueAsInt(n); vn.mSet = mReader->getAttributeValueAsInt(n);
tbl.mMap[s] = vn; tbl.mMap[s] = vn;
} }
else if( IsElement( "bind")) { else if( IsElement( "bind")) {
DefaultLogger::get()->warn("Collada: Found unsupported <bind> element"); DefaultLogger::get()->warn("Collada: Found unsupported <bind> element");
} }
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) { else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) {
if( strcmp( mReader->getNodeName(), "instance_material") == 0) if( strcmp( mReader->getNodeName(), "instance_material") == 0)
break; break;
} }
} }
} }
@ -2624,7 +2624,7 @@ void ColladaParser::ReadNodeGeometry( Node* pNode)
const char* url = mReader->getAttributeValue( attrUrl); const char* url = mReader->getAttributeValue( attrUrl);
if( url[0] != '#') if( url[0] != '#')
ThrowException( "Unknown reference format"); ThrowException( "Unknown reference format");
Collada::MeshInstance instance; Collada::MeshInstance instance;
instance.mMeshOrController = url+1; // skipping the leading # instance.mMeshOrController = url+1; // skipping the leading #
@ -2633,7 +2633,7 @@ void ColladaParser::ReadNodeGeometry( Node* pNode)
// read material associations. Ignore additional elements inbetween // read material associations. Ignore additional elements inbetween
while( mReader->read()) while( mReader->read())
{ {
if( mReader->getNodeType() == irr::io::EXN_ELEMENT) if( mReader->getNodeType() == irr::io::EXN_ELEMENT)
{ {
if( IsElement( "instance_material")) if( IsElement( "instance_material"))
{ {
@ -2654,14 +2654,14 @@ void ColladaParser::ReadNodeGeometry( Node* pNode)
// store the association // store the association
instance.mMaterials[group] = s; instance.mMaterials[group] = s;
} }
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END) else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END)
{ {
if( strcmp( mReader->getNodeName(), "instance_geometry") == 0 if( strcmp( mReader->getNodeName(), "instance_geometry") == 0
|| strcmp( mReader->getNodeName(), "instance_controller") == 0) || strcmp( mReader->getNodeName(), "instance_controller") == 0)
break; break;
} }
} }
} }
@ -2691,7 +2691,7 @@ void ColladaParser::ReadScene()
if( url[0] != '#') if( url[0] != '#')
ThrowException( "Unknown reference format in <instance_visual_scene> element"); ThrowException( "Unknown reference format in <instance_visual_scene> element");
// find the referred scene, skip the leading # // find the referred scene, skip the leading #
NodeLibrary::const_iterator sit = mNodeLibrary.find( url+1); NodeLibrary::const_iterator sit = mNodeLibrary.find( url+1);
if( sit == mNodeLibrary.end()) if( sit == mNodeLibrary.end())
ThrowException( "Unable to resolve visual_scene reference \"" + std::string(url) + "\" in <instance_visual_scene> element."); ThrowException( "Unable to resolve visual_scene reference \"" + std::string(url) + "\" in <instance_visual_scene> element.");
@ -2699,10 +2699,10 @@ void ColladaParser::ReadScene()
} else { } else {
SkipElement(); SkipElement();
} }
} }
else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END){ else if( mReader->getNodeType() == irr::io::EXN_ELEMENT_END){
break; break;
} }
} }
} }
@ -2729,8 +2729,8 @@ void ColladaParser::SkipElement()
// Skips all data until the end node of the given element // Skips all data until the end node of the given element
void ColladaParser::SkipElement( const char* pElement) void ColladaParser::SkipElement( const char* pElement)
{ {
// copy the current node's name because it'a pointer to the reader's internal buffer, // copy the current node's name because it'a pointer to the reader's internal buffer,
// which is going to change with the upcoming parsing // which is going to change with the upcoming parsing
std::string element = pElement; std::string element = pElement;
while( mReader->read()) while( mReader->read())
{ {
@ -2852,8 +2852,8 @@ aiMatrix4x4 ColladaParser::CalculateResultTransform( const std::vector<Transform
aiVector3D dir = aiVector3D( dstPos - pos).Normalize(); aiVector3D dir = aiVector3D( dstPos - pos).Normalize();
aiVector3D right = (dir ^ up).Normalize(); aiVector3D right = (dir ^ up).Normalize();
res *= aiMatrix4x4( res *= aiMatrix4x4(
right.x, up.x, -dir.x, pos.x, right.x, up.x, -dir.x, pos.x,
right.y, up.y, -dir.y, pos.y, right.y, up.y, -dir.y, pos.y,
right.z, up.z, -dir.z, pos.z, right.z, up.z, -dir.z, pos.z,
0, 0, 0, 1); 0, 0, 0, 1);
@ -2877,7 +2877,7 @@ aiMatrix4x4 ColladaParser::CalculateResultTransform( const std::vector<Transform
} }
case TF_SCALE: case TF_SCALE:
{ {
aiMatrix4x4 scale( tf.f[0], 0.0f, 0.0f, 0.0f, 0.0f, tf.f[1], 0.0f, 0.0f, 0.0f, 0.0f, tf.f[2], 0.0f, aiMatrix4x4 scale( tf.f[0], 0.0f, 0.0f, 0.0f, 0.0f, tf.f[1], 0.0f, 0.0f, 0.0f, 0.0f, tf.f[2], 0.0f,
0.0f, 0.0f, 0.0f, 1.0f); 0.0f, 0.0f, 0.0f, 1.0f);
res *= scale; res *= scale;
break; break;
@ -2893,7 +2893,7 @@ aiMatrix4x4 ColladaParser::CalculateResultTransform( const std::vector<Transform
res *= mat; res *= mat;
break; break;
} }
default: default:
ai_assert( false); ai_assert( false);
break; break;
} }

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,23 +23,23 @@ contributors may be used to endorse or promote products
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
*/ */
/** @file ColladaParser.h /** @file ColladaParser.h
* @brief Defines the parser helper class for the collada loader * @brief Defines the parser helper class for the collada loader
*/ */
#ifndef AI_COLLADAPARSER_H_INC #ifndef AI_COLLADAPARSER_H_INC
@ -54,9 +54,9 @@ namespace Assimp
{ {
// ------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------
/** Parser helper class for the Collada loader. /** Parser helper class for the Collada loader.
* *
* Does all the XML reading and builds internal data structures from it, * Does all the XML reading and builds internal data structures from it,
* but leaves the resolving of all the references to the loader. * but leaves the resolving of all the references to the loader.
*/ */
class ColladaParser class ColladaParser
@ -154,7 +154,7 @@ protected:
/** Reads a mesh from the geometry library */ /** Reads a mesh from the geometry library */
void ReadMesh( Collada::Mesh* pMesh); void ReadMesh( Collada::Mesh* pMesh);
/** Reads a source element - a combination of raw data and an accessor defining /** Reads a source element - a combination of raw data and an accessor defining
* things that should not be redefinable. Yes, that's another rant. * things that should not be redefinable. Yes, that's another rant.
*/ */
void ReadSource(); void ReadSource();
@ -164,7 +164,7 @@ protected:
*/ */
void ReadDataArray(); void ReadDataArray();
/** Reads an accessor and stores it in the global library under the given ID - /** Reads an accessor and stores it in the global library under the given ID -
* accessors use the ID of the parent <source> element * accessors use the ID of the parent <source> element
*/ */
void ReadAccessor( const std::string& pID); void ReadAccessor( const std::string& pID);
@ -231,7 +231,7 @@ protected:
/** Tests for the closing tag of the given element, throws an exception if not found */ /** Tests for the closing tag of the given element, throws an exception if not found */
void TestClosing( const char* pName); void TestClosing( const char* pName);
/** Checks the present element for the presence of the attribute, returns its index /** Checks the present element for the presence of the attribute, returns its index
or throws an exception if not found */ or throws an exception if not found */
int GetAttribute( const char* pAttr) const; int GetAttribute( const char* pAttr) const;
@ -239,7 +239,7 @@ protected:
therefore useful for optional attributes */ therefore useful for optional attributes */
int TestAttribute( const char* pAttr) const; int TestAttribute( const char* pAttr) const;
/** Reads the text contents of an element, throws an exception if not given. /** Reads the text contents of an element, throws an exception if not given.
Skips leading whitespace. */ Skips leading whitespace. */
const char* GetTextContent(); const char* GetTextContent();
@ -270,7 +270,7 @@ protected:
/** XML reader, member for everyday use */ /** XML reader, member for everyday use */
irr::io::IrrXMLReader* mReader; irr::io::IrrXMLReader* mReader;
/** All data arrays found in the file by ID. Might be referred to by actually /** All data arrays found in the file by ID. Might be referred to by actually
everyone. Collada, you are a steaming pile of indirection. */ everyone. Collada, you are a steaming pile of indirection. */
typedef std::map<std::string, Collada::Data> DataLibrary; typedef std::map<std::string, Collada::Data> DataLibrary;
DataLibrary mDataLibrary; DataLibrary mDataLibrary;
@ -311,7 +311,7 @@ protected:
typedef std::map<std::string, Collada::Controller> ControllerLibrary; typedef std::map<std::string, Collada::Controller> ControllerLibrary;
ControllerLibrary mControllerLibrary; ControllerLibrary mControllerLibrary;
/** Pointer to the root node. Don't delete, it just points to one of /** Pointer to the root node. Don't delete, it just points to one of
the nodes in the node library. */ the nodes in the node library. */
Collada::Node* mRootNode; Collada::Node* mRootNode;
@ -332,13 +332,13 @@ protected:
// Check for element match // Check for element match
inline bool ColladaParser::IsElement( const char* pName) const inline bool ColladaParser::IsElement( const char* pName) const
{ {
ai_assert( mReader->getNodeType() == irr::io::EXN_ELEMENT); ai_assert( mReader->getNodeType() == irr::io::EXN_ELEMENT);
return ::strcmp( mReader->getNodeName(), pName) == 0; return ::strcmp( mReader->getNodeName(), pName) == 0;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Finds the item in the given library by its reference, throws if not found // Finds the item in the given library by its reference, throws if not found
template <typename Type> template <typename Type>
const Type& ColladaParser::ResolveLibraryReference( const std::map<std::string, Type>& pLibrary, const std::string& pURL) const const Type& ColladaParser::ResolveLibraryReference( const std::map<std::string, Type>& pLibrary, const std::string& pURL) const
{ {
typename std::map<std::string, Type>::const_iterator it = pLibrary.find( pURL); typename std::map<std::string, Type>::const_iterator it = pLibrary.find( pURL);

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -96,7 +96,7 @@ inline unsigned int FindEmptyUVChannel (aiMesh* mesh)
{ {
for (unsigned int m = 0; m < AI_MAX_NUMBER_OF_TEXTURECOORDS;++m) for (unsigned int m = 0; m < AI_MAX_NUMBER_OF_TEXTURECOORDS;++m)
if (!mesh->mTextureCoords[m])return m; if (!mesh->mTextureCoords[m])return m;
DefaultLogger::get()->error("Unable to compute UV coordinates, no free UV slot found"); DefaultLogger::get()->error("Unable to compute UV coordinates, no free UV slot found");
return UINT_MAX; return UINT_MAX;
} }
@ -106,8 +106,8 @@ inline unsigned int FindEmptyUVChannel (aiMesh* mesh)
void RemoveUVSeams (aiMesh* mesh, aiVector3D* out) void RemoveUVSeams (aiMesh* mesh, aiVector3D* out)
{ {
// TODO: just a very rough algorithm. I think it could be done // TODO: just a very rough algorithm. I think it could be done
// much easier, but I don't know how and am currently too tired to // much easier, but I don't know how and am currently too tired to
// to think about a better solution. // to think about a better solution.
const static float LOWER_LIMIT = 0.1f; const static float LOWER_LIMIT = 0.1f;
const static float UPPER_LIMIT = 0.9f; const static float UPPER_LIMIT = 0.9f;
@ -125,7 +125,7 @@ void RemoveUVSeams (aiMesh* mesh, aiVector3D* out)
// Check whether this face lies on a UV seam. We can just guess, // Check whether this face lies on a UV seam. We can just guess,
// but the assumption that a face with at least one very small // but the assumption that a face with at least one very small
// on the one side and one very large U coord on the other side // on the one side and one very large U coord on the other side
// lies on a UV seam should work for most cases. // lies on a UV seam should work for most cases.
for (unsigned int n = 0; n < face.mNumIndices;++n) for (unsigned int n = 0; n < face.mNumIndices;++n)
{ {
@ -153,12 +153,12 @@ void RemoveUVSeams (aiMesh* mesh, aiVector3D* out)
{ {
for (unsigned int n = 0; n < face.mNumIndices;++n) for (unsigned int n = 0; n < face.mNumIndices;++n)
{ {
// If the u value is over the upper limit and no other u // If the u value is over the upper limit and no other u
// value of that face is 0, round it to 0 // value of that face is 0, round it to 0
if (out[face.mIndices[n]].x > UPPER_LIMIT && !zero) if (out[face.mIndices[n]].x > UPPER_LIMIT && !zero)
out[face.mIndices[n]].x = 0.f; out[face.mIndices[n]].x = 0.f;
// If the u value is below the lower limit and no other u // If the u value is below the lower limit and no other u
// value of that face is 1, round it to 1 // value of that face is 1, round it to 1
else if (out[face.mIndices[n]].x < LOWER_LIMIT && !one) else if (out[face.mIndices[n]].x < LOWER_LIMIT && !one)
out[face.mIndices[n]].x = 1.f; out[face.mIndices[n]].x = 1.f;
@ -166,7 +166,7 @@ void RemoveUVSeams (aiMesh* mesh, aiVector3D* out)
// The face contains both 0 and 1 as UV coords. This can occur // The face contains both 0 and 1 as UV coords. This can occur
// for faces which have an edge that lies directly on the seam. // for faces which have an edge that lies directly on the seam.
// Due to numerical inaccuracies one U coord becomes 0, the // Due to numerical inaccuracies one U coord becomes 0, the
// other 1. But we do still have a third UV coord to determine // other 1. But we do still have a third UV coord to determine
// to which side we must round to. // to which side we must round to.
else if (one && zero) else if (one && zero)
{ {
@ -188,7 +188,7 @@ void ComputeUVMappingProcess::ComputeSphereMapping(aiMesh* mesh,const aiVector3D
// If the axis is one of x,y,z run a faster code path. It's worth the extra effort ... // If the axis is one of x,y,z run a faster code path. It's worth the extra effort ...
// currently the mapping axis will always be one of x,y,z, except if the // currently the mapping axis will always be one of x,y,z, except if the
// PretransformVertices step is used (it transforms the meshes into worldspace, // PretransformVertices step is used (it transforms the meshes into worldspace,
// thus changing the mapping axis) // thus changing the mapping axis)
if (axis * base_axis_x >= angle_epsilon) { if (axis * base_axis_x >= angle_epsilon) {
@ -200,7 +200,7 @@ void ComputeUVMappingProcess::ComputeSphereMapping(aiMesh* mesh,const aiVector3D
// x = cos(lon)*cos(lat) // x = cos(lon)*cos(lat)
// y = sin(lon)*cos(lat) // y = sin(lon)*cos(lat)
// z = sin(lat) // z = sin(lat)
// //
// Thus we can derive: // Thus we can derive:
// lat = arcsin (z) // lat = arcsin (z)
// lon = arctan (y/x) // lon = arctan (y/x)
@ -238,8 +238,8 @@ void ComputeUVMappingProcess::ComputeSphereMapping(aiMesh* mesh,const aiVector3D
(asin (diff.z) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.f); (asin (diff.z) + AI_MATH_HALF_PI_F) / AI_MATH_PI_F, 0.f);
} }
} }
// Now find and remove UV seams. A seam occurs if a face has a tcoord // Now find and remove UV seams. A seam occurs if a face has a tcoord
// close to zero on the one side, and a tcoord close to one on the // close to zero on the one side, and a tcoord close to one on the
// other side. // other side.
@ -253,13 +253,13 @@ void ComputeUVMappingProcess::ComputeCylinderMapping(aiMesh* mesh,const aiVector
// If the axis is one of x,y,z run a faster code path. It's worth the extra effort ... // If the axis is one of x,y,z run a faster code path. It's worth the extra effort ...
// currently the mapping axis will always be one of x,y,z, except if the // currently the mapping axis will always be one of x,y,z, except if the
// PretransformVertices step is used (it transforms the meshes into worldspace, // PretransformVertices step is used (it transforms the meshes into worldspace,
// thus changing the mapping axis) // thus changing the mapping axis)
if (axis * base_axis_x >= angle_epsilon) { if (axis * base_axis_x >= angle_epsilon) {
FindMeshCenter(mesh, center, min, max); FindMeshCenter(mesh, center, min, max);
const float diff = max.x - min.x; const float diff = max.x - min.x;
// If the main axis is 'z', the z coordinate of a point 'p' is mapped // If the main axis is 'z', the z coordinate of a point 'p' is mapped
// directly to the texture V axis. The other axis is derived from // directly to the texture V axis. The other axis is derived from
// the angle between ( p.x - c.x, p.y - c.y ) and (1,0), where // the angle between ( p.x - c.x, p.y - c.y ) and (1,0), where
// 'c' is the center point of the mesh. // 'c' is the center point of the mesh.
@ -328,7 +328,7 @@ void ComputeUVMappingProcess::ComputePlaneMapping(aiMesh* mesh,const aiVector3D&
// If the axis is one of x,y,z run a faster code path. It's worth the extra effort ... // If the axis is one of x,y,z run a faster code path. It's worth the extra effort ...
// currently the mapping axis will always be one of x,y,z, except if the // currently the mapping axis will always be one of x,y,z, except if the
// PretransformVertices step is used (it transforms the meshes into worldspace, // PretransformVertices step is used (it transforms the meshes into worldspace,
// thus changing the mapping axis) // thus changing the mapping axis)
if (axis * base_axis_x >= angle_epsilon) { if (axis * base_axis_x >= angle_epsilon) {
FindMeshCenter(mesh, center, min, max); FindMeshCenter(mesh, center, min, max);
@ -386,7 +386,7 @@ void ComputeUVMappingProcess::ComputeBoxMapping( aiMesh*, aiVector3D* )
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ComputeUVMappingProcess::Execute( aiScene* pScene) void ComputeUVMappingProcess::Execute( aiScene* pScene)
{ {
DefaultLogger::get()->debug("GenUVCoordsProcess begin"); DefaultLogger::get()->debug("GenUVCoordsProcess begin");
char buffer[1024]; char buffer[1024];

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -109,7 +109,7 @@ protected:
* @param axis Main axis * @param axis Main axis
* @param out Receives output UV coordinates * @param out Receives output UV coordinates
*/ */
void ComputePlaneMapping(aiMesh* mesh,const aiVector3D& axis, void ComputePlaneMapping(aiMesh* mesh,const aiVector3D& axis,
aiVector3D* out); aiVector3D* out);
// ------------------------------------------------------------------- // -------------------------------------------------------------------

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -85,7 +85,7 @@ void MakeLeftHandedProcess::Execute( aiScene* pScene)
ai_assert(pScene->mRootNode != NULL); ai_assert(pScene->mRootNode != NULL);
DefaultLogger::get()->debug("MakeLeftHandedProcess begin"); DefaultLogger::get()->debug("MakeLeftHandedProcess begin");
// recursively convert all the nodes // recursively convert all the nodes
ProcessNode( pScene->mRootNode, aiMatrix4x4()); ProcessNode( pScene->mRootNode, aiMatrix4x4());
// process the meshes accordingly // process the meshes accordingly
@ -133,7 +133,7 @@ void MakeLeftHandedProcess::ProcessNode( aiNode* pNode, const aiMatrix4x4& pPare
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Converts a single mesh to left handed coordinates. // Converts a single mesh to left handed coordinates.
void MakeLeftHandedProcess::ProcessMesh( aiMesh* pMesh) void MakeLeftHandedProcess::ProcessMesh( aiMesh* pMesh)
{ {
// mirror positions, normals and stuff along the Z axis // mirror positions, normals and stuff along the Z axis
@ -141,7 +141,7 @@ void MakeLeftHandedProcess::ProcessMesh( aiMesh* pMesh)
{ {
pMesh->mVertices[a].z *= -1.0f; pMesh->mVertices[a].z *= -1.0f;
if( pMesh->HasNormals()) if( pMesh->HasNormals())
pMesh->mNormals[a].z *= -1.0f; pMesh->mNormals[a].z *= -1.0f;
if( pMesh->HasTangentsAndBitangents()) if( pMesh->HasTangentsAndBitangents())
{ {
pMesh->mTangents[a].z *= -1.0f; pMesh->mTangents[a].z *= -1.0f;
@ -170,7 +170,7 @@ void MakeLeftHandedProcess::ProcessMesh( aiMesh* pMesh)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Converts a single material to left handed coordinates. // Converts a single material to left handed coordinates.
void MakeLeftHandedProcess::ProcessMaterial( aiMaterial* _mat) void MakeLeftHandedProcess::ProcessMaterial( aiMaterial* _mat)
{ {
aiMaterial* mat = (aiMaterial*)_mat; aiMaterial* mat = (aiMaterial*)_mat;
@ -179,7 +179,7 @@ void MakeLeftHandedProcess::ProcessMaterial( aiMaterial* _mat)
// Mapping axis for UV mappings? // Mapping axis for UV mappings?
if (!::strcmp( prop->mKey.data, "$tex.mapaxis")) { if (!::strcmp( prop->mKey.data, "$tex.mapaxis")) {
ai_assert( prop->mDataLength >= sizeof(aiVector3D)); /* something is wrong with the validation if we end up here */ ai_assert( prop->mDataLength >= sizeof(aiVector3D)); /* something is wrong with the validation if we end up here */
aiVector3D* pff = (aiVector3D*)prop->mData; aiVector3D* pff = (aiVector3D*)prop->mData;
pff->z *= -1.f; pff->z *= -1.f;
@ -188,27 +188,27 @@ void MakeLeftHandedProcess::ProcessMaterial( aiMaterial* _mat)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Converts the given animation to LH coordinates. // Converts the given animation to LH coordinates.
void MakeLeftHandedProcess::ProcessAnimation( aiNodeAnim* pAnim) void MakeLeftHandedProcess::ProcessAnimation( aiNodeAnim* pAnim)
{ {
// position keys // position keys
for( unsigned int a = 0; a < pAnim->mNumPositionKeys; a++) for( unsigned int a = 0; a < pAnim->mNumPositionKeys; a++)
pAnim->mPositionKeys[a].mValue.z *= -1.0f; pAnim->mPositionKeys[a].mValue.z *= -1.0f;
// rotation keys // rotation keys
for( unsigned int a = 0; a < pAnim->mNumRotationKeys; a++) for( unsigned int a = 0; a < pAnim->mNumRotationKeys; a++)
{ {
/* That's the safe version, but the float errors add up. So we try the short version instead /* That's the safe version, but the float errors add up. So we try the short version instead
aiMatrix3x3 rotmat = pAnim->mRotationKeys[a].mValue.GetMatrix(); aiMatrix3x3 rotmat = pAnim->mRotationKeys[a].mValue.GetMatrix();
rotmat.a3 = -rotmat.a3; rotmat.b3 = -rotmat.b3; rotmat.a3 = -rotmat.a3; rotmat.b3 = -rotmat.b3;
rotmat.c1 = -rotmat.c1; rotmat.c2 = -rotmat.c2; rotmat.c1 = -rotmat.c1; rotmat.c2 = -rotmat.c2;
aiQuaternion rotquat( rotmat); aiQuaternion rotquat( rotmat);
pAnim->mRotationKeys[a].mValue = rotquat; pAnim->mRotationKeys[a].mValue = rotquat;
*/ */
pAnim->mRotationKeys[a].mValue.x *= -1.0f; pAnim->mRotationKeys[a].mValue.x *= -1.0f;
pAnim->mRotationKeys[a].mValue.y *= -1.0f; pAnim->mRotationKeys[a].mValue.y *= -1.0f;
} }
} }
#endif // !! ASSIMP_BUILD_NO_MAKELEFTHANDED_PROCESS #endif // !! ASSIMP_BUILD_NO_MAKELEFTHANDED_PROCESS
#ifndef ASSIMP_BUILD_NO_FLIPUVS_PROCESS #ifndef ASSIMP_BUILD_NO_FLIPUVS_PROCESS
@ -245,7 +245,7 @@ void FlipUVsProcess::Execute( aiScene* pScene)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Converts a single material // Converts a single material
void FlipUVsProcess::ProcessMaterial (aiMaterial* _mat) void FlipUVsProcess::ProcessMaterial (aiMaterial* _mat)
{ {
aiMaterial* mat = (aiMaterial*)_mat; aiMaterial* mat = (aiMaterial*)_mat;
@ -269,7 +269,7 @@ void FlipUVsProcess::ProcessMaterial (aiMaterial* _mat)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Converts a single mesh // Converts a single mesh
void FlipUVsProcess::ProcessMesh( aiMesh* pMesh) void FlipUVsProcess::ProcessMesh( aiMesh* pMesh)
{ {
// mirror texture y coordinate // mirror texture y coordinate
@ -316,7 +316,7 @@ void FlipWindingOrderProcess::Execute( aiScene* pScene)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Converts a single mesh // Converts a single mesh
void FlipWindingOrderProcess::ProcessMesh( aiMesh* pMesh) void FlipWindingOrderProcess::ProcessMesh( aiMesh* pMesh)
{ {
// invert the order of all faces in this mesh // invert the order of all faces in this mesh

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* - LH to RH * - LH to RH
* - UV origin upper-left to lower-left * - UV origin upper-left to lower-left
* - face order cw to ccw * - face order cw to ccw
*/ */
#ifndef AI_CONVERTTOLHPROCESS_H_INC #ifndef AI_CONVERTTOLHPROCESS_H_INC
#define AI_CONVERTTOLHPROCESS_H_INC #define AI_CONVERTTOLHPROCESS_H_INC
@ -61,9 +61,9 @@ namespace Assimp {
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
/** @brief The MakeLeftHandedProcess converts all imported data to a left-handed /** @brief The MakeLeftHandedProcess converts all imported data to a left-handed
* coordinate system. * coordinate system.
* *
* This implies a mirroring of the Z axis of the coordinate system. But to keep * This implies a mirroring of the Z axis of the coordinate system. But to keep
* transformation matrices free from reflections we shift the reflection to other * transformation matrices free from reflections we shift the reflection to other
* places. We mirror the meshes and adapt the rotations. * places. We mirror the meshes and adapt the rotations.
* *
@ -71,7 +71,7 @@ namespace Assimp {
*/ */
class MakeLeftHandedProcess : public BaseProcess class MakeLeftHandedProcess : public BaseProcess
{ {
public: public:
MakeLeftHandedProcess(); MakeLeftHandedProcess();
@ -91,7 +91,7 @@ protected:
void ProcessNode( aiNode* pNode, const aiMatrix4x4& pParentGlobalRotation); void ProcessNode( aiNode* pNode, const aiMatrix4x4& pParentGlobalRotation);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Converts a single mesh to left handed coordinates. /** Converts a single mesh to left handed coordinates.
* This means that positions, normals and tangents are mirrored at * This means that positions, normals and tangents are mirrored at
* the local Z axis and the order of all faces are inverted. * the local Z axis and the order of all faces are inverted.
* @param pMesh The mesh to convert. * @param pMesh The mesh to convert.
@ -105,7 +105,7 @@ protected:
void ProcessMaterial( aiMaterial* pMat); void ProcessMaterial( aiMaterial* pMat);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Converts the given animation to LH coordinates. /** Converts the given animation to LH coordinates.
* The rotation and translation keys are transformed, the scale keys * The rotation and translation keys are transformed, the scale keys
* work in local space and can therefore be left untouched. * work in local space and can therefore be left untouched.
* @param pAnim The bone animation to transform * @param pAnim The bone animation to transform

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,22 +23,22 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
*/ */
/** @file DXFHelper.h /** @file DXFHelper.h
* @brief Internal utilities for the DXF loader. * @brief Internal utilities for the DXF loader.
*/ */
@ -180,7 +180,7 @@ struct PolyLine
PolyLine() PolyLine()
: flags() : flags()
{} {}
std::vector<aiVector3D> positions; std::vector<aiVector3D> positions;
std::vector<aiColor4D> colors; std::vector<aiColor4D> colors;
std::vector<unsigned int> indices; std::vector<unsigned int> indices;

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -59,14 +59,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace Assimp; using namespace Assimp;
// AutoCAD Binary DXF<CR><LF><SUB><NULL> // AutoCAD Binary DXF<CR><LF><SUB><NULL>
#define AI_DXF_BINARY_IDENT ("AutoCAD Binary DXF\r\n\x1a\0") #define AI_DXF_BINARY_IDENT ("AutoCAD Binary DXF\r\n\x1a\0")
#define AI_DXF_BINARY_IDENT_LEN (24) #define AI_DXF_BINARY_IDENT_LEN (24)
// default vertex color that all uncolored vertices will receive // default vertex color that all uncolored vertices will receive
#define AI_DXF_DEFAULT_COLOR aiColor4D(0.6f,0.6f,0.6f,0.6f) #define AI_DXF_DEFAULT_COLOR aiColor4D(0.6f,0.6f,0.6f,0.6f)
// color indices for DXF - 16 are supported, the table is // color indices for DXF - 16 are supported, the table is
// taken directly from the DXF spec. // taken directly from the DXF spec.
static aiColor4D g_aclrDxfIndexColors[] = static aiColor4D g_aclrDxfIndexColors[] =
{ {
@ -101,7 +101,7 @@ static const aiImporterDesc desc = {
0, 0,
0, 0,
0, 0,
"dxf" "dxf"
}; };
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -110,12 +110,12 @@ DXFImporter::DXFImporter()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor, private as well // Destructor, private as well
DXFImporter::~DXFImporter() DXFImporter::~DXFImporter()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool DXFImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, bool /*checkSig*/) const bool DXFImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, bool /*checkSig*/) const
{ {
return SimpleExtensionCheck(pFile,"dxf"); return SimpleExtensionCheck(pFile,"dxf");
@ -129,13 +129,13 @@ const aiImporterDesc* DXFImporter::GetInfo () const
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure. // Imports the given file into the given scene structure.
void DXFImporter::InternReadFile( const std::string& pFile, void DXFImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, aiScene* pScene,
IOSystem* pIOHandler) IOSystem* pIOHandler)
{ {
boost::shared_ptr<IOStream> file = boost::shared_ptr<IOStream>( pIOHandler->Open( pFile) ); boost::shared_ptr<IOStream> file = boost::shared_ptr<IOStream>( pIOHandler->Open( pFile) );
// Check whether we can read the file // Check whether we can read the file
if( file.get() == NULL) { if( file.get() == NULL) {
throw DeadlyImportError( "Failed to open DXF file " + pFile + ""); throw DeadlyImportError( "Failed to open DXF file " + pFile + "");
@ -153,7 +153,7 @@ void DXFImporter::InternReadFile( const std::string& pFile,
// which will choose a suitable strategy. // which will choose a suitable strategy.
file->Seek(0,aiOrigin_SET); file->Seek(0,aiOrigin_SET);
StreamReaderLE stream( file ); StreamReaderLE stream( file );
DXF::LineReader reader (stream); DXF::LineReader reader (stream);
DXF::FileData output; DXF::FileData output;
@ -167,14 +167,14 @@ void DXFImporter::InternReadFile( const std::string& pFile,
ParseBlocks(reader,output); ParseBlocks(reader,output);
continue; continue;
} }
// primary entity table // primary entity table
if (reader.Is(2,"ENTITIES")) { if (reader.Is(2,"ENTITIES")) {
ParseEntities(reader,output); ParseEntities(reader,output);
continue; continue;
} }
// skip unneeded sections entirely to avoid any problems with them // skip unneeded sections entirely to avoid any problems with them
// alltogether. // alltogether.
else if (reader.Is(2,"CLASSES") || reader.Is(2,"TABLES")) { else if (reader.Is(2,"CLASSES") || reader.Is(2,"TABLES")) {
SkipSection(reader); SkipSection(reader);
@ -239,7 +239,7 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
} }
DXF::Block* entities = 0; DXF::Block* entities = 0;
// index blocks by name // index blocks by name
DXF::BlockMap blocks_by_name; DXF::BlockMap blocks_by_name;
BOOST_FOREACH (DXF::Block& bl, output.blocks) { BOOST_FOREACH (DXF::Block& bl, output.blocks) {
@ -296,7 +296,7 @@ void DXFImporter::ConvertMeshes(aiScene* pScene, DXF::FileData& output)
unsigned int cvert = 0,cface = 0; unsigned int cvert = 0,cface = 0;
BOOST_FOREACH(const DXF::PolyLine* pl, corr[elem.second]){ BOOST_FOREACH(const DXF::PolyLine* pl, corr[elem.second]){
// sum over all faces since we need to 'verbosify' them. // sum over all faces since we need to 'verbosify' them.
cvert += std::accumulate(pl->counts.begin(),pl->counts.end(),0); cvert += std::accumulate(pl->counts.begin(),pl->counts.end(),0);
cface += pl->counts.size(); cface += pl->counts.size();
} }
@ -371,7 +371,7 @@ void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& bloc
// XXX this would be the place to implement recursive expansion if needed. // XXX this would be the place to implement recursive expansion if needed.
const DXF::Block& bl_src = *(*it).second; const DXF::Block& bl_src = *(*it).second;
BOOST_FOREACH (boost::shared_ptr<const DXF::PolyLine> pl_in, bl_src.lines) { BOOST_FOREACH (boost::shared_ptr<const DXF::PolyLine> pl_in, bl_src.lines) {
boost::shared_ptr<DXF::PolyLine> pl_out = boost::shared_ptr<DXF::PolyLine>(new DXF::PolyLine(*pl_in)); boost::shared_ptr<DXF::PolyLine> pl_out = boost::shared_ptr<DXF::PolyLine>(new DXF::PolyLine(*pl_in));
@ -454,21 +454,21 @@ void DXFImporter::GenerateHierarchy(aiScene* pScene, DXF::FileData& /*output*/)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void DXFImporter::SkipSection(DXF::LineReader& reader) void DXFImporter::SkipSection(DXF::LineReader& reader)
{ {
for( ;!reader.End() && !reader.Is(0,"ENDSEC"); reader++); for( ;!reader.End() && !reader.Is(0,"ENDSEC"); reader++);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void DXFImporter::ParseHeader(DXF::LineReader& reader, DXF::FileData& /*output*/) void DXFImporter::ParseHeader(DXF::LineReader& reader, DXF::FileData& /*output*/)
{ {
for( ;!reader.End() && !reader.Is(0,"ENDSEC"); reader++); for( ;!reader.End() && !reader.Is(0,"ENDSEC"); reader++);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void DXFImporter::ParseBlocks(DXF::LineReader& reader, DXF::FileData& output) void DXFImporter::ParseBlocks(DXF::LineReader& reader, DXF::FileData& output)
{ {
while( !reader.End() && !reader.Is(0,"ENDSEC")) { while( !reader.End() && !reader.Is(0,"ENDSEC")) {
if (reader.Is(0,"BLOCK")) { if (reader.Is(0,"BLOCK")) {
ParseBlock(++reader,output); ParseBlock(++reader,output);
@ -485,7 +485,7 @@ void DXFImporter::ParseBlocks(DXF::LineReader& reader, DXF::FileData& output)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void DXFImporter::ParseBlock(DXF::LineReader& reader, DXF::FileData& output) void DXFImporter::ParseBlock(DXF::LineReader& reader, DXF::FileData& output)
{ {
// push a new block onto the stack. // push a new block onto the stack.
output.blocks.push_back( DXF::Block() ); output.blocks.push_back( DXF::Block() );
DXF::Block& block = output.blocks.back(); DXF::Block& block = output.blocks.back();
@ -532,7 +532,7 @@ void DXFImporter::ParseBlock(DXF::LineReader& reader, DXF::FileData& output)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void DXFImporter::ParseEntities(DXF::LineReader& reader, DXF::FileData& output) void DXFImporter::ParseEntities(DXF::LineReader& reader, DXF::FileData& output)
{ {
// push a new block onto the stack. // push a new block onto the stack.
output.blocks.push_back( DXF::Block() ); output.blocks.push_back( DXF::Block() );
DXF::Block& block = output.blocks.back(); DXF::Block& block = output.blocks.back();
@ -566,13 +566,13 @@ void DXFImporter::ParseEntities(DXF::LineReader& reader, DXF::FileData& output)
void DXFImporter::ParseInsertion(DXF::LineReader& reader, DXF::FileData& output) void DXFImporter::ParseInsertion(DXF::LineReader& reader, DXF::FileData& output)
{ {
output.blocks.back().insertions.push_back( DXF::InsertBlock() ); output.blocks.back().insertions.push_back( DXF::InsertBlock() );
DXF::InsertBlock& bl = output.blocks.back().insertions.back(); DXF::InsertBlock& bl = output.blocks.back().insertions.back();
while( !reader.End() && !reader.Is(0)) { while( !reader.End() && !reader.Is(0)) {
switch(reader.GroupCode()) switch(reader.GroupCode())
{ {
// name of referenced block // name of referenced block
case 2: case 2:
@ -623,7 +623,7 @@ void DXFImporter::ParsePolyLine(DXF::LineReader& reader, DXF::FileData& output)
unsigned int iguess = 0, vguess = 0; unsigned int iguess = 0, vguess = 0;
while( !reader.End() && !reader.Is(0,"ENDSEC")) { while( !reader.End() && !reader.Is(0,"ENDSEC")) {
if (reader.Is(0,"VERTEX")) { if (reader.Is(0,"VERTEX")) {
ParsePolyLineVertex(++reader,line); ParsePolyLineVertex(++reader,line);
if (reader.Is(0,"SEQEND")) { if (reader.Is(0,"SEQEND")) {
@ -632,9 +632,9 @@ void DXFImporter::ParsePolyLine(DXF::LineReader& reader, DXF::FileData& output)
continue; continue;
} }
switch(reader.GroupCode()) switch(reader.GroupCode())
{ {
// flags --- important that we know whether it is a // flags --- important that we know whether it is a
// polyface mesh or 'just' a line. // polyface mesh or 'just' a line.
case 70: case 70:
if (!line.flags) { if (!line.flags) {
@ -682,7 +682,7 @@ void DXFImporter::ParsePolyLine(DXF::LineReader& reader, DXF::FileData& output)
return; return;
} }
// if these numbers are wrong, parsing might have gone wild. // if these numbers are wrong, parsing might have gone wild.
// however, the docs state that applications are not required // however, the docs state that applications are not required
// to set the 71 and 72 fields, respectively, to valid values. // to set the 71 and 72 fields, respectively, to valid values.
// So just fire a warning. // So just fire a warning.
@ -752,10 +752,10 @@ void DXFImporter::ParsePolyLineVertex(DXF::LineReader& reader, DXF::PolyLine& li
case 30: out.z = reader.ValueAsFloat();break; case 30: out.z = reader.ValueAsFloat();break;
// POLYFACE vertex indices // POLYFACE vertex indices
case 71: case 71:
case 72: case 72:
case 73: case 73:
case 74: case 74:
if (cnti == 4) { if (cnti == 4) {
DefaultLogger::get()->warn("DXF: more than 4 indices per face not supported; ignoring"); DefaultLogger::get()->warn("DXF: more than 4 indices per face not supported; ignoring");
break; break;
@ -764,14 +764,14 @@ void DXFImporter::ParsePolyLineVertex(DXF::LineReader& reader, DXF::PolyLine& li
break; break;
// color // color
case 62: case 62:
clr = g_aclrDxfIndexColors[reader.ValueAsUnsignedInt() % AI_DXF_NUM_INDEX_COLORS]; clr = g_aclrDxfIndexColors[reader.ValueAsUnsignedInt() % AI_DXF_NUM_INDEX_COLORS];
break; break;
}; };
reader++; reader++;
} }
if (line.flags & DXF_POLYLINE_FLAG_POLYFACEMESH && !(flags & DXF_VERTEX_FLAG_PART_OF_POLYFACE)) { if (line.flags & DXF_POLYLINE_FLAG_POLYFACEMESH && !(flags & DXF_VERTEX_FLAG_PART_OF_POLYFACE)) {
DefaultLogger::get()->warn("DXF: expected vertex to be part of a polyface but the 0x128 flag isn't set"); DefaultLogger::get()->warn("DXF: expected vertex to be part of a polyface but the 0x128 flag isn't set");
} }
@ -805,7 +805,7 @@ void DXFImporter::Parse3DFace(DXF::LineReader& reader, DXF::FileData& output)
aiVector3D vip[4]; aiVector3D vip[4];
aiColor4D clr = AI_DXF_DEFAULT_COLOR; aiColor4D clr = AI_DXF_DEFAULT_COLOR;
bool b[4] = {false,false,false,false}; bool b[4] = {false,false,false,false};
while( !reader.End() ) { while( !reader.End() ) {
@ -813,11 +813,11 @@ void DXFImporter::Parse3DFace(DXF::LineReader& reader, DXF::FileData& output)
if (reader.GroupCode() == 0) { if (reader.GroupCode() == 0) {
break; break;
} }
switch (reader.GroupCode()) switch (reader.GroupCode())
{ {
// 8 specifies the layer // 8 specifies the layer
case 8: case 8:
line.layer = reader.Value(); line.layer = reader.Value();
break; break;
@ -882,8 +882,8 @@ void DXFImporter::Parse3DFace(DXF::LineReader& reader, DXF::FileData& output)
break; break;
// color // color
case 62: case 62:
clr = g_aclrDxfIndexColors[reader.ValueAsUnsignedInt() % AI_DXF_NUM_INDEX_COLORS]; clr = g_aclrDxfIndexColors[reader.ValueAsUnsignedInt() % AI_DXF_NUM_INDEX_COLORS];
break; break;
}; };
@ -895,7 +895,7 @@ void DXFImporter::Parse3DFace(DXF::LineReader& reader, DXF::FileData& output)
if (vip[3] == vip[2]) { if (vip[3] == vip[2]) {
b[1] = false; b[1] = false;
} }
// sanity checks to see if we got something meaningful // sanity checks to see if we got something meaningful
if ((b[1] && !b[0]) || !b[2] || !b[3]) { if ((b[1] && !b[0]) || !b[2] || !b[3]) {
DefaultLogger::get()->warn("DXF: unexpected vertex setup in 3DFACE/LINE/FACE entity; ignoring"); DefaultLogger::get()->warn("DXF: unexpected vertex setup in 3DFACE/LINE/FACE entity; ignoring");

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,22 +23,22 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
*/ */
/** @file DXFLoader.h /** @file DXFLoader.h
* @brief Declaration of the .dxf importer class. * @brief Declaration of the .dxf importer class.
*/ */
#ifndef AI_DXFLOADER_H_INCLUDED #ifndef AI_DXFLOADER_H_INCLUDED
@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp { namespace Assimp {
namespace DXF { namespace DXF {
class LineReader; class LineReader;
struct FileData; struct FileData;
struct PolyLine; struct PolyLine;
@ -74,9 +74,9 @@ public:
public: public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Returns whether the class can handle the format of the given file. /** Returns whether the class can handle the format of the given file.
* See BaseImporter::CanRead() for details. */ * See BaseImporter::CanRead() for details. */
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
bool checkSig) const; bool checkSig) const;
protected: protected:
@ -87,10 +87,10 @@ protected:
const aiImporterDesc* GetInfo () const; const aiImporterDesc* GetInfo () const;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Imports the given file into the given scene structure. /** Imports the given file into the given scene structure.
* See BaseImporter::InternReadFile() for details */ * See BaseImporter::InternReadFile() for details */
void InternReadFile( const std::string& pFile, void InternReadFile( const std::string& pFile,
aiScene* pScene, aiScene* pScene,
IOSystem* pIOHandler); IOSystem* pIOHandler);
private: private:
@ -107,39 +107,39 @@ private:
DXF::FileData& output); DXF::FileData& output);
// ----------------------------------------------------- // -----------------------------------------------------
void ParseBlocks(DXF::LineReader& reader, void ParseBlocks(DXF::LineReader& reader,
DXF::FileData& output); DXF::FileData& output);
// ----------------------------------------------------- // -----------------------------------------------------
void ParseBlock(DXF::LineReader& reader, void ParseBlock(DXF::LineReader& reader,
DXF::FileData& output); DXF::FileData& output);
// ----------------------------------------------------- // -----------------------------------------------------
void ParseInsertion(DXF::LineReader& reader, void ParseInsertion(DXF::LineReader& reader,
DXF::FileData& output); DXF::FileData& output);
// ----------------------------------------------------- // -----------------------------------------------------
void ParsePolyLine(DXF::LineReader& reader, void ParsePolyLine(DXF::LineReader& reader,
DXF::FileData& output); DXF::FileData& output);
// ----------------------------------------------------- // -----------------------------------------------------
void ParsePolyLineVertex(DXF::LineReader& reader, void ParsePolyLineVertex(DXF::LineReader& reader,
DXF::PolyLine& line); DXF::PolyLine& line);
// ----------------------------------------------------- // -----------------------------------------------------
void Parse3DFace(DXF::LineReader& reader, void Parse3DFace(DXF::LineReader& reader,
DXF::FileData& output); DXF::FileData& output);
// ----------------------------------------------------- // -----------------------------------------------------
void ConvertMeshes(aiScene* pScene, void ConvertMeshes(aiScene* pScene,
DXF::FileData& output); DXF::FileData& output);
// ----------------------------------------------------- // -----------------------------------------------------
void GenerateHierarchy(aiScene* pScene, void GenerateHierarchy(aiScene* pScene,
DXF::FileData& output); DXF::FileData& output);
// ----------------------------------------------------- // -----------------------------------------------------
void GenerateMaterials(aiScene* pScene, void GenerateMaterials(aiScene* pScene,
DXF::FileData& output); DXF::FileData& output);
// ----------------------------------------------------- // -----------------------------------------------------

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -79,7 +79,7 @@ bool DeboneProcess::IsActive( unsigned int pFlags) const
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void DeboneProcess::SetupProperties(const Importer* pImp) void DeboneProcess::SetupProperties(const Importer* pImp)
{ {
// get the current value of the property // get the current value of the property
mAllOrNone = pImp->GetPropertyInteger(AI_CONFIG_PP_DB_ALL_OR_NONE,0)?true:false; mAllOrNone = pImp->GetPropertyInteger(AI_CONFIG_PP_DB_ALL_OR_NONE,0)?true:false;
mThreshold = pImp->GetPropertyFloat(AI_CONFIG_PP_DB_THRESHOLD,AI_DEBONE_THRESHOLD); mThreshold = pImp->GetPropertyFloat(AI_CONFIG_PP_DB_THRESHOLD,AI_DEBONE_THRESHOLD);
@ -95,12 +95,12 @@ void DeboneProcess::Execute( aiScene* pScene)
return; return;
} }
std::vector<bool> splitList(pScene->mNumMeshes); std::vector<bool> splitList(pScene->mNumMeshes);
for( unsigned int a = 0; a < pScene->mNumMeshes; a++) { for( unsigned int a = 0; a < pScene->mNumMeshes; a++) {
splitList[a] = ConsiderMesh( pScene->mMeshes[a] ); splitList[a] = ConsiderMesh( pScene->mMeshes[a] );
} }
int numSplits = 0; int numSplits = 0;
if(!!mNumBonesCanDoWithout && (!mAllOrNone||mNumBonesCanDoWithout==mNumBones)) { if(!!mNumBonesCanDoWithout && (!mAllOrNone||mNumBonesCanDoWithout==mNumBones)) {
for(unsigned int a = 0; a < pScene->mNumMeshes; a++) { for(unsigned int a = 0; a < pScene->mNumMeshes; a++) {
@ -124,16 +124,16 @@ void DeboneProcess::Execute( aiScene* pScene)
std::vector<std::pair<aiMesh*,const aiBone*> > newMeshes; std::vector<std::pair<aiMesh*,const aiBone*> > newMeshes;
if(splitList[a]) { if(splitList[a]) {
SplitMesh(srcMesh,newMeshes); SplitMesh(srcMesh,newMeshes);
} }
// mesh was split // mesh was split
if(!newMeshes.empty()) { if(!newMeshes.empty()) {
unsigned int out = 0, in = srcMesh->mNumBones; unsigned int out = 0, in = srcMesh->mNumBones;
// store new meshes and indices of the new meshes // store new meshes and indices of the new meshes
for(unsigned int b=0;b<newMeshes.size();b++) { for(unsigned int b=0;b<newMeshes.size();b++) {
const aiString *find = newMeshes[b].second?&newMeshes[b].second->mName:0; const aiString *find = newMeshes[b].second?&newMeshes[b].second->mName:0;
aiNode *theNode = find?pScene->mRootNode->FindNode(*find):0; aiNode *theNode = find?pScene->mRootNode->FindNode(*find):0;
@ -144,7 +144,7 @@ void DeboneProcess::Execute( aiScene* pScene)
out+=newMeshes[b].first->mNumBones; out+=newMeshes[b].first->mNumBones;
} }
if(!DefaultLogger::isNullLogger()) { if(!DefaultLogger::isNullLogger()) {
char buffer[1024]; char buffer[1024];
::sprintf(buffer,"Removed %u bones. Input bones: %u. Output bones: %u",in-out,in,out); ::sprintf(buffer,"Removed %u bones. Input bones: %u. Output bones: %u",in-out,in,out);
@ -159,8 +159,8 @@ void DeboneProcess::Execute( aiScene* pScene)
mSubMeshIndices[a].push_back(std::pair<unsigned int,aiNode*>(meshes.size(),(aiNode*)0)); mSubMeshIndices[a].push_back(std::pair<unsigned int,aiNode*>(meshes.size(),(aiNode*)0));
meshes.push_back(srcMesh); meshes.push_back(srcMesh);
} }
} }
// rebuild the scene's mesh array // rebuild the scene's mesh array
pScene->mNumMeshes = meshes.size(); pScene->mNumMeshes = meshes.size();
delete [] pScene->mMeshes; delete [] pScene->mMeshes;
@ -207,14 +207,14 @@ bool DeboneProcess::ConsiderMesh(const aiMesh* pMesh)
if(vertexBones[vid]!=cUnowned) { if(vertexBones[vid]!=cUnowned) {
if(vertexBones[vid]==i) //double entry if(vertexBones[vid]==i) //double entry
{ {
DefaultLogger::get()->warn("Encountered double entry in bone weights"); DefaultLogger::get()->warn("Encountered double entry in bone weights");
} }
else //TODO: track attraction in order to break tie else //TODO: track attraction in order to break tie
{ {
vertexBones[vid] = cCoowned; vertexBones[vid] = cCoowned;
} }
} }
else vertexBones[vid] = i; else vertexBones[vid] = i;
} }
if(!isBoneNecessary[i]) { if(!isBoneNecessary[i]) {
@ -235,8 +235,8 @@ bool DeboneProcess::ConsiderMesh(const aiMesh* pMesh)
unsigned int w = vertexBones[pMesh->mFaces[i].mIndices[j]]; unsigned int w = vertexBones[pMesh->mFaces[i].mIndices[j]];
if(v!=w) { if(v!=w) {
if(v<pMesh->mNumBones) isBoneNecessary[v] = true; if(v<pMesh->mNumBones) isBoneNecessary[v] = true;
if(w<pMesh->mNumBones) isBoneNecessary[w] = true; if(w<pMesh->mNumBones) isBoneNecessary[w] = true;
} }
} }
} }
@ -244,10 +244,10 @@ bool DeboneProcess::ConsiderMesh(const aiMesh* pMesh)
for(unsigned int i=0;i<pMesh->mNumBones;i++) { for(unsigned int i=0;i<pMesh->mNumBones;i++) {
if(!isBoneNecessary[i]) { if(!isBoneNecessary[i]) {
mNumBonesCanDoWithout++; mNumBonesCanDoWithout++;
split = true; split = true;
} }
mNumBones++; mNumBones++;
} }
return split; return split;
@ -279,14 +279,14 @@ void DeboneProcess::SplitMesh( const aiMesh* pMesh, std::vector< std::pair< aiMe
if(vertexBones[vid]!=cUnowned) { if(vertexBones[vid]!=cUnowned) {
if(vertexBones[vid]==i) //double entry if(vertexBones[vid]==i) //double entry
{ {
//DefaultLogger::get()->warn("Encountered double entry in bone weights"); //DefaultLogger::get()->warn("Encountered double entry in bone weights");
} }
else //TODO: track attraction in order to break tie else //TODO: track attraction in order to break tie
{ {
vertexBones[vid] = cCoowned; vertexBones[vid] = cCoowned;
} }
} }
else vertexBones[vid] = i; else vertexBones[vid] = i;
} }
if(!isBoneNecessary[i]) { if(!isBoneNecessary[i]) {
@ -309,32 +309,32 @@ void DeboneProcess::SplitMesh( const aiMesh* pMesh, std::vector< std::pair< aiMe
unsigned int w = vertexBones[pMesh->mFaces[i].mIndices[j]]; unsigned int w = vertexBones[pMesh->mFaces[i].mIndices[j]];
if(v!=w) { if(v!=w) {
if(v<pMesh->mNumBones) isBoneNecessary[v] = true; if(v<pMesh->mNumBones) isBoneNecessary[v] = true;
if(w<pMesh->mNumBones) isBoneNecessary[w] = true; if(w<pMesh->mNumBones) isBoneNecessary[w] = true;
} }
else nInterstitial++; else nInterstitial++;
} }
if(v<pMesh->mNumBones &&nInterstitial==pMesh->mFaces[i].mNumIndices) { if(v<pMesh->mNumBones &&nInterstitial==pMesh->mFaces[i].mNumIndices) {
faceBones[i] = v; //primitive belongs to bone #v faceBones[i] = v; //primitive belongs to bone #v
facesPerBone[v]++; facesPerBone[v]++;
} }
else nFacesUnowned++; else nFacesUnowned++;
} }
// invalidate any "cojoined" faces // invalidate any "cojoined" faces
for(unsigned int i=0;i<pMesh->mNumFaces;i++) { for(unsigned int i=0;i<pMesh->mNumFaces;i++) {
if(faceBones[i]<pMesh->mNumBones&&isBoneNecessary[faceBones[i]]) if(faceBones[i]<pMesh->mNumBones&&isBoneNecessary[faceBones[i]])
{ {
ai_assert(facesPerBone[faceBones[i]]>0); ai_assert(facesPerBone[faceBones[i]]>0);
facesPerBone[faceBones[i]]--; facesPerBone[faceBones[i]]--;
nFacesUnowned++; nFacesUnowned++;
faceBones[i] = cUnowned; faceBones[i] = cUnowned;
} }
} }
if(nFacesUnowned) { if(nFacesUnowned) {
std::vector<unsigned int> subFaces; std::vector<unsigned int> subFaces;
for(unsigned int i=0;i<pMesh->mNumFaces;i++) { for(unsigned int i=0;i<pMesh->mNumFaces;i++) {
@ -349,9 +349,9 @@ void DeboneProcess::SplitMesh( const aiMesh* pMesh, std::vector< std::pair< aiMe
poNewMeshes.push_back(push_pair); poNewMeshes.push_back(push_pair);
} }
for(unsigned int i=0;i<pMesh->mNumBones;i++) { for(unsigned int i=0;i<pMesh->mNumBones;i++) {
if(!isBoneNecessary[i]&&facesPerBone[i]>0) { if(!isBoneNecessary[i]&&facesPerBone[i]>0) {
std::vector<unsigned int> subFaces; std::vector<unsigned int> subFaces;
for(unsigned int j=0;j<pMesh->mNumFaces;j++) { for(unsigned int j=0;j<pMesh->mNumFaces;j++) {
@ -367,7 +367,7 @@ void DeboneProcess::SplitMesh( const aiMesh* pMesh, std::vector< std::pair< aiMe
ApplyTransform(subMesh,pMesh->mBones[i]->mOffsetMatrix); ApplyTransform(subMesh,pMesh->mBones[i]->mOffsetMatrix);
std::pair<aiMesh*,const aiBone*> push_pair(subMesh,pMesh->mBones[i]); std::pair<aiMesh*,const aiBone*> push_pair(subMesh,pMesh->mBones[i]);
poNewMeshes.push_back(push_pair); poNewMeshes.push_back(push_pair);
} }
} }
} }
@ -377,13 +377,13 @@ void DeboneProcess::SplitMesh( const aiMesh* pMesh, std::vector< std::pair< aiMe
void DeboneProcess::UpdateNode(aiNode* pNode) const void DeboneProcess::UpdateNode(aiNode* pNode) const
{ {
// rebuild the node's mesh index list // rebuild the node's mesh index list
std::vector<unsigned int> newMeshList; std::vector<unsigned int> newMeshList;
// this will require two passes // this will require two passes
unsigned int m = pNode->mNumMeshes, n = mSubMeshIndices.size(); unsigned int m = pNode->mNumMeshes, n = mSubMeshIndices.size();
// first pass, look for meshes which have not moved // first pass, look for meshes which have not moved
for(unsigned int a=0;a<m;a++) { for(unsigned int a=0;a<m;a++) {
@ -399,7 +399,7 @@ void DeboneProcess::UpdateNode(aiNode* pNode) const
} }
} }
// second pass, collect deboned meshes // second pass, collect deboned meshes
for(unsigned int a=0;a<n;a++) for(unsigned int a=0;a<n;a++)
{ {
@ -436,7 +436,7 @@ void DeboneProcess::ApplyTransform(aiMesh* mesh, const aiMatrix4x4& mat)const
{ {
// Check whether we need to transform the coordinates at all // Check whether we need to transform the coordinates at all
if (!mat.IsIdentity()) { if (!mat.IsIdentity()) {
if (mesh->HasPositions()) { if (mesh->HasPositions()) {
for (unsigned int i = 0; i < mesh->mNumVertices; ++i) { for (unsigned int i = 0; i < mesh->mNumVertices; ++i) {
mesh->mVertices[i] = mat * mesh->mVertices[i]; mesh->mVertices[i] = mat * mesh->mVertices[i];

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -59,9 +59,9 @@ namespace Assimp
#endif // !! AI_DEBONE_THRESHOLD #endif // !! AI_DEBONE_THRESHOLD
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** This post processing step removes bones nearly losslessly or according to /** This post processing step removes bones nearly losslessly or according to
* a configured threshold. In order to remove the bone, the primitives affected by * a configured threshold. In order to remove the bone, the primitives affected by
* the bone are split from the mesh. The split off (new) mesh is boneless. At any * the bone are split from the mesh. The split off (new) mesh is boneless. At any
* point in time, bones without affect upon a given mesh are to be removed. * point in time, bones without affect upon a given mesh are to be removed.
*/ */
class DeboneProcess : public BaseProcess class DeboneProcess : public BaseProcess
@ -74,9 +74,9 @@ public:
public: public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Returns whether the processing step is present in the given flag. /** Returns whether the processing step is present in the given flag.
* @param pFlags The processing flags the importer was called with. * @param pFlags The processing flags the importer was called with.
* A bitwise combination of #aiPostProcessSteps. * A bitwise combination of #aiPostProcessSteps.
* @return true if the process is present in this flag fields, * @return true if the process is present in this flag fields,
* false if not. * false if not.
*/ */
bool IsActive( unsigned int pFlags) const; bool IsActive( unsigned int pFlags) const;
@ -89,7 +89,7 @@ public:
void SetupProperties(const Importer* pImp); void SetupProperties(const Importer* pImp);
protected: protected:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Executes the post processing step on the given imported data. /** Executes the post processing step on the given imported data.
* At the moment a process is not supposed to fail. * At the moment a process is not supposed to fail.
@ -112,7 +112,7 @@ protected:
void UpdateNode(aiNode* pNode) const; void UpdateNode(aiNode* pNode) const;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Apply transformation to a mesh // Apply transformation to a mesh
void ApplyTransform(aiMesh* mesh, const aiMatrix4x4& mat)const; void ApplyTransform(aiMesh* mesh, const aiMatrix4x4& mat)const;
public: public:

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,21 +25,21 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
/** @file DefaultIOStream.cpp /** @file DefaultIOStream.cpp
* @brief Default File I/O implementation for #Importer * @brief Default File I/O implementation for #Importer
*/ */
@ -60,8 +60,8 @@ DefaultIOStream::~DefaultIOStream()
} }
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
size_t DefaultIOStream::Read(void* pvBuffer, size_t DefaultIOStream::Read(void* pvBuffer,
size_t pSize, size_t pSize,
size_t pCount) size_t pCount)
{ {
ai_assert(NULL != pvBuffer && 0 != pSize && 0 != pCount); ai_assert(NULL != pvBuffer && 0 != pSize && 0 != pCount);
@ -69,7 +69,7 @@ size_t DefaultIOStream::Read(void* pvBuffer,
} }
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
size_t DefaultIOStream::Write(const void* pvBuffer, size_t DefaultIOStream::Write(const void* pvBuffer,
size_t pSize, size_t pSize,
size_t pCount) size_t pCount)
{ {
@ -86,7 +86,7 @@ aiReturn DefaultIOStream::Seek(size_t pOffset,
} }
// Just to check whether our enum maps one to one with the CRT constants // Just to check whether our enum maps one to one with the CRT constants
BOOST_STATIC_ASSERT(aiOrigin_CUR == SEEK_CUR && BOOST_STATIC_ASSERT(aiOrigin_CUR == SEEK_CUR &&
aiOrigin_END == SEEK_END && aiOrigin_SET == SEEK_SET); aiOrigin_END == SEEK_END && aiOrigin_SET == SEEK_SET);
// do the seek // do the seek
@ -108,7 +108,7 @@ size_t DefaultIOStream::FileSize() const
if (! mFile || mFilename.empty()) { if (! mFile || mFilename.empty()) {
return 0; return 0;
} }
if (SIZE_MAX == cachedSize) { if (SIZE_MAX == cachedSize) {
// Although fseek/ftell would allow us to reuse the exising file handle here, // Although fseek/ftell would allow us to reuse the exising file handle here,
@ -120,17 +120,17 @@ size_t DefaultIOStream::FileSize() const
// See here for details: // See here for details:
// https://www.securecoding.cert.org/confluence/display/seccode/FIO19-C.+Do+not+use+fseek()+and+ftell()+to+compute+the+size+of+a+regular+file // https://www.securecoding.cert.org/confluence/display/seccode/FIO19-C.+Do+not+use+fseek()+and+ftell()+to+compute+the+size+of+a+regular+file
#if defined _WIN32 && !defined __GNUC__ #if defined _WIN32 && !defined __GNUC__
struct __stat64 fileStat; struct __stat64 fileStat;
int err = _stat64( mFilename.c_str(), &fileStat ); int err = _stat64( mFilename.c_str(), &fileStat );
if (0 != err) if (0 != err)
return 0; return 0;
cachedSize = (size_t) (fileStat.st_size); cachedSize = (size_t) (fileStat.st_size);
#else #else
struct stat fileStat; struct stat fileStat;
int err = stat(mFilename.c_str(), &fileStat ); int err = stat(mFilename.c_str(), &fileStat );
if (0 != err) if (0 != err)
return 0; return 0;
cachedSize = (size_t) (fileStat.st_size); cachedSize = (size_t) (fileStat.st_size);
#endif #endif
} }
return cachedSize; return cachedSize;

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -58,13 +58,13 @@ namespace Assimp {
class DefaultIOStream : public IOStream class DefaultIOStream : public IOStream
{ {
friend class DefaultIOSystem; friend class DefaultIOSystem;
#if __ANDROID__ #if __ANDROID__
#if __ANDROID_API__ > 9 #if __ANDROID_API__ > 9
#if defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT) #if defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT)
friend class AndroidJNIIOSystem; friend class AndroidJNIIOSystem;
#endif // defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT) #endif // defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT)
#endif // __ANDROID_API__ > 9 #endif // __ANDROID_API__ > 9
#endif // __ANDROID__ #endif // __ANDROID__
protected: protected:
DefaultIOStream(); DefaultIOStream();
@ -76,14 +76,14 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/// Read from stream /// Read from stream
size_t Read(void* pvBuffer, size_t Read(void* pvBuffer,
size_t pSize, size_t pSize,
size_t pCount); size_t pCount);
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/// Write to stream /// Write to stream
size_t Write(const void* pvBuffer, size_t Write(const void* pvBuffer,
size_t pSize, size_t pSize,
size_t pCount); size_t pCount);
@ -116,8 +116,8 @@ private:
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
inline DefaultIOStream::DefaultIOStream () : inline DefaultIOStream::DefaultIOStream () :
mFile (NULL), mFile (NULL),
mFilename (""), mFilename (""),
cachedSize (SIZE_MAX) cachedSize (SIZE_MAX)
{ {
@ -126,9 +126,9 @@ inline DefaultIOStream::DefaultIOStream () :
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
inline DefaultIOStream::DefaultIOStream (FILE* pFile, inline DefaultIOStream::DefaultIOStream (FILE* pFile,
const std::string &strFilename) : const std::string &strFilename) :
mFile(pFile), mFile(pFile),
mFilename(strFilename), mFilename(strFilename),
cachedSize (SIZE_MAX) cachedSize (SIZE_MAX)
{ {

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -57,14 +57,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using namespace Assimp; using namespace Assimp;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor. // Constructor.
DefaultIOSystem::DefaultIOSystem() DefaultIOSystem::DefaultIOSystem()
{ {
// nothing to do here // nothing to do here
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor. // Destructor.
DefaultIOSystem::~DefaultIOSystem() DefaultIOSystem::~DefaultIOSystem()
{ {
// nothing to do here // nothing to do here
@ -90,7 +90,7 @@ IOStream* DefaultIOSystem::Open( const char* strFile, const char* strMode)
ai_assert(NULL != strMode); ai_assert(NULL != strMode);
FILE* file = ::fopen( strFile, strMode); FILE* file = ::fopen( strFile, strMode);
if( NULL == file) if( NULL == file)
return NULL; return NULL;
return new DefaultIOStream(file, (std::string) strFile); return new DefaultIOStream(file, (std::string) strFile);
@ -122,7 +122,7 @@ bool IOSystem::ComparePaths (const char* one, const char* second) const
} }
// maximum path length // maximum path length
// XXX http://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html // XXX http://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html
#ifdef PATH_MAX #ifdef PATH_MAX
# define PATHLIMIT PATH_MAX # define PATHLIMIT PATH_MAX
#else #else
@ -140,13 +140,13 @@ inline void MakeAbsolutePath (const char* in, char* _out)
#else #else
// use realpath // use realpath
ret = realpath(in, _out); ret = realpath(in, _out);
#endif #endif
if(!ret) { if(!ret) {
// preserve the input path, maybe someone else is able to fix // preserve the input path, maybe someone else is able to fix
// the path before it is accessed (e.g. our file system filter) // the path before it is accessed (e.g. our file system filter)
DefaultLogger::get()->warn("Invalid path: "+std::string(in)); DefaultLogger::get()->warn("Invalid path: "+std::string(in));
strcpy(_out,in); strcpy(_out,in);
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -160,7 +160,7 @@ bool DefaultIOSystem::ComparePaths (const char* one, const char* second) const
char temp1[PATHLIMIT]; char temp1[PATHLIMIT];
char temp2[PATHLIMIT]; char temp2[PATHLIMIT];
MakeAbsolutePath (one, temp1); MakeAbsolutePath (one, temp1);
MakeAbsolutePath (second, temp2); MakeAbsolutePath (second, temp2);

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -76,7 +76,7 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Compare two paths */ /** Compare two paths */
bool ComparePaths (const char* one, const char* second) const; bool ComparePaths (const char* one, const char* second) const;
/** @brief get the file name of a full filepath /** @brief get the file name of a full filepath
* example: /tmp/archive.tar.gz -> archive.tar.gz * example: /tmp/archive.tar.gz -> archive.tar.gz
*/ */

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -84,7 +84,7 @@ struct LogStreamInfo
{ {
// empty // empty
} }
// Destructor // Destructor
~LogStreamInfo() ~LogStreamInfo()
{ {
@ -98,7 +98,7 @@ LogStream* LogStream::createDefaultStream(aiDefaultLogStream streams,
const char* name /*= "AssimpLog.txt"*/, const char* name /*= "AssimpLog.txt"*/,
IOSystem* io /*= NULL*/) IOSystem* io /*= NULL*/)
{ {
switch (streams) switch (streams)
{ {
// This is a platform-specific feature // This is a platform-specific feature
case aiDefaultLogStream_DEBUGGER: case aiDefaultLogStream_DEBUGGER:
@ -154,7 +154,7 @@ Logger *DefaultLogger::create(const char* name /*= "AssimpLog.txt"*/,
// Stream the log to CERR? // Stream the log to CERR?
if (defStreams & aiDefaultLogStream_STDERR) if (defStreams & aiDefaultLogStream_STDERR)
m_pLogger->attachStream( LogStream::createDefaultStream(aiDefaultLogStream_STDERR)); m_pLogger->attachStream( LogStream::createDefaultStream(aiDefaultLogStream_STDERR));
// Stream the log to a file // Stream the log to a file
if (defStreams & aiDefaultLogStream_FILE && name && *name) if (defStreams & aiDefaultLogStream_FILE && name && *name)
m_pLogger->attachStream( LogStream::createDefaultStream(aiDefaultLogStream_FILE,name,io)); m_pLogger->attachStream( LogStream::createDefaultStream(aiDefaultLogStream_FILE,name,io));
@ -176,17 +176,17 @@ void Logger::debug(const char* message) {
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
void Logger::info(const char* message) { void Logger::info(const char* message) {
// SECURITY FIX: see above // SECURITY FIX: see above
if (strlen(message)>MAX_LOG_MESSAGE_LENGTH) { if (strlen(message)>MAX_LOG_MESSAGE_LENGTH) {
return; return;
} }
return OnInfo(message); return OnInfo(message);
} }
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
void Logger::warn(const char* message) { void Logger::warn(const char* message) {
// SECURITY FIX: see above // SECURITY FIX: see above
if (strlen(message)>MAX_LOG_MESSAGE_LENGTH) { if (strlen(message)>MAX_LOG_MESSAGE_LENGTH) {
return; return;
@ -196,7 +196,7 @@ void Logger::warn(const char* message) {
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
void Logger::error(const char* message) { void Logger::error(const char* message) {
// SECURITY FIX: see above // SECURITY FIX: see above
if (strlen(message)>MAX_LOG_MESSAGE_LENGTH) { if (strlen(message)>MAX_LOG_MESSAGE_LENGTH) {
return; return;
@ -310,7 +310,7 @@ bool DefaultLogger::attachStream( LogStream *pStream, unsigned int severity )
return true; return true;
} }
} }
LogStreamInfo *pInfo = new LogStreamInfo( severity, pStream ); LogStreamInfo *pInfo = new LogStreamInfo( severity, pStream );
m_StreamArray.push_back( pInfo ); m_StreamArray.push_back( pInfo );
return true; return true;
@ -326,7 +326,7 @@ bool DefaultLogger::detatchStream( LogStream *pStream, unsigned int severity )
if (0 == severity) { if (0 == severity) {
severity = SeverityAll; severity = SeverityAll;
} }
for ( StreamIt it = m_StreamArray.begin(); for ( StreamIt it = m_StreamArray.begin();
it != m_StreamArray.end(); it != m_StreamArray.end();
++it ) ++it )
@ -350,7 +350,7 @@ bool DefaultLogger::detatchStream( LogStream *pStream, unsigned int severity )
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
// Constructor // Constructor
DefaultLogger::DefaultLogger(LogSeverity severity) DefaultLogger::DefaultLogger(LogSeverity severity)
: Logger ( severity ) : Logger ( severity )
, noRepeatMsg (false) , noRepeatMsg (false)
@ -371,7 +371,7 @@ DefaultLogger::~DefaultLogger()
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
// Writes message to stream // Writes message to stream
void DefaultLogger::WriteToStreams(const char *message, void DefaultLogger::WriteToStreams(const char *message,
ErrorSeverity ErrorSev ) ErrorSeverity ErrorSev )
{ {
ai_assert(NULL != message); ai_assert(NULL != message);

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -49,16 +49,16 @@ namespace Assimp {
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
/** @brief Internal default implementation of the #ProgressHandler interface. */ /** @brief Internal default implementation of the #ProgressHandler interface. */
class DefaultProgressHandler class DefaultProgressHandler
: public ProgressHandler { : public ProgressHandler {
virtual bool Update(float /*percentage*/) { virtual bool Update(float /*percentage*/) {
return false; return false;
} }
}; // !class DefaultProgressHandler }; // !class DefaultProgressHandler
} // Namespace Assimp } // Namespace Assimp
#endif #endif

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2012, assimp team Copyright (c) 2006-2012, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2008, assimp team Copyright (c) 2006-2008, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -50,7 +50,7 @@ using std::runtime_error;
#endif #endif
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** FOR IMPORTER PLUGINS ONLY: Simple exception class to be thrown if an /** FOR IMPORTER PLUGINS ONLY: Simple exception class to be thrown if an
* unrecoverable error occurs while importing. Loading APIs return * unrecoverable error occurs while importing. Loading APIs return
* NULL instead of a valid aiScene then. */ * NULL instead of a valid aiScene then. */
class DeadlyImportError class DeadlyImportError

View File

@ -7,8 +7,8 @@ Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following with or without modification, are permitted provided that the following
conditions are met: conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -25,16 +25,16 @@ conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
*/ */
@ -92,7 +92,7 @@ void ExportSceneAssxml(const char*, IOSystem*, const aiScene*, const ExportPrope
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// global array of all export formats which Assimp supports in its current build // global array of all export formats which Assimp supports in its current build
Exporter::ExportFormatEntry gExporters[] = Exporter::ExportFormatEntry gExporters[] =
{ {
#ifndef ASSIMP_BUILD_NO_COLLADA_EXPORTER #ifndef ASSIMP_BUILD_NO_COLLADA_EXPORTER
Exporter::ExportFormatEntry( "collada", "COLLADA - Digital Asset Exchange Schema", "dae", &ExportSceneCollada), Exporter::ExportFormatEntry( "collada", "COLLADA - Digital Asset Exchange Schema", "dae", &ExportSceneCollada),
@ -108,21 +108,21 @@ Exporter::ExportFormatEntry gExporters[] =
#endif #endif
#ifndef ASSIMP_BUILD_NO_OBJ_EXPORTER #ifndef ASSIMP_BUILD_NO_OBJ_EXPORTER
Exporter::ExportFormatEntry( "obj", "Wavefront OBJ format", "obj", &ExportSceneObj, Exporter::ExportFormatEntry( "obj", "Wavefront OBJ format", "obj", &ExportSceneObj,
aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */), aiProcess_GenSmoothNormals /*| aiProcess_PreTransformVertices */),
#endif #endif
#ifndef ASSIMP_BUILD_NO_STL_EXPORTER #ifndef ASSIMP_BUILD_NO_STL_EXPORTER
Exporter::ExportFormatEntry( "stl", "Stereolithography", "stl" , &ExportSceneSTL, Exporter::ExportFormatEntry( "stl", "Stereolithography", "stl" , &ExportSceneSTL,
aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices
), ),
Exporter::ExportFormatEntry( "stlb", "Stereolithography (binary)", "stl" , &ExportSceneSTLBinary, Exporter::ExportFormatEntry( "stlb", "Stereolithography (binary)", "stl" , &ExportSceneSTLBinary,
aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_PreTransformVertices
), ),
#endif #endif
#ifndef ASSIMP_BUILD_NO_PLY_EXPORTER #ifndef ASSIMP_BUILD_NO_PLY_EXPORTER
Exporter::ExportFormatEntry( "ply", "Stanford Polygon Library", "ply" , &ExportScenePly, Exporter::ExportFormatEntry( "ply", "Stanford Polygon Library", "ply" , &ExportScenePly,
aiProcess_PreTransformVertices aiProcess_PreTransformVertices
), ),
Exporter::ExportFormatEntry( "plyb", "Stanford Polygon Library (binary)", "ply", &ExportScenePlyBinary, Exporter::ExportFormatEntry( "plyb", "Stanford Polygon Library (binary)", "ply", &ExportScenePlyBinary,
@ -162,7 +162,7 @@ public:
std::copy(gExporters,gExporters+ASSIMP_NUM_EXPORTERS,mExporters.begin()); std::copy(gExporters,gExporters+ASSIMP_NUM_EXPORTERS,mExporters.begin());
} }
~ExporterPimpl() ~ExporterPimpl()
{ {
delete blob; delete blob;
@ -173,7 +173,7 @@ public:
} }
public: public:
aiExportDataBlob* blob; aiExportDataBlob* blob;
boost::shared_ptr< Assimp::IOSystem > mIOSystem; boost::shared_ptr< Assimp::IOSystem > mIOSystem;
bool mIsDefaultIOHandler; bool mIsDefaultIOHandler;
@ -199,7 +199,7 @@ using namespace Assimp;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Exporter :: Exporter() Exporter :: Exporter()
: pimpl(new ExporterPimpl()) : pimpl(new ExporterPimpl())
{ {
} }
@ -263,7 +263,7 @@ const aiExportDataBlob* Exporter :: ExportToBlob( const aiScene* pScene, const
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool IsVerboseFormat(const aiMesh* mesh) bool IsVerboseFormat(const aiMesh* mesh)
{ {
// avoid slow vector<bool> specialization // avoid slow vector<bool> specialization
std::vector<unsigned int> seen(mesh->mNumVertices,0); std::vector<unsigned int> seen(mesh->mNumVertices,0);
@ -281,7 +281,7 @@ bool IsVerboseFormat(const aiMesh* mesh)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool IsVerboseFormat(const aiScene* pScene) bool IsVerboseFormat(const aiScene* pScene)
{ {
for(unsigned int i = 0; i < pScene->mNumMeshes; ++i) { for(unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
if(!IsVerboseFormat(pScene->mMeshes[i])) { if(!IsVerboseFormat(pScene->mMeshes[i])) {
@ -301,7 +301,7 @@ aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const
// format. They will likely not be aware that there is a flag in the scene to indicate // format. They will likely not be aware that there is a flag in the scene to indicate
// this, however. To avoid surprises and bug reports, we check for duplicates in // this, however. To avoid surprises and bug reports, we check for duplicates in
// meshes upfront. // meshes upfront.
const bool is_verbose_format = !(pScene->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT) || IsVerboseFormat(pScene); const bool is_verbose_format = !(pScene->mFlags & AI_SCENE_FLAGS_NON_VERBOSE_FORMAT) || IsVerboseFormat(pScene);
pimpl->mError = ""; pimpl->mError = "";
for (size_t i = 0; i < pimpl->mExporters.size(); ++i) { for (size_t i = 0; i < pimpl->mExporters.size(); ++i) {
@ -310,7 +310,7 @@ aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const
try { try {
// Always create a full copy of the scene. We might optimize this one day, // Always create a full copy of the scene. We might optimize this one day,
// but for now it is the most pragmatic way. // but for now it is the most pragmatic way.
aiScene* scenecopy_tmp; aiScene* scenecopy_tmp;
SceneCombiner::CopyScene(&scenecopy_tmp,pScene); SceneCombiner::CopyScene(&scenecopy_tmp,pScene);
@ -339,7 +339,7 @@ aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const
// we need to run the MakeVerboseFormat step first. // we need to run the MakeVerboseFormat step first.
bool must_join_again = false; bool must_join_again = false;
if (!is_verbose_format) { if (!is_verbose_format) {
bool verbosify = false; bool verbosify = false;
for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) { for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) {
BaseProcess* const p = pimpl->mPostProcessingSteps[a]; BaseProcess* const p = pimpl->mPostProcessingSteps[a];
@ -370,7 +370,7 @@ aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const
step.Execute(scenecopy.get()); step.Execute(scenecopy.get());
} }
} }
{ {
FlipUVsProcess step; FlipUVsProcess step;
if (step.IsActive(pp)) { if (step.IsActive(pp)) {
@ -389,9 +389,9 @@ aiReturn Exporter :: Export( const aiScene* pScene, const char* pFormatId, const
for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) { for( unsigned int a = 0; a < pimpl->mPostProcessingSteps.size(); a++) {
BaseProcess* const p = pimpl->mPostProcessingSteps[a]; BaseProcess* const p = pimpl->mPostProcessingSteps[a];
if (p->IsActive(pp) if (p->IsActive(pp)
&& !dynamic_cast<FlipUVsProcess*>(p) && !dynamic_cast<FlipUVsProcess*>(p)
&& !dynamic_cast<FlipWindingOrderProcess*>(p) && !dynamic_cast<FlipWindingOrderProcess*>(p)
&& !dynamic_cast<MakeLeftHandedProcess*>(p)) { && !dynamic_cast<MakeLeftHandedProcess*>(p)) {
p->Execute(scenecopy.get()); p->Execute(scenecopy.get());
@ -443,14 +443,14 @@ void Exporter :: FreeBlob( )
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
const aiExportDataBlob* Exporter :: GetBlob() const const aiExportDataBlob* Exporter :: GetBlob() const
{ {
return pimpl->blob; return pimpl->blob;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
const aiExportDataBlob* Exporter :: GetOrphanedBlob() const const aiExportDataBlob* Exporter :: GetOrphanedBlob() const
{ {
const aiExportDataBlob* tmp = pimpl->blob; const aiExportDataBlob* tmp = pimpl->blob;
pimpl->blob = NULL; pimpl->blob = NULL;
@ -459,18 +459,18 @@ const aiExportDataBlob* Exporter :: GetOrphanedBlob() const
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
size_t Exporter :: GetExportFormatCount() const size_t Exporter :: GetExportFormatCount() const
{ {
return pimpl->mExporters.size(); return pimpl->mExporters.size();
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
const aiExportFormatDesc* Exporter :: GetExportFormatDescription( size_t pIndex ) const const aiExportFormatDesc* Exporter :: GetExportFormatDescription( size_t pIndex ) const
{ {
if (pIndex >= GetExportFormatCount()) { if (pIndex >= GetExportFormatCount()) {
return NULL; return NULL;
} }
// Return from static storage if the requested index is built-in. // Return from static storage if the requested index is built-in.
if (pIndex < sizeof(gExporters) / sizeof(gExporters[0])) { if (pIndex < sizeof(gExporters) / sizeof(gExporters[0])) {
return &gExporters[pIndex].mDescription; return &gExporters[pIndex].mDescription;
@ -512,7 +512,7 @@ ExportProperties::ExportProperties(const ExportProperties &other)
mStringProperties(other.mStringProperties), mStringProperties(other.mStringProperties),
mMatrixProperties(other.mMatrixProperties) mMatrixProperties(other.mMatrixProperties)
{ {
} }
@ -546,7 +546,7 @@ bool ExportProperties :: SetPropertyMatrix(const char* szName, const aiMatrix4x4
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Get a configuration property // Get a configuration property
int ExportProperties :: GetPropertyInteger(const char* szName, int ExportProperties :: GetPropertyInteger(const char* szName,
int iErrorReturn /*= 0xffffffff*/) const int iErrorReturn /*= 0xffffffff*/) const
{ {
return GetGenericProperty<int>(mIntProperties,szName,iErrorReturn); return GetGenericProperty<int>(mIntProperties,szName,iErrorReturn);
@ -554,7 +554,7 @@ int ExportProperties :: GetPropertyInteger(const char* szName,
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Get a configuration property // Get a configuration property
float ExportProperties :: GetPropertyFloat(const char* szName, float ExportProperties :: GetPropertyFloat(const char* szName,
float iErrorReturn /*= 10e10*/) const float iErrorReturn /*= 10e10*/) const
{ {
return GetGenericProperty<float>(mFloatProperties,szName,iErrorReturn); return GetGenericProperty<float>(mFloatProperties,szName,iErrorReturn);
@ -562,7 +562,7 @@ float ExportProperties :: GetPropertyFloat(const char* szName,
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Get a configuration property // Get a configuration property
const std::string ExportProperties :: GetPropertyString(const char* szName, const std::string ExportProperties :: GetPropertyString(const char* szName,
const std::string& iErrorReturn /*= ""*/) const const std::string& iErrorReturn /*= ""*/) const
{ {
return GetGenericProperty<std::string>(mStringProperties,szName,iErrorReturn); return GetGenericProperty<std::string>(mStringProperties,szName,iErrorReturn);
@ -570,7 +570,7 @@ const std::string ExportProperties :: GetPropertyString(const char* szName,
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Has a configuration property // Has a configuration property
const aiMatrix4x4 ExportProperties :: GetPropertyMatrix(const char* szName, const aiMatrix4x4 ExportProperties :: GetPropertyMatrix(const char* szName,
const aiMatrix4x4& iErrorReturn /*= aiMatrix4x4()*/) const const aiMatrix4x4& iErrorReturn /*= aiMatrix4x4()*/) const
{ {
return GetGenericProperty<aiMatrix4x4>(mMatrixProperties,szName,iErrorReturn); return GetGenericProperty<aiMatrix4x4>(mMatrixProperties,szName,iErrorReturn);

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,24 +23,24 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
*/ */
/** @file FBXAnimation.cpp /** @file FBXAnimation.cpp
* @brief Assimp::FBX::AnimationCurve, Assimp::FBX::AnimationCurveNode, * @brief Assimp::FBX::AnimationCurve, Assimp::FBX::AnimationCurveNode,
* Assimp::FBX::AnimationLayer, Assimp::FBX::AnimationStack * Assimp::FBX::AnimationLayer, Assimp::FBX::AnimationStack
*/ */
#ifndef ASSIMP_BUILD_NO_FBX_IMPORTER #ifndef ASSIMP_BUILD_NO_FBX_IMPORTER
@ -72,7 +72,7 @@ AnimationCurve::AnimationCurve(uint64_t id, const Element& element, const std::s
if(keys.size() != values.size()) { if(keys.size() != values.size()) {
DOMError("the number of key times does not match the number of keyframe values",&KeyTime); DOMError("the number of key times does not match the number of keyframe values",&KeyTime);
} }
// check if the key times are well-ordered // check if the key times are well-ordered
if(!std::equal(keys.begin(), keys.end() - 1, keys.begin() + 1, std::less<KeyTimeList::value_type>())) { if(!std::equal(keys.begin(), keys.end() - 1, keys.begin() + 1, std::less<KeyTimeList::value_type>())) {
DOMError("the keyframes are not in ascending order",&KeyTime); DOMError("the keyframes are not in ascending order",&KeyTime);
@ -98,14 +98,14 @@ AnimationCurve::~AnimationCurve()
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element& element, const std::string& name, const Document& doc, AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element& element, const std::string& name, const Document& doc,
const char* const * target_prop_whitelist /*= NULL*/, size_t whitelist_size /*= 0*/) const char* const * target_prop_whitelist /*= NULL*/, size_t whitelist_size /*= 0*/)
: Object(id, element, name) : Object(id, element, name)
, target() , target()
, doc(doc) , doc(doc)
{ {
const Scope& sc = GetRequiredScope(element); const Scope& sc = GetRequiredScope(element);
// find target node // find target node
const char* whitelist[] = {"Model","NodeAttribute"}; const char* whitelist[] = {"Model","NodeAttribute"};
const std::vector<const Connection*>& conns = doc.GetConnectionsBySourceSequenced(ID(),whitelist,2); const std::vector<const Connection*>& conns = doc.GetConnectionsBySourceSequenced(ID(),whitelist,2);
@ -140,7 +140,7 @@ AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element& element, cons
// XXX support constraints as DOM class // XXX support constraints as DOM class
//ai_assert(dynamic_cast<const Model*>(ob) || dynamic_cast<const NodeAttribute*>(ob)); //ai_assert(dynamic_cast<const Model*>(ob) || dynamic_cast<const NodeAttribute*>(ob));
target = ob; target = ob;
if(!target) { if(!target) {
continue; continue;
} }
@ -218,7 +218,7 @@ AnimationLayer::~AnimationLayer()
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
AnimationCurveNodeList AnimationLayer::Nodes(const char* const * target_prop_whitelist /*= NULL*/, AnimationCurveNodeList AnimationLayer::Nodes(const char* const * target_prop_whitelist /*= NULL*/,
size_t whitelist_size /*= 0*/) const size_t whitelist_size /*= 0*/) const
{ {
AnimationCurveNodeList nodes; AnimationCurveNodeList nodes;

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -24,15 +24,15 @@ following conditions are met:
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -102,7 +102,7 @@ public:
Converter(aiScene* out, const Document& doc) Converter(aiScene* out, const Document& doc)
: defaultMaterialIndex() : defaultMaterialIndex()
, out(out) , out(out)
, doc(doc) , doc(doc)
{ {
// animations need to be converted first since this will // animations need to be converted first since this will
@ -155,7 +155,7 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// find scene root and trigger recursive scene conversion // find scene root and trigger recursive scene conversion
void ConvertRootNode() void ConvertRootNode()
{ {
out->mRootNode = new aiNode(); out->mRootNode = new aiNode();
out->mRootNode->mName.Set("RootNode"); out->mRootNode->mName.Set("RootNode");
@ -208,7 +208,7 @@ private:
const std::string& original_name = FixNodeName(model->Name()); const std::string& original_name = FixNodeName(model->Name());
// check if any of the nodes in the chain has the name the fbx node // check if any of the nodes in the chain has the name the fbx node
// is supposed to have. If there is none, add another node to // is supposed to have. If there is none, add another node to
// preserve the name - people might have scripts etc. that rely // preserve the name - people might have scripts etc. that rely
// on specific node names. // on specific node names.
aiNode* name_carrier = NULL; aiNode* name_carrier = NULL;
@ -258,7 +258,7 @@ private:
ConvertCameras(*model); ConvertCameras(*model);
} }
nodes.push_back(nodes_chain.front()); nodes.push_back(nodes_chain.front());
nodes_chain.clear(); nodes_chain.clear();
} }
} }
@ -269,7 +269,7 @@ private:
std::swap_ranges(nodes.begin(),nodes.end(),parent.mChildren); std::swap_ranges(nodes.begin(),nodes.end(),parent.mChildren);
} }
} }
catch(std::exception&) { catch(std::exception&) {
Util::delete_fun<aiNode> deleter; Util::delete_fun<aiNode> deleter;
std::for_each(nodes.begin(),nodes.end(),deleter); std::for_each(nodes.begin(),nodes.end(),deleter);
@ -478,7 +478,7 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
aiVector3D TransformationCompDefaultValue(TransformationComp comp) aiVector3D TransformationCompDefaultValue(TransformationComp comp)
{ {
// XXX a neat way to solve the never-ending special cases for scaling // XXX a neat way to solve the never-ending special cases for scaling
// would be to do everything in log space! // would be to do everything in log space!
return comp == TransformationComp_Scaling ? aiVector3D(1.f,1.f,1.f) : aiVector3D(); return comp == TransformationComp_Scaling ? aiVector3D(1.f,1.f,1.f) : aiVector3D();
} }
@ -524,7 +524,7 @@ private:
order[2] = 0; order[2] = 0;
break; break;
case Model::RotOrder_EulerXZY: case Model::RotOrder_EulerXZY:
order[0] = 1; order[0] = 1;
order[1] = 2; order[1] = 2;
order[2] = 0; order[2] = 0;
@ -536,13 +536,13 @@ private:
order[2] = 1; order[2] = 1;
break; break;
case Model::RotOrder_EulerYXZ: case Model::RotOrder_EulerYXZ:
order[0] = 2; order[0] = 2;
order[1] = 0; order[1] = 0;
order[2] = 1; order[2] = 1;
break; break;
case Model::RotOrder_EulerZXY: case Model::RotOrder_EulerZXY:
order[0] = 1; order[0] = 1;
order[1] = 0; order[1] = 0;
order[2] = 2; order[2] = 2;
@ -557,7 +557,7 @@ private:
default: default:
ai_assert(false); ai_assert(false);
} }
ai_assert((order[0] >= 0) && (order[0] <= 2)); ai_assert((order[0] >= 0) && (order[0] <= 2));
ai_assert((order[1] >= 0) && (order[1] <= 2)); ai_assert((order[1] >= 0) && (order[1] <= 2));
ai_assert((order[2] >= 0) && (order[2] <= 2)); ai_assert((order[2] >= 0) && (order[2] <= 2));
@ -588,7 +588,7 @@ private:
const TransformationComp comp = static_cast<TransformationComp>(i); const TransformationComp comp = static_cast<TransformationComp>(i);
if( comp == TransformationComp_Rotation || comp == TransformationComp_Scaling || comp == TransformationComp_Translation || if( comp == TransformationComp_Rotation || comp == TransformationComp_Scaling || comp == TransformationComp_Translation ||
comp == TransformationComp_GeometricScaling || comp == TransformationComp_GeometricRotation || comp == TransformationComp_GeometricTranslation ) { comp == TransformationComp_GeometricScaling || comp == TransformationComp_GeometricRotation || comp == TransformationComp_GeometricTranslation ) {
continue; continue;
} }
@ -612,7 +612,7 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
/** note: memory for output_nodes will be managed by the caller */ /** note: memory for output_nodes will be managed by the caller */
void GenerateTransformationNodeChain(const Model& model, void GenerateTransformationNodeChain(const Model& model,
std::vector<aiNode*>& output_nodes) std::vector<aiNode*>& output_nodes)
{ {
const PropertyTable& props = model.Props(); const PropertyTable& props = model.Props();
@ -622,7 +622,7 @@ private:
aiMatrix4x4 chain[TransformationComp_MAXIMUM]; aiMatrix4x4 chain[TransformationComp_MAXIMUM];
std::fill_n(chain, static_cast<unsigned int>(TransformationComp_MAXIMUM), aiMatrix4x4()); std::fill_n(chain, static_cast<unsigned int>(TransformationComp_MAXIMUM), aiMatrix4x4());
// generate transformation matrices for all the different transformation components // generate transformation matrices for all the different transformation components
const float zero_epsilon = 1e-6f; const float zero_epsilon = 1e-6f;
bool is_complex = false; bool is_complex = false;
@ -637,14 +637,14 @@ private:
const aiVector3D& PostRotation = PropertyGet<aiVector3D>(props,"PostRotation",ok); const aiVector3D& PostRotation = PropertyGet<aiVector3D>(props,"PostRotation",ok);
if(ok && PostRotation.SquareLength() > zero_epsilon) { if(ok && PostRotation.SquareLength() > zero_epsilon) {
is_complex = true; is_complex = true;
GetRotationMatrix(rot, PostRotation, chain[TransformationComp_PostRotation]); GetRotationMatrix(rot, PostRotation, chain[TransformationComp_PostRotation]);
} }
const aiVector3D& RotationPivot = PropertyGet<aiVector3D>(props,"RotationPivot",ok); const aiVector3D& RotationPivot = PropertyGet<aiVector3D>(props,"RotationPivot",ok);
if(ok && RotationPivot.SquareLength() > zero_epsilon) { if(ok && RotationPivot.SquareLength() > zero_epsilon) {
is_complex = true; is_complex = true;
aiMatrix4x4::Translation(RotationPivot,chain[TransformationComp_RotationPivot]); aiMatrix4x4::Translation(RotationPivot,chain[TransformationComp_RotationPivot]);
aiMatrix4x4::Translation(-RotationPivot,chain[TransformationComp_RotationPivotInverse]); aiMatrix4x4::Translation(-RotationPivot,chain[TransformationComp_RotationPivotInverse]);
} }
@ -659,7 +659,7 @@ private:
const aiVector3D& ScalingOffset = PropertyGet<aiVector3D>(props,"ScalingOffset",ok); const aiVector3D& ScalingOffset = PropertyGet<aiVector3D>(props,"ScalingOffset",ok);
if(ok && ScalingOffset.SquareLength() > zero_epsilon) { if(ok && ScalingOffset.SquareLength() > zero_epsilon) {
is_complex = true; is_complex = true;
aiMatrix4x4::Translation(ScalingOffset,chain[TransformationComp_ScalingOffset]); aiMatrix4x4::Translation(ScalingOffset,chain[TransformationComp_ScalingOffset]);
} }
@ -685,12 +685,12 @@ private:
if(ok && Rotation.SquareLength() > zero_epsilon) { if(ok && Rotation.SquareLength() > zero_epsilon) {
GetRotationMatrix(rot, Rotation, chain[TransformationComp_Rotation]); GetRotationMatrix(rot, Rotation, chain[TransformationComp_Rotation]);
} }
const aiVector3D& GeometricScaling = PropertyGet<aiVector3D>(props, "GeometricScaling", ok); const aiVector3D& GeometricScaling = PropertyGet<aiVector3D>(props, "GeometricScaling", ok);
if (ok && std::fabs(GeometricScaling.SquareLength() - 1.0f) > zero_epsilon) { if (ok && std::fabs(GeometricScaling.SquareLength() - 1.0f) > zero_epsilon) {
aiMatrix4x4::Scaling(GeometricScaling, chain[TransformationComp_GeometricScaling]); aiMatrix4x4::Scaling(GeometricScaling, chain[TransformationComp_GeometricScaling]);
} }
const aiVector3D& GeometricRotation = PropertyGet<aiVector3D>(props, "GeometricRotation", ok); const aiVector3D& GeometricRotation = PropertyGet<aiVector3D>(props, "GeometricRotation", ok);
if (ok && GeometricRotation.SquareLength() > zero_epsilon) { if (ok && GeometricRotation.SquareLength() > zero_epsilon) {
GetRotationMatrix(rot, GeometricRotation, chain[TransformationComp_GeometricRotation]); GetRotationMatrix(rot, GeometricRotation, chain[TransformationComp_GeometricRotation]);
@ -715,7 +715,7 @@ private:
FBXImporter::LogInfo("generating full transformation chain for node: " + name); FBXImporter::LogInfo("generating full transformation chain for node: " + name);
// query the anim_chain_bits dictionary to find out which chain elements // query the anim_chain_bits dictionary to find out which chain elements
// have associated node animation channels. These can not be dropped // have associated node animation channels. These can not be dropped
// even if they have identity transform in bind pose. // even if they have identity transform in bind pose.
NodeAnimBitMap::const_iterator it = node_anim_chain_bits.find(name); NodeAnimBitMap::const_iterator it = node_anim_chain_bits.find(name);
const unsigned int anim_chain_bitmask = (it == node_anim_chain_bits.end() ? 0 : (*it).second); const unsigned int anim_chain_bitmask = (it == node_anim_chain_bits.end() ? 0 : (*it).second);
@ -723,14 +723,14 @@ private:
unsigned int bit = 0x1; unsigned int bit = 0x1;
for (size_t i = 0; i < TransformationComp_MAXIMUM; ++i, bit <<= 1) { for (size_t i = 0; i < TransformationComp_MAXIMUM; ++i, bit <<= 1) {
const TransformationComp comp = static_cast<TransformationComp>(i); const TransformationComp comp = static_cast<TransformationComp>(i);
if (chain[i].IsIdentity() && (anim_chain_bitmask & bit) == 0) { if (chain[i].IsIdentity() && (anim_chain_bitmask & bit) == 0) {
continue; continue;
} }
aiNode* nd = new aiNode(); aiNode* nd = new aiNode();
output_nodes.push_back(nd); output_nodes.push_back(nd);
nd->mName.Set(NameTransformationChainNode(name, comp)); nd->mName.Set(NameTransformationChainNode(name, comp));
nd->mTransformation = chain[i]; nd->mTransformation = chain[i];
} }
@ -749,7 +749,7 @@ private:
nd->mTransformation = nd->mTransformation * chain[i]; nd->mTransformation = nd->mTransformation * chain[i];
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void SetupNodeMetadata(const Model& model, aiNode& nd) void SetupNodeMetadata(const Model& model, aiNode& nd)
@ -823,10 +823,10 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// MeshGeometry -> aiMesh, return mesh index + 1 or 0 if the conversion failed // MeshGeometry -> aiMesh, return mesh index + 1 or 0 if the conversion failed
std::vector<unsigned int> ConvertMesh(const MeshGeometry& mesh,const Model& model, std::vector<unsigned int> ConvertMesh(const MeshGeometry& mesh,const Model& model,
const aiMatrix4x4& node_global_transform) const aiMatrix4x4& node_global_transform)
{ {
std::vector<unsigned int> temp; std::vector<unsigned int> temp;
MeshMap::const_iterator it = meshes_converted.find(&mesh); MeshMap::const_iterator it = meshes_converted.find(&mesh);
if (it != meshes_converted.end()) { if (it != meshes_converted.end()) {
@ -841,7 +841,7 @@ private:
return temp; return temp;
} }
// one material per mesh maps easily to aiMesh. Multiple material // one material per mesh maps easily to aiMesh. Multiple material
// meshes need to be split. // meshes need to be split.
const MatIndexArray& mindices = mesh.GetMaterialIndices(); const MatIndexArray& mindices = mesh.GetMaterialIndices();
if (doc.Settings().readMaterials && !mindices.empty()) { if (doc.Settings().readMaterials && !mindices.empty()) {
@ -881,11 +881,11 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
unsigned int ConvertMeshSingleMaterial(const MeshGeometry& mesh, const Model& model, unsigned int ConvertMeshSingleMaterial(const MeshGeometry& mesh, const Model& model,
const aiMatrix4x4& node_global_transform) const aiMatrix4x4& node_global_transform)
{ {
const MatIndexArray& mindices = mesh.GetMaterialIndices(); const MatIndexArray& mindices = mesh.GetMaterialIndices();
aiMesh* const out_mesh = SetupEmptyMesh(mesh); aiMesh* const out_mesh = SetupEmptyMesh(mesh);
const std::vector<aiVector3D>& vertices = mesh.GetVertices(); const std::vector<aiVector3D>& vertices = mesh.GetVertices();
const std::vector<unsigned int>& faces = mesh.GetFaceIndexCounts(); const std::vector<unsigned int>& faces = mesh.GetFaceIndexCounts();
@ -904,7 +904,7 @@ private:
aiFace& f = *fac++; aiFace& f = *fac++;
f.mNumIndices = pcount; f.mNumIndices = pcount;
f.mIndices = new unsigned int[pcount]; f.mIndices = new unsigned int[pcount];
switch(pcount) switch(pcount)
{ {
case 1: case 1:
out_mesh->mPrimitiveTypes |= aiPrimitiveType_POINT; out_mesh->mPrimitiveTypes |= aiPrimitiveType_POINT;
@ -951,7 +951,7 @@ private:
binormals = &tempBinormals; binormals = &tempBinormals;
} }
else { else {
binormals = NULL; binormals = NULL;
} }
} }
@ -1009,12 +1009,12 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::vector<unsigned int> ConvertMeshMultiMaterial(const MeshGeometry& mesh, const Model& model, std::vector<unsigned int> ConvertMeshMultiMaterial(const MeshGeometry& mesh, const Model& model,
const aiMatrix4x4& node_global_transform) const aiMatrix4x4& node_global_transform)
{ {
const MatIndexArray& mindices = mesh.GetMaterialIndices(); const MatIndexArray& mindices = mesh.GetMaterialIndices();
ai_assert(mindices.size()); ai_assert(mindices.size());
std::set<MatIndexArray::value_type> had; std::set<MatIndexArray::value_type> had;
std::vector<unsigned int> indices; std::vector<unsigned int> indices;
@ -1031,9 +1031,9 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
unsigned int ConvertMeshMultiMaterial(const MeshGeometry& mesh, const Model& model, unsigned int ConvertMeshMultiMaterial(const MeshGeometry& mesh, const Model& model,
MatIndexArray::value_type index, MatIndexArray::value_type index,
const aiMatrix4x4& node_global_transform) const aiMatrix4x4& node_global_transform)
{ {
aiMesh* const out_mesh = SetupEmptyMesh(mesh); aiMesh* const out_mesh = SetupEmptyMesh(mesh);
@ -1048,9 +1048,9 @@ private:
// count faces // count faces
std::vector<unsigned int>::const_iterator itf = faces.begin(); std::vector<unsigned int>::const_iterator itf = faces.begin();
for(MatIndexArray::const_iterator it = mindices.begin(), for(MatIndexArray::const_iterator it = mindices.begin(),
end = mindices.end(); it != end; ++it, ++itf) end = mindices.end(); it != end; ++it, ++itf)
{ {
if ((*it) != index) { if ((*it) != index) {
continue; continue;
} }
@ -1083,7 +1083,7 @@ private:
out_mesh->mNormals = new aiVector3D[vertices.size()]; out_mesh->mNormals = new aiVector3D[vertices.size()];
} }
// allocate tangents, binormals. // allocate tangents, binormals.
const std::vector<aiVector3D>& tangents = mesh.GetTangents(); const std::vector<aiVector3D>& tangents = mesh.GetTangents();
const std::vector<aiVector3D>* binormals = &mesh.GetBinormals(); const std::vector<aiVector3D>* binormals = &mesh.GetBinormals();
@ -1091,7 +1091,7 @@ private:
std::vector<aiVector3D> tempBinormals; std::vector<aiVector3D> tempBinormals;
if (!binormals->size()) { if (!binormals->size()) {
if (normals.size()) { if (normals.size()) {
// XXX this computes the binormals for the entire mesh, not only // XXX this computes the binormals for the entire mesh, not only
// the part for which we need them. // the part for which we need them.
tempBinormals.resize(normals.size()); tempBinormals.resize(normals.size());
for (unsigned int i = 0; i < tangents.size(); ++i) { for (unsigned int i = 0; i < tangents.size(); ++i) {
@ -1101,7 +1101,7 @@ private:
binormals = &tempBinormals; binormals = &tempBinormals;
} }
else { else {
binormals = NULL; binormals = NULL;
} }
} }
@ -1139,9 +1139,9 @@ private:
unsigned int cursor = 0, in_cursor = 0; unsigned int cursor = 0, in_cursor = 0;
itf = faces.begin(); itf = faces.begin();
for(MatIndexArray::const_iterator it = mindices.begin(), for(MatIndexArray::const_iterator it = mindices.begin(),
end = mindices.end(); it != end; ++it, ++itf) end = mindices.end(); it != end; ++it, ++itf)
{ {
const unsigned int pcount = *itf; const unsigned int pcount = *itf;
if ((*it) != index) { if ((*it) != index) {
in_cursor += pcount; in_cursor += pcount;
@ -1152,7 +1152,7 @@ private:
f.mNumIndices = pcount; f.mNumIndices = pcount;
f.mIndices = new unsigned int[pcount]; f.mIndices = new unsigned int[pcount];
switch(pcount) switch(pcount)
{ {
case 1: case 1:
out_mesh->mPrimitiveTypes |= aiPrimitiveType_POINT; out_mesh->mPrimitiveTypes |= aiPrimitiveType_POINT;
@ -1196,7 +1196,7 @@ private:
} }
} }
} }
ConvertMaterialForMesh(out_mesh,model,mesh,index); ConvertMaterialForMesh(out_mesh,model,mesh,index);
if(process_weights) { if(process_weights) {
@ -1206,7 +1206,7 @@ private:
return static_cast<unsigned int>(meshes.size() - 1); return static_cast<unsigned int>(meshes.size() - 1);
} }
static const unsigned int NO_MATERIAL_SEPARATION = /* std::numeric_limits<unsigned int>::max() */ static const unsigned int NO_MATERIAL_SEPARATION = /* std::numeric_limits<unsigned int>::max() */
static_cast<unsigned int>(-1); static_cast<unsigned int>(-1);
@ -1215,9 +1215,9 @@ private:
* account when determining which weights to include. * account when determining which weights to include.
* - outputVertStartIndices is only used when a material index is specified, it gives for * - outputVertStartIndices is only used when a material index is specified, it gives for
* each output vertex the DOM index it maps to. */ * each output vertex the DOM index it maps to. */
void ConvertWeights(aiMesh* out, const Model& model, const MeshGeometry& geo, void ConvertWeights(aiMesh* out, const Model& model, const MeshGeometry& geo,
const aiMatrix4x4& node_global_transform = aiMatrix4x4(), const aiMatrix4x4& node_global_transform = aiMatrix4x4(),
unsigned int materialIndex = NO_MATERIAL_SEPARATION, unsigned int materialIndex = NO_MATERIAL_SEPARATION,
std::vector<unsigned int>* outputVertStartIndices = NULL) std::vector<unsigned int>* outputVertStartIndices = NULL)
{ {
ai_assert(geo.DeformerSkin()); ai_assert(geo.DeformerSkin());
@ -1247,7 +1247,7 @@ private:
const MatIndexArray& mats = geo.GetMaterialIndices(); const MatIndexArray& mats = geo.GetMaterialIndices();
bool ok = false; bool ok = false;
const size_t no_index_sentinel = std::numeric_limits<size_t>::max(); const size_t no_index_sentinel = std::numeric_limits<size_t>::max();
@ -1268,12 +1268,12 @@ private:
index_out_indices.push_back(no_index_sentinel); index_out_indices.push_back(no_index_sentinel);
count_out_indices.push_back(0); count_out_indices.push_back(0);
for(unsigned int i = 0; i < count; ++i) { for(unsigned int i = 0; i < count; ++i) {
if (no_mat_check || static_cast<size_t>(mats[geo.FaceForVertexIndex(out_idx[i])]) == materialIndex) { if (no_mat_check || static_cast<size_t>(mats[geo.FaceForVertexIndex(out_idx[i])]) == materialIndex) {
if (index_out_indices.back() == no_index_sentinel) { if (index_out_indices.back() == no_index_sentinel) {
index_out_indices.back() = out_indices.size(); index_out_indices.back() = out_indices.size();
} }
if (no_mat_check) { if (no_mat_check) {
@ -1293,14 +1293,14 @@ private:
++count_out_indices.back(); ++count_out_indices.back();
ok = true; ok = true;
} }
} }
} }
// if we found at least one, generate the output bones // if we found at least one, generate the output bones
// XXX this could be heavily simplified by collecting the bone // XXX this could be heavily simplified by collecting the bone
// data in a single step. // data in a single step.
if (ok) { if (ok) {
ConvertCluster(bones, model, *cluster, out_indices, index_out_indices, ConvertCluster(bones, model, *cluster, out_indices, index_out_indices,
count_out_indices, node_global_transform); count_out_indices, node_global_transform);
} }
} }
@ -1360,13 +1360,13 @@ private:
out_weight.mVertexId = static_cast<unsigned int>(out_indices[index_index + j]); out_weight.mVertexId = static_cast<unsigned int>(out_indices[index_index + j]);
out_weight.mWeight = weights[i]; out_weight.mWeight = weights[i];
} }
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ConvertMaterialForMesh(aiMesh* out, const Model& model, const MeshGeometry& geo, void ConvertMaterialForMesh(aiMesh* out, const Model& model, const MeshGeometry& geo,
MatIndexArray::value_type materialIndex) MatIndexArray::value_type materialIndex)
{ {
// locate source materials for this mesh // locate source materials for this mesh
@ -1384,7 +1384,7 @@ private:
return; return;
} }
out->mMaterialIndex = ConvertMaterial(*mat, &geo); out->mMaterialIndex = ConvertMaterial(*mat, &geo);
materials_converted[mat] = out->mMaterialIndex; materials_converted[mat] = out->mMaterialIndex;
} }
@ -1393,7 +1393,7 @@ private:
unsigned int GetDefaultMaterial() unsigned int GetDefaultMaterial()
{ {
if (defaultMaterialIndex) { if (defaultMaterialIndex) {
return defaultMaterialIndex - 1; return defaultMaterialIndex - 1;
} }
aiMaterial* out_mat = new aiMaterial(); aiMaterial* out_mat = new aiMaterial();
@ -1441,7 +1441,7 @@ private:
// shading stuff and colors // shading stuff and colors
SetShadingPropertiesCommon(out_mat,props); SetShadingPropertiesCommon(out_mat,props);
// texture assignments // texture assignments
SetTextureProperties(out_mat,material.Textures(), mesh); SetTextureProperties(out_mat,material.Textures(), mesh);
SetTextureProperties(out_mat,material.LayeredTextures(), mesh); SetTextureProperties(out_mat,material.LayeredTextures(), mesh);
@ -1451,8 +1451,8 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void TrySetTextureProperties(aiMaterial* out_mat, const TextureMap& textures, void TrySetTextureProperties(aiMaterial* out_mat, const TextureMap& textures,
const std::string& propName, const std::string& propName,
aiTextureType target, const MeshGeometry* const mesh) aiTextureType target, const MeshGeometry* const mesh)
{ {
TextureMap::const_iterator it = textures.find(propName); TextureMap::const_iterator it = textures.find(propName);
@ -1494,14 +1494,14 @@ private:
// be moved, causing trouble when users read only the first // be moved, causing trouble when users read only the first
// UV channel and ignore UV channel assignments altogether. // UV channel and ignore UV channel assignments altogether.
const unsigned int matIndex = static_cast<unsigned int>(std::distance(materials.begin(), const unsigned int matIndex = static_cast<unsigned int>(std::distance(materials.begin(),
std::find(materials.begin(),materials.end(),out_mat) std::find(materials.begin(),materials.end(),out_mat)
)); ));
uvIndex = -1; uvIndex = -1;
if (!mesh) if (!mesh)
{ {
BOOST_FOREACH(const MeshMap::value_type& v,meshes_converted) { BOOST_FOREACH(const MeshMap::value_type& v,meshes_converted) {
const MeshGeometry* const mesh = dynamic_cast<const MeshGeometry*> (v.first); const MeshGeometry* const mesh = dynamic_cast<const MeshGeometry*> (v.first);
if(!mesh) { if(!mesh) {
@ -1533,7 +1533,7 @@ private:
uvIndex = index; uvIndex = index;
} }
else { else {
FBXImporter::LogWarn("the UV channel named " + uvSet + FBXImporter::LogWarn("the UV channel named " + uvSet +
" appears at different positions in meshes, results will be wrong"); " appears at different positions in meshes, results will be wrong");
} }
} }
@ -1572,8 +1572,8 @@ private:
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void TrySetTextureProperties(aiMaterial* out_mat, const LayeredTextureMap& layeredTextures, void TrySetTextureProperties(aiMaterial* out_mat, const LayeredTextureMap& layeredTextures,
const std::string& propName, const std::string& propName,
aiTextureType target, const MeshGeometry* const mesh) aiTextureType target, const MeshGeometry* const mesh)
{ {
LayeredTextureMap::const_iterator it = layeredTextures.find(propName); LayeredTextureMap::const_iterator it = layeredTextures.find(propName);
@ -1614,13 +1614,13 @@ private:
// be moved, causing trouble when users read only the first // be moved, causing trouble when users read only the first
// UV channel and ignore UV channel assignments altogether. // UV channel and ignore UV channel assignments altogether.
const unsigned int matIndex = static_cast<unsigned int>(std::distance(materials.begin(), const unsigned int matIndex = static_cast<unsigned int>(std::distance(materials.begin(),
std::find(materials.begin(),materials.end(),out_mat) std::find(materials.begin(),materials.end(),out_mat)
)); ));
uvIndex = -1; uvIndex = -1;
if (!mesh) if (!mesh)
{ {
BOOST_FOREACH(const MeshMap::value_type& v,meshes_converted) { BOOST_FOREACH(const MeshMap::value_type& v,meshes_converted) {
const MeshGeometry* const mesh = dynamic_cast<const MeshGeometry*> (v.first); const MeshGeometry* const mesh = dynamic_cast<const MeshGeometry*> (v.first);
if(!mesh) { if(!mesh) {
@ -1652,7 +1652,7 @@ private:
uvIndex = index; uvIndex = index;
} }
else { else {
FBXImporter::LogWarn("the UV channel named " + uvSet + FBXImporter::LogWarn("the UV channel named " + uvSet +
" appears at different positions in meshes, results will be wrong"); " appears at different positions in meshes, results will be wrong");
} }
} }
@ -1721,7 +1721,7 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
aiColor3D GetColorPropertyFromMaterial(const PropertyTable& props, const std::string& baseName, aiColor3D GetColorPropertyFromMaterial(const PropertyTable& props, const std::string& baseName,
bool& result) bool& result)
{ {
result = true; result = true;
@ -1752,8 +1752,8 @@ private:
{ {
// set shading properties. There are various, redundant ways in which FBX materials // set shading properties. There are various, redundant ways in which FBX materials
// specify their shading settings (depending on shading models, prop // specify their shading settings (depending on shading models, prop
// template etc.). No idea which one is right in a particular context. // template etc.). No idea which one is right in a particular context.
// Just try to make sense of it - there's no spec to verify this against, // Just try to make sense of it - there's no spec to verify this against,
// so why should we. // so why should we.
bool ok; bool ok;
const aiColor3D& Diffuse = GetColorPropertyFromMaterial(props,"Diffuse",ok); const aiColor3D& Diffuse = GetColorPropertyFromMaterial(props,"Diffuse",ok);
@ -1855,7 +1855,7 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// convert animation data to aiAnimation et al // convert animation data to aiAnimation et al
void ConvertAnimations() void ConvertAnimations()
{ {
// first of all determine framerate // first of all determine framerate
const FileGlobalSettings::FrameRate fps = doc.GlobalSettings().TimeMode(); const FileGlobalSettings::FrameRate fps = doc.GlobalSettings().TimeMode();
@ -1870,8 +1870,8 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// rename a node already partially converted. fixed_name is a string previously returned by // rename a node already partially converted. fixed_name is a string previously returned by
// FixNodeName, new_name specifies the string FixNodeName should return on all further invocations // FixNodeName, new_name specifies the string FixNodeName should return on all further invocations
// which would previously have returned the old value. // which would previously have returned the old value.
// //
// this also updates names in node animations, cameras and light sources and is thus slow. // this also updates names in node animations, cameras and light sources and is thus slow.
@ -1920,7 +1920,7 @@ private:
// UNLESS RenameNode() is called for a particular node name. // UNLESS RenameNode() is called for a particular node name.
std::string FixNodeName(const std::string& name) std::string FixNodeName(const std::string& name)
{ {
// strip Model:: prefix, avoiding ambiguities (i.e. don't strip if // strip Model:: prefix, avoiding ambiguities (i.e. don't strip if
// this causes ambiguities, well possible between empty identifiers, // this causes ambiguities, well possible between empty identifiers,
// such as "Model::" and ""). Make sure the behaviour is consistent // such as "Model::" and ""). Make sure the behaviour is consistent
// across multiple calls to FixNodeName(). // across multiple calls to FixNodeName().
@ -1960,7 +1960,7 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ConvertAnimationStack(const AnimationStack& st) void ConvertAnimationStack(const AnimationStack& st)
{ {
const AnimationLayerList& layers = st.Layers(); const AnimationLayerList& layers = st.Layers();
if(layers.empty()) { if(layers.empty()) {
return; return;
@ -1979,12 +1979,12 @@ private:
} }
anim->mName.Set(name); anim->mName.Set(name);
// need to find all nodes for which we need to generate node animations - // need to find all nodes for which we need to generate node animations -
// it may happen that we need to merge multiple layers, though. // it may happen that we need to merge multiple layers, though.
NodeMap node_map; NodeMap node_map;
// reverse mapping from curves to layers, much faster than querying // reverse mapping from curves to layers, much faster than querying
// the FBX DOM for it. // the FBX DOM for it.
LayerMap layer_map; LayerMap layer_map;
@ -1993,7 +1993,7 @@ private:
"Lcl Rotation", "Lcl Rotation",
"Lcl Translation" "Lcl Translation"
}; };
BOOST_FOREACH(const AnimationLayer* layer, layers) { BOOST_FOREACH(const AnimationLayer* layer, layers) {
ai_assert(layer); ai_assert(layer);
@ -2027,12 +2027,12 @@ private:
try { try {
BOOST_FOREACH(const NodeMap::value_type& kv, node_map) { BOOST_FOREACH(const NodeMap::value_type& kv, node_map) {
GenerateNodeAnimations(node_anims, GenerateNodeAnimations(node_anims,
kv.first, kv.first,
kv.second, kv.second,
layer_map, layer_map,
start_time, stop_time, start_time, stop_time,
max_time, max_time,
min_time); min_time);
} }
} }
@ -2081,10 +2081,10 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void GenerateNodeAnimations(std::vector<aiNodeAnim*>& node_anims, void GenerateNodeAnimations(std::vector<aiNodeAnim*>& node_anims,
const std::string& fixed_name, const std::string& fixed_name,
const std::vector<const AnimationCurveNode*>& curves, const std::vector<const AnimationCurveNode*>& curves,
const LayerMap& layer_map, const LayerMap& layer_map,
int64_t start, int64_t stop, int64_t start, int64_t stop,
double& max_time, double& max_time,
double& min_time) double& min_time)
@ -2147,7 +2147,7 @@ private:
// check if this curves contains redundant information by looking // check if this curves contains redundant information by looking
// up the corresponding node's transformation chain. // up the corresponding node's transformation chain.
if (doc.Settings().optimizeEmptyAnimationCurves && if (doc.Settings().optimizeEmptyAnimationCurves &&
IsRedundantAnimationData(target, comp, (*chain[i]).second)) { IsRedundantAnimationData(target, comp, (*chain[i]).second)) {
FBXImporter::LogDebug("dropping redundant animation channel for node " + target.Name()); FBXImporter::LogDebug("dropping redundant animation channel for node " + target.Name());
@ -2175,8 +2175,8 @@ private:
// we can use a single node and also a single node animation channel. // we can use a single node and also a single node animation channel.
if (!has_complex && !NeedsComplexTransformationChain(target)) { if (!has_complex && !NeedsComplexTransformationChain(target)) {
aiNodeAnim* const nd = GenerateSimpleNodeAnim(fixed_name, target, chain, aiNodeAnim* const nd = GenerateSimpleNodeAnim(fixed_name, target, chain,
node_property_map.end(), node_property_map.end(),
layer_map, layer_map,
start, stop, start, stop,
max_time, max_time,
@ -2212,14 +2212,14 @@ private:
const std::string& chain_name = NameTransformationChainNode(fixed_name, comp); const std::string& chain_name = NameTransformationChainNode(fixed_name, comp);
aiNodeAnim* na; aiNodeAnim* na;
switch(comp) switch(comp)
{ {
case TransformationComp_Rotation: case TransformationComp_Rotation:
case TransformationComp_PreRotation: case TransformationComp_PreRotation:
case TransformationComp_PostRotation: case TransformationComp_PostRotation:
case TransformationComp_GeometricRotation: case TransformationComp_GeometricRotation:
na = GenerateRotationNodeAnim(chain_name, na = GenerateRotationNodeAnim(chain_name,
target, target,
(*chain[i]).second, (*chain[i]).second,
layer_map, layer_map,
start, stop, start, stop,
@ -2234,8 +2234,8 @@ private:
case TransformationComp_ScalingPivot: case TransformationComp_ScalingPivot:
case TransformationComp_Translation: case TransformationComp_Translation:
case TransformationComp_GeometricTranslation: case TransformationComp_GeometricTranslation:
na = GenerateTranslationNodeAnim(chain_name, na = GenerateTranslationNodeAnim(chain_name,
target, target,
(*chain[i]).second, (*chain[i]).second,
layer_map, layer_map,
start, stop, start, stop,
@ -2244,11 +2244,11 @@ private:
// pivoting requires us to generate an implicit inverse channel to undo the pivot translation // pivoting requires us to generate an implicit inverse channel to undo the pivot translation
if (comp == TransformationComp_RotationPivot) { if (comp == TransformationComp_RotationPivot) {
const std::string& invName = NameTransformationChainNode(fixed_name, const std::string& invName = NameTransformationChainNode(fixed_name,
TransformationComp_RotationPivotInverse); TransformationComp_RotationPivotInverse);
aiNodeAnim* const inv = GenerateTranslationNodeAnim(invName, aiNodeAnim* const inv = GenerateTranslationNodeAnim(invName,
target, target,
(*chain[i]).second, (*chain[i]).second,
layer_map, layer_map,
start, stop, start, stop,
@ -2268,11 +2268,11 @@ private:
flags |= bit << (TransformationComp_RotationPivotInverse - i); flags |= bit << (TransformationComp_RotationPivotInverse - i);
} }
else if (comp == TransformationComp_ScalingPivot) { else if (comp == TransformationComp_ScalingPivot) {
const std::string& invName = NameTransformationChainNode(fixed_name, const std::string& invName = NameTransformationChainNode(fixed_name,
TransformationComp_ScalingPivotInverse); TransformationComp_ScalingPivotInverse);
aiNodeAnim* const inv = GenerateTranslationNodeAnim(invName, aiNodeAnim* const inv = GenerateTranslationNodeAnim(invName,
target, target,
(*chain[i]).second, (*chain[i]).second,
layer_map, layer_map,
start, stop, start, stop,
@ -2287,7 +2287,7 @@ private:
else { else {
node_anims.push_back(inv); node_anims.push_back(inv);
} }
ai_assert(TransformationComp_RotationPivotInverse > i); ai_assert(TransformationComp_RotationPivotInverse > i);
flags |= bit << (TransformationComp_RotationPivotInverse - i); flags |= bit << (TransformationComp_RotationPivotInverse - i);
} }
@ -2296,8 +2296,8 @@ private:
case TransformationComp_Scaling: case TransformationComp_Scaling:
case TransformationComp_GeometricScaling: case TransformationComp_GeometricScaling:
na = GenerateScalingNodeAnim(chain_name, na = GenerateScalingNodeAnim(chain_name,
target, target,
(*chain[i]).second, (*chain[i]).second,
layer_map, layer_map,
start, stop, start, stop,
@ -2326,8 +2326,8 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool IsRedundantAnimationData(const Model& target, bool IsRedundantAnimationData(const Model& target,
TransformationComp comp, TransformationComp comp,
const std::vector<const AnimationCurveNode*>& curves) const std::vector<const AnimationCurveNode*>& curves)
{ {
ai_assert(curves.size()); ai_assert(curves.size());
@ -2362,8 +2362,8 @@ private:
} }
const aiVector3D dyn_val = aiVector3D(vx[0], vy[0], vz[0]); const aiVector3D dyn_val = aiVector3D(vx[0], vy[0], vz[0]);
const aiVector3D& static_val = PropertyGet<aiVector3D>(target.Props(), const aiVector3D& static_val = PropertyGet<aiVector3D>(target.Props(),
NameTransformationCompProperty(comp), NameTransformationCompProperty(comp),
TransformationCompDefaultValue(comp) TransformationCompDefaultValue(comp)
); );
@ -2373,8 +2373,8 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
aiNodeAnim* GenerateRotationNodeAnim(const std::string& name, aiNodeAnim* GenerateRotationNodeAnim(const std::string& name,
const Model& target, const Model& target,
const std::vector<const AnimationCurveNode*>& curves, const std::vector<const AnimationCurveNode*>& curves,
const LayerMap& layer_map, const LayerMap& layer_map,
int64_t start, int64_t stop, int64_t start, int64_t stop,
@ -2405,7 +2405,7 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
aiNodeAnim* GenerateScalingNodeAnim(const std::string& name, aiNodeAnim* GenerateScalingNodeAnim(const std::string& name,
const Model& /*target*/, const Model& /*target*/,
const std::vector<const AnimationCurveNode*>& curves, const std::vector<const AnimationCurveNode*>& curves,
const LayerMap& layer_map, const LayerMap& layer_map,
@ -2437,7 +2437,7 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
aiNodeAnim* GenerateTranslationNodeAnim(const std::string& name, aiNodeAnim* GenerateTranslationNodeAnim(const std::string& name,
const Model& /*target*/, const Model& /*target*/,
const std::vector<const AnimationCurveNode*>& curves, const std::vector<const AnimationCurveNode*>& curves,
const LayerMap& layer_map, const LayerMap& layer_map,
@ -2477,9 +2477,9 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// generate node anim, extracting only Rotation, Scaling and Translation from the given chain // generate node anim, extracting only Rotation, Scaling and Translation from the given chain
aiNodeAnim* GenerateSimpleNodeAnim(const std::string& name, aiNodeAnim* GenerateSimpleNodeAnim(const std::string& name,
const Model& target, const Model& target,
NodeMap::const_iterator chain[TransformationComp_MAXIMUM], NodeMap::const_iterator chain[TransformationComp_MAXIMUM],
NodeMap::const_iterator iter_end, NodeMap::const_iterator iter_end,
const LayerMap& layer_map, const LayerMap& layer_map,
int64_t start, int64_t stop, int64_t start, int64_t stop,
@ -2495,14 +2495,14 @@ private:
// need to convert from TRS order to SRT? // need to convert from TRS order to SRT?
if(reverse_order) { if(reverse_order) {
aiVector3D def_scale, def_translate; aiVector3D def_scale, def_translate;
aiQuaternion def_rot; aiQuaternion def_rot;
KeyFrameListList scaling; KeyFrameListList scaling;
KeyFrameListList translation; KeyFrameListList translation;
KeyFrameListList rotation; KeyFrameListList rotation;
if(chain[TransformationComp_Scaling] != iter_end) { if(chain[TransformationComp_Scaling] != iter_end) {
scaling = GetKeyframeList((*chain[TransformationComp_Scaling]).second, start, stop); scaling = GetKeyframeList((*chain[TransformationComp_Scaling]).second, start, stop);
} }
@ -2516,7 +2516,7 @@ private:
else { else {
def_translate = PropertyGet(props,"Lcl Translation",aiVector3D(0.f,0.f,0.f)); def_translate = PropertyGet(props,"Lcl Translation",aiVector3D(0.f,0.f,0.f));
} }
if(chain[TransformationComp_Rotation] != iter_end) { if(chain[TransformationComp_Rotation] != iter_end) {
rotation = GetKeyframeList((*chain[TransformationComp_Rotation]).second, start, stop); rotation = GetKeyframeList((*chain[TransformationComp_Rotation]).second, start, stop);
} }
@ -2569,10 +2569,10 @@ private:
// which requires all of rotation, scaling and translation // which requires all of rotation, scaling and translation
// to be set. // to be set.
if(chain[TransformationComp_Scaling] != iter_end) { if(chain[TransformationComp_Scaling] != iter_end) {
ConvertScaleKeys(na, (*chain[TransformationComp_Scaling]).second, ConvertScaleKeys(na, (*chain[TransformationComp_Scaling]).second,
layer_map, layer_map,
start, stop, start, stop,
max_time, max_time,
min_time); min_time);
} }
else { else {
@ -2585,8 +2585,8 @@ private:
} }
if(chain[TransformationComp_Rotation] != iter_end) { if(chain[TransformationComp_Rotation] != iter_end) {
ConvertRotationKeys(na, (*chain[TransformationComp_Rotation]).second, ConvertRotationKeys(na, (*chain[TransformationComp_Rotation]).second,
layer_map, layer_map,
start, stop, start, stop,
max_time, max_time,
min_time, min_time,
@ -2603,10 +2603,10 @@ private:
} }
if(chain[TransformationComp_Translation] != iter_end) { if(chain[TransformationComp_Translation] != iter_end) {
ConvertTranslationKeys(na, (*chain[TransformationComp_Translation]).second, ConvertTranslationKeys(na, (*chain[TransformationComp_Translation]).second,
layer_map, layer_map,
start, stop, start, stop,
max_time, max_time,
min_time); min_time);
} }
else { else {
@ -2628,7 +2628,7 @@ private:
typedef boost::tuple<boost::shared_ptr<KeyTimeList>, boost::shared_ptr<KeyValueList>, unsigned int > KeyFrameList; typedef boost::tuple<boost::shared_ptr<KeyTimeList>, boost::shared_ptr<KeyValueList>, unsigned int > KeyFrameList;
typedef std::vector<KeyFrameList> KeyFrameListList; typedef std::vector<KeyFrameList> KeyFrameListList;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
KeyFrameListList GetKeyframeList(const std::vector<const AnimationCurveNode*>& nodes, int64_t start, int64_t stop) KeyFrameListList GetKeyframeList(const std::vector<const AnimationCurveNode*>& nodes, int64_t start, int64_t stop)
@ -2693,10 +2693,10 @@ private:
ai_assert(inputs.size()); ai_assert(inputs.size());
// reserve some space upfront - it is likely that the keyframe lists // reserve some space upfront - it is likely that the keyframe lists
// have matching time values, so max(of all keyframe lists) should // have matching time values, so max(of all keyframe lists) should
// be a good estimate. // be a good estimate.
KeyTimeList keys; KeyTimeList keys;
size_t estimate = 0; size_t estimate = 0;
BOOST_FOREACH(const KeyFrameList& kfl, inputs) { BOOST_FOREACH(const KeyFrameList& kfl, inputs) {
estimate = std::max(estimate, kfl.get<0>()->size()); estimate = std::max(estimate, kfl.get<0>()->size());
@ -2732,15 +2732,15 @@ private:
++next_pos[i]; ++next_pos[i];
} }
} }
} }
return keys; return keys;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void InterpolateKeys(aiVectorKey* valOut,const KeyTimeList& keys, const KeyFrameListList& inputs, void InterpolateKeys(aiVectorKey* valOut,const KeyTimeList& keys, const KeyFrameListList& inputs,
const bool geom, const bool geom,
double& max_time, double& max_time,
double& min_time) double& min_time)
@ -2764,7 +2764,7 @@ private:
const size_t ksize = kfl.get<0>()->size(); const size_t ksize = kfl.get<0>()->size();
if (ksize > next_pos[i] && kfl.get<0>()->at(next_pos[i]) == time) { if (ksize > next_pos[i] && kfl.get<0>()->at(next_pos[i]) == time) {
++next_pos[i]; ++next_pos[i];
} }
const size_t id0 = next_pos[i]>0 ? next_pos[i]-1 : 0; const size_t id0 = next_pos[i]>0 ? next_pos[i]-1 : 0;
@ -2799,14 +2799,14 @@ private:
valOut->mValue.x = result[0]; valOut->mValue.x = result[0];
valOut->mValue.y = result[1]; valOut->mValue.y = result[1];
valOut->mValue.z = result[2]; valOut->mValue.z = result[2];
++valOut; ++valOut;
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void InterpolateKeys(aiQuatKey* valOut,const KeyTimeList& keys, const KeyFrameListList& inputs, void InterpolateKeys(aiQuatKey* valOut,const KeyTimeList& keys, const KeyFrameListList& inputs,
const bool geom, const bool geom,
double& maxTime, double& maxTime,
double& minTime, double& minTime,
@ -2826,7 +2826,7 @@ private:
valOut[i].mTime = temp[i].mTime; valOut[i].mTime = temp[i].mTime;
GetRotationMatrix(order, temp[i].mValue, m); GetRotationMatrix(order, temp[i].mValue, m);
aiQuaternion quat = aiQuaternion(aiMatrix3x3(m)); aiQuaternion quat = aiQuaternion(aiMatrix3x3(m));
@ -2838,20 +2838,20 @@ private:
quat.y = -quat.y; quat.y = -quat.y;
quat.z = -quat.z; quat.z = -quat.z;
quat.w = -quat.w; quat.w = -quat.w;
} }
lastq = quat; lastq = quat;
valOut[i].mValue = quat; valOut[i].mValue = quat;
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ConvertTransformOrder_TRStoSRT(aiQuatKey* out_quat, aiVectorKey* out_scale, void ConvertTransformOrder_TRStoSRT(aiQuatKey* out_quat, aiVectorKey* out_scale,
aiVectorKey* out_translation, aiVectorKey* out_translation,
const KeyFrameListList& scaling, const KeyFrameListList& scaling,
const KeyFrameListList& translation, const KeyFrameListList& translation,
const KeyFrameListList& rotation, const KeyFrameListList& rotation,
const KeyTimeList& times, const KeyTimeList& times,
double& maxTime, double& maxTime,
double& minTime, double& minTime,
@ -2908,7 +2908,7 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// euler xyz -> quat // euler xyz -> quat
aiQuaternion EulerToQuaternion(const aiVector3D& rot, Model::RotOrder order) aiQuaternion EulerToQuaternion(const aiVector3D& rot, Model::RotOrder order)
{ {
aiMatrix4x4 m; aiMatrix4x4 m;
GetRotationMatrix(order, rot, m); GetRotationMatrix(order, rot, m);
@ -2926,7 +2926,7 @@ private:
ai_assert(nodes.size()); ai_assert(nodes.size());
// XXX for now, assume scale should be blended geometrically (i.e. two // XXX for now, assume scale should be blended geometrically (i.e. two
// layers should be multiplied with each other). There is a FBX // layers should be multiplied with each other). There is a FBX
// property in the layer to specify the behaviour, though. // property in the layer to specify the behaviour, though.
const KeyFrameListList& inputs = GetKeyframeList(nodes, start, stop); const KeyFrameListList& inputs = GetKeyframeList(nodes, start, stop);
@ -2940,7 +2940,7 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ConvertTranslationKeys(aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes, void ConvertTranslationKeys(aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes,
const LayerMap& /*layers*/, const LayerMap& /*layers*/,
int64_t start, int64_t stop, int64_t start, int64_t stop,
double& maxTime, double& maxTime,
@ -2960,7 +2960,7 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ConvertRotationKeys(aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes, void ConvertRotationKeys(aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes,
const LayerMap& /*layers*/, const LayerMap& /*layers*/,
int64_t start, int64_t stop, int64_t start, int64_t stop,
double& maxTime, double& maxTime,

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -139,7 +139,7 @@ Skin::Skin(uint64_t id, const Element& element, const Document& doc, const std::
accuracy = ParseTokenAsFloat(GetRequiredToken(*Link_DeformAcuracy,0)); accuracy = ParseTokenAsFloat(GetRequiredToken(*Link_DeformAcuracy,0));
} }
// resolve assigned clusters // resolve assigned clusters
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"Deformer"); const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"Deformer");
clusters.reserve(conns.size()); clusters.reserve(conns.size());

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -107,7 +107,7 @@ const Object* LazyObject::Get(bool dieOnError)
std::string name = ParseTokenAsString(*tokens[1],err); std::string name = ParseTokenAsString(*tokens[1],err);
if (err) { if (err) {
DOMError(err,&element); DOMError(err,&element);
} }
// small fix for binary reading: binary fbx files don't use // small fix for binary reading: binary fbx files don't use
// prefixes such as Model:: in front of their names. The // prefixes such as Model:: in front of their names. The
@ -125,7 +125,7 @@ const Object* LazyObject::Get(bool dieOnError)
const std::string classtag = ParseTokenAsString(*tokens[2],err); const std::string classtag = ParseTokenAsString(*tokens[2],err);
if (err) { if (err) {
DOMError(err,&element); DOMError(err,&element);
} }
// prevent recursive calls // prevent recursive calls
flags |= BEING_CONSTRUCTED; flags |= BEING_CONSTRUCTED;
@ -192,7 +192,7 @@ const Object* LazyObject::Get(bool dieOnError)
} }
else if (!strncmp(obtype,"AnimationCurveNode",length)) { else if (!strncmp(obtype,"AnimationCurveNode",length)) {
object.reset(new AnimationCurveNode(id,element,name,doc)); object.reset(new AnimationCurveNode(id,element,name,doc));
} }
} }
catch(std::exception& ex) { catch(std::exception& ex) {
flags &= ~BEING_CONSTRUCTED; flags &= ~BEING_CONSTRUCTED;
@ -236,7 +236,7 @@ Object::~Object()
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
FileGlobalSettings::FileGlobalSettings(const Document& doc, boost::shared_ptr<const PropertyTable> props) FileGlobalSettings::FileGlobalSettings(const Document& doc, boost::shared_ptr<const PropertyTable> props)
: props(props) : props(props)
, doc(doc) , doc(doc)
{ {
} }
@ -314,7 +314,7 @@ void Document::ReadHeader()
" trying to read it nevertheless"); " trying to read it nevertheless");
} }
} }
const Element* const ecreator = shead["Creator"]; const Element* const ecreator = shead["Creator"];
if(ecreator) { if(ecreator) {
@ -372,10 +372,10 @@ void Document::ReadObjects()
const Scope& sobjects = *eobjects->Compound(); const Scope& sobjects = *eobjects->Compound();
BOOST_FOREACH(const ElementMap::value_type& el, sobjects.Elements()) { BOOST_FOREACH(const ElementMap::value_type& el, sobjects.Elements()) {
// extract ID // extract ID
const TokenList& tok = el.second->Tokens(); const TokenList& tok = el.second->Tokens();
if (tok.empty()) { if (tok.empty()) {
DOMError("expected ID after object key",el.second); DOMError("expected ID after object key",el.second);
} }
@ -503,8 +503,8 @@ void Document::ReadConnections()
// add new connection // add new connection
const Connection* const c = new Connection(insertionOrder++,src,dest,prop,*this); const Connection* const c = new Connection(insertionOrder++,src,dest,prop,*this);
src_connections.insert(ConnectionMap::value_type(src,c)); src_connections.insert(ConnectionMap::value_type(src,c));
dest_connections.insert(ConnectionMap::value_type(dest,c)); dest_connections.insert(ConnectionMap::value_type(dest,c));
} }
} }
@ -541,12 +541,12 @@ LazyObject* Document::GetObject(uint64_t id) const
#define MAX_CLASSNAMES 6 #define MAX_CLASSNAMES 6
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::vector<const Connection*> Document::GetConnectionsSequenced(uint64_t id, std::vector<const Connection*> Document::GetConnectionsSequenced(uint64_t id,
const ConnectionMap& conns) const const ConnectionMap& conns) const
{ {
std::vector<const Connection*> temp; std::vector<const Connection*> temp;
const std::pair<ConnectionMap::const_iterator,ConnectionMap::const_iterator> range = const std::pair<ConnectionMap::const_iterator,ConnectionMap::const_iterator> range =
conns.equal_range(id); conns.equal_range(id);
temp.reserve(std::distance(range.first,range.second)); temp.reserve(std::distance(range.first,range.second));
@ -561,9 +561,9 @@ std::vector<const Connection*> Document::GetConnectionsSequenced(uint64_t id,
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::vector<const Connection*> Document::GetConnectionsSequenced(uint64_t id, bool is_src, std::vector<const Connection*> Document::GetConnectionsSequenced(uint64_t id, bool is_src,
const ConnectionMap& conns, const ConnectionMap& conns,
const char* const* classnames, const char* const* classnames,
size_t count) const size_t count) const
{ {
@ -579,12 +579,12 @@ std::vector<const Connection*> Document::GetConnectionsSequenced(uint64_t id, bo
std::vector<const Connection*> temp; std::vector<const Connection*> temp;
const std::pair<ConnectionMap::const_iterator,ConnectionMap::const_iterator> range = const std::pair<ConnectionMap::const_iterator,ConnectionMap::const_iterator> range =
conns.equal_range(id); conns.equal_range(id);
temp.reserve(std::distance(range.first,range.second)); temp.reserve(std::distance(range.first,range.second));
for (ConnectionMap::const_iterator it = range.first; it != range.second; ++it) { for (ConnectionMap::const_iterator it = range.first; it != range.second; ++it) {
const Token& key = (is_src const Token& key = (is_src
? (*it).second->LazyDestinationObject() ? (*it).second->LazyDestinationObject()
: (*it).second->LazySourceObject() : (*it).second->LazySourceObject()
).GetElement().KeyToken(); ).GetElement().KeyToken();
@ -620,7 +620,7 @@ std::vector<const Connection*> Document::GetConnectionsBySourceSequenced(uint64_
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::vector<const Connection*> Document::GetConnectionsBySourceSequenced(uint64_t dest, std::vector<const Connection*> Document::GetConnectionsBySourceSequenced(uint64_t dest,
const char* classname) const const char* classname) const
{ {
const char* arr[] = {classname}; const char* arr[] = {classname};
@ -630,7 +630,7 @@ std::vector<const Connection*> Document::GetConnectionsBySourceSequenced(uint64_
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::vector<const Connection*> Document::GetConnectionsBySourceSequenced(uint64_t source, std::vector<const Connection*> Document::GetConnectionsBySourceSequenced(uint64_t source,
const char* const* classnames, size_t count) const const char* const* classnames, size_t count) const
{ {
return GetConnectionsSequenced(source, true, ConnectionsBySource(),classnames, count); return GetConnectionsSequenced(source, true, ConnectionsBySource(),classnames, count);
@ -638,7 +638,7 @@ std::vector<const Connection*> Document::GetConnectionsBySourceSequenced(uint64_
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::vector<const Connection*> Document::GetConnectionsByDestinationSequenced(uint64_t dest, std::vector<const Connection*> Document::GetConnectionsByDestinationSequenced(uint64_t dest,
const char* classname) const const char* classname) const
{ {
const char* arr[] = {classname}; const char* arr[] = {classname};
@ -654,7 +654,7 @@ std::vector<const Connection*> Document::GetConnectionsByDestinationSequenced(ui
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::vector<const Connection*> Document::GetConnectionsByDestinationSequenced(uint64_t dest, std::vector<const Connection*> Document::GetConnectionsByDestinationSequenced(uint64_t dest,
const char* const* classnames, size_t count) const const char* const* classnames, size_t count) const
{ {
@ -663,7 +663,7 @@ std::vector<const Connection*> Document::GetConnectionsByDestinationSequenced(ui
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Connection::Connection(uint64_t insertionOrder, uint64_t src, uint64_t dest, const std::string& prop, Connection::Connection(uint64_t insertionOrder, uint64_t src, uint64_t dest, const std::string& prop,
const Document& doc) const Document& doc)
: insertionOrder(insertionOrder) : insertionOrder(insertionOrder)

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -96,7 +96,7 @@ public:
const Object* Get(bool dieOnError = false); const Object* Get(bool dieOnError = false);
template <typename T> template <typename T>
const T* Get(bool dieOnError = false) { const T* Get(bool dieOnError = false) {
const Object* const ob = Get(dieOnError); const Object* const ob = Get(dieOnError);
return ob ? dynamic_cast<const T*>(ob) : NULL; return ob ? dynamic_cast<const T*>(ob) : NULL;
@ -373,12 +373,12 @@ public:
public: public:
enum RotOrder enum RotOrder
{ {
RotOrder_EulerXYZ = 0, RotOrder_EulerXYZ = 0,
RotOrder_EulerXZY, RotOrder_EulerXZY,
RotOrder_EulerYZX, RotOrder_EulerYZX,
RotOrder_EulerYXZ, RotOrder_EulerYXZ,
RotOrder_EulerZXY, RotOrder_EulerZXY,
RotOrder_EulerZYX, RotOrder_EulerZYX,
RotOrder_SphericXYZ, RotOrder_SphericXYZ,
@ -566,7 +566,7 @@ public:
return *props.get(); return *props.get();
} }
// return a 4-tuple // return a 4-tuple
const unsigned int* Crop() const { const unsigned int* Crop() const {
return crop; return crop;
} }
@ -753,9 +753,9 @@ public:
const std::vector<aiVector3D>& GetBinormals() const { const std::vector<aiVector3D>& GetBinormals() const {
return binormals; return binormals;
} }
/** Return list of faces - each entry denotes a face and specifies /** Return list of faces - each entry denotes a face and specifies
* how many vertices it has. Vertices are taken from the * how many vertices it has. Vertices are taken from the
* vertex data arrays in sequential order. */ * vertex data arrays in sequential order. */
const std::vector<unsigned int>& GetFaceIndexCounts() const { const std::vector<unsigned int>& GetFaceIndexCounts() const {
return faces; return faces;
@ -781,8 +781,8 @@ public:
static const std::vector<aiColor4D> empty; static const std::vector<aiColor4D> empty;
return index >= AI_MAX_NUMBER_OF_COLOR_SETS ? empty : colors[index]; return index >= AI_MAX_NUMBER_OF_COLOR_SETS ? empty : colors[index];
} }
/** Get per-face-vertex material assignments */ /** Get per-face-vertex material assignments */
const MatIndexArray& GetMaterialIndices() const { const MatIndexArray& GetMaterialIndices() const {
return materials; return materials;
@ -810,7 +810,7 @@ public:
* This mapping is always unique. */ * This mapping is always unique. */
unsigned int FaceForVertexIndex(unsigned int in_index) const { unsigned int FaceForVertexIndex(unsigned int in_index) const {
ai_assert(in_index < vertices.size()); ai_assert(in_index < vertices.size());
// in the current conversion pattern this will only be needed if // in the current conversion pattern this will only be needed if
// weights are present, so no need to always pre-compute this table // weights are present, so no need to always pre-compute this table
if (facesVertexStartIndices.empty()) { if (facesVertexStartIndices.empty()) {
@ -827,7 +827,7 @@ public:
in_index in_index
); );
return static_cast<unsigned int>(std::distance(facesVertexStartIndices.begin(), it - 1)); return static_cast<unsigned int>(std::distance(facesVertexStartIndices.begin(), it - 1));
} }
public: public:
@ -838,27 +838,27 @@ private:
void ReadLayerElement(const Scope& layerElement); void ReadLayerElement(const Scope& layerElement);
void ReadVertexData(const std::string& type, int index, const Scope& source); void ReadVertexData(const std::string& type, int index, const Scope& source);
void ReadVertexDataUV(std::vector<aiVector2D>& uv_out, const Scope& source, void ReadVertexDataUV(std::vector<aiVector2D>& uv_out, const Scope& source,
const std::string& MappingInformationType, const std::string& MappingInformationType,
const std::string& ReferenceInformationType); const std::string& ReferenceInformationType);
void ReadVertexDataNormals(std::vector<aiVector3D>& normals_out, const Scope& source, void ReadVertexDataNormals(std::vector<aiVector3D>& normals_out, const Scope& source,
const std::string& MappingInformationType, const std::string& MappingInformationType,
const std::string& ReferenceInformationType); const std::string& ReferenceInformationType);
void ReadVertexDataColors(std::vector<aiColor4D>& colors_out, const Scope& source, void ReadVertexDataColors(std::vector<aiColor4D>& colors_out, const Scope& source,
const std::string& MappingInformationType, const std::string& MappingInformationType,
const std::string& ReferenceInformationType); const std::string& ReferenceInformationType);
void ReadVertexDataTangents(std::vector<aiVector3D>& tangents_out, const Scope& source, void ReadVertexDataTangents(std::vector<aiVector3D>& tangents_out, const Scope& source,
const std::string& MappingInformationType, const std::string& MappingInformationType,
const std::string& ReferenceInformationType); const std::string& ReferenceInformationType);
void ReadVertexDataBinormals(std::vector<aiVector3D>& binormals_out, const Scope& source, void ReadVertexDataBinormals(std::vector<aiVector3D>& binormals_out, const Scope& source,
const std::string& MappingInformationType, const std::string& MappingInformationType,
const std::string& ReferenceInformationType); const std::string& ReferenceInformationType);
void ReadVertexDataMaterials(MatIndexArray& materials_out, const Scope& source, void ReadVertexDataMaterials(MatIndexArray& materials_out, const Scope& source,
const std::string& MappingInformationType, const std::string& MappingInformationType,
const std::string& ReferenceInformationType); const std::string& ReferenceInformationType);
@ -902,7 +902,7 @@ public:
} }
/** get list of keyframe values. /** get list of keyframe values.
* Invariant: |GetKeys()| == |GetValues()| && |GetKeys()| > 0*/ * Invariant: |GetKeys()| == |GetValues()| && |GetKeys()| > 0*/
const KeyValueList& GetValues() const { const KeyValueList& GetValues() const {
return values; return values;
@ -990,7 +990,7 @@ class AnimationLayer : public Object
{ {
public: public:
AnimationLayer(uint64_t id, const Element& element, const std::string& name, const Document& doc); AnimationLayer(uint64_t id, const Element& element, const std::string& name, const Document& doc);
~AnimationLayer(); ~AnimationLayer();
@ -1210,7 +1210,7 @@ public:
// during their entire lifetime (Document). FBX files have // during their entire lifetime (Document). FBX files have
// up to many thousands of objects (most of which we never use), // up to many thousands of objects (most of which we never use),
// so the memory overhead for them should be kept at a minimum. // so the memory overhead for them should be kept at a minimum.
typedef std::map<uint64_t, LazyObject*> ObjectMap; typedef std::map<uint64_t, LazyObject*> ObjectMap;
typedef std::fbx_unordered_map<std::string, boost::shared_ptr<const PropertyTable> > PropertyTemplateMap; typedef std::fbx_unordered_map<std::string, boost::shared_ptr<const PropertyTable> > PropertyTemplateMap;
@ -1288,7 +1288,7 @@ private:
/** DOM root for a FBX file */ /** DOM root for a FBX file */
class Document class Document
{ {
public: public:
@ -1353,10 +1353,10 @@ public:
std::vector<const Connection*> GetConnectionsBySourceSequenced(uint64_t source, const char* classname) const; std::vector<const Connection*> GetConnectionsBySourceSequenced(uint64_t source, const char* classname) const;
std::vector<const Connection*> GetConnectionsByDestinationSequenced(uint64_t dest, const char* classname) const; std::vector<const Connection*> GetConnectionsByDestinationSequenced(uint64_t dest, const char* classname) const;
std::vector<const Connection*> GetConnectionsBySourceSequenced(uint64_t source, std::vector<const Connection*> GetConnectionsBySourceSequenced(uint64_t source,
const char* const* classnames, size_t count) const; const char* const* classnames, size_t count) const;
std::vector<const Connection*> GetConnectionsByDestinationSequenced(uint64_t dest, std::vector<const Connection*> GetConnectionsByDestinationSequenced(uint64_t dest,
const char* const* classnames, const char* const* classnames,
size_t count) const; size_t count) const;
const std::vector<const AnimationStack*>& AnimationStacks() const; const std::vector<const AnimationStack*>& AnimationStacks() const;
@ -1364,9 +1364,9 @@ public:
private: private:
std::vector<const Connection*> GetConnectionsSequenced(uint64_t id, const ConnectionMap&) const; std::vector<const Connection*> GetConnectionsSequenced(uint64_t id, const ConnectionMap&) const;
std::vector<const Connection*> GetConnectionsSequenced(uint64_t id, bool is_src, std::vector<const Connection*> GetConnectionsSequenced(uint64_t id, bool is_src,
const ConnectionMap&, const ConnectionMap&,
const char* const* classnames, const char* const* classnames,
size_t count) const; size_t count) const;
private: private:

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -95,10 +95,10 @@ void DOMWarning(const std::string& message, const Element* element /*= NULL*/)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// fetch a property table and the corresponding property template // fetch a property table and the corresponding property template
boost::shared_ptr<const PropertyTable> GetPropertyTable(const Document& doc, boost::shared_ptr<const PropertyTable> GetPropertyTable(const Document& doc,
const std::string& templateName, const std::string& templateName,
const Element &element, const Element &element,
const Scope& sc, const Scope& sc,
bool no_warn /*= false*/) bool no_warn /*= false*/)
{ {
@ -107,7 +107,7 @@ boost::shared_ptr<const PropertyTable> GetPropertyTable(const Document& doc,
static_cast<const PropertyTable*>(NULL)); static_cast<const PropertyTable*>(NULL));
if(templateName.length()) { if(templateName.length()) {
PropertyTemplateMap::const_iterator it = doc.Templates().find(templateName); PropertyTemplateMap::const_iterator it = doc.Templates().find(templateName);
if(it != doc.Templates().end()) { if(it != doc.Templates().end()) {
templateProps = (*it).second; templateProps = (*it).second;
} }

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2012, assimp team Copyright (c) 2006-2012, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -66,20 +66,20 @@ void DOMWarning(const std::string& message, const Token& token);
void DOMWarning(const std::string& message, const Element* element = NULL); void DOMWarning(const std::string& message, const Element* element = NULL);
// fetch a property table and the corresponding property template // fetch a property table and the corresponding property template
boost::shared_ptr<const PropertyTable> GetPropertyTable(const Document& doc, boost::shared_ptr<const PropertyTable> GetPropertyTable(const Document& doc,
const std::string& templateName, const std::string& templateName,
const Element &element, const Element &element,
const Scope& sc, const Scope& sc,
bool no_warn = false); bool no_warn = false);
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
template <typename T> template <typename T>
inline const T* ProcessSimpleConnection(const Connection& con, inline const T* ProcessSimpleConnection(const Connection& con,
bool is_object_property_conn, bool is_object_property_conn,
const char* name, const char* name,
const Element& element, const Element& element,
const char** propNameOut = NULL) const char** propNameOut = NULL)
{ {
if (is_object_property_conn && !con.PropertyName().length()) { if (is_object_property_conn && !con.PropertyName().length()) {
@ -98,7 +98,7 @@ inline const T* ProcessSimpleConnection(const Connection& con,
} }
if(is_object_property_conn && propNameOut) { if(is_object_property_conn && propNameOut) {
// note: this is ok, the return value of PropertyValue() is guaranteed to // note: this is ok, the return value of PropertyValue() is guaranteed to
// remain valid and unchanged as long as the document exists. // remain valid and unchanged as long as the document exists.
*propNameOut = con.PropertyName().c_str(); *propNameOut = con.PropertyName().c_str();
} }

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -48,7 +48,7 @@ namespace Assimp {
namespace FBX { namespace FBX {
/** FBX import settings, parts of which are publicly accessible via their corresponding AI_CONFIG constants */ /** FBX import settings, parts of which are publicly accessible via their corresponding AI_CONFIG constants */
struct ImportSettings struct ImportSettings
{ {
ImportSettings() ImportSettings()
: strictMode(true) : strictMode(true)
@ -62,7 +62,7 @@ struct ImportSettings
, preservePivots(true) , preservePivots(true)
, optimizeEmptyAnimationCurves(true) , optimizeEmptyAnimationCurves(true)
{} {}
/** enable strict mode: /** enable strict mode:
* - only accept fbx 2012, 2013 files * - only accept fbx 2012, 2013 files
@ -75,7 +75,7 @@ struct ImportSettings
/** specifies whether all geometry layers are read and scanned for /** specifies whether all geometry layers are read and scanned for
* usable data channels. The FBX spec indicates that many readers * usable data channels. The FBX spec indicates that many readers
* will only read the first channel and that this is in some way * will only read the first channel and that this is in some way
* the recommended way- in reality, however, it happens a lot that * the recommended way- in reality, however, it happens a lot that
* vertex data is spread among multiple layers. The default * vertex data is spread among multiple layers. The default
* value for this option is true.*/ * value for this option is true.*/
bool readAllLayers; bool readAllLayers;
@ -88,7 +88,7 @@ struct ImportSettings
bool readAllMaterials; bool readAllMaterials;
/** import materials (true) or skip them and assign a default /** import materials (true) or skip them and assign a default
* material. The default value is true.*/ * material. The default value is true.*/
bool readMaterials; bool readMaterials;
@ -114,7 +114,7 @@ struct ImportSettings
* *
* The naming scheme for the generated nodes is: * The naming scheme for the generated nodes is:
* <OriginalName>_$AssimpFbx$_<TransformName> * <OriginalName>_$AssimpFbx$_<TransformName>
* *
* where <TransformName> is one of * where <TransformName> is one of
* RotationPivot * RotationPivot
* RotationOffset * RotationOffset

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -79,7 +79,7 @@ static const aiImporterDesc desc = {
0, 0,
0, 0,
0, 0,
"fbx" "fbx"
}; };
} }
@ -89,13 +89,13 @@ FBXImporter::FBXImporter()
{} {}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor, private as well // Destructor, private as well
FBXImporter::~FBXImporter() FBXImporter::~FBXImporter()
{ {
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool FBXImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const bool FBXImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
{ {
const std::string& extension = GetExtension(pFile); const std::string& extension = GetExtension(pFile);
@ -136,8 +136,8 @@ void FBXImporter::SetupProperties(const Importer* pImp)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure. // Imports the given file into the given scene structure.
void FBXImporter::InternReadFile( const std::string& pFile, void FBXImporter::InternReadFile( const std::string& pFile,
aiScene* pScene, IOSystem* pIOHandler) aiScene* pScene, IOSystem* pIOHandler)
{ {
boost::scoped_ptr<IOStream> stream(pIOHandler->Open(pFile,"rb")); boost::scoped_ptr<IOStream> stream(pIOHandler->Open(pFile,"rb"));
@ -170,7 +170,7 @@ void FBXImporter::InternReadFile( const std::string& pFile,
Tokenize(tokens,begin); Tokenize(tokens,begin);
} }
// use this information to construct a very rudimentary // use this information to construct a very rudimentary
// parse-tree representing the FBX scope structure // parse-tree representing the FBX scope structure
Parser parser(tokens, is_binary); Parser parser(tokens, is_binary);

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "FBXImportSettings.h" #include "FBXImportSettings.h"
namespace Assimp { namespace Assimp {
// TinyFormatter.h // TinyFormatter.h
namespace Formatter { namespace Formatter {
template <typename T,typename TR, typename A> class basic_formatter; template <typename T,typename TR, typename A> class basic_formatter;
@ -74,7 +74,7 @@ public:
public: public:
// -------------------- // --------------------
bool CanRead( const std::string& pFile, bool CanRead( const std::string& pFile,
IOSystem* pIOHandler, IOSystem* pIOHandler,
bool checkSig bool checkSig
) const; ) const;
@ -88,14 +88,14 @@ protected:
void SetupProperties(const Importer* pImp); void SetupProperties(const Importer* pImp);
// -------------------- // --------------------
void InternReadFile( const std::string& pFile, void InternReadFile( const std::string& pFile,
aiScene* pScene, aiScene* pScene,
IOSystem* pIOHandler IOSystem* pIOHandler
); );
private: private:
private: private:
FBX::ImportSettings settings; FBX::ImportSettings settings;

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -62,7 +62,7 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
: Object(id,element,name) : Object(id,element,name)
{ {
const Scope& sc = GetRequiredScope(element); const Scope& sc = GetRequiredScope(element);
const Element* const ShadingModel = sc["ShadingModel"]; const Element* const ShadingModel = sc["ShadingModel"];
const Element* const MultiLayer = sc["MultiLayer"]; const Element* const MultiLayer = sc["MultiLayer"];
@ -218,7 +218,7 @@ LayeredTexture::LayeredTexture(uint64_t id, const Element& element, const Docume
const Element* const BlendModes = sc["BlendModes"]; const Element* const BlendModes = sc["BlendModes"];
const Element* const Alphas = sc["Alphas"]; const Element* const Alphas = sc["Alphas"];
if(BlendModes!=0) if(BlendModes!=0)
{ {
blendMode = (BlendMode)ParseTokenAsInt(GetRequiredToken(*BlendModes,0)); blendMode = (BlendMode)ParseTokenAsInt(GetRequiredToken(*BlendModes,0));

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -158,11 +158,11 @@ MeshGeometry::MeshGeometry(uint64_t id, const Element& element, const std::strin
const int absi = index < 0 ? (-index - 1) : index; const int absi = index < 0 ? (-index - 1) : index;
mappings[mapping_offsets[absi] + mapping_counts[absi]++] = cursor++; mappings[mapping_offsets[absi] + mapping_counts[absi]++] = cursor++;
} }
// if settings.readAllLayers is true: // if settings.readAllLayers is true:
// * read all layers, try to load as many vertex channels as possible // * read all layers, try to load as many vertex channels as possible
// if settings.readAllLayers is false: // if settings.readAllLayers is false:
// * read only the layer with index 0, but warn about any further layers // * read only the layer with index 0, but warn about any further layers
for (ElementMap::const_iterator it = Layer.first; it != Layer.second; ++it) { for (ElementMap::const_iterator it = Layer.first; it != Layer.second; ++it) {
const TokenList& tokens = (*it).second->Tokens(); const TokenList& tokens = (*it).second->Tokens();
@ -223,7 +223,7 @@ void MeshGeometry::ReadLayerElement(const Scope& layerElement)
} }
} }
FBXImporter::LogError(Formatter::format("failed to resolve vertex layer element: ") FBXImporter::LogError(Formatter::format("failed to resolve vertex layer element: ")
<< type << ", index: " << typedIndex); << type << ", index: " << typedIndex);
} }
@ -238,10 +238,10 @@ void MeshGeometry::ReadVertexData(const std::string& type, int index, const Scop
const std::string& ReferenceInformationType = ParseTokenAsString(GetRequiredToken( const std::string& ReferenceInformationType = ParseTokenAsString(GetRequiredToken(
GetRequiredElement(source,"ReferenceInformationType"),0) GetRequiredElement(source,"ReferenceInformationType"),0)
); );
if (type == "LayerElementUV") { if (type == "LayerElementUV") {
if(index >= AI_MAX_NUMBER_OF_TEXTURECOORDS) { if(index >= AI_MAX_NUMBER_OF_TEXTURECOORDS) {
FBXImporter::LogError(Formatter::format("ignoring UV layer, maximum number of UV channels exceeded: ") FBXImporter::LogError(Formatter::format("ignoring UV layer, maximum number of UV channels exceeded: ")
<< index << " (limit is " << AI_MAX_NUMBER_OF_TEXTURECOORDS << ")" ); << index << " (limit is " << AI_MAX_NUMBER_OF_TEXTURECOORDS << ")" );
return; return;
} }
@ -319,7 +319,7 @@ void MeshGeometry::ReadVertexData(const std::string& type, int index, const Scop
} }
else if (type == "LayerElementColor") { else if (type == "LayerElementColor") {
if(index >= AI_MAX_NUMBER_OF_COLOR_SETS) { if(index >= AI_MAX_NUMBER_OF_COLOR_SETS) {
FBXImporter::LogError(Formatter::format("ignoring vertex color layer, maximum number of color sets exceeded: ") FBXImporter::LogError(Formatter::format("ignoring vertex color layer, maximum number of color sets exceeded: ")
<< index << " (limit is " << AI_MAX_NUMBER_OF_COLOR_SETS << ")" ); << index << " (limit is " << AI_MAX_NUMBER_OF_COLOR_SETS << ")" );
return; return;
} }
@ -337,7 +337,7 @@ void MeshGeometry::ReadVertexData(const std::string& type, int index, const Scop
// output is in polygon vertex order. This logic is used for reading normals, UVs, colors, // output is in polygon vertex order. This logic is used for reading normals, UVs, colors,
// tangents .. // tangents ..
template <typename T> template <typename T>
void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source, void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
const std::string& MappingInformationType, const std::string& MappingInformationType,
const std::string& ReferenceInformationType, const std::string& ReferenceInformationType,
const char* dataElementName, const char* dataElementName,
@ -353,7 +353,7 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
// handle permutations of Mapping and Reference type - it would be nice to // handle permutations of Mapping and Reference type - it would be nice to
// deal with this more elegantly and with less redundancy, but right // deal with this more elegantly and with less redundancy, but right
// now it seems unavoidable. // now it seems unavoidable.
if (MappingInformationType == "ByVertice" && ReferenceInformationType == "Direct") { if (MappingInformationType == "ByVertice" && ReferenceInformationType == "Direct") {
data_out.resize(vertex_count); data_out.resize(vertex_count);
for (size_t i = 0, e = tempUV.size(); i < e; ++i) { for (size_t i = 0, e = tempUV.size(); i < e; ++i) {
@ -363,7 +363,7 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
} }
} }
} }
else if (MappingInformationType == "ByVertice" && ReferenceInformationType == "IndexToDirect") { else if (MappingInformationType == "ByVertice" && ReferenceInformationType == "IndexToDirect") {
data_out.resize(vertex_count); data_out.resize(vertex_count);
std::vector<int> uvIndices; std::vector<int> uvIndices;
@ -380,9 +380,9 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
} }
} }
} }
else if (MappingInformationType == "ByPolygonVertex" && ReferenceInformationType == "Direct") { else if (MappingInformationType == "ByPolygonVertex" && ReferenceInformationType == "Direct") {
if (tempUV.size() != vertex_count) { if (tempUV.size() != vertex_count) {
FBXImporter::LogError(Formatter::format("length of input data unexpected for ByPolygon mapping: ") FBXImporter::LogError(Formatter::format("length of input data unexpected for ByPolygon mapping: ")
<< tempUV.size() << ", expected " << vertex_count << tempUV.size() << ", expected " << vertex_count
); );
return; return;
@ -390,7 +390,7 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
data_out.swap(tempUV); data_out.swap(tempUV);
} }
else if (MappingInformationType == "ByPolygonVertex" && ReferenceInformationType == "IndexToDirect") { else if (MappingInformationType == "ByPolygonVertex" && ReferenceInformationType == "IndexToDirect") {
data_out.resize(vertex_count); data_out.resize(vertex_count);
std::vector<int> uvIndices; std::vector<int> uvIndices;
@ -411,13 +411,13 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
} }
} }
else { else {
FBXImporter::LogError(Formatter::format("ignoring vertex data channel, access type not implemented: ") FBXImporter::LogError(Formatter::format("ignoring vertex data channel, access type not implemented: ")
<< MappingInformationType << "," << ReferenceInformationType); << MappingInformationType << "," << ReferenceInformationType);
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void MeshGeometry::ReadVertexDataNormals(std::vector<aiVector3D>& normals_out, const Scope& source, void MeshGeometry::ReadVertexDataNormals(std::vector<aiVector3D>& normals_out, const Scope& source,
const std::string& MappingInformationType, const std::string& MappingInformationType,
const std::string& ReferenceInformationType) const std::string& ReferenceInformationType)
{ {
@ -432,7 +432,7 @@ void MeshGeometry::ReadVertexDataNormals(std::vector<aiVector3D>& normals_out, c
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void MeshGeometry::ReadVertexDataUV(std::vector<aiVector2D>& uv_out, const Scope& source, void MeshGeometry::ReadVertexDataUV(std::vector<aiVector2D>& uv_out, const Scope& source,
const std::string& MappingInformationType, const std::string& MappingInformationType,
const std::string& ReferenceInformationType) const std::string& ReferenceInformationType)
{ {
@ -447,7 +447,7 @@ void MeshGeometry::ReadVertexDataUV(std::vector<aiVector2D>& uv_out, const Scope
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void MeshGeometry::ReadVertexDataColors(std::vector<aiColor4D>& colors_out, const Scope& source, void MeshGeometry::ReadVertexDataColors(std::vector<aiColor4D>& colors_out, const Scope& source,
const std::string& MappingInformationType, const std::string& MappingInformationType,
const std::string& ReferenceInformationType) const std::string& ReferenceInformationType)
{ {
@ -462,7 +462,7 @@ void MeshGeometry::ReadVertexDataColors(std::vector<aiColor4D>& colors_out, cons
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void MeshGeometry::ReadVertexDataTangents(std::vector<aiVector3D>& tangents_out, const Scope& source, void MeshGeometry::ReadVertexDataTangents(std::vector<aiVector3D>& tangents_out, const Scope& source,
const std::string& MappingInformationType, const std::string& MappingInformationType,
const std::string& ReferenceInformationType) const std::string& ReferenceInformationType)
{ {
@ -478,7 +478,7 @@ void MeshGeometry::ReadVertexDataTangents(std::vector<aiVector3D>& tangents_out,
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void MeshGeometry::ReadVertexDataBinormals(std::vector<aiVector3D>& binormals_out, const Scope& source, void MeshGeometry::ReadVertexDataBinormals(std::vector<aiVector3D>& binormals_out, const Scope& source,
const std::string& MappingInformationType, const std::string& MappingInformationType,
const std::string& ReferenceInformationType) const std::string& ReferenceInformationType)
{ {
@ -494,7 +494,7 @@ void MeshGeometry::ReadVertexDataBinormals(std::vector<aiVector3D>& binormals_ou
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void MeshGeometry::ReadVertexDataMaterials(std::vector<int>& materials_out, const Scope& source, void MeshGeometry::ReadVertexDataMaterials(std::vector<int>& materials_out, const Scope& source,
const std::string& MappingInformationType, const std::string& MappingInformationType,
const std::string& ReferenceInformationType) const std::string& ReferenceInformationType)
{ {
@ -516,21 +516,21 @@ void MeshGeometry::ReadVertexDataMaterials(std::vector<int>& materials_out, cons
FBXImporter::LogWarn(Formatter::format("expected only a single material index, ignoring all except the first one")); FBXImporter::LogWarn(Formatter::format("expected only a single material index, ignoring all except the first one"));
materials_out.clear(); materials_out.clear();
} }
materials.assign(vertices.size(),materials_out[0]); materials.assign(vertices.size(),materials_out[0]);
} }
else if (MappingInformationType == "ByPolygon" && ReferenceInformationType == "IndexToDirect") { else if (MappingInformationType == "ByPolygon" && ReferenceInformationType == "IndexToDirect") {
materials.resize(face_count); materials.resize(face_count);
if(materials_out.size() != face_count) { if(materials_out.size() != face_count) {
FBXImporter::LogError(Formatter::format("length of input data unexpected for ByPolygon mapping: ") FBXImporter::LogError(Formatter::format("length of input data unexpected for ByPolygon mapping: ")
<< materials_out.size() << ", expected " << face_count << materials_out.size() << ", expected " << face_count
); );
return; return;
} }
} }
else { else {
FBXImporter::LogError(Formatter::format("ignoring material assignments, access type not implemented: ") FBXImporter::LogError(Formatter::format("ignoring material assignments, access type not implemented: ")
<< MappingInformationType << "," << ReferenceInformationType); << MappingInformationType << "," << ReferenceInformationType);
} }
} }

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -139,7 +139,7 @@ bool Model::IsNull() const
{ {
const std::vector<const NodeAttribute*>& attrs = GetAttributes(); const std::vector<const NodeAttribute*>& attrs = GetAttributes();
BOOST_FOREACH(const NodeAttribute* att, attrs) { BOOST_FOREACH(const NodeAttribute* att, attrs) {
const Null* null_tag = dynamic_cast<const Null*>(att); const Null* null_tag = dynamic_cast<const Null*>(att);
if(null_tag) { if(null_tag) {
return true; return true;

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -122,7 +122,7 @@ private:
* @verbatim * @verbatim
* GlobalSettings: { * GlobalSettings: {
* Version: 1000 * Version: 1000
* Properties70: * Properties70:
* [...] * [...]
* } * }
* @endverbatim */ * @endverbatim */
@ -157,10 +157,10 @@ private:
/** FBX parsing class, takes a list of input tokens and generates a hierarchy /** FBX parsing class, takes a list of input tokens and generates a hierarchy
* of nested #Scope instances, representing the fbx DOM.*/ * of nested #Scope instances, representing the fbx DOM.*/
class Parser class Parser
{ {
public: public:
/** Parse given a token list. Does not take ownership of the tokens - /** Parse given a token list. Does not take ownership of the tokens -
* the objects must persist during the entire parser lifetime */ * the objects must persist during the entire parser lifetime */
Parser (const TokenList& tokens,bool is_binary); Parser (const TokenList& tokens,bool is_binary);
@ -187,12 +187,12 @@ private:
TokenPtr LastToken() const; TokenPtr LastToken() const;
TokenPtr CurrentToken() const; TokenPtr CurrentToken() const;
private: private:
const TokenList& tokens; const TokenList& tokens;
TokenPtr last, current; TokenPtr last, current;
TokenList::const_iterator cursor; TokenList::const_iterator cursor;
boost::scoped_ptr<Scope> root; boost::scoped_ptr<Scope> root;

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -94,12 +94,12 @@ Property* ReadTypedProperty(const Element& element)
else if (!strcmp(cs, "KTime")) { else if (!strcmp(cs, "KTime")) {
return new TypedProperty<int64_t>(ParseTokenAsInt64(*tok[4])); return new TypedProperty<int64_t>(ParseTokenAsInt64(*tok[4]));
} }
else if (!strcmp(cs,"Vector3D") || else if (!strcmp(cs,"Vector3D") ||
!strcmp(cs,"ColorRGB") || !strcmp(cs,"ColorRGB") ||
!strcmp(cs,"Vector") || !strcmp(cs,"Vector") ||
!strcmp(cs,"Color") || !strcmp(cs,"Color") ||
!strcmp(cs,"Lcl Translation") || !strcmp(cs,"Lcl Translation") ||
!strcmp(cs,"Lcl Rotation") || !strcmp(cs,"Lcl Rotation") ||
!strcmp(cs,"Lcl Scaling") !strcmp(cs,"Lcl Scaling")
) { ) {
return new TypedProperty<aiVector3D>(aiVector3D( return new TypedProperty<aiVector3D>(aiVector3D(
@ -200,7 +200,7 @@ const Property* PropertyTable::Get(const std::string& name) const
return NULL; return NULL;
} }
} }
return (*it).second; return (*it).second;
} }
@ -218,7 +218,7 @@ DirectPropertyMap PropertyTable::GetUnparsedProperties() const
// Wrap the naked pointer (since the call site is required to acquire ownership) // Wrap the naked pointer (since the call site is required to acquire ownership)
// std::unique_ptr from C++11 would be preferred both as a wrapper and a return value. // std::unique_ptr from C++11 would be preferred both as a wrapper and a return value.
boost::shared_ptr<Property> prop = boost::shared_ptr<Property>(ReadTypedProperty(*element.second)); boost::shared_ptr<Property> prop = boost::shared_ptr<Property>(ReadTypedProperty(*element.second));
// Element could not be read. Skip it. // Element could not be read. Skip it.
if (!prop) continue; if (!prop) continue;

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,23 +23,23 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
*/ */
/** @file FBXProperties.h /** @file FBXProperties.h
* @brief FBX dynamic properties * @brief FBX dynamic properties
*/ */
#ifndef INCLUDED_AI_FBX_PROPERTIES_H #ifndef INCLUDED_AI_FBX_PROPERTIES_H
#define INCLUDED_AI_FBX_PROPERTIES_H #define INCLUDED_AI_FBX_PROPERTIES_H
@ -87,7 +87,7 @@ class TypedProperty : public Property
{ {
public: public:
TypedProperty(const T& value) TypedProperty(const T& value)
: value(value) : value(value)
{ {
} }
@ -114,7 +114,7 @@ public:
// in-memory property table with no source element // in-memory property table with no source element
PropertyTable(); PropertyTable();
PropertyTable(const Element& element, boost::shared_ptr<const PropertyTable> templateProps); PropertyTable(const Element& element, boost::shared_ptr<const PropertyTable> templateProps);
~PropertyTable(); ~PropertyTable();
@ -144,7 +144,7 @@ private:
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
template <typename T> template <typename T>
inline T PropertyGet(const PropertyTable& in, const std::string& name, inline T PropertyGet(const PropertyTable& in, const std::string& name,
const T& defaultValue) const T& defaultValue)
{ {
const Property* const prop = in.Get(name); const Property* const prop = in.Get(name);
@ -152,7 +152,7 @@ inline T PropertyGet(const PropertyTable& in, const std::string& name,
return defaultValue; return defaultValue;
} }
// strong typing, no need to be lenient // strong typing, no need to be lenient
const TypedProperty<T>* const tprop = prop->As< TypedProperty<T> >(); const TypedProperty<T>* const tprop = prop->As< TypedProperty<T> >();
if(!tprop) { if(!tprop) {
return defaultValue; return defaultValue;
@ -164,7 +164,7 @@ inline T PropertyGet(const PropertyTable& in, const std::string& name,
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
template <typename T> template <typename T>
inline T PropertyGet(const PropertyTable& in, const std::string& name, inline T PropertyGet(const PropertyTable& in, const std::string& name,
bool& result) bool& result)
{ {
const Property* const prop = in.Get(name); const Property* const prop = in.Get(name);
@ -173,7 +173,7 @@ inline T PropertyGet(const PropertyTable& in, const std::string& name,
return T(); return T();
} }
// strong typing, no need to be lenient // strong typing, no need to be lenient
const TypedProperty<T>* const tprop = prop->As< TypedProperty<T> >(); const TypedProperty<T>* const tprop = prop->As< TypedProperty<T> >();
if(!tprop) { if(!tprop) {
result = false; result = false;

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -93,11 +93,11 @@ AI_WONT_RETURN void TokenizeError(const std::string& message, unsigned int line,
} }
// process a potential data token up to 'cur', adding it to 'output_tokens'. // process a potential data token up to 'cur', adding it to 'output_tokens'.
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessDataToken( TokenList& output_tokens, const char*& start, const char*& end, void ProcessDataToken( TokenList& output_tokens, const char*& start, const char*& end,
unsigned int line, unsigned int line,
unsigned int column, unsigned int column,
TokenType type = TokenType_DATA, TokenType type = TokenType_DATA,
bool must_have_token = false) bool must_have_token = false)
{ {
@ -143,7 +143,7 @@ void Tokenize(TokenList& output_tokens, const char* input)
bool comment = false; bool comment = false;
bool in_double_quotes = false; bool in_double_quotes = false;
bool pending_data_token = false; bool pending_data_token = false;
const char* token_begin = NULL, *token_end = NULL; const char* token_begin = NULL, *token_end = NULL;
for (const char* cur = input;*cur;column += (*cur == '\t' ? ASSIMP_FBX_TAB_WIDTH : 1), ++cur) { for (const char* cur = input;*cur;column += (*cur == '\t' ? ASSIMP_FBX_TAB_WIDTH : 1), ++cur) {
const char c = *cur; const char c = *cur;
@ -194,7 +194,7 @@ void Tokenize(TokenList& output_tokens, const char* input)
ProcessDataToken(output_tokens,token_begin,token_end,line,column); ProcessDataToken(output_tokens,token_begin,token_end,line,column);
output_tokens.push_back(new_Token(cur,cur+1,TokenType_CLOSE_BRACKET,line,column)); output_tokens.push_back(new_Token(cur,cur+1,TokenType_CLOSE_BRACKET,line,column));
continue; continue;
case ',': case ',':
if (pending_data_token) { if (pending_data_token) {
ProcessDataToken(output_tokens,token_begin,token_end,line,column,TokenType_DATA,true); ProcessDataToken(output_tokens,token_begin,token_end,line,column,TokenType_DATA,true);
@ -211,7 +211,7 @@ void Tokenize(TokenList& output_tokens, const char* input)
} }
continue; continue;
} }
if (IsSpaceOrNewLine(c)) { if (IsSpaceOrNewLine(c)) {
if (token_begin) { if (token_begin) {

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -59,7 +59,7 @@ enum TokenType
{ {
// { // {
TokenType_OPEN_BRACKET = 0, TokenType_OPEN_BRACKET = 0,
// } // }
TokenType_CLOSE_BRACKET, TokenType_CLOSE_BRACKET,
@ -82,7 +82,7 @@ enum TokenType
* classified by the #TokenType enumerated types. * classified by the #TokenType enumerated types.
* *
* Offers iterator protocol. Tokens are immutable. */ * Offers iterator protocol. Tokens are immutable. */
class Token class Token
{ {
private: private:

View File

@ -5,8 +5,8 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2015, assimp team Copyright (c) 2006-2015, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the with or without modification, are permitted provided that the
following conditions are met: following conditions are met:
* Redistributions of source code must retain the above * Redistributions of source code must retain the above
@ -23,16 +23,16 @@ following conditions are met:
derived from this software without specific prior derived from this software without specific prior
written permission of the assimp team. written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -59,7 +59,7 @@ const char* TokenTypeString(TokenType t)
switch(t) { switch(t) {
case TokenType_OPEN_BRACKET: case TokenType_OPEN_BRACKET:
return "TOK_OPEN_BRACKET"; return "TOK_OPEN_BRACKET";
case TokenType_CLOSE_BRACKET: case TokenType_CLOSE_BRACKET:
return "TOK_CLOSE_BRACKET"; return "TOK_CLOSE_BRACKET";
@ -79,7 +79,7 @@ const char* TokenTypeString(TokenType t)
ai_assert(false); ai_assert(false);
return ""; return "";
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::string AddOffset(const std::string& prefix, const std::string& text, unsigned int offset) std::string AddOffset(const std::string& prefix, const std::string& text, unsigned int offset)
@ -102,7 +102,7 @@ std::string AddTokenText(const std::string& prefix, const std::string& text, con
", offset 0x", std::hex, tok->Offset(),") ", ", offset 0x", std::hex, tok->Offset(),") ",
text) ); text) );
} }
return static_cast<std::string>( (Formatter::format(),prefix, return static_cast<std::string>( (Formatter::format(),prefix,
" (",TokenTypeString(tok->Type()), " (",TokenTypeString(tok->Type()),
", line ",tok->Line(), ", line ",tok->Line(),

Some files were not shown because too many files have changed in this diff Show More