Skip to content

Commit

Permalink
fix: adds condition to avoid texture duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
balataca committed Aug 2, 2023
1 parent 0cb478a commit ccbc526
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 19 deletions.
2 changes: 1 addition & 1 deletion dist/aframe-transparent-video-shader.cjs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
AFRAME.registerShader("transparent-video",{schema:{src:{type:"map"}},init:function(e){var r=new THREE.VideoTexture(e.src),a=new THREE.VideoTexture(e.src);r.format=THREE.RGBAFormat,a.format=THREE.AlphaFormat,e.transparent=!0,this.material=new THREE.ShaderMaterial({vertexShader:"\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n varying vec2 vUv;\n uniform sampler2D videoTexture;\n uniform sampler2D alphaTexture;\n\n void main() {\n vec4 videoColor = texture2D(videoTexture, vUv);\n vec4 alphaColor = texture2D(alphaTexture, vUv);\n\n gl_FragColor = vec4(videoColor.rgb, alphaColor.a);\n }\n ",uniforms:{videoTexture:{type:"t",value:r},alphaTexture:{type:"t",value:a}},transparent:!0})}});
AFRAME.registerShader("transparent-video",{schema:{src:{type:"map"}},applyWebmShader:function(e){var a=new THREE.VideoTexture(e);a.format=THREE.RGBAFormat,this.material=new THREE.MeshBasicMaterial({map:a,transparent:!0})},applyHEVCShader:function(e){var a=new THREE.VideoTexture(e),r=new THREE.VideoTexture(e);a.format=THREE.RGBAFormat,r.format=THREE.AlphaFormat,this.material=new THREE.ShaderMaterial({vertexShader:"\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n varying vec2 vUv;\n uniform sampler2D videoTexture;\n uniform sampler2D alphaTexture;\n\n void main() {\n vec4 videoColor = texture2D(videoTexture, vUv);\n vec4 alphaColor = texture2D(alphaTexture, vUv);\n\n gl_FragColor = vec4(videoColor.rgb, alphaColor.a);\n }\n ",uniforms:{videoTexture:{type:"t",value:a},alphaTexture:{type:"t",value:r}},transparent:!0})},init:function(e){var a,r=e.src,t=new URL(r.currentSrc).pathname.split("."),n=null==(a=t[t.length-1])?void 0:a.toLowerCase();e.transparent=!0,"webm"===n?this.applyWebmShader(r):this.applyHEVCShader(r)}});
//# sourceMappingURL=aframe-transparent-video-shader.cjs.map
2 changes: 1 addition & 1 deletion dist/aframe-transparent-video-shader.cjs.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions dist/aframe-transparent-video-shader.esm.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/aframe-transparent-video-shader.esm.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion dist/aframe-transparent-video-shader.modern.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/aframe-transparent-video-shader.modern.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/aframe-transparent-video-shader.module.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ccbc526

Please sign in to comment.