Skip to content

Commit

Permalink
closes #2115: rollback setup of FBX-camera.
Browse files Browse the repository at this point in the history
  • Loading branch information
kimkulling committed Feb 19, 2019
1 parent cc8f91c commit adbc7e8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
16 changes: 9 additions & 7 deletions code/ColladaLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,24 +109,27 @@ 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) {
/* If CanRead() is called in order to check whether we
* 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[] = {"<collada"};
return SearchFileHeaderForToken(pIOHandler,pFile,tokens,1);
}

return false;
}

Expand All @@ -147,8 +150,7 @@ const aiImporterDesc* ColladaLoader::GetInfo () const

// ------------------------------------------------------------------------------------------------
// 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;

// clean all member arrays - just for safety, it should work even if we did not
Expand Down Expand Up @@ -184,7 +186,7 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I
// ... then fill the materials with the now adjusted settings
FillMaterials(parser, pScene);

// Apply unitsize scale calculation
// Apply unit-size scale calculation
pScene->mRootNode->mTransformation *= aiMatrix4x4(parser.mUnitSize, 0, 0, 0,
0, parser.mUnitSize, 0, 0,
0, 0, parser.mUnitSize, 0,
Expand Down
13 changes: 11 additions & 2 deletions code/FBXConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit adbc7e8

Please sign in to comment.