no graphics for something

beta.r3js.org
-=yb4f310 2017-05-10 15:56:27 +02:00
parent a32037a826
commit 838ae9e3af
7 changed files with 56 additions and 55 deletions

View File

@ -1,14 +1,14 @@
/**
* GameLib Namespace
*/
if (typeof GameLib == 'undefined') {
if (typeof GameLib === 'undefined') {
function GameLib() {}
}
/**
* GameLib.D3 Namespace
*/
if (typeof GameLib.D3 == 'undefined') {
if (typeof GameLib.D3 === 'undefined') {
GameLib.D3 = function(){};
}
@ -16,14 +16,14 @@ if (typeof GameLib.D3 == 'undefined') {
* GameLib.D3.API Namespace
* @constructor
*/
if (typeof GameLib.D3.API == 'undefined') {
if (typeof GameLib.D3.API === 'undefined') {
GameLib.D3.API = function(){};
}
/**
* GameLib.API Namespace
*/
if (typeof GameLib.API == 'undefined') {
if (typeof GameLib.API === 'undefined') {
GameLib.API = function(){};
}
@ -31,13 +31,13 @@ if (typeof GameLib.API == 'undefined') {
* GameLib.D3.Runtime Namespace
* @constructor
*/
if (typeof GameLib.D3.Runtime == 'undefined') {
if (typeof GameLib.D3.Runtime === 'undefined') {
GameLib.D3.Runtime = function(){};
}
if (typeof Q == 'undefined') {
if (typeof Q === 'undefined') {
if (typeof require == 'undefined') {
if (typeof require === 'undefined') {
console.warn('You need the Q promise library for the GameLib.D3');
throw new Error('You need the Q promise library for the GameLib.D3');
}
@ -45,9 +45,9 @@ if (typeof Q == 'undefined') {
var Q = require('q');
}
if (typeof _ == 'undefined') {
if (typeof _ === 'undefined') {
if (typeof require == 'undefined') {
if (typeof require === 'undefined') {
console.warn('You need the lodash library for the GameLib.D3');
throw new Error('You need the lodash library for the GameLib.D3');
}

View File

@ -18,7 +18,7 @@ GameLib.D3.API.Input.Editor = function (
id,
name,
domElement,
domContainer,
// domContainer,
editor,
camera,
widthOffset,
@ -53,11 +53,11 @@ GameLib.D3.API.Input.Editor = function (
domElement = null;
}
this.domElement = domElement;
if (GameLib.Utils.UndefinedOrNull(domContainer)) {
domContainer = null;
}
this.domContainer = domContainer;
//
// if (GameLib.Utils.UndefinedOrNull(domContainer)) {
// domContainer = null;
// }
// this.domContainer = domContainer;
if (GameLib.Utils.UndefinedOrNull(editor)) {
editor = null;
@ -109,7 +109,7 @@ GameLib.D3.API.Input.Editor.FromObjectComponent = function(objectComponent) {
objectComponent.id,
objectComponent.name,
objectComponent.domElement,
objectComponent.domContainer,
// objectComponent.domContainer,
objectComponent.editor,
objectComponent.camera,
objectComponent.widthOffset,

View File

@ -2,6 +2,7 @@
* Raw Scene API object - should always correspond with the Scene Schema
* @param id String
* @param name String
* @param imageFactory [GameLib.D3.API.ImageFactory]
* @param meshes [GameLib.D3.API.Mesh]
* @param position GameLib.API.Vector3
* @param quaternion GameLib.API.Quaternion

View File

@ -2,13 +2,11 @@
* Input parent class
* @param graphics GameLib.D3.Graphics
* @param apiInputEditor GameLib.D3.API.Input.Editor
* @param dom GameLib.DOM
* @constructor
*/
GameLib.D3.Input.Editor = function (
graphics,
apiInputEditor,
dom
apiInputEditor
) {
this.graphics = graphics;
@ -23,7 +21,7 @@ GameLib.D3.Input.Editor = function (
apiInputEditor.id,
apiInputEditor.name,
apiInputEditor.domElement,
apiInputEditor.domContainer,
// apiInputEditor.domContainer,
apiInputEditor.editor,
apiInputEditor.camera,
apiInputEditor.widthOffset,
@ -34,26 +32,24 @@ GameLib.D3.Input.Editor = function (
apiInputEditor.parentEntity
);
if (GameLib.Utils.UndefinedOrNull(dom)) {
console.warn('Cannot create window resize event without handle to the DOM');
dom = null;
// throw new Error('Cannot create Input without an handle to the DOM');
}
this.dom = dom;
// if (GameLib.Utils.UndefinedOrNull(dom)) {
// console.warn('Cannot create window resize event without handle to the DOM');
// dom = null;
// // throw new Error('Cannot create Input without an handle to the DOM');
// }
// this.dom = dom;
if (this.domElement instanceof GameLib.API.DomElement) {
this.domElement = new GameLib.DomElement(
this.graphics,
this.domElement
)
}
if (this.domContainer instanceof GameLib.API.DomElement) {
this.domContainer = new GameLib.DomElement(
this.graphics,
this.domContainer
)
}
// if (this.domContainer instanceof GameLib.API.DomElement) {
// this.domContainer = new GameLib.DomElement(
// this.domContainer
// )
// }
/**
* Cannot create a new Editor object here - it will cause an infinite loop
@ -171,7 +167,7 @@ GameLib.D3.Input.Editor.prototype.toApiComponent = function() {
this.id,
this.name,
this.domElementId,
this.domContainerId,
// this.domContainerId,
GameLib.Utils.IdOrNull(this.editor),
GameLib.Utils.IdOrNull(this.camera),
this.widthOffset,
@ -196,9 +192,9 @@ GameLib.D3.Input.Editor.FromObjectComponent = function(graphics, objectComponent
};
GameLib.D3.Input.Editor.prototype.onWindowResize = function() {
this.domContainer.instance.style.height = (this.window.innerHeight - this.containerHeightOffset) + 'px';
this.domContainer.instance.style.width = (this.window.innerWidth - this.containerWidthOffset) + 'px';
//
// this.domContainer.instance.style.height = (this.window.innerHeight - this.containerHeightOffset) + 'px';
// this.domContainer.instance.style.width = (this.window.innerWidth - this.containerWidthOffset) + 'px';
var width = this.window.innerWidth - this.widthOffset;

View File

@ -31,7 +31,6 @@ GameLib.D3.Renderer = function (
if (this.domElement instanceof GameLib.API.DomElement) {
this.domElement = new GameLib.DomElement(
this.graphics,
this.domElement
);
}

View File

@ -1,13 +1,9 @@
/**
* Runtime domElement for updating instance objects
* @param graphics GameLib.D3.Graphics
* @param apiDomElement GameLib.API.DomElement
* @constructor
*/
GameLib.DomElement = function (graphics, apiDomElement) {
this.graphics = graphics;
this.graphics.isNotThreeThrow();
GameLib.DomElement = function (apiDomElement) {
GameLib.API.DomElement.call(
this,
@ -29,7 +25,16 @@ GameLib.DomElement.prototype.constructor = GameLib.DomElement;
* @returns {*}
*/
GameLib.DomElement.prototype.createInstance = function(update) {
return document.getElementById(this.domElementId);
var instance = null;
if (update) {
instance = this.instance;
} else {
instance = document.getElementById(this.domElementId);
}
return instance;
};
/**

View File

@ -36,7 +36,6 @@ GameLib.System = function(
if (this.domElement instanceof GameLib.API.DomElement) {
this.domElement = new GameLib.DomElement(
this.graphics,
this.domElement
);
}
@ -56,11 +55,11 @@ GameLib.System.SYSTEM_TYPE_ALL = 0x7;
*/
GameLib.System.prototype.start = function() {
if (this.systemType == GameLib.System.SYSTEM_TYPE_INPUT) {
if (this.systemType === GameLib.System.SYSTEM_TYPE_INPUT) {
this.driveInputObjects = this.entityManager.query([GameLib.D3.Input.Drive]);
}
if (this.systemType == GameLib.System.SYSTEM_TYPE_RENDER) {
if (this.systemType === GameLib.System.SYSTEM_TYPE_RENDER) {
if (GameLib.Utils.UndefinedOrNull(this.domElement)) {
console.warn('Cannot start a rendering system without a valid DOM element');
@ -83,7 +82,7 @@ GameLib.System.prototype.start = function() {
this.viewports = this.entityManager.query([GameLib.D3.Viewport]);
}
if (this.systemType == GameLib.System.SYSTEM_TYPE_ANIMATION) {
if (this.systemType === GameLib.System.SYSTEM_TYPE_ANIMATION) {
this.pathFollowingObjects = this.entityManager.query([GameLib.D3.PathFollowing]);
this.followObjects = this.entityManager.query([GameLib.D3.Follow]);
this.meshObjects = this.entityManager.query([GameLib.D3.Mesh]);
@ -100,7 +99,7 @@ GameLib.System.prototype.start = function() {
*/
GameLib.System.prototype.update = function(deltaTime) {
if (this.systemType == GameLib.System.SYSTEM_TYPE_INPUT) {
if (this.systemType === GameLib.System.SYSTEM_TYPE_INPUT) {
this.driveInputObjects.forEach(
function(object) {
object.update(deltaTime);
@ -108,7 +107,8 @@ GameLib.System.prototype.update = function(deltaTime) {
);
}
if (this.systemType == GameLib.System.SYSTEM_TYPE_ANIMATION) {
if (this.systemType === GameLib.System.SYSTEM_TYPE_ANIMATION) {
this.pathFollowingObjects.forEach(
function(object) {
object.update(deltaTime);
@ -146,7 +146,7 @@ GameLib.System.prototype.update = function(deltaTime) {
);
}
if (this.systemType == GameLib.System.SYSTEM_TYPE_RENDER) {
if (this.systemType === GameLib.System.SYSTEM_TYPE_RENDER) {
this.viewports.forEach(
function (viewport) {
viewport.update(deltaTime);
@ -162,17 +162,17 @@ GameLib.System.prototype.update = function(deltaTime) {
*/
GameLib.System.prototype.stop = function() {
if (this.systemType == GameLib.System.SYSTEM_TYPE_INPUT) {
if (this.systemType === GameLib.System.SYSTEM_TYPE_INPUT) {
this.driveInputObjects = [];
}
if (this.systemType == GameLib.System.SYSTEM_TYPE_RENDER) {
if (this.systemType === GameLib.System.SYSTEM_TYPE_RENDER) {
this.domElement.innerHTML = 'Rendering System Stopped';
this.renderers = [];
this.viewports = [];
}
if (this.systemType == GameLib.System.SYSTEM_TYPE_ANIMATION) {
if (this.systemType === GameLib.System.SYSTEM_TYPE_ANIMATION) {
this.pathFollowingObjects = [];
this.followObjects = [];
this.meshObjects = [];
@ -185,7 +185,7 @@ GameLib.System.prototype.stop = function() {
/**
* Converts runtime vector to API Vector
* @returns {GameLib.API.Mouse}
* @returns {GameLib.API.System}
*/
GameLib.System.prototype.toApiSystem = function() {