elation-engine 0.9.116 → 0.9.117

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.116",
4
+ "version": "0.9.117",
5
5
  "main": "",
6
6
  "author": "James Baicoianu",
7
7
  "license": "MIT",
@@ -1,4 +1,4 @@
1
- console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated with r150+, and will be removed with r160. Please use ES Modules or alternatives: https://threejs.org/docs/index.html#manual/en/introduction/Installation' );
1
+ //console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated with r150+, and will be removed with r160. Please use ES Modules or alternatives: https://threejs.org/docs/index.html#manual/en/introduction/Installation' );
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2010-2023 Three.js Authors
@@ -191,7 +191,39 @@ elation.require([
191
191
  this.textureHasAlpha = (function() {
192
192
  let scene = new THREE.Scene();
193
193
  let plane = new THREE.PlaneGeometry(2, 2);
194
- let material = new THREE.MeshBasicMaterial({color: 0xff0000});
194
+ //let material = new THREE.MeshBasicMaterial({color: 0xff0000});
195
+ let material = new THREE.ShaderMaterial({
196
+ vertexShader: `
197
+ uniform sampler2D map;
198
+ varying vec2 vUv;
199
+ void main() {
200
+ mat4 modelViewProjectionMatrix = projectionMatrix * modelViewMatrix;
201
+
202
+ vec3 transformed = vec3( position );
203
+
204
+ // Transform our new vertex position into clip space
205
+ vec4 pos = modelViewProjectionMatrix * vec4(transformed, 1.0);
206
+
207
+ gl_Position = pos;
208
+ vUv = uv;
209
+ }
210
+ `,
211
+
212
+ fragmentShader: `
213
+ uniform sampler2D map;
214
+ varying vec2 vUv;
215
+ void main(){
216
+ vec4 sampledDiffuseColor = texture2D( map, vUv );
217
+ gl_FragColor = vec4(sampledDiffuseColor.rgb, floor(sampledDiffuseColor.a));
218
+ //gl_FragColor = vec4(sampledDiffuseColor.rgb, 0.0);
219
+ }
220
+ `,
221
+
222
+ uniforms: {
223
+ map: { type: 't' },
224
+ },
225
+ });
226
+
195
227
  let mesh = new THREE.Mesh(plane, material);
196
228
  mesh.position.set(0,0,-1);
197
229
  scene.add(mesh);
@@ -202,8 +234,8 @@ elation.require([
202
234
  let viewport = new THREE.Vector4(0, 0, 1, 1);
203
235
 
204
236
  return function(texture) {
205
- material.map = texture;
206
- material.map.needsUpdate = true;
237
+ material.uniforms.map.value = texture;
238
+ texture.needsUpdate = true;
207
239
  let renderer = this.renderer;
208
240
  let pixeldata = new Uint8Array(4);
209
241
  let oldrendertarget = renderer.getRenderTarget();