From 13ec11bca805ab2d8ae533bfb36df98c27f8fd56 Mon Sep 17 00:00:00 2001 From: boxdot Date: Wed, 27 Jan 2016 02:12:15 +0100 Subject: [PATCH] Import mClipPlane{Near,Far} and mHorizontalFOV from Blender. --- code/BlenderLoader.cpp | 8 +++++++- code/BlenderScene.cpp | 5 ++++- code/BlenderScene.h | 14 +++----------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/code/BlenderLoader.cpp b/code/BlenderLoader.cpp index a33992bec..abf6bb9c0 100644 --- a/code/BlenderLoader.cpp +++ b/code/BlenderLoader.cpp @@ -1011,13 +1011,19 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co } // ------------------------------------------------------------------------------------------------ -aiCamera* BlenderImporter::ConvertCamera(const Scene& /*in*/, const Object* obj, const Camera* /*camera*/, ConversionData& /*conv_data*/) +aiCamera* BlenderImporter::ConvertCamera(const Scene& /*in*/, const Object* obj, const Camera* cam, ConversionData& /*conv_data*/) { ScopeGuard out(new aiCamera()); out->mName = obj->id.name+2; out->mPosition = aiVector3D(0.f, 0.f, 0.f); out->mUp = aiVector3D(0.f, 1.f, 0.f); out->mLookAt = aiVector3D(0.f, 0.f, -1.f); + if (cam->sensor_x && cam->lens) { + out->mHorizontalFOV = atan2(cam->sensor_x, 2.f * cam->lens); + } + out->mClipPlaneNear = cam->clipsta; + out->mClipPlaneFar = cam->clipend; + return out.dismiss(); } diff --git a/code/BlenderScene.cpp b/code/BlenderScene.cpp index 03831060b..1273de81e 100644 --- a/code/BlenderScene.cpp +++ b/code/BlenderScene.cpp @@ -620,7 +620,10 @@ template <> void Structure :: Convert ( ReadField(dest.id,"id",db); ReadField((int&)dest.type,"type",db); ReadField((int&)dest.flag,"flag",db); - ReadField(dest.angle,"angle",db); + ReadField(dest.lens,"lens",db); + ReadField(dest.sensor_x,"sensor_x",db); + ReadField(dest.clipsta,"clipsta",db); + ReadField(dest.clipend,"clipend",db); db.reader->IncPtr(size); } diff --git a/code/BlenderScene.h b/code/BlenderScene.h index b24fcfc3e..0af1f3912 100644 --- a/code/BlenderScene.h +++ b/code/BlenderScene.h @@ -312,18 +312,10 @@ struct Camera : ElemBase { ID id FAIL; - // struct AnimData *adt; - Type type,flag WARN; - float angle WARN; - //float passepartalpha, angle; - //float clipsta, clipend; - //float lens, ortho_scale, drawsize; - //float shiftx, shifty; - - //float YF_dofdist, YF_aperture; - //short YF_bkhtype, YF_bkhbias; - //float YF_bkhrot; + float lens WARN; + float sensor_x WARN; + float clipsta, clipend; };