89 lines
2.2 KiB
JavaScript
89 lines
2.2 KiB
JavaScript
|
/**
|
||
|
* GameLib.D3.API.Camera.Perspective
|
||
|
* @constructor
|
||
|
* @param apiCamera
|
||
|
* @param fov
|
||
|
* @param near
|
||
|
* @param far
|
||
|
* @param filmGauge
|
||
|
* @param filmOffset
|
||
|
* @param focus
|
||
|
* @param zoom
|
||
|
*/
|
||
|
GameLib.D3.API.Camera.Perspective = function(
|
||
|
apiCamera,
|
||
|
near,
|
||
|
far,
|
||
|
fov,
|
||
|
filmGauge,
|
||
|
filmOffset,
|
||
|
focus,
|
||
|
zoom
|
||
|
) {
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(apiCamera)) {
|
||
|
apiCamera = {
|
||
|
cameraType : GameLib.D3.API.Camera.CAMERA_TYPE_PERSPECTIVE
|
||
|
};
|
||
|
}
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(apiCamera.cameraType)) {
|
||
|
apiCamera.cameraType = GameLib.D3.API.Camera.CAMERA_TYPE_PERSPECTIVE;
|
||
|
}
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(near)) {
|
||
|
// near = new GameLib.API.Number(0.1, 0.001, 0.001, 2000);
|
||
|
near = 0.1;
|
||
|
}
|
||
|
this.near = near;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(far)) {
|
||
|
// far = new GameLib.API.Number(2000, 1, 1, 4000);
|
||
|
far = 2000;
|
||
|
}
|
||
|
this.far = far;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(fov)) {
|
||
|
// fov = new GameLib.API.Number(50, 1, 0, 180);
|
||
|
fov = 50;
|
||
|
}
|
||
|
this.fov = fov;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(filmGauge)) {
|
||
|
// filmGauge = new GameLib.API.Number(35, 1, 0, 200);
|
||
|
filmGauge = 35;
|
||
|
}
|
||
|
this.filmGauge = filmGauge;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(filmOffset)) {
|
||
|
// filmOffset = new GameLib.API.Number(0, 1, 0, 200);
|
||
|
filmOffset = 0;
|
||
|
}
|
||
|
this.filmOffset = filmOffset;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(focus)) {
|
||
|
// focus = new GameLib.API.Number(10, 0.1, 0, 200);
|
||
|
focus = 10;
|
||
|
}
|
||
|
this.focus = focus;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(zoom)) {
|
||
|
// zoom = new GameLib.API.Number(1, 0.01, 0, 10);
|
||
|
zoom = 1;
|
||
|
}
|
||
|
this.zoom = zoom;
|
||
|
|
||
|
GameLib.D3.API.Camera.call(
|
||
|
this,
|
||
|
apiCamera.id,
|
||
|
apiCamera.name,
|
||
|
apiCamera.cameraType,
|
||
|
apiCamera.aspect,
|
||
|
apiCamera.position,
|
||
|
apiCamera.lookAt,
|
||
|
apiCamera.parentEntity
|
||
|
);
|
||
|
};
|
||
|
|
||
|
GameLib.D3.API.Camera.Perspective.prototype = Object.create(GameLib.D3.API.Camera.prototype);
|
||
|
GameLib.D3.API.Camera.Perspective.prototype.constructor = GameLib.D3.API.Camera.Perspective;
|