|
@@ -100,6 +100,25 @@ var BABYLON;
|
|
else if (camera instanceof BABYLON.VRDeviceOrientationCamera) {
|
|
else if (camera instanceof BABYLON.VRDeviceOrientationCamera) {
|
|
serializationObject.type = "VRDeviceOrientationCamera";
|
|
serializationObject.type = "VRDeviceOrientationCamera";
|
|
}
|
|
}
|
|
|
|
+ //special properties of specific cameras
|
|
|
|
+ if (camera instanceof BABYLON.ArcRotateCamera || camera instanceof BABYLON.AnaglyphArcRotateCamera) {
|
|
|
|
+ var arcCamera = camera;
|
|
|
|
+ serializationObject.alpha = arcCamera.alpha;
|
|
|
|
+ serializationObject.beta = arcCamera.beta;
|
|
|
|
+ serializationObject.radius = arcCamera.radius;
|
|
|
|
+ }
|
|
|
|
+ else if (camera instanceof BABYLON.FollowCamera) {
|
|
|
|
+ var followCam = camera;
|
|
|
|
+ serializationObject.radius = followCam.radius;
|
|
|
|
+ serializationObject.heightOffset = followCam.heightOffset;
|
|
|
|
+ serializationObject.rotationOffset = followCam.rotationOffset;
|
|
|
|
+ }
|
|
|
|
+ else if (camera instanceof BABYLON.AnaglyphFreeCamera || camera instanceof BABYLON.AnaglyphArcRotateCamera) {
|
|
|
|
+ //eye space is a private member and can only be access like this. Without changing the implementation this is the best way to get it.
|
|
|
|
+ if (camera['_eye_space'] !== undefined) {
|
|
|
|
+ serializationObject.eye_space = BABYLON.Tools.ToDegrees(camera['_eye_space']);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
//general properties that not all cameras have. The [] is due to typescript's type safety
|
|
//general properties that not all cameras have. The [] is due to typescript's type safety
|
|
if (camera['speed'] !== undefined) {
|
|
if (camera['speed'] !== undefined) {
|
|
serializationObject.speed = camera['speed'];
|
|
serializationObject.speed = camera['speed'];
|
|
@@ -112,9 +131,12 @@ var BABYLON;
|
|
if (camera['lockedTarget'] && camera['lockedTarget'].id) {
|
|
if (camera['lockedTarget'] && camera['lockedTarget'].id) {
|
|
serializationObject.lockedTargetId = camera['lockedTarget'].id;
|
|
serializationObject.lockedTargetId = camera['lockedTarget'].id;
|
|
}
|
|
}
|
|
- //will be undefined if not defined.
|
|
|
|
- serializationObject.checkCollisions = camera['checkCollisions'];
|
|
|
|
- serializationObject.applyGravity = camera['applyGravity'];
|
|
|
|
|
|
+ if (camera['checkCollisions'] !== undefined) {
|
|
|
|
+ serializationObject.checkCollisions = camera['checkCollisions'];
|
|
|
|
+ }
|
|
|
|
+ if (camera['applyGravity'] !== undefined) {
|
|
|
|
+ serializationObject.applyGravity = camera['applyGravity'];
|
|
|
|
+ }
|
|
if (camera['ellipsoid']) {
|
|
if (camera['ellipsoid']) {
|
|
serializationObject.ellipsoid = camera['ellipsoid'].asArray();
|
|
serializationObject.ellipsoid = camera['ellipsoid'].asArray();
|
|
}
|
|
}
|