|
@@ -59,12 +59,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
// We need MathFunctions.h to compute the lcm/gcd of a number
|
|
// We need MathFunctions.h to compute the lcm/gcd of a number
|
|
#include "MathFunctions.h"
|
|
#include "MathFunctions.h"
|
|
#include <memory>
|
|
#include <memory>
|
|
-#include "../include/assimp/DefaultLogger.hpp"
|
|
|
|
-#include "../include/assimp/mesh.h"
|
|
|
|
-#include "../include/assimp/material.h"
|
|
|
|
-#include "../include/assimp/scene.h"
|
|
|
|
-#include "../include/assimp/IOSystem.hpp"
|
|
|
|
-#include "../include/assimp/postprocess.h"
|
|
|
|
|
|
+#include <assimp/DefaultLogger.hpp>
|
|
|
|
+#include <assimp/mesh.h>
|
|
|
|
+#include <assimp/material.h>
|
|
|
|
+#include <assimp/scene.h>
|
|
|
|
+#include <assimp/IOSystem.hpp>
|
|
|
|
+#include <assimp/postprocess.h>
|
|
|
|
|
|
|
|
|
|
using namespace Assimp;
|
|
using namespace Assimp;
|
|
@@ -207,54 +207,54 @@ void IRRImporter::BuildSkybox(std::vector<aiMesh*>& meshes, std::vector<aiMateri
|
|
// by six single planes with different textures, so we'll
|
|
// by six single planes with different textures, so we'll
|
|
// need to build six meshes.
|
|
// 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
|
|
// FRONT SIDE
|
|
meshes.push_back( BuildSingleQuadMesh(
|
|
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)) );
|
|
|
|
|
|
+ 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 = materials.size()-6u;
|
|
meshes.back()->mMaterialIndex = materials.size()-6u;
|
|
|
|
|
|
// LEFT SIDE
|
|
// LEFT SIDE
|
|
meshes.push_back( BuildSingleQuadMesh(
|
|
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)) );
|
|
|
|
|
|
+ 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 = materials.size()-5u;
|
|
meshes.back()->mMaterialIndex = materials.size()-5u;
|
|
|
|
|
|
// BACK SIDE
|
|
// BACK SIDE
|
|
meshes.push_back( BuildSingleQuadMesh(
|
|
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)) );
|
|
|
|
|
|
+ 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 = materials.size()-4u;
|
|
meshes.back()->mMaterialIndex = materials.size()-4u;
|
|
|
|
|
|
// RIGHT SIDE
|
|
// RIGHT SIDE
|
|
meshes.push_back( BuildSingleQuadMesh(
|
|
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)) );
|
|
|
|
|
|
+ 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 = materials.size()-3u;
|
|
meshes.back()->mMaterialIndex = materials.size()-3u;
|
|
|
|
|
|
// TOP SIDE
|
|
// TOP SIDE
|
|
meshes.push_back( BuildSingleQuadMesh(
|
|
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)) );
|
|
|
|
|
|
+ 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 = materials.size()-2u;
|
|
meshes.back()->mMaterialIndex = materials.size()-2u;
|
|
|
|
|
|
// BOTTOM SIDE
|
|
// BOTTOM SIDE
|
|
meshes.push_back( BuildSingleQuadMesh(
|
|
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)) );
|
|
|
|
|
|
+ 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 = materials.size()-1u;
|
|
meshes.back()->mMaterialIndex = materials.size()-1u;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -479,7 +479,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
|
|
aiVectorKey& key = anim->mPositionKeys[i];
|
|
aiVectorKey& key = anim->mPositionKeys[i];
|
|
key.mTime = i * tdelta;
|
|
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)));
|
|
key.mValue = in.circleCenter + in.circleRadius * ((vecU * std::cos(t)) + (vecV * std::sin(t)));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -498,7 +498,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
|
|
anim->mPositionKeys = new aiVectorKey[anim->mNumPositionKeys];
|
|
anim->mPositionKeys = new aiVectorKey[anim->mNumPositionKeys];
|
|
|
|
|
|
aiVector3D diff = in.direction - in.circleCenter;
|
|
aiVector3D diff = in.direction - in.circleCenter;
|
|
- const float lengthOfWay = diff.Length();
|
|
|
|
|
|
+ const ai_real lengthOfWay = diff.Length();
|
|
diff.Normalize();
|
|
diff.Normalize();
|
|
|
|
|
|
const double timeFactor = lengthOfWay / in.timeForWay;
|
|
const double timeFactor = lengthOfWay / in.timeForWay;
|
|
@@ -507,7 +507,7 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
|
|
for (unsigned int i = 0; i < anim->mNumPositionKeys;++i) {
|
|
for (unsigned int i = 0; i < anim->mNumPositionKeys;++i) {
|
|
aiVectorKey& key = anim->mPositionKeys[i];
|
|
aiVectorKey& key = anim->mPositionKeys[i];
|
|
key.mTime = i * tdelta;
|
|
key.mTime = i * tdelta;
|
|
- key.mValue = in.circleCenter + diff * float(timeFactor * key.mTime);
|
|
|
|
|
|
+ key.mValue = in.circleCenter + diff * ai_real(timeFactor * key.mTime);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -542,8 +542,8 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
|
|
{
|
|
{
|
|
aiVectorKey& key = anim->mPositionKeys[i];
|
|
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 * 0.001 );
|
|
|
|
+ const ai_real u = dt - std::floor(dt);
|
|
const int idx = (int)std::floor(dt) % size;
|
|
const int idx = (int)std::floor(dt) % size;
|
|
|
|
|
|
// get the 4 current points to evaluate the spline
|
|
// get the 4 current points to evaluate the spline
|
|
@@ -553,13 +553,13 @@ void IRRImporter::ComputeAnimations(Node* root, aiNode* real, std::vector<aiNode
|
|
const aiVector3D& p3 = in.splineKeys[ ClampSpline( idx + 2, size ) ].mValue;
|
|
const aiVector3D& p3 = in.splineKeys[ ClampSpline( idx + 2, size ) ].mValue;
|
|
|
|
|
|
// compute polynomials
|
|
// 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 = 2.0 * u3 - 3.0 * u2 + 1.0;
|
|
|
|
+ const ai_real h2 = -2.0 * u3 + 3.0 * u3;
|
|
|
|
+ const ai_real h3 = u3 - 2.0 * u3;
|
|
|
|
+ const ai_real h4 = u3 - u2;
|
|
|
|
|
|
// compute the spline tangents
|
|
// compute the spline tangents
|
|
const aiVector3D t1 = ( p2 - p0 ) * in.tightness;
|
|
const aiVector3D t1 = ( p2 - p0 ) * in.tightness;
|
|
@@ -1372,8 +1372,7 @@ void IRRImporter::InternReadFile( const std::string& pFile,
|
|
|
|
|
|
/* Now iterate through all cameras and compute their final (horizontal) FOV
|
|
/* Now iterate through all cameras and compute their final (horizontal) FOV
|
|
*/
|
|
*/
|
|
- for (std::vector<aiCamera*>::iterator it = cameras.begin(), end = cameras.end();it != end; ++it) {
|
|
|
|
- aiCamera* cam = *it;
|
|
|
|
|
|
+ for (aiCamera *cam : cameras) {
|
|
|
|
|
|
// screen aspect could be missing
|
|
// screen aspect could be missing
|
|
if (cam->mAspect) {
|
|
if (cam->mAspect) {
|