Image namespace fix

beta.r3js.org
-=yb4f310 2017-12-02 12:11:14 +01:00
parent 5506d73e56
commit e9ac1c9c9e
15 changed files with 44 additions and 49 deletions

View File

@ -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',

View File

@ -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,

View File

@ -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;
}

View File

@ -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;
};

View File

@ -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
}

View File

@ -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
}
);

View File

@ -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)
);
};

View File

@ -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
}
)
);

View File

@ -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
*/

View File

@ -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