|
|
@@ -2,6 +2,7 @@ package com.jme3.scene.plugins.blender.cameras;
|
|
|
|
|
|
import com.jme3.asset.BlenderKey.FeaturesToLoad;
|
|
|
import com.jme3.renderer.Camera;
|
|
|
+import com.jme3.scene.CameraNode;
|
|
|
import com.jme3.scene.plugins.blender.AbstractBlenderHelper;
|
|
|
import com.jme3.scene.plugins.blender.BlenderContext;
|
|
|
import com.jme3.scene.plugins.blender.exceptions.BlenderFileException;
|
|
|
@@ -41,7 +42,7 @@ public class CameraHelper extends AbstractBlenderHelper {
|
|
|
* an exception is thrown when there are problems with the
|
|
|
* blender file
|
|
|
*/
|
|
|
- public Camera toCamera(Structure structure) throws BlenderFileException {
|
|
|
+ public CameraNode toCamera(Structure structure) throws BlenderFileException {
|
|
|
if (blenderVersion >= 250) {
|
|
|
return this.toCamera250(structure);
|
|
|
} else {
|
|
|
@@ -59,15 +60,15 @@ public class CameraHelper extends AbstractBlenderHelper {
|
|
|
* an exception is thrown when there are problems with the
|
|
|
* blender file
|
|
|
*/
|
|
|
- public Camera toCamera250(Structure structure) throws BlenderFileException {
|
|
|
- Camera result = new Camera(DEFAULT_CAM_WIDTH, DEFAULT_CAM_HEIGHT);
|
|
|
+ private CameraNode toCamera250(Structure structure) throws BlenderFileException {
|
|
|
+ Camera camera = new Camera(DEFAULT_CAM_WIDTH, DEFAULT_CAM_HEIGHT);
|
|
|
int type = ((Number) structure.getFieldValue("type")).intValue();
|
|
|
if (type != 0 && type != 1) {
|
|
|
LOGGER.log(Level.WARNING, "Unknown camera type: {0}. Perspective camera is being used!", type);
|
|
|
type = 0;
|
|
|
}
|
|
|
//type==0 - perspective; type==1 - orthographic; perspective is used as default
|
|
|
- result.setParallelProjection(type == 1);
|
|
|
+ camera.setParallelProjection(type == 1);
|
|
|
float aspect = 0;
|
|
|
float clipsta = ((Number) structure.getFieldValue("clipsta")).floatValue();
|
|
|
float clipend = ((Number) structure.getFieldValue("clipend")).floatValue();
|
|
|
@@ -76,8 +77,8 @@ public class CameraHelper extends AbstractBlenderHelper {
|
|
|
} else {
|
|
|
aspect = ((Number) structure.getFieldValue("ortho_scale")).floatValue();
|
|
|
}
|
|
|
- result.setFrustumPerspective(45, aspect, clipsta, clipend);
|
|
|
- return result;
|
|
|
+ camera.setFrustumPerspective(45, aspect, clipsta, clipend);
|
|
|
+ return new CameraNode(null, camera);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -90,15 +91,15 @@ public class CameraHelper extends AbstractBlenderHelper {
|
|
|
* an exception is thrown when there are problems with the
|
|
|
* blender file
|
|
|
*/
|
|
|
- public Camera toCamera249(Structure structure) throws BlenderFileException {
|
|
|
- Camera result = new Camera(DEFAULT_CAM_WIDTH, DEFAULT_CAM_HEIGHT);
|
|
|
+ private CameraNode toCamera249(Structure structure) throws BlenderFileException {
|
|
|
+ Camera camera = new Camera(DEFAULT_CAM_WIDTH, DEFAULT_CAM_HEIGHT);
|
|
|
int type = ((Number) structure.getFieldValue("type")).intValue();
|
|
|
if (type != 0 && type != 1) {
|
|
|
LOGGER.log(Level.WARNING, "Unknown camera type: {0}. Perspective camera is being used!", type);
|
|
|
type = 0;
|
|
|
}
|
|
|
//type==0 - perspective; type==1 - orthographic; perspective is used as default
|
|
|
- result.setParallelProjection(type == 1);
|
|
|
+ camera.setParallelProjection(type == 1);
|
|
|
float aspect = 0;
|
|
|
float clipsta = ((Number) structure.getFieldValue("clipsta")).floatValue();
|
|
|
float clipend = ((Number) structure.getFieldValue("clipend")).floatValue();
|
|
|
@@ -107,8 +108,8 @@ public class CameraHelper extends AbstractBlenderHelper {
|
|
|
} else {
|
|
|
aspect = ((Number) structure.getFieldValue("ortho_scale")).floatValue();
|
|
|
}
|
|
|
- result.setFrustumPerspective(aspect, result.getWidth() / result.getHeight(), clipsta, clipend);
|
|
|
- return result;
|
|
|
+ camera.setFrustumPerspective(aspect, camera.getWidth() / camera.getHeight(), clipsta, clipend);
|
|
|
+ return new CameraNode(null, camera);
|
|
|
}
|
|
|
|
|
|
@Override
|