From adbc7e8f7036f92c6102af2a2a598c37491be771 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 19 Feb 2019 20:23:20 +0100 Subject: [PATCH] closes https://github.com/assimp/assimp/issues/2115: rollback setup of FBX-camera. --- code/ColladaLoader.cpp | 16 +++++++++------- code/FBXConverter.cpp | 13 +++++++++++-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index 0c87330a9..2a3412ac2 100644 --- a/code/ColladaLoader.cpp +++ b/code/ColladaLoader.cpp @@ -109,13 +109,13 @@ ColladaLoader::~ColladaLoader() { // ------------------------------------------------------------------------------------------------ // 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 std::string extension = GetExtension(pFile); - if( extension == "dae") + if (extension == "dae") { return true; + } // XML - too generic, we need to open the file and search for typical keywords if( extension == "xml" || !extension.length() || checkSig) { @@ -123,10 +123,13 @@ bool ColladaLoader::CanRead( const std::string& pFile, IOSystem* pIOHandler, boo * support a specific file extension in general pIOHandler * might be NULL and it's our duty to return true here. */ - if (!pIOHandler)return true; + if (!pIOHandler) { + return true; + } const char* tokens[] = {"mRootNode->mTransformation *= aiMatrix4x4(parser.mUnitSize, 0, 0, 0, 0, parser.mUnitSize, 0, 0, 0, 0, parser.mUnitSize, 0, diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index 1bfc90b6d..a81f1e615 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -390,9 +390,18 @@ namespace Assimp { out_camera->mAspect = cam.AspectWidth() / cam.AspectHeight(); //cameras are defined along positive x direction - out_camera->mPosition = cam.Position(); + /*out_camera->mPosition = cam.Position(); out_camera->mLookAt = (cam.InterestPosition() - out_camera->mPosition).Normalize(); - out_camera->mUp = cam.UpVector(); + out_camera->mUp = cam.UpVector();*/ + + out_camera->mPosition = aiVector3D(0.0f); + out_camera->mLookAt = aiVector3D(1.0f, 0.0f, 0.0f); + out_camera->mUp = aiVector3D(0.0f, 1.0f, 0.0f); + + out_camera->mHorizontalFOV = AI_DEG_TO_RAD(cam.FieldOfView()); + + out_camera->mClipPlaneNear = cam.NearPlane(); + out_camera->mClipPlaneFar = cam.FarPlane(); out_camera->mHorizontalFOV = AI_DEG_TO_RAD(cam.FieldOfView()); out_camera->mClipPlaneNear = cam.NearPlane();