From e9ac1c9c9ef9af74e6f6f473d391715959970633 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Sat, 2 Dec 2017 12:11:14 +0100 Subject: [PATCH] Image namespace fix --- {src => bak}/game-lib-d3-api-image-factory.js | 0 {src => bak}/game-lib-d3-api-look-at.js | 0 .../game-lib-d3-api-path-following.js | 0 {src => bak}/game-lib-d3-look-at.js | 0 {src => bak}/game-lib-d3-path-following.js | 0 src/game-lib-a-component-a.js | 4 +-- ...-d3-api-image.js => game-lib-api-image.js} | 10 +++--- src/game-lib-d3-api-scene.js | 2 +- src/game-lib-d3-broadphase.js | 18 +++++----- src/game-lib-d3-scene.js | 6 ++-- src/game-lib-d3-texture.js | 12 +++---- ...game-lib-d3-image.js => game-lib-image.js} | 33 ++++++++----------- src/game-lib-system-gui.js | 4 +-- src/game-lib-system-linking.js | 2 +- src/game-lib-system-storage.js | 2 +- 15 files changed, 44 insertions(+), 49 deletions(-) rename {src => bak}/game-lib-d3-api-image-factory.js (100%) rename {src => bak}/game-lib-d3-api-look-at.js (100%) rename {src => bak}/game-lib-d3-api-path-following.js (100%) rename {src => bak}/game-lib-d3-look-at.js (100%) rename {src => bak}/game-lib-d3-path-following.js (100%) rename src/{game-lib-d3-api-image.js => game-lib-api-image.js} (86%) rename src/{game-lib-d3-image.js => game-lib-image.js} (67%) diff --git a/src/game-lib-d3-api-image-factory.js b/bak/game-lib-d3-api-image-factory.js similarity index 100% rename from src/game-lib-d3-api-image-factory.js rename to bak/game-lib-d3-api-image-factory.js diff --git a/src/game-lib-d3-api-look-at.js b/bak/game-lib-d3-api-look-at.js similarity index 100% rename from src/game-lib-d3-api-look-at.js rename to bak/game-lib-d3-api-look-at.js diff --git a/src/game-lib-d3-api-path-following.js b/bak/game-lib-d3-api-path-following.js similarity index 100% rename from src/game-lib-d3-api-path-following.js rename to bak/game-lib-d3-api-path-following.js diff --git a/src/game-lib-d3-look-at.js b/bak/game-lib-d3-look-at.js similarity index 100% rename from src/game-lib-d3-look-at.js rename to bak/game-lib-d3-look-at.js diff --git a/src/game-lib-d3-path-following.js b/bak/game-lib-d3-path-following.js similarity index 100% rename from src/game-lib-d3-path-following.js rename to bak/game-lib-d3-path-following.js diff --git a/src/game-lib-a-component-a.js b/src/game-lib-a-component-a.js index ab8728c..796dbd3 100644 --- a/src/game-lib-a-component-a.js +++ b/src/game-lib-a-component-a.js @@ -410,8 +410,8 @@ GameLib.Component.GetComponentInfo = function(number) { runtime : GameLib.Component.GUI_RUNTIME }; case 0x1f : return { - name : 'GameLib.D3.Image', - runtime : GameLib.Component.GRAPHICS_RUNTIME + name : 'GameLib.Image', + runtime : GameLib.Component.DEFAULT_RUNTIME }; case 0x20 : return { name : 'GameLib.Entity', diff --git a/src/game-lib-d3-api-image.js b/src/game-lib-api-image.js similarity index 86% rename from src/game-lib-d3-api-image.js rename to src/game-lib-api-image.js index abc311e..7cc2b28 100644 --- a/src/game-lib-d3-api-image.js +++ b/src/game-lib-api-image.js @@ -10,7 +10,7 @@ * @param parentEntity GameLib.Entity * @constructor */ -GameLib.D3.API.Image = function( +GameLib.API.Image = function( id, name, fileName, @@ -74,16 +74,16 @@ GameLib.D3.API.Image = function( this.parentEntity = parentEntity; }; -GameLib.D3.API.Image.prototype = Object.create(GameLib.Component.prototype); -GameLib.D3.API.Image.prototype.constructor = GameLib.D3.API.Image; +GameLib.API.Image.prototype = Object.create(GameLib.Component.prototype); +GameLib.API.Image.prototype.constructor = GameLib.API.Image; /** * Returns an API light from an Object light * @constructor * @param objectImage */ -GameLib.D3.API.Image.FromObject = function(objectImage) { - return new GameLib.D3.API.Image( +GameLib.API.Image.FromObject = function(objectImage) { + return new GameLib.API.Image( objectImage.id, objectImage.name, objectImage.fileName, diff --git a/src/game-lib-d3-api-scene.js b/src/game-lib-d3-api-scene.js index 0bf7656..6ef60e7 100644 --- a/src/game-lib-d3-api-scene.js +++ b/src/game-lib-d3-api-scene.js @@ -173,7 +173,7 @@ GameLib.D3.API.Scene.FromObject = function(objectScene) { apiImages = objectScene.images.map( function(objectImage) { if (objectImage instanceof Object) { - return GameLib.D3.API.Image.FromObject(objectImage) + return GameLib.API.Image.FromObject(objectImage) } else { return objectImage; } diff --git a/src/game-lib-d3-broadphase.js b/src/game-lib-d3-broadphase.js index 3b8f675..183cce2 100644 --- a/src/game-lib-d3-broadphase.js +++ b/src/game-lib-d3-broadphase.js @@ -37,6 +37,14 @@ GameLib.D3.Broadphase = function ( GameLib.D3.Broadphase.prototype = Object.create(GameLib.D3.API.Broadphase.prototype); GameLib.D3.Broadphase.prototype.constructor = GameLib.D3.Broadphase; +/** + * Broadphase Types + * @type {number} + */ +GameLib.D3.Broadphase.BROADPHASE_TYPE_NAIVE = 0x1; +GameLib.D3.Broadphase.BROADPHASE_TYPE_GRID = 0x2; +GameLib.D3.Broadphase.BROADPHASE_TYPE_SAP = 0x3; + /** * * @returns {*} @@ -112,12 +120,4 @@ GameLib.D3.Broadphase.FromObject = function(graphics, objectComponent) { graphics, apiBroadphase ); -}; - -/** - * Broadphase Types - * @type {number} - */ -GameLib.D3.Broadphase.BROADPHASE_TYPE_NAIVE = 0x1; -GameLib.D3.Broadphase.BROADPHASE_TYPE_GRID = 0x2; -GameLib.D3.Broadphase.BROADPHASE_TYPE_SAP = 0x3; \ No newline at end of file +}; \ No newline at end of file diff --git a/src/game-lib-d3-scene.js b/src/game-lib-d3-scene.js index cb6be64..ba88c63 100644 --- a/src/game-lib-d3-scene.js +++ b/src/game-lib-d3-scene.js @@ -114,9 +114,9 @@ GameLib.D3.Scene = function ( this.images = this.images.map( function(apiImage) { - if (apiImage instanceof GameLib.D3.API.Image) { + if (apiImage instanceof GameLib.API.Image) { - var image = new GameLib.D3.Image( + var image = new GameLib.Image( this.graphics, apiImage ); @@ -173,7 +173,7 @@ GameLib.D3.Scene = function ( 'lights' : [GameLib.D3.Light], 'textures' : [GameLib.D3.Texture], 'materials' : [GameLib.D3.Material], - 'images' : [GameLib.D3.Image], + 'images' : [GameLib.Image], 'fog' : GameLib.D3.Fog, 'renderCamera' : GameLib.D3.Camera } diff --git a/src/game-lib-d3-texture.js b/src/game-lib-d3-texture.js index 9ef8c4a..e550c13 100644 --- a/src/game-lib-d3-texture.js +++ b/src/game-lib-d3-texture.js @@ -63,8 +63,8 @@ GameLib.D3.Texture = function( this ); - if (this.image instanceof GameLib.D3.API.Image) { - this.image = new GameLib.D3.Image( + if (this.image instanceof GameLib.API.Image) { + this.image = new GameLib.Image( this.graphics, this.image ); @@ -72,8 +72,8 @@ GameLib.D3.Texture = function( this.images = this.images.map( function(image) { - if (image instanceof GameLib.D3.API.Image) { - return new GameLib.D3.Image( + if (image instanceof GameLib.API.Image) { + return new GameLib.Image( this.graphics, image ); @@ -94,8 +94,8 @@ GameLib.D3.Texture = function( this, GameLib.Component.COMPONENT_TEXTURE, { - 'image' : GameLib.D3.Image, - 'images' : [GameLib.D3.Image], + 'image' : GameLib.Image, + 'images' : [GameLib.Image], 'canvas' : GameLib.Canvas } ); diff --git a/src/game-lib-d3-image.js b/src/game-lib-image.js similarity index 67% rename from src/game-lib-d3-image.js rename to src/game-lib-image.js index 915ff46..7cbcb59 100644 --- a/src/game-lib-d3-image.js +++ b/src/game-lib-image.js @@ -4,22 +4,19 @@ * @param graphics * @param apiImage */ -GameLib.D3.Image = function( - graphics, +GameLib.Image = function( apiImage ) { - this.graphics = graphics; - this.graphics.isNotThreeThrow(); if (GameLib.Utils.UndefinedOrNull(apiImage)) { apiImage = {}; } - if (apiImage instanceof GameLib.D3.Image) { + if (apiImage instanceof GameLib.Image) { return apiImage; } - GameLib.D3.API.Image.call( + GameLib.API.Image.call( this, apiImage.id, apiImage.name, @@ -38,14 +35,14 @@ GameLib.D3.Image = function( }; -GameLib.D3.Image.prototype = Object.create(GameLib.D3.API.Image.prototype); -GameLib.D3.Image.prototype.constructor = GameLib.D3.Image; +GameLib.Image.prototype = Object.create(GameLib.API.Image.prototype); +GameLib.Image.prototype.constructor = GameLib.Image; /** * Creates an image instance * @returns {*} */ -GameLib.D3.Image.prototype.createInstance = function() { +GameLib.Image.prototype.createInstance = function() { GameLib.Event.Emit( GameLib.Event.LOAD_IMAGE, @@ -68,7 +65,7 @@ GameLib.D3.Image.prototype.createInstance = function() { /** * Updates the instance with the current state */ -GameLib.D3.Image.prototype.updateInstance = function(property) { +GameLib.Image.prototype.updateInstance = function(property) { if (GameLib.Utils.UndefinedOrNull(property)) { console.warn('unknown property update for Image: ' + property); @@ -85,11 +82,11 @@ GameLib.D3.Image.prototype.updateInstance = function(property) { /** * - * @returns {GameLib.D3.API.Image} + * @returns {GameLib.API.Image} */ -GameLib.D3.Image.prototype.toApiObject = function() { +GameLib.Image.prototype.toApiObject = function() { - var apiImage = new GameLib.D3.API.Image( + var apiImage = new GameLib.API.Image( this.id, this.name, this.fileName, @@ -104,14 +101,12 @@ GameLib.D3.Image.prototype.toApiObject = function() { }; /** - * @param graphics * @param objectImage - * @returns {GameLib.D3.Image} + * @returns {GameLib.Image} * @constructor */ -GameLib.D3.Image.FromObject = function(graphics, objectImage) { - return new GameLib.D3.Image( - graphics, - GameLib.D3.API.Image.FromObject(objectImage) +GameLib.Image.FromObject = function(objectImage) { + return new GameLib.Image( + GameLib.API.Image.FromObject(objectImage) ); }; diff --git a/src/game-lib-system-gui.js b/src/game-lib-system-gui.js index 9f29b9a..af4e123 100644 --- a/src/game-lib-system-gui.js +++ b/src/game-lib-system-gui.js @@ -811,8 +811,8 @@ GameLib.System.GUI.prototype.buildControl = function(folder, componentTemplate, property, { 'naive': GameLib.D3.Broadphase.BROADPHASE_TYPE_NAIVE, - 'grid': GameLib.D3.Image.BROADPHASE_TYPE_GRID, - 'sap': GameLib.D3.Image.BROADPHASE_TYPE_SAP + 'grid': GameLib.D3.Broadphase.BROADPHASE_TYPE_GRID, + 'sap': GameLib.D3.Broadphase.BROADPHASE_TYPE_SAP } ) ); diff --git a/src/game-lib-system-linking.js b/src/game-lib-system-linking.js index 041aba1..bedd31f 100644 --- a/src/game-lib-system-linking.js +++ b/src/game-lib-system-linking.js @@ -580,7 +580,7 @@ GameLib.System.Linking.prototype.instanceCreated = function(data) { this.resolveDependencies(data.component); - if (data.component instanceof GameLib.D3.Image) { + if (data.component instanceof GameLib.Image) { /** * Find all textures which use this image */ diff --git a/src/game-lib-system-storage.js b/src/game-lib-system-storage.js index c4422eb..cb0e599 100644 --- a/src/game-lib-system-storage.js +++ b/src/game-lib-system-storage.js @@ -710,7 +710,7 @@ GameLib.System.Storage.prototype.fetchComponents = function(data, clientCallback */ GameLib.System.Storage.prototype.imageUploadComplete = function(data) { - var runtimeImages = GameLib.EntityManager.Instance.queryComponents(GameLib.D3.Image); + var runtimeImages = GameLib.EntityManager.Instance.queryComponents(GameLib.Image); /** * Process all images - we have to load them in addition to creating their runtime components