Merge pull request #773 from boxdot/master

Import mClipPlane{Near,Far} and mHorizontalFOV from Blender.
pull/800/head
Kim Kulling 2016-01-27 17:20:26 +01:00
commit f473b17c99
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()); ScopeGuard<aiCamera> out(new aiCamera());
out->mName = obj->id.name+2; out->mName = obj->id.name+2;
out->mPosition = aiVector3D(0.f, 0.f, 0.f); out->mPosition = aiVector3D(0.f, 0.f, 0.f);
out->mUp = aiVector3D(0.f, 1.f, 0.f); out->mUp = aiVector3D(0.f, 1.f, 0.f);
out->mLookAt = aiVector3D(0.f, 0.f, -1.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(); return out.dismiss();
} }

View File

@ -620,7 +620,10 @@ template <> void Structure :: Convert<Camera> (
ReadField<ErrorPolicy_Fail>(dest.id,"id",db); ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
ReadField<ErrorPolicy_Warn>((int&)dest.type,"type",db); ReadField<ErrorPolicy_Warn>((int&)dest.type,"type",db);
ReadField<ErrorPolicy_Warn>((int&)dest.flag,"flag",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); db.reader->IncPtr(size);
} }

View File

@ -312,18 +312,10 @@ struct Camera : ElemBase {
ID id FAIL; ID id FAIL;
// struct AnimData *adt;
Type type,flag WARN; Type type,flag WARN;
float angle WARN; float lens WARN;
//float passepartalpha, angle; float sensor_x WARN;
//float clipsta, clipend; float clipsta, clipend;
//float lens, ortho_scale, drawsize;
//float shiftx, shifty;
//float YF_dofdist, YF_aperture;
//short YF_bkhtype, YF_bkhbias;
//float YF_bkhrot;
}; };