Import mClipPlane{Near,Far} and mHorizontalFOV from Blender.

pull/773/head
boxdot 2016-01-27 02:12:15 +01:00
parent 11d0085f4d
commit 13ec11bca8
3 changed files with 14 additions and 13 deletions

View File

@ -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<aiCamera> 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();
}

View File

@ -620,7 +620,10 @@ template <> void Structure :: Convert<Camera> (
ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
ReadField<ErrorPolicy_Warn>((int&)dest.type,"type",db);
ReadField<ErrorPolicy_Warn>((int&)dest.flag,"flag",db);
ReadField<ErrorPolicy_Warn>(dest.angle,"angle",db);
ReadField<ErrorPolicy_Warn>(dest.lens,"lens",db);
ReadField<ErrorPolicy_Warn>(dest.sensor_x,"sensor_x",db);
ReadField<ErrorPolicy_Igno>(dest.clipsta,"clipsta",db);
ReadField<ErrorPolicy_Igno>(dest.clipend,"clipend",db);
db.reader->IncPtr(size);
}

View File

@ -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;
};