use of com.badlogic.gdx.graphics.PerspectiveCamera in project nhglib by VoidZombie.
the class CameraComponentJson method parse.
@Override
public void parse(JsonValue jsonValue) {
CameraComponent cameraComponent = entities.createComponent(entity, CameraComponent.class);
Camera camera;
float nearPlane = jsonValue.getFloat("nearPlane");
float farPlane = jsonValue.getFloat("farPlane");
CameraComponent.Type type = CameraComponent.Type.fromString(jsonValue.getString("cameraType"));
switch(type) {
default:
case PERSPECTIVE:
float fieldOfView = jsonValue.getFloat("fieldOfView");
camera = new PerspectiveCamera(fieldOfView, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
break;
case ORTHOGRAPHIC:
camera = new OrthographicCamera();
break;
}
camera.near = nearPlane;
camera.far = farPlane;
cameraComponent.camera = camera;
cameraComponent.type = type;
output = cameraComponent;
}
Aggregations