elation-engine 0.9.126 → 0.9.127

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "elation-engine",
3
3
  "description": "WebGL/WebVR engine written in Javascript",
4
- "version": "0.9.126",
4
+ "version": "0.9.127",
5
5
  "main": "",
6
6
  "author": "James Baicoianu",
7
7
  "license": "MIT",
package/scripts/assets.js CHANGED
@@ -2204,13 +2204,14 @@ console.log('set up hls', hlsConfig);
2204
2204
  fragment_src: false,
2205
2205
  vertex_src: false,
2206
2206
  hasalpha: false,
2207
- uniforms: {},
2207
+ uniforms: [],
2208
2208
 
2209
2209
  _construct: function(args) {
2210
2210
  elation.class.call(this, args);
2211
2211
  this.instances = [];
2212
+ if (!this.uniforms) this.uniforms = [];
2212
2213
  if (this.shadertype == 'shadertoy') {
2213
- this.uniforms = [
2214
+ this.uniforms.push.apply(this.uniforms, [
2214
2215
  { name: 'iResolution', value: new THREE.Vector3(512, 512, 0, 0) },
2215
2216
  { name: 'iTime', value: 0 },
2216
2217
  { name: 'iTimeDelta', value: 0 },
@@ -2221,7 +2222,7 @@ console.log('set up hls', hlsConfig);
2221
2222
  { name: 'iChannel1', value: new THREE.Texture() },
2222
2223
  { name: 'iChannel2', value: new THREE.Texture() },
2223
2224
  { name: 'iChannel3', value: new THREE.Texture() },
2224
- ];
2225
+ ]);
2225
2226
  this.uniformsMap = this.parseUniforms(this.uniforms);
2226
2227
  // FIXME - this hack is used to update the Shadertoy uniforms at 60fps, but it should be abstracted out and driven by the object that's using the shader
2227
2228
  // As a general shader harness, this will give us the means to update uniforms based on custom functions, so we can pass in things like mouse position,
@@ -13,7 +13,7 @@ elation.require([
13
13
  };
14
14
  this.persistdelay = 1000;
15
15
  this.lastpersist = 0;
16
- this.framechanges = [];
16
+ this.framechanges = new Set();
17
17
  this.eventMappedObjects = new Set();
18
18
 
19
19
  //this.scene['world-3d'].fog = new THREE.FogExp2(0x000000, 0.0000008);
@@ -52,6 +52,7 @@ elation.require([
52
52
  }
53
53
  }
54
54
  var uniques = this.uniques;
55
+ /*
55
56
  while (this.framechanges.length > 0) {
56
57
  var changed = this.framechanges.pop();
57
58
  if (!uniques[changed.id]) {
@@ -59,6 +60,14 @@ elation.require([
59
60
  changed.applyChanges();
60
61
  }
61
62
  }
63
+ */
64
+ this.framechanges.forEach(changed => {
65
+ if (!uniques[changed.id]) {
66
+ uniques[changed.id] = true;
67
+ changed.applyChanges();
68
+ }
69
+ });
70
+ this.framechanges.clear();
62
71
  }
63
72
  this.engine_stop = function(ev) {
64
73
  console.log('SHUTDOWN: world');
@@ -127,7 +136,8 @@ elation.require([
127
136
  this.thing_change_queued = function(ev) {
128
137
  var thing = ev.target;
129
138
  if (thing) {
130
- this.framechanges.push(thing);
139
+ //this.framechanges.push(thing);
140
+ this.framechanges.add(thing);
131
141
  this.engine.systems.render.setdirty();
132
142
  }
133
143
  }
@@ -43,7 +43,7 @@ elation.require(['engine.things.generic', 'engine.things.camera', 'engine.things
43
43
  'look_down': ['keyboard_down,gamepad_any_axis_3', elation.bind(this, this.updateControls)],
44
44
  'run': ['keyboard_shift,gamepad_any_button_10', elation.bind(this, this.updateControls)],
45
45
  //'crouch': ['keyboard_c', elation.bind(this, this.updateControls)],
46
- 'jump': ['keyboard_space,gamepad_any_button_1', elation.bind(this, this.handleJump)],
46
+ 'jump': ['keyboard_space', elation.bind(this, this.handleJump)],
47
47
  //'toss': ['keyboard_space,gamepad_any_button_0,mouse_button_0', elation.bind(this, this.toss)],
48
48
  //'toss_cube': ['keyboard_shift_space,gamepad_any_button_1', elation.bind(this, this.toss_cube)],
49
49
  //'use': ['keyboard_e,gamepad_any_button_0,mouse_button_0', elation.bind(this, this.handleUse)],
@@ -9,6 +9,7 @@ elation.require(['engine.things.generic'], function() {
9
9
  this.setTexture = function(texture) {
10
10
  var scene = this.engine.systems.world.scene['world-3d'];
11
11
  scene.background = texture;
12
+ elation.events.fire({element: this, type: 'skybox_update', bubbles: true});
12
13
  }
13
14
  }, elation.engine.things.generic);
14
15
  });