summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/assimp/code/IRRLoader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/assimp/code/IRRLoader.cpp')
-rw-r--r--src/3rdparty/assimp/code/IRRLoader.cpp100
1 files changed, 51 insertions, 49 deletions
diff --git a/src/3rdparty/assimp/code/IRRLoader.cpp b/src/3rdparty/assimp/code/IRRLoader.cpp
index 2d702523d..c29d5b072 100644
--- a/src/3rdparty/assimp/code/IRRLoader.cpp
+++ b/src/3rdparty/assimp/code/IRRLoader.cpp
@@ -3,7 +3,8 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
-Copyright (c) 2006-2016, assimp team
+Copyright (c) 2006-2017, assimp team
+
All rights reserved.
@@ -52,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "fast_atof.h"
#include "GenericProperty.h"
-#include "SceneCombiner.h"
+#include <assimp/SceneCombiner.h>
#include "StandardShapes.h"
#include "Importer.h"
@@ -65,7 +66,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/scene.h>
#include <assimp/IOSystem.hpp>
#include <assimp/postprocess.h>
-
+#include <assimp/importerdesc.h>
using namespace Assimp;
using namespace irr;
@@ -207,55 +208,55 @@ void IRRImporter::BuildSkybox(std::vector<aiMesh*>& meshes, std::vector<aiMateri
// by six single planes with different textures, so we'll
// need to build six meshes.
- const float l = 10.f; // the size used by Irrlicht
+ const ai_real l = 10.0; // the size used by Irrlicht
// FRONT SIDE
meshes.push_back( BuildSingleQuadMesh(
- SkyboxVertex(-l,-l,-l, 0, 0, 1, 1.f,1.f),
- SkyboxVertex( l,-l,-l, 0, 0, 1, 0.f,1.f),
- SkyboxVertex( l, l,-l, 0, 0, 1, 0.f,0.f),
- SkyboxVertex(-l, l,-l, 0, 0, 1, 1.f,0.f)) );
- meshes.back()->mMaterialIndex = materials.size()-6u;
+ SkyboxVertex(-l,-l,-l, 0, 0, 1, 1.0,1.0),
+ SkyboxVertex( l,-l,-l, 0, 0, 1, 0.0,1.0),
+ SkyboxVertex( l, l,-l, 0, 0, 1, 0.0,0.0),
+ SkyboxVertex(-l, l,-l, 0, 0, 1, 1.0,0.0)) );
+ meshes.back()->mMaterialIndex = static_cast<unsigned int>(materials.size()-6u);
// LEFT SIDE
meshes.push_back( BuildSingleQuadMesh(
- SkyboxVertex( l,-l,-l, -1, 0, 0, 1.f,1.f),
- SkyboxVertex( l,-l, l, -1, 0, 0, 0.f,1.f),
- SkyboxVertex( l, l, l, -1, 0, 0, 0.f,0.f),
- SkyboxVertex( l, l,-l, -1, 0, 0, 1.f,0.f)) );
- meshes.back()->mMaterialIndex = materials.size()-5u;
+ SkyboxVertex( l,-l,-l, -1, 0, 0, 1.0,1.0),
+ SkyboxVertex( l,-l, l, -1, 0, 0, 0.0,1.0),
+ SkyboxVertex( l, l, l, -1, 0, 0, 0.0,0.0),
+ SkyboxVertex( l, l,-l, -1, 0, 0, 1.0,0.0)) );
+ meshes.back()->mMaterialIndex = static_cast<unsigned int>(materials.size()-5u);
// BACK SIDE
meshes.push_back( BuildSingleQuadMesh(
- SkyboxVertex( l,-l, l, 0, 0, -1, 1.f,1.f),
- SkyboxVertex(-l,-l, l, 0, 0, -1, 0.f,1.f),
- SkyboxVertex(-l, l, l, 0, 0, -1, 0.f,0.f),
- SkyboxVertex( l, l, l, 0, 0, -1, 1.f,0.f)) );
- meshes.back()->mMaterialIndex = materials.size()-4u;
+ SkyboxVertex( l,-l, l, 0, 0, -1, 1.0,1.0),
+ SkyboxVertex(-l,-l, l, 0, 0, -1, 0.0,1.0),
+ SkyboxVertex(-l, l, l, 0, 0, -1, 0.0,0.0),
+ SkyboxVertex( l, l, l, 0, 0, -1, 1.0,0.0)) );
+ meshes.back()->mMaterialIndex = static_cast<unsigned int>(materials.size()-4u);
// RIGHT SIDE
meshes.push_back( BuildSingleQuadMesh(
- SkyboxVertex(-l,-l, l, 1, 0, 0, 1.f,1.f),
- SkyboxVertex(-l,-l,-l, 1, 0, 0, 0.f,1.f),
- SkyboxVertex(-l, l,-l, 1, 0, 0, 0.f,0.f),
- SkyboxVertex(-l, l, l, 1, 0, 0, 1.f,0.f)) );
- meshes.back()->mMaterialIndex = materials.size()-3u;
+ SkyboxVertex(-l,-l, l, 1, 0, 0, 1.0,1.0),
+ SkyboxVertex(-l,-l,-l, 1, 0, 0, 0.0,1.0),
+ SkyboxVertex(-l, l,-l, 1, 0, 0, 0.0,0.0),
+ SkyboxVertex(-l, l, l, 1, 0, 0, 1.0,0.0)) );
+ meshes.back()->mMaterialIndex = static_cast<unsigned int>(materials.size()-3u);
// TOP SIDE
meshes.push_back( BuildSingleQuadMesh(
- SkyboxVertex( l, l,-l, 0, -1, 0, 1.f,1.f),
- SkyboxVertex( l, l, l, 0, -1, 0, 0.f,1.f),
- SkyboxVertex(-l, l, l, 0, -1, 0, 0.f,0.f),
- SkyboxVertex(-l, l,-l, 0, -1, 0, 1.f,0.f)) );
- meshes.back()->mMaterialIndex = materials.size()-2u;
+ SkyboxVertex( l, l,-l, 0, -1, 0, 1.0,1.0),
+ SkyboxVertex( l, l, l, 0, -1, 0, 0.0,1.0),
+ SkyboxVertex(-l, l, l, 0, -1, 0, 0.0,0.0),
+ SkyboxVertex(-l, l,-l, 0, -1, 0, 1.0,0.0)) );
+ meshes.back()->mMaterialIndex = static_cast<unsigned int>(materials.size()-2u);
// BOTTOM SIDE
meshes.push_back( BuildSingleQuadMesh(
- SkyboxVertex( l,-l, l, 0, 1, 0, 0.f,0.f),
- SkyboxVertex( l,-l,-l, 0, 1, 0, 1.f,0.f),
- SkyboxVertex(-l,-l,-l, 0, 1, 0, 1.f,1.f),
- SkyboxVertex(-l,-l, l, 0, 1, 0, 0.f,1.f)) );
- meshes.back()->mMaterialIndex = materials.size()-1u;
+ SkyboxVertex( l,-l, l, 0, 1, 0, 0.0,0.0),
+ SkyboxVertex( l,-l,-l, 0, 1, 0, 1.0,0.0),
+ SkyboxVertex(-l,-l,-l, 0, 1, 0, 1.0,1.0),
+ SkyboxVertex(-l,-l, l, 0, 1, 0, 0.0,1.0)) );
+ meshes.back()->mMaterialIndex = static_cast<unsigned int>(materials.size()-1u);
}
// ------------------------------------------------------------------------------------------------
@@ -269,14 +270,15 @@ void IRRImporter::CopyMaterial(std::vector<aiMaterial*>& materials,
if (UINT_MAX == defMatIdx)
{
defMatIdx = (unsigned int)materials.size();
- aiMaterial* mat = new aiMaterial();
+ //TODO: add this materials to someone?
+ /*aiMaterial* mat = new aiMaterial();
aiString s;
s.Set(AI_DEFAULT_MATERIAL_NAME);
mat->AddProperty(&s,AI_MATKEY_NAME);
aiColor3D c(0.6f,0.6f,0.6f);
- mat->AddProperty(&c,1,AI_MATKEY_COLOR_DIFFUSE);
+ mat->AddProperty(&c,1,AI_MATKEY_COLOR_DIFFUSE);*/
}
mesh->mMaterialIndex = defMatIdx;
return;
@@ -392,7 +394,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
angles[1] %= 360;
angles[2] %= 360;
- if ((angles[0]*angles[1]) && (angles[1]*angles[2]))
+ if ( (angles[0]*angles[1]) != 0 && (angles[1]*angles[2]) != 0 )
{
FindSuitableMultiple(angles[0]);
FindSuitableMultiple(angles[1]);
@@ -479,7 +481,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
aiVectorKey& key = anim->mPositionKeys[i];
key.mTime = i * tdelta;
- const float t = (float) ( in.speed * key.mTime );
+ const ai_real t = (ai_real) ( in.speed * key.mTime );
key.mValue = in.circleCenter + in.circleRadius * ((vecU * std::cos(t)) + (vecV * std::sin(t)));
}
@@ -498,7 +500,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
anim->mPositionKeys = new aiVectorKey[anim->mNumPositionKeys];
aiVector3D diff = in.direction - in.circleCenter;
- const float lengthOfWay = diff.Length();
+ const ai_real lengthOfWay = diff.Length();
diff.Normalize();
const double timeFactor = lengthOfWay / in.timeForWay;
@@ -507,7 +509,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
for (unsigned int i = 0; i < anim->mNumPositionKeys;++i) {
aiVectorKey& key = anim->mPositionKeys[i];
key.mTime = i * tdelta;
- key.mValue = in.circleCenter + diff * float(timeFactor * key.mTime);
+ key.mValue = in.circleCenter + diff * ai_real(timeFactor * key.mTime);
}
}
break;
@@ -542,8 +544,8 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
{
aiVectorKey& key = anim->mPositionKeys[i];
- const float dt = (i * in.speed * 0.001f );
- const float u = dt - std::floor(dt);
+ const ai_real dt = (i * in.speed * ai_real( 0.001 ) );
+ const ai_real u = dt - std::floor(dt);
const int idx = (int)std::floor(dt) % size;
// get the 4 current points to evaluate the spline
@@ -553,13 +555,13 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
const aiVector3D& p3 = in.splineKeys[ ClampSpline( idx + 2, size ) ].mValue;
// compute polynomials
- const float u2 = u*u;
- const float u3 = u2*2;
+ const ai_real u2 = u*u;
+ const ai_real u3 = u2*2;
- const float h1 = 2.0f * u3 - 3.0f * u2 + 1.0f;
- const float h2 = -2.0f * u3 + 3.0f * u3;
- const float h3 = u3 - 2.0f * u3;
- const float h4 = u3 - u2;
+ const ai_real h1 = ai_real( 2.0 ) * u3 - ai_real( 3.0 ) * u2 + ai_real( 1.0 );
+ const ai_real h2 = ai_real( -2.0 ) * u3 + ai_real( 3.0 ) * u3;
+ const ai_real h3 = u3 - ai_real( 2.0 ) * u3;
+ const ai_real h4 = u3 - u2;
// compute the spline tangents
const aiVector3D t1 = ( p2 - p0 ) * in.tightness;
@@ -641,7 +643,7 @@ void SetupMapping (aiMaterial* mat, aiTextureMapping mode, const aiVector3D& axi
delete[] mat->mProperties;
mat->mProperties = new aiMaterialProperty*[p.size()*2];
- mat->mNumAllocated = p.size()*2;
+ mat->mNumAllocated = static_cast<unsigned int>(p.size()*2);
}
mat->mNumProperties = (unsigned int)p.size();
::memcpy(mat->mProperties,&p[0],sizeof(void*)*mat->mNumProperties);