/** * This component renders a scene * @param id String * @param name String * @param autoClear bool * @param localClipping * @param width * @param height * @param domElement * @param parentEntity * @param preserveDrawingBuffer * @constructor */ GameLib.D3.API.Renderer = function ( id, name, autoClear, localClipping, width, height, preserveDrawingBuffer, domElement, parentEntity ) { GameLib.Component.call( this, GameLib.Component.COMPONENT_RENDERER, { 'domElement' : GameLib.DomElement }, null, parentEntity ); if (GameLib.Utils.UndefinedOrNull(id)) { id = GameLib.Utils.RandomId(); } this.id = id; if (GameLib.Utils.UndefinedOrNull(name)) { name = "Renderer (" + this.id + ")"; } this.name = name; 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; if (GameLib.Utils.UndefinedOrNull(preserveDrawingBuffer)) { preserveDrawingBuffer = false; } this.preserveDrawingBuffer = preserveDrawingBuffer; if (GameLib.Utils.UndefinedOrNull(domElement)) { domElement = null; } this.domElement = domElement; }; GameLib.D3.API.Renderer.prototype = Object.create(GameLib.Component.prototype); GameLib.D3.API.Renderer.prototype.constructor = GameLib.D3.API.Renderer; /** * Object to GameLib.D3.API.Renderer * @param objectComponent * @constructor */ GameLib.D3.API.Renderer.FromObjectComponent = function(objectComponent) { return new GameLib.D3.API.Renderer( objectComponent.id, objectComponent.name, objectComponent.autoClear, objectComponent.localClipping, objectComponent.width, objectComponent.height, objectComponent.preserveDrawingBuffer, objectComponent.domElement, objectComponent.parentEntity ); };