start to fix cube camera
parent
fbcc5a8086
commit
453ec6d498
|
@ -61,7 +61,7 @@ GameLib.Event.RENDER = 0x2b;
|
||||||
GameLib.Event.EVENT_LIST = 0x2c;
|
GameLib.Event.EVENT_LIST = 0x2c;
|
||||||
GameLib.Event.COMPILE_SUCCESS = 0x2d;
|
GameLib.Event.COMPILE_SUCCESS = 0x2d;
|
||||||
GameLib.Event.COMPILE_FAILED = 0x2e;
|
GameLib.Event.COMPILE_FAILED = 0x2e;
|
||||||
GameLib.Event.IMAGE_CHANGED = 0x2f;
|
GameLib.Event.TEXTURE_IMAGE_UPDATED = 0x2f;
|
||||||
//GameLib.Event.PARENT_ENTITY_CHANGED = 0x30;
|
//GameLib.Event.PARENT_ENTITY_CHANGED = 0x30;
|
||||||
GameLib.Event.MATERIAL_TEXTURES_UPDATED = 0x31;
|
GameLib.Event.MATERIAL_TEXTURES_UPDATED = 0x31;
|
||||||
GameLib.Event.DELETE_COMPONENT_ERROR = 0x32;
|
GameLib.Event.DELETE_COMPONENT_ERROR = 0x32;
|
||||||
|
@ -188,7 +188,7 @@ GameLib.Event.GetEventName = function(number) {
|
||||||
case 0x2c : return 'event_list';
|
case 0x2c : return 'event_list';
|
||||||
case 0x2d : return 'compile_success';
|
case 0x2d : return 'compile_success';
|
||||||
case 0x2e : return 'compile_failed';
|
case 0x2e : return 'compile_failed';
|
||||||
case 0x2f : return 'image_changed';
|
case 0x2f : return 'texture_image_updated';
|
||||||
case 0x30 : return 'unused';
|
case 0x30 : return 'unused';
|
||||||
case 0x31 : return 'material_textures_updated';
|
case 0x31 : return 'material_textures_updated';
|
||||||
case 0x32 : return 'delete_component_error';
|
case 0x32 : return 'delete_component_error';
|
||||||
|
|
|
@ -277,7 +277,7 @@ GameLib.Component.SHAPE_CONVEX_HULL = 0x2c;
|
||||||
GameLib.Component.SHAPE_CONVEX_HULL_CYLINDER = 0x2d;
|
GameLib.Component.SHAPE_CONVEX_HULL_CYLINDER = 0x2d;
|
||||||
GameLib.Component.SHAPE_HEIGHT_MAP = 0x2e;
|
GameLib.Component.SHAPE_HEIGHT_MAP = 0x2e;
|
||||||
GameLib.Component.SHAPE_PLANE = 0x2f;
|
GameLib.Component.SHAPE_PLANE = 0x2f;
|
||||||
//GameLib.Component.CONTROLS = 0x30;
|
GameLib.Component.CONTROLS = 0x30;
|
||||||
GameLib.Component.CONTROLS_EDITOR = 0x31;
|
GameLib.Component.CONTROLS_EDITOR = 0x31;
|
||||||
GameLib.Component.CONTROLS_TOUCH = 0x32;
|
GameLib.Component.CONTROLS_TOUCH = 0x32;
|
||||||
GameLib.Component.FRICTION_MATERIAL = 0x33;
|
GameLib.Component.FRICTION_MATERIAL = 0x33;
|
||||||
|
@ -332,7 +332,8 @@ GameLib.Component.PASS_BLOOM = 0x63;
|
||||||
GameLib.Component.PASS_FXAA = 0x64;
|
GameLib.Component.PASS_FXAA = 0x64;
|
||||||
GameLib.Component.RENDER_CONFIGURATION = 0x65;
|
GameLib.Component.RENDER_CONFIGURATION = 0x65;
|
||||||
GameLib.Component.MATERIAL_BASIC = 0x66;
|
GameLib.Component.MATERIAL_BASIC = 0x66;
|
||||||
GameLib.Component.MAX_COMPONENTS = 0x67;
|
GameLib.Component.TEXTURE = 0x67;
|
||||||
|
GameLib.Component.MAX_COMPONENTS = 0x68;
|
||||||
|
|
||||||
GameLib.Component.GRAPHICS_RUNTIME = 0x1;
|
GameLib.Component.GRAPHICS_RUNTIME = 0x1;
|
||||||
GameLib.Component.PHYSICS_RUNTIME = 0x2;
|
GameLib.Component.PHYSICS_RUNTIME = 0x2;
|
||||||
|
@ -635,12 +636,12 @@ GameLib.Component.GetComponentInfo = function(number) {
|
||||||
constructor : GameLib.D3.Shape.Plane,
|
constructor : GameLib.D3.Shape.Plane,
|
||||||
apiConstructor : GameLib.D3.API.Shape
|
apiConstructor : GameLib.D3.API.Shape
|
||||||
};
|
};
|
||||||
case 0x30 : return null;/*return {
|
case 0x30 : return {
|
||||||
name : 'GameLib.Controls',
|
name : 'GameLib.Controls',
|
||||||
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
runtime : GameLib.Component.DEFAULT_RUNTIME,
|
||||||
constructor : GameLib.Controls,
|
constructor : GameLib.Controls,
|
||||||
apiConstructor : GameLib.API.Controls
|
apiConstructor : GameLib.API.Controls
|
||||||
};*/
|
};
|
||||||
case 0x31 : return {
|
case 0x31 : return {
|
||||||
name : 'GameLib.Controls.D3.Editor',
|
name : 'GameLib.Controls.D3.Editor',
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
@ -965,6 +966,12 @@ GameLib.Component.GetComponentInfo = function(number) {
|
||||||
constructor : GameLib.D3.Material.Basic,
|
constructor : GameLib.D3.Material.Basic,
|
||||||
apiConstructor : GameLib.D3.API.Material.Basic
|
apiConstructor : GameLib.D3.API.Material.Basic
|
||||||
};
|
};
|
||||||
|
case 0x67 : return {
|
||||||
|
name : 'GameLib.D3.Texture',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Texture,
|
||||||
|
apiConstructor : GameLib.D3.API.Texture
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,16 +27,26 @@ GameLib.D3.API.RenderTarget = function (
|
||||||
}
|
}
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(name)) {
|
|
||||||
name = 'Render Target (' + id + ')';
|
|
||||||
}
|
|
||||||
this.name = name;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(renderTargetType)) {
|
if (GameLib.Utils.UndefinedOrNull(renderTargetType)) {
|
||||||
renderTargetType = GameLib.D3.API.RenderTarget.TARGET_TYPE_NORMAL;
|
renderTargetType = GameLib.D3.API.RenderTarget.TARGET_TYPE_NORMAL;
|
||||||
}
|
}
|
||||||
this.renderTargetType = renderTargetType;
|
this.renderTargetType = renderTargetType;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(name)) {
|
||||||
|
|
||||||
|
switch (this.renderTargetType) {
|
||||||
|
case GameLib.D3.API.RenderTarget.TARGET_TYPE_CUBE :
|
||||||
|
name = 'Render Target Cube';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log('just a normal render target');
|
||||||
|
name = 'Render Target';
|
||||||
|
}
|
||||||
|
|
||||||
|
name += ' (' + id + ')';
|
||||||
|
}
|
||||||
|
this.name = name;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(width)) {
|
if (GameLib.Utils.UndefinedOrNull(width)) {
|
||||||
width = 512;
|
width = 512;
|
||||||
}
|
}
|
||||||
|
@ -58,44 +68,34 @@ GameLib.D3.API.RenderTarget = function (
|
||||||
this.textureParameters = textureParameters;
|
this.textureParameters = textureParameters;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(texture)) {
|
if (GameLib.Utils.UndefinedOrNull(texture)) {
|
||||||
|
texture = null;
|
||||||
switch (this.renderTargetType) {
|
//
|
||||||
case GameLib.D3.API.RenderTarget.TARGET_TYPE_NORMAL :
|
// switch (this.renderTargetType) {
|
||||||
|
// case GameLib.D3.API.RenderTarget.TARGET_TYPE_NORMAL :
|
||||||
texture = new GameLib.D3.API.Texture(
|
//
|
||||||
null,
|
// texture = new GameLib.D3.API.Texture(
|
||||||
'Texture (Render Target ' + this.id + ')',
|
// null,
|
||||||
GameLib.D3.API.Texture.TEXTURE_TYPE_IMAGE
|
// 'Texture (Render Target ' + this.id + ')',
|
||||||
);
|
// GameLib.D3.API.Texture.TEXTURE_TYPE_IMAGE
|
||||||
break;
|
// );
|
||||||
|
// break;
|
||||||
case GameLib.D3.API.RenderTarget.TARGET_TYPE_CUBE :
|
//
|
||||||
|
// case GameLib.D3.API.RenderTarget.TARGET_TYPE_CUBE :
|
||||||
texture = new GameLib.D3.API.Texture(
|
//
|
||||||
null,
|
// texture = new GameLib.D3.API.Texture(
|
||||||
'Cube Texture (Render Target ' + this.id + ')',
|
// null,
|
||||||
GameLib.D3.API.Texture.TEXTURE_TYPE_CUBE
|
// 'Cube Texture (Render Target ' + this.id + ')',
|
||||||
);
|
// GameLib.D3.API.Texture.TEXTURE_TYPE_CUBE
|
||||||
break;
|
// );
|
||||||
|
// break;
|
||||||
default :
|
//
|
||||||
throw new Error('Unknown render target type: ' + this.renderTargetType);
|
// default :
|
||||||
}
|
// throw new Error('Unknown render target type: ' + this.renderTargetType);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
this.texture = texture;
|
this.texture = texture;
|
||||||
|
|
||||||
var componentType = null;
|
var componentType = GameLib.D3.API.RenderTarget.GetComponentType(this.renderTargetType);
|
||||||
|
|
||||||
switch (this.renderTargetType) {
|
|
||||||
case GameLib.D3.API.RenderTarget.TARGET_TYPE_NORMAL :
|
|
||||||
componentType = GameLib.Component.RENDER_TARGET;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.RenderTarget.TARGET_TYPE_CUBE :
|
|
||||||
componentType = GameLib.Component.RENDER_TARGET_CUBE;
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
throw new Error('Unknown render target type: ' + this.renderTargetType);
|
|
||||||
}
|
|
||||||
|
|
||||||
GameLib.API.Component.call(
|
GameLib.API.Component.call(
|
||||||
this,
|
this,
|
||||||
|
@ -105,6 +105,24 @@ GameLib.D3.API.RenderTarget = function (
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.RenderTarget.GetComponentType = function(renderTargetType) {
|
||||||
|
|
||||||
|
var componentType = null;
|
||||||
|
|
||||||
|
switch (renderTargetType) {
|
||||||
|
case GameLib.D3.API.RenderTarget.TARGET_TYPE_NORMAL :
|
||||||
|
componentType = GameLib.Component.RENDER_TARGET;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.RenderTarget.TARGET_TYPE_CUBE :
|
||||||
|
componentType = GameLib.Component.RENDER_TARGET_CUBE;
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
throw new Error('Unknown render target type: ' + renderTargetType);
|
||||||
|
}
|
||||||
|
|
||||||
|
return componentType;
|
||||||
|
};
|
||||||
|
|
||||||
GameLib.D3.API.RenderTarget.prototype = Object.create(GameLib.API.Component.prototype);
|
GameLib.D3.API.RenderTarget.prototype = Object.create(GameLib.API.Component.prototype);
|
||||||
GameLib.D3.API.RenderTarget.prototype.constructor = GameLib.D3.API.RenderTarget;
|
GameLib.D3.API.RenderTarget.prototype.constructor = GameLib.D3.API.RenderTarget;
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,16 @@ GameLib.D3.API.RenderTarget.Cube = function (
|
||||||
apiRenderTarget.renderTargetType = GameLib.D3.API.RenderTarget.TARGET_TYPE_CUBE;
|
apiRenderTarget.renderTargetType = GameLib.D3.API.RenderTarget.TARGET_TYPE_CUBE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiRenderTarget.textureParameters)) {
|
||||||
|
apiRenderTarget.textureParameters = {
|
||||||
|
minFilter : GameLib.D3.API.Texture.TYPE_LINEAR_MIPMAP_LINEAR_FILTER
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiRenderTarget.textureParameters.minFilter)) {
|
||||||
|
apiRenderTarget.textureParameters.minFilter = GameLib.D3.API.Texture.TYPE_LINEAR_MIPMAP_LINEAR_FILTER;
|
||||||
|
}
|
||||||
|
|
||||||
GameLib.D3.API.RenderTarget.call(
|
GameLib.D3.API.RenderTarget.call(
|
||||||
this,
|
this,
|
||||||
apiRenderTarget.id,
|
apiRenderTarget.id,
|
||||||
|
|
|
@ -27,8 +27,8 @@ GameLib.D3.Camera.Cube = function(
|
||||||
apiCubeCamera.renderTarget
|
apiCubeCamera.renderTarget
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.renderTarget instanceof GameLib.D3.API.RenderTarget) {
|
if (this.renderTarget instanceof GameLib.D3.API.RenderTarget.Cube) {
|
||||||
this.renderTarget = new GameLib.D3.RenderTarget(
|
this.renderTarget = new GameLib.D3.RenderTarget.Cube(
|
||||||
this.graphics,
|
this.graphics,
|
||||||
this.renderTarget
|
this.renderTarget
|
||||||
)
|
)
|
||||||
|
@ -57,16 +57,11 @@ GameLib.D3.Camera.Cube.prototype.createInstance = function() {
|
||||||
this.cubeResolution
|
this.cubeResolution
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
if (this.renderTarget && this.renderTarget.instance) {
|
|
||||||
this.instance.renderTarget = this.renderTarget.instance;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
this.renderTarget.instance = this.instance.renderTarget;
|
this.renderTarget.instance = this.instance.renderTarget;
|
||||||
|
|
||||||
this.renderTarget.instance.texture = this.instance.renderTarget.texture;
|
this.renderTarget.instance.texture = this.instance.renderTarget.texture;
|
||||||
|
//
|
||||||
this.renderTarget.texture.instance = this.instance.renderTarget.texture;
|
// this.renderTarget.texture.instance = this.instance.renderTarget.texture;
|
||||||
|
|
||||||
GameLib.D3.Camera.prototype.createInstance.call(this);
|
GameLib.D3.Camera.prototype.createInstance.call(this);
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,12 +30,12 @@ GameLib.D3.RenderTarget = function (
|
||||||
apiRenderTarget.texture
|
apiRenderTarget.texture
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.texture instanceof GameLib.D3.API.Texture) {
|
// if (this.texture instanceof GameLib.D3.API.Texture) {
|
||||||
this.texture = new GameLib.D3.Texture(
|
// this.texture = new GameLib.D3.Texture(
|
||||||
this.graphics,
|
// this.graphics,
|
||||||
this.texture
|
// this.texture
|
||||||
)
|
// )
|
||||||
}
|
// }
|
||||||
|
|
||||||
GameLib.Component.call(
|
GameLib.Component.call(
|
||||||
this,
|
this,
|
||||||
|
|
|
@ -39,12 +39,12 @@ GameLib.D3.RenderTarget.Cube.prototype.constructor = GameLib.D3.RenderTarget.Cub
|
||||||
*/
|
*/
|
||||||
GameLib.D3.RenderTarget.Cube.prototype.createInstance = function() {
|
GameLib.D3.RenderTarget.Cube.prototype.createInstance = function() {
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(this.texture)) {
|
if (
|
||||||
throw new Error('no texture');
|
GameLib.Utils.UndefinedOrNull(this.texture) ||
|
||||||
}
|
GameLib.Utils.UndefinedOrNull(this.texture.instance)
|
||||||
|
) {
|
||||||
if (GameLib.Utils.UndefinedOrNull(this.texture.instance)) {
|
console.warn('render target texture not ready');
|
||||||
throw new Error('no texture instance');
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.instance = new THREE.WebGLRenderTargetCube(
|
this.instance = new THREE.WebGLRenderTargetCube(
|
||||||
|
@ -53,16 +53,12 @@ GameLib.D3.RenderTarget.Cube.prototype.createInstance = function() {
|
||||||
this.textureParameters
|
this.textureParameters
|
||||||
);
|
);
|
||||||
|
|
||||||
this.instance.texture.minFilter = THREE.LinearMipMapLinearFilter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The instance texture is automatically generated - we assign it to our texture and update from instance
|
* The instance texture is automatically generated - we assign it to our texture and update from instance
|
||||||
*/
|
*/
|
||||||
//this.texture.instance = this.instance.texture;
|
|
||||||
//this.texture.updateFromInstance();
|
|
||||||
|
|
||||||
|
this.texture.instance = this.instance.texture;
|
||||||
//this.instance.texture = this.texture.instance;
|
this.texture.updateFromInstance();
|
||||||
|
|
||||||
GameLib.Component.prototype.createInstance.call(this);
|
GameLib.Component.prototype.createInstance.call(this);
|
||||||
};
|
};
|
||||||
|
@ -72,6 +68,15 @@ GameLib.D3.RenderTarget.Cube.prototype.createInstance = function() {
|
||||||
*/
|
*/
|
||||||
GameLib.D3.RenderTarget.Cube.prototype.updateInstance = function(property) {
|
GameLib.D3.RenderTarget.Cube.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (property === 'texture') {
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(this.instance)) {
|
||||||
|
this.createInstance();
|
||||||
|
} else {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
property === 'width' ||
|
property === 'width' ||
|
||||||
property === 'height'
|
property === 'height'
|
||||||
|
@ -83,9 +88,7 @@ GameLib.D3.RenderTarget.Cube.prototype.updateInstance = function(property) {
|
||||||
this.instance.stencilBuffer = this.stencilBuffer;
|
this.instance.stencilBuffer = this.stencilBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'texture') {
|
|
||||||
this.instance.texture = this.texture.instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
* created
|
* created
|
||||||
* @param apiTexture
|
* @param apiTexture
|
||||||
* @param graphics GameLib.GraphicsRuntime
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @property textureType
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Texture = function(
|
GameLib.D3.Texture = function(
|
||||||
|
@ -50,29 +51,23 @@ GameLib.D3.Texture = function(
|
||||||
apiTexture.forward
|
apiTexture.forward
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.offset instanceof GameLib.API.Vector2) {
|
this.offset = new GameLib.Vector2(
|
||||||
this.offset = new GameLib.Vector2(
|
this.graphics,
|
||||||
this.graphics,
|
this.offset,
|
||||||
this.offset,
|
this
|
||||||
this
|
);
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.repeat instanceof GameLib.API.Vector2) {
|
this.repeat = new GameLib.Vector2(
|
||||||
this.repeat = new GameLib.Vector2(
|
this.graphics,
|
||||||
this.graphics,
|
this.repeat,
|
||||||
this.repeat,
|
this
|
||||||
this
|
);
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.center instanceof GameLib.API.Vector2) {
|
this.center = new GameLib.Vector2(
|
||||||
this.center = new GameLib.Vector2(
|
this.graphics,
|
||||||
this.graphics,
|
this.center,
|
||||||
this.center,
|
this
|
||||||
this
|
);
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
var linkedObjects = {};
|
var linkedObjects = {};
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ GameLib.D3.Texture.Cube.prototype.updateInstance = function(property) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.publish(
|
this.publish(
|
||||||
GameLib.Event.IMAGE_CHANGED,
|
GameLib.Event.TEXTURE_IMAGE_UPDATED,
|
||||||
{
|
{
|
||||||
texture : this
|
texture : this
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,15 +68,18 @@ GameLib.D3.Texture.Image.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
if (property === 'image') {
|
if (property === 'image') {
|
||||||
|
|
||||||
|
if (this.image && this.image.instance) {
|
||||||
|
this.instance.image = this.image.instance;
|
||||||
|
this.instance.needsUpdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
this.publish(
|
this.publish(
|
||||||
GameLib.Event.IMAGE_CHANGED,
|
GameLib.Event.TEXTURE_IMAGE_UPDATED,
|
||||||
{
|
{
|
||||||
texture : this
|
texture : this
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
this.instance.needsUpdate = true;
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1610,7 +1610,8 @@ GameLib.System.GUI.prototype.buildControl = function(folder, componentTemplate,
|
||||||
) {
|
) {
|
||||||
controllers.push(folder.add(object, property, -Math.PI * 2, Math.PI * 2, 0.01));
|
controllers.push(folder.add(object, property, -Math.PI * 2, Math.PI * 2, 0.01));
|
||||||
} else if (
|
} else if (
|
||||||
property === 'port'
|
property === 'port' ||
|
||||||
|
property === 'far'
|
||||||
) {
|
) {
|
||||||
controllers.push(folder.add(object, property, 1, 65536, 1));
|
controllers.push(folder.add(object, property, 1, 65536, 1));
|
||||||
} else if (
|
} else if (
|
||||||
|
|
|
@ -49,11 +49,6 @@ GameLib.System.Linking = function(
|
||||||
*/
|
*/
|
||||||
this.removeMeshSubscription = null;
|
this.removeMeshSubscription = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* Images
|
|
||||||
*/
|
|
||||||
this.imageChangedSubscription = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Materials
|
* Materials
|
||||||
*/
|
*/
|
||||||
|
@ -135,14 +130,6 @@ GameLib.System.Linking.prototype.start = function() {
|
||||||
this.removeMesh
|
this.removeMesh
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Images
|
|
||||||
*/
|
|
||||||
this.imageChangedSubscription = this.subscribe(
|
|
||||||
GameLib.Event.IMAGE_CHANGED,
|
|
||||||
this.imageChanged
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Materials
|
* Materials
|
||||||
*/
|
*/
|
||||||
|
@ -559,24 +546,6 @@ GameLib.System.Linking.prototype.removeComponent = function(data) {
|
||||||
// }
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.System.Linking.prototype.imageChanged = function(data) {
|
|
||||||
|
|
||||||
var materials = GameLib.EntityManager.Instance.queryComponents(GameLib.Component.MATERIAL);
|
|
||||||
|
|
||||||
materials.map(function(material){
|
|
||||||
|
|
||||||
var textures = material.getTextures();
|
|
||||||
|
|
||||||
if (textures.indexOf(data.texture) !== -1) {
|
|
||||||
if (material.loaded) {
|
|
||||||
material.updateInstance('diffuseMap');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.System.Linking.prototype.arrayItemAdded = function(data) {
|
GameLib.System.Linking.prototype.arrayItemAdded = function(data) {
|
||||||
if (
|
if (
|
||||||
data.component instanceof GameLib.D3.PhysicsWorld &&
|
data.component instanceof GameLib.D3.PhysicsWorld &&
|
||||||
|
@ -930,11 +899,6 @@ GameLib.System.Linking.prototype.stop = function() {
|
||||||
*/
|
*/
|
||||||
this.removeMeshSubscription.remove();
|
this.removeMeshSubscription.remove();
|
||||||
|
|
||||||
/**
|
|
||||||
* Images
|
|
||||||
*/
|
|
||||||
this.imageChangedSubscription.remove();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Materials
|
* Materials
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -26,6 +26,11 @@ GameLib.System.Render = function(
|
||||||
|
|
||||||
this.activeRenderConfiguration = null;
|
this.activeRenderConfiguration = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Images
|
||||||
|
*/
|
||||||
|
this.imageChangedSubscription = null;
|
||||||
|
|
||||||
this.renderConfigurations = [];
|
this.renderConfigurations = [];
|
||||||
|
|
||||||
this.renderers = [];
|
this.renderers = [];
|
||||||
|
@ -82,12 +87,17 @@ GameLib.System.Render.prototype.start = function() {
|
||||||
this.windowResize
|
this.windowResize
|
||||||
);
|
);
|
||||||
|
|
||||||
this.getRenderConfigurationSubscription = this.subscribe(
|
this.imageChangedSubscription = this.subscribe(
|
||||||
|
GameLib.Event.TEXTURE_IMAGE_UPDATED,
|
||||||
|
this.imageChanged
|
||||||
|
);
|
||||||
|
|
||||||
|
this.getRenderConfigurationSubscription = this.subscribe(
|
||||||
GameLib.Event.GET_RENDER_CONFIGURATION,
|
GameLib.Event.GET_RENDER_CONFIGURATION,
|
||||||
this.getRenderConfiguration
|
this.getRenderConfiguration
|
||||||
);
|
);
|
||||||
|
|
||||||
this.setACtiveRenderConfigurationSubscription = this.subscribe(
|
this.setActiveRenderConfigurationSubscription = this.subscribe(
|
||||||
GameLib.Event.SET_ACTIVE_RENDER_CONFIGURATION,
|
GameLib.Event.SET_ACTIVE_RENDER_CONFIGURATION,
|
||||||
this.setActiveRenderConfiguration
|
this.setActiveRenderConfiguration
|
||||||
);
|
);
|
||||||
|
@ -221,6 +231,30 @@ GameLib.System.Render.prototype.windowResize = function(data) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GameLib.System.Render.prototype.imageChanged = function(data) {
|
||||||
|
|
||||||
|
// var textures = GameLib.EntityManager.Instance.queryComponentsByConstructor(GameLib.D3.Texture).map(
|
||||||
|
// function(texture) {
|
||||||
|
// if (texture.image ===)
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
|
var materials = GameLib.EntityManager.Instance.queryComponentsByConstructor(GameLib.D3.Material);
|
||||||
|
|
||||||
|
materials.map(function(material){
|
||||||
|
|
||||||
|
var textures = material.getTextures();
|
||||||
|
|
||||||
|
if (textures.indexOf(data.texture) !== -1) {
|
||||||
|
if (material.loaded) {
|
||||||
|
material.updateInstance('diffuseMap');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* From now on we want to track everything about a component, only from the systems that are active
|
* From now on we want to track everything about a component, only from the systems that are active
|
||||||
* @param data
|
* @param data
|
||||||
|
@ -593,7 +627,12 @@ GameLib.System.Render.prototype.stop = function() {
|
||||||
|
|
||||||
this.getRenderConfigurationSubscription.remove();
|
this.getRenderConfigurationSubscription.remove();
|
||||||
|
|
||||||
this.setACtiveRenderConfigurationSubscription.remove();
|
this.setActiveRenderConfigurationSubscription.remove();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Images
|
||||||
|
*/
|
||||||
|
this.imageChangedSubscription.remove();
|
||||||
|
|
||||||
// this.delayedInstanceEncounteredSubscription.remove();
|
// this.delayedInstanceEncounteredSubscription.remove();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue