re-introduce basic material

beta.r3js.org
-=yb4f310 2018-02-06 12:29:40 +01:00
parent 584b5e2a7b
commit 82e33bc84b
12 changed files with 606 additions and 27 deletions

View File

@ -128,6 +128,7 @@ GameLib.Event.MESH_FACE_SELECTED = 0x6e;
GameLib.Event.MESH_FACE_DESELECTED = 0x6f;
GameLib.Event.BEFORE_WINDOW_RESIZE = 0x70;
GameLib.Event.GET_WINDOW_SIZE = 0x71;
GameLib.Event.GET_RENDER_CONFIGURATION = 0x72;
/**
* Returns string name of event ID
@ -250,6 +251,8 @@ GameLib.Event.GetEventName = function(number) {
case 0x6e : return 'mesh_face_selected';
case 0x6f : return 'mesh_face_deselected';
case 0x70 : return 'before_window_resize';
case 0x71 : return 'get_window_size';
case 0x72 : return 'get_render_configuration';
break;
}

View File

@ -28,6 +28,8 @@ GameLib.Component = function(
this.isClone = false;
this.generateNewImageIds = false;
if (GameLib.Utils.UndefinedOrNull(delayed)) {
delayed = false;
}
@ -305,7 +307,8 @@ GameLib.Component.PASS_SSAO = 0x62;
GameLib.Component.PASS_BLOOM = 0x63;
GameLib.Component.PASS_FXAA = 0x64;
GameLib.Component.RENDER_CONFIGURATION = 0x65;
GameLib.Component.MAX_COMPONENTS = 0x66;
GameLib.Component.MATERIAL_BASIC = 0x66;
GameLib.Component.MAX_COMPONENTS = 0x67;
GameLib.Component.GRAPHICS_RUNTIME = 0x1;
GameLib.Component.PHYSICS_RUNTIME = 0x2;
@ -932,6 +935,12 @@ GameLib.Component.GetComponentInfo = function(number) {
constructor : GameLib.RenderConfiguration,
apiConstructor : GameLib.API.RenderConfiguration
};
case 0x66 : return {
name : 'GameLib.D3.Material.Basic',
runtime : GameLib.Component.GRAPHICS_RUNTIME,
constructor : GameLib.D3.Material.Basic,
apiConstructor : GameLib.D3.API.Material.Basic
};
break;
}
@ -1158,10 +1167,13 @@ GameLib.Component.prototype.generateNewIds = function() {
this.idToObject[property].id = newId;
this.idToObject[property].name = this.idToObject[property].name.replace(oldId,newId);
// TODO: replace image filenames - but then also copy them server side?
// if (this.idToObject[property].fileName) {
// this.idToObject[property].fileName = this.idToObject[property].fileName.replace(oldId,newId);
// }
if (this.generateNewImageIds) {
// TODO: replace image filenames - but then also copy them server side?
if (this.idToObject[property].fileName) {
this.idToObject[property].fileName = this.idToObject[property].fileName.replace(oldId,newId);
}
}
codeComponents.map(function(codeComponent){
codeComponent.code = codeComponent.code.replace(oldId,newId);

View File

@ -197,7 +197,12 @@ GameLib.D3.API.Material = function(
this.fog = fog;
if (GameLib.Utils.UndefinedOrNull(lights)) {
lights = true;
if (this.materialType === GameLib.D3.API.Material.MATERIAL_TYPE_BASIC) {
lights = false;
} else {
lights = true;
}
}
this.lights = lights;
@ -272,6 +277,9 @@ GameLib.D3.API.Material = function(
case GameLib.D3.API.Material.MATERIAL_TYPE_STANDARD :
componentType = GameLib.Component.MATERIAL_STANDARD;
break;
case GameLib.D3.API.Material.MATERIAL_TYPE_BASIC :
componentType = GameLib.Component.MATERIAL_BASIC;
break;
default :
throw new Error('unhandled material type: ' + this.materialType);
}
@ -293,9 +301,9 @@ GameLib.D3.API.Material.prototype.constructor = GameLib.D3.API.Material;
* Combine Method
* @type {number}
*/
GameLib.D3.API.Material.TYPE_MULTIPLY_OPERATION = 0;
GameLib.D3.API.Material.TYPE_MIX_OPERATION = 1;
GameLib.D3.API.Material.TYPE_ADD_OPERATION = 2;
GameLib.D3.API.Material.COMBINE_MULTIPLY_OPERATION = 0;
GameLib.D3.API.Material.COMBINE_MIX_OPERATION = 1;
GameLib.D3.API.Material.COMBINE_ADD_OPERATION = 2;
/**
* Vertex Color Mode
@ -388,10 +396,18 @@ GameLib.D3.API.Material.MATERIAL_TYPE_SPRITE = 0xa;
GameLib.D3.API.Material.MATERIAL_TYPE_TOON = 0xb;
GameLib.D3.API.Material.MATERIAL_TYPE_SHADER = 0xc;
/**
* Line Cap
* @type {number}
*/
GameLib.D3.API.Material.LINE_CAP_BUTT = 0x1;//'butt';
GameLib.D3.API.Material.LINE_CAP_ROUND = 0x2;//'round';
GameLib.D3.API.Material.LINE_CAP_SQUARE = 0x3;//'square';
/**
* Line Join
* @type {number}
*/
GameLib.D3.API.Material.LINE_JOIN_ROUND = 0x1;//'round';
GameLib.D3.API.Material.LINE_JOIN_BEVEL = 0x2;//'bevel';
GameLib.D3.API.Material.LINE_JOIN_MITER = 0x3;//'miter';
GameLib.D3.API.Material.LINE_JOIN_MITER = 0x3;//'miter';

View File

@ -0,0 +1,190 @@
/**
* GameLib.D3.API.Material.Basic
* @param apiMaterial
* @param alphaMap
* @param aoMap
* @param aoMapIntensity
* @param color
* @param combine
* @param envMap
* @param lightMap
* @param lightMapIntensity
* @param diffuseMap
* @param morphTargets
* @param reflectivity
* @param refractionRatio
* @param skinning
* @param specularMap
* @param wireframe
* @param wireframeLinecap
* @param wireframeLinejoin
* @param wireframeLinewidth
* @constructor
*/
GameLib.D3.API.Material.Basic = function(
apiMaterial,
alphaMap,
aoMap,
aoMapIntensity,
color,
combine,
envMap,
lightMap,
lightMapIntensity,
diffuseMap,
morphTargets,
reflectivity,
refractionRatio,
skinning,
specularMap,
wireframe,
wireframeLinecap,
wireframeLinejoin,
wireframeLinewidth
) {
if (GameLib.Utils.UndefinedOrNull(apiMaterial)) {
apiMaterial = {
materialType: GameLib.D3.API.Material.MATERIAL_TYPE_BASIC
};
}
if (GameLib.Utils.UndefinedOrNull(apiMaterial.materialType)) {
apiMaterial.materialType = GameLib.D3.API.Material.MATERIAL_TYPE_BASIC;
}
if (GameLib.Utils.UndefinedOrNull(alphaMap)) {
alphaMap = null;
}
this.alphaMap = alphaMap;
if (GameLib.Utils.UndefinedOrNull(aoMap)) {
aoMap = null;
}
this.aoMap = aoMap;
if (GameLib.Utils.UndefinedOrNull(aoMapIntensity)) {
aoMapIntensity = 1;
}
this.aoMapIntensity = aoMapIntensity;
if (GameLib.Utils.UndefinedOrNull(color)) {
color = new GameLib.API.Color(1, 1, 1, 1)
}
this.color = color;
if (GameLib.Utils.UndefinedOrNull(combine)) {
combine = GameLib.D3.API.Material.COMBINE_MULTIPLY_OPERATION;
}
this.combine = combine;
if (GameLib.Utils.UndefinedOrNull(envMap)) {
envMap = null;
}
this.envMap = envMap;
if (GameLib.Utils.UndefinedOrNull(lightMap)) {
lightMap = null;
}
this.lightMap = lightMap;
if (GameLib.Utils.UndefinedOrNull(lightMapIntensity)) {
lightMapIntensity = 1;
}
this.lightMapIntensity = lightMapIntensity;
if (GameLib.Utils.UndefinedOrNull(diffuseMap)) {
diffuseMap = null;
}
this.diffuseMap = diffuseMap;
if (GameLib.Utils.UndefinedOrNull(morphTargets)) {
morphTargets = false;
}
this.morphTargets = morphTargets;
if (GameLib.Utils.UndefinedOrNull(reflectivity)) {
reflectivity = 1;
}
this.reflectivity = reflectivity;
if (GameLib.Utils.UndefinedOrNull(refractionRatio)) {
refractionRatio = 0.98;
}
this.refractionRatio = refractionRatio;
if (GameLib.Utils.UndefinedOrNull(skinning)) {
skinning = false;
}
this.skinning = skinning;
if (GameLib.Utils.UndefinedOrNull(specularMap)) {
specularMap = null;
}
this.specularMap = specularMap;
if (GameLib.Utils.UndefinedOrNull(wireframe)) {
wireframe = false;
}
this.wireframe = wireframe;
if (GameLib.Utils.UndefinedOrNull(wireframeLinecap)) {
wireframeLinecap = 'round';
}
this.wireframeLinecap = wireframeLinecap;
if (GameLib.Utils.UndefinedOrNull(wireframeLinejoin)) {
wireframeLinejoin = 'round';
}
this.wireframeLinejoin = wireframeLinejoin;
if (GameLib.Utils.UndefinedOrNull(wireframeLinewidth)) {
wireframeLinewidth = 1;
}
this.wireframeLinewidth = wireframeLinewidth;
GameLib.D3.API.Material.call(
this,
apiMaterial.id,
apiMaterial.name,
apiMaterial.materialType,
apiMaterial.parentEntity,
apiMaterial.parentMeshes,
apiMaterial.alphaTest,
apiMaterial.blendDst,
apiMaterial.blendDstAlpha,
apiMaterial.blendEquation,
apiMaterial.blendEquationAlpha,
apiMaterial.blending,
apiMaterial.blendSrc,
apiMaterial.blendSrcAlpha,
apiMaterial.clipIntersection,
apiMaterial.clippingPlanes,
apiMaterial.clipShadows,
apiMaterial.colorWrite,
apiMaterial.customDepthMaterial,
apiMaterial.customDistanceMaterial,
apiMaterial.defines,
apiMaterial.depthFunc,
apiMaterial.depthTest,
apiMaterial.depthWrite,
apiMaterial.fog,
apiMaterial.lights,
apiMaterial.opacity,
apiMaterial.overdraw,
apiMaterial.polygonOffset,
apiMaterial.polygonOffsetFactor,
apiMaterial.polygonOffsetUnits,
apiMaterial.precision,
apiMaterial.premultipliedAlpha,
apiMaterial.dithering,
apiMaterial.flatShading,
apiMaterial.side,
apiMaterial.transparent,
apiMaterial.vertexColors,
apiMaterial.visible
);
};
GameLib.D3.API.Material.Basic.prototype = Object.create(GameLib.D3.API.Material.prototype);
GameLib.D3.API.Material.Basic.prototype.constructor = GameLib.D3.API.Material.Basic;

View File

@ -105,7 +105,7 @@ GameLib.D3.API.Mesh = function(
if (GameLib.Utils.UndefinedOrNull(materials) || (materials instanceof Array && materials.length === 0)) {
materials = [
new GameLib.D3.API.Material.Standard({
new GameLib.D3.API.Material.Basic({
name : 'Material ' + this.id
})
];

View File

@ -3,12 +3,20 @@
* @param apiPass
* @param camera
* @param scene
* @param radius
* @param onlyAO
* @param aoClamp
* @param lumInfluence
* @constructor
*/
GameLib.D3.API.Pass.SSAO = function (
apiPass,
scene,
camera
camera,
radius,
onlyAO,
aoClamp,
lumInfluence
) {
if (GameLib.Utils.UndefinedOrNull(apiPass)) {
apiPass = {
@ -30,6 +38,26 @@ GameLib.D3.API.Pass.SSAO = function (
}
this.camera = camera;
if (GameLib.Utils.UndefinedOrNull(radius)) {
radius = 4;
}
this.radius = radius;
if (GameLib.Utils.UndefinedOrNull(onlyAO)) {
onlyAO = false;
}
this.onlyAO = onlyAO;
if (GameLib.Utils.UndefinedOrNull(aoClamp)) {
aoClamp = 0.25;
}
this.aoClamp = aoClamp;
if (GameLib.Utils.UndefinedOrNull(lumInfluence)) {
lumInfluence = 0.7;
}
this.lumInfluence = lumInfluence;
GameLib.D3.API.Pass.call(
this,
apiPass.id,

View File

@ -79,6 +79,14 @@ GameLib.D3.Material = function(
linkedObjects.normalMap = GameLib.D3.Texture;
linkedObjects.roughnessMap = GameLib.D3.Texture;
break;
case GameLib.D3.API.Material.MATERIAL_TYPE_BASIC :
linkedObjects.alphaMap = GameLib.D3.Texture;
linkedObjects.aoMap = GameLib.D3.Texture;
linkedObjects.diffuseMap = GameLib.D3.Texture;
linkedObjects.envMap = GameLib.D3.Texture;
linkedObjects.lightMap = GameLib.D3.Texture;
linkedObjects.specularMap = GameLib.D3.Texture;
break;
default :
throw new Error('unhandled material type: ' + this.materialType);

View File

@ -0,0 +1,262 @@
/**
* GameLib.D3.Material.Basic
* @param graphics
* @param apiMaterialBasic
* @constructor
*/
GameLib.D3.Material.Basic = function(
graphics,
apiMaterialBasic
) {
this.graphics = graphics;
this.graphics.isNotThreeThrow();
if (GameLib.Utils.UndefinedOrNull(apiMaterialBasic)) {
apiMaterialBasic = {
materialType : GameLib.D3.API.Material.MATERIAL_TYPE_BASIC
};
}
GameLib.D3.API.Material.Basic.call(
this,
apiMaterialBasic,
apiMaterialBasic.alphaMap,
apiMaterialBasic.aoMap,
apiMaterialBasic.aoMapIntensity,
apiMaterialBasic.color,
apiMaterialBasic.combine,
apiMaterialBasic.envMap,
apiMaterialBasic.lightMap,
apiMaterialBasic.lightMapIntensity,
apiMaterialBasic.diffuseMap,
apiMaterialBasic.morphTargets,
apiMaterialBasic.reflectivity,
apiMaterialBasic.refractionRatio,
apiMaterialBasic.skinning,
apiMaterialBasic.specularMap,
apiMaterialBasic.wireframe,
apiMaterialBasic.wireframeLinecap,
apiMaterialBasic.wireframeLinejoin,
apiMaterialBasic.wireframeLinewidth
);
if (this.alphaMap instanceof GameLib.D3.API.Texture) {
this.alphaMap = new GameLib.D3.Texture(
this.graphics,
this.alphaMap
);
}
if (this.aoMap instanceof GameLib.D3.API.Texture) {
this.aoMap = new GameLib.D3.Texture(
this.graphics,
this.aoMap
);
}
this.color = new GameLib.Color(
this.graphics,
this.color,
this
);
if (this.envMap instanceof GameLib.D3.API.Texture) {
this.envMap = new GameLib.D3.Texture(
this.graphics,
this.envMap
);
}
if (this.lightMap instanceof GameLib.D3.API.Texture) {
this.lightMap = new GameLib.D3.Texture(
this.graphics,
this.lightMap
);
}
if (this.diffuseMap instanceof GameLib.D3.API.Texture) {
this.diffuseMap = new GameLib.D3.Texture(
this.graphics,
this.diffuseMap
);
}
if (this.specularMap instanceof GameLib.D3.API.Texture) {
this.specularMap = new GameLib.D3.Texture(
this.graphics,
this.specularMap
);
}
GameLib.D3.Material.call(
this,
this.graphics,
this
);
};
GameLib.D3.Material.Basic.prototype = Object.create(GameLib.D3.Material.prototype);
GameLib.D3.Material.Basic.prototype.constructor = GameLib.D3.Material.Basic;
/**
* Creates an instance of our texture object
* @returns {*}
*/
GameLib.D3.Material.Basic.prototype.createInstance = function() {
this.instance = new THREE.MeshBasicMaterial(
{
alphaMap : this.alphaMap ? this.alphaMap.instance : null,
aoMap : this.aoMap ? this.aoMap.instance : null,
aoMapIntensity : this.aoMapIntensity,
color : this.color.instance,
envMap : this.envMap ? this.envMap.instance : null,
lightMap : this.lightMap ? this.lightMap.instance : null,
lightMapIntensity : this.lightMapIntensity,
map : this.diffuseMap ? this.diffuseMap.instance : null,
morphTargets : this.morphTargets,
reflectivity : this.reflectivity,
refractionRatio : this.refractionRatio,
skinning : this.skinning,
specularMap : this.specularMap ? this.specularMap.instance : null,
wireframe : this.wireframe,
wireframeLinecap : this.wireframeLinecap,
wireframeLinejoin : this.wireframeLinejoin,
wireframeLinewidth : this.wireframeLinewidth
}
);
GameLib.D3.Material.prototype.createInstance.call(this);
};
/**
* Updates the instance with the current state
*/
GameLib.D3.Material.Basic.prototype.updateInstance = function(property) {
if (property === 'alphaMap') {
this.assignTexture('alphaMap', property);
return;
}
if (property === 'aoMap') {
this.assignTexture('aoMap', property);
return;
}
if (property === 'aoMapIntensity') {
this.instance.aoMapIntensity = this.aoMapIntensity;
return;
}
if (property === 'color') {
this.instance.color = this.color.instance;
return;
}
if (property === 'combine') {
this.instance.combine = this.combine;
return;
}
if (property === 'envMap') {
this.assignTexture('envMap', property);
return;
}
if (property === 'lightMap') {
this.assignTexture('lightMap', property);
return;
}
if (property === 'lightMapIntensity') {
this.instance.lightMapIntensity = this.lightMapIntensity;
return;
}
if (property === 'diffuseMap') {
this.assignTexture('map', property);
return;
}
if (property === 'morphTargets') {
this.instance.morphTargets = this.morphTargets;
return;
}
if (property === 'reflectivity') {
this.instance.reflectivity = this.reflectivity;
return;
}
if (property === 'refractionRatio') {
this.instance.refractionRatio = this.refractionRatio;
return;
}
if (property === 'skinning') {
this.instance.skinning = this.skinning;
return;
}
if (property === 'specularMap') {
this.assignTexture('specularMap', property);
return;
}
if (property === 'wireframe') {
this.instance.wireframe = this.wireframe;
return;
}
if (property === 'wireframeLinecap') {
this.instance.wireframeLinecap = this.wireframeLinecap;
return;
}
if (property === 'wireframeLinejoin') {
this.instance.wireframeLinejoin = this.wireframeLinejoin;
return;
}
if (property === 'wireframeLinewidth') {
this.instance.wireframeLinewidth = this.wireframeLinewidth;
return;
}
GameLib.D3.Material.prototype.updateInstance.call(this, property);
};
/**
* Converts a GameLib.D3.Material.Basic to a GameLib.D3.API.Material.Basic
* @returns {GameLib.D3.API.Material.Basic}
*/
GameLib.D3.Material.Basic.prototype.toApiObject = function() {
var apiMaterial = GameLib.D3.Material.prototype.toApiObject.call(this);
var apiMaterialBasic = new GameLib.D3.API.Material.Basic(
apiMaterial,
GameLib.Utils.IdOrNull(this.alphaMap),
GameLib.Utils.IdOrNull(this.aoMap),
this.aoMapIntensity,
this.color.toApiObject(),
this.combine,
GameLib.Utils.IdOrNull(this.envMap),
GameLib.Utils.IdOrNull(this.envMap),
this.lightMapIntensity,
GameLib.Utils.IdOrNull(this.diffuseMap),
this.morphTargets,
this.reflectivity,
this.refractionRatio,
this.skinning,
GameLib.Utils.IdOrNull(this.specularMap),
this.wireframe,
this.wireframeLinecap,
this.wireframeLinejoin,
this.wireframeLinewidth
);
return apiMaterialBasic;
};

View File

@ -22,7 +22,11 @@ GameLib.D3.Pass.SSAO = function (
this,
apiPassSSAO,
apiPassSSAO.scene,
apiPassSSAO.camera
apiPassSSAO.camera,
apiPassSSAO.radius,
apiPassSSAO.onlyAO,
apiPassSSAO.aoClamp,
apiPassSSAO.lumInfluence
);
if (this.scene instanceof GameLib.D3.API.Scene) {
@ -74,6 +78,14 @@ GameLib.D3.Pass.SSAO.prototype.createInstance = function() {
this.camera.instance
);
this.instance.radius = this.radius;
this.instance.onlyAO = this.onlyAO;
this.instance.aoClamp = this.aoClamp;
this.instance.lumInfluence = this.lumInfluence;
console.log('Constructed an SSAO pass instance');
GameLib.D3.Pass.prototype.createInstance.call(this);
@ -98,6 +110,30 @@ GameLib.D3.Pass.SSAO.prototype.updateInstance = function(property) {
return;
}
if (!this.instance) {
return;
}
if (property === 'radius') {
this.instance.radius = this.radius;
return;
}
if (property === 'onlyAO') {
this.instance.onlyAO = this.onlyAO;
return;
}
if (property === 'aoClamp') {
this.instance.aoClamp = this.aoClamp;
return;
}
if (property === 'lumInfluence') {
this.instance.lumInfluence = this.lumInfluence;
return;
}
GameLib.D3.Pass.prototype.updateInstance.call(this, property);
};
@ -113,7 +149,11 @@ GameLib.D3.Pass.SSAO.prototype.toApiObject = function() {
var apiSSAOPass = new GameLib.D3.API.Pass.SSAO(
apiPass,
GameLib.Utils.IdOrNull(this.scene),
GameLib.Utils.IdOrNull(this.camera)
GameLib.Utils.IdOrNull(this.camera),
this.radius,
this.onlyAO,
this.aoClamp,
this.lumInfluence
);
return apiSSAOPass;

View File

@ -1177,9 +1177,9 @@ GameLib.System.GUI.prototype.buildControl = function(folder, componentTemplate,
object,
property,
{
'multiply': GameLib.D3.API.Material.TYPE_MULTIPLY_OPERATION,
'mix': GameLib.D3.API.Material.TYPE_MIX_OPERATION,
'add': GameLib.D3.API.Material.TYPE_ADD_OPERATION
'multiply': GameLib.D3.API.Material.COMBINE_MULTIPLY_OPERATION,
'mix': GameLib.D3.API.Material.COMBINE_MIX_OPERATION,
'add': GameLib.D3.API.Material.COMBINE_ADD_OPERATION
}
)
);
@ -1498,6 +1498,8 @@ GameLib.System.GUI.prototype.buildControl = function(folder, componentTemplate,
property === 'fadeOutFactor' ||
property === 'metalness' ||
property === 'roughness' ||
property === 'aoClamp' ||
property === 'lumInfluence' ||
property === 'volume'
) {
controllers.push(folder.add(object, property, 0, 1.0, 0.001));
@ -1517,6 +1519,9 @@ GameLib.System.GUI.prototype.buildControl = function(folder, componentTemplate,
property === 'normalScale' ||
property === 'displacementScale' ||
property === 'heightMapScale' ||
property === 'lightMapIntensity' ||
property === 'aoMapIntensity' ||
property === 'envMapIntensity' ||
property === 'intensity'
) {
controllers.push(folder.add(object, property, -10, 10, 0.001));

View File

@ -977,18 +977,22 @@ GameLib.System.Input.prototype.onMouseDownEdit = function(event) {
this.mouse.x = (event.offsetX / event.target.width ) * 2 - 1;
this.mouse.y = -(event.offsetY / event.target.height) * 2 + 1;
var renderers = GameLib.EntityManager.Instance.queryComponents(GameLib.Component.RENDERER);
GameLib.Event.Emit(
GameLib.Event.GET_RENDER_CONFIGURATION,
null,
function(configuration) {
renderers.map(
function(renderer) {
var scenes = configuration.activeScenes;
var intersects = renderer.scenes.reduce(
var camera = configuration.activeCamera;
var intersects = scenes.reduce(
function (result, scene) {
editorControl.raycaster.setFromCamera(
this.mouse,
renderer.editCamera
camera
);
intersects = editorControl.raycaster.getIntersectedObjects(scene.meshes);
@ -1025,7 +1029,6 @@ GameLib.System.Input.prototype.onMouseDownEdit = function(event) {
var mesh = intersects[0].mesh;
var face = intersects[0].face;
var faceIndex = intersects[0].faceIndex;
/**
* Prevent default action (like context menu or whatever)
@ -1060,13 +1063,9 @@ GameLib.System.Input.prototype.onMouseDownEdit = function(event) {
GameLib.Event.BUILD_GUI,
null
)
}.bind(this)
);
}.bind(this)
);
}

View File

@ -73,6 +73,11 @@ GameLib.System.Render.prototype.start = function() {
this.windowResize
);
this.getRenderConfigurationSubscription = this.subscribe(
GameLib.Event.GET_RENDER_CONFIGURATION,
this.getRenderConfiguration
);
// this.delayedInstanceEncounteredSubscription = GameLib.Event.Subscribe(
// GameLib.Event.DELAYED_INSTANCE_ENCOUNTERED,
// this.delayedInstanceEncountered.bind(this)
@ -132,6 +137,15 @@ GameLib.System.Render.prototype.run = function() {
// );
// };
GameLib.System.Render.prototype.getRenderConfiguration = function (data, callback) {
if (this.renderConfigurations.length > 0) {
callback(this.renderConfigurations[0]);
} else {
callback(null);
}
};
GameLib.System.Render.prototype.getOffset = function (el) {
var rect = el.getBoundingClientRect(),
scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
@ -486,6 +500,8 @@ GameLib.System.Render.prototype.stop = function() {
this.renderSubscription.remove();
this.getRenderConfigurationSubscription.remove();
// this.delayedInstanceEncounteredSubscription.remove();
// window.removeEventListener(