r3-legacy/src/game-lib-d3-api-renderer.js

77 lines
1.6 KiB
JavaScript
Raw Normal View History

2016-12-19 17:44:15 +01:00
/**
* This component renders a scene
* @param id String
* @param name String
* @param scene GameLib.D3.Scene
* @param camera GameLib.D3.Camera
* @param autoClear bool
* @param localClipping
* @param width
* @param height
* @constructor
*/
GameLib.D3.API.Renderer = function (
id,
name,
scene,
camera,
autoClear,
localClipping,
width,
height
) {
GameLib.Component.call(
this,
GameLib.Component.COMPONENT_RENDERER,
{
'scene' : GameLib.D3.Scene,
'camera' : GameLib.D3.Camera
}
2016-12-19 17:44:15 +01:00
);
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = this.constructor.name;
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(scene)) {
scene = null;
}
this.scene = scene;
if (GameLib.Utils.UndefinedOrNull(camera)) {
camera = null;
}
this.camera = camera;
if (GameLib.Utils.UndefinedOrNull(autoClear)) {
autoClear = true;
}
this.autoClear = autoClear;
if (GameLib.Utils.UndefinedOrNull(localClipping)) {
localClipping = false;
}
this.localClipping = localClipping;
if (GameLib.Utils.UndefinedOrNull(width)) {
width = 800;
}
this.width = width;
if (GameLib.Utils.UndefinedOrNull(height)) {
height = 600;
}
this.height = height;
};
GameLib.D3.API.Renderer.prototype = Object.create(GameLib.Component.prototype);
GameLib.D3.API.Renderer.prototype.constructor = GameLib.D3.API.Renderer;