Skip to content

Commit

Permalink
updating particle component to work with A-Frame 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
stemkoski committed Mar 12, 2022
1 parent dc1afa9 commit a30ad85
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
16 changes: 8 additions & 8 deletions js/aframe-spe-particles-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ AFRAME.registerComponent("spe-particles", {
this.pauseTickId = undefined
this.emitterID = uniqueEmitterID++
this.pauseTick = this.pauseTick.bind(this)
this.defaultTexture = new THREE.DataTexture(new Uint8Array(3).fill(255), 1, 1, THREE.RGBFormat)
this.defaultTexture = new THREE.DataTexture(new Uint8Array(4).fill(255), 1, 1, THREE.RGBAFormat)
this.defaultTexture.needsUpdate = true
},

Expand Down Expand Up @@ -1087,7 +1087,7 @@ SPE.ShaderAttribute.prototype.resetUpdateRange = function() {

SPE.ShaderAttribute.prototype.resetDynamic = function() {
'use strict';
this.bufferAttribute.usage = this.dynamicBuffer; // LJS: stop A-Frame warnings ".dynamic" -> ".usage"
this.bufferAttribute.usage = this.dynamicBuffer;
};

/**
Expand All @@ -1111,7 +1111,7 @@ SPE.ShaderAttribute.prototype.forceUpdateAll = function() {
this.bufferAttribute.array = this.typedArray.array;
this.bufferAttribute.updateRange.offset = 0;
this.bufferAttribute.updateRange.count = -1;
this.bufferAttribute.dynamic = false; // LJS: stop A-Frame warnings ".dynamic" -> ".usage"
this.bufferAttribute.dynamic = false; // ???
this.bufferAttribute.needsUpdate = true;
};

Expand Down Expand Up @@ -1180,7 +1180,7 @@ SPE.ShaderAttribute.prototype._createBufferAttribute = function( size ) {
}

this.bufferAttribute = new THREE.BufferAttribute( this.typedArray.array, this.componentSize );
this.bufferAttribute.usage = this.dynamicBuffer; // LJS: stop A-Frame warnings ".dynamic" -> ".usage"
this.bufferAttribute.usage = this.dynamicBuffer;
};

/**
Expand Down Expand Up @@ -1209,7 +1209,7 @@ SPE.shaderChunks = {
uniforms: [
'uniform float deltaTime;',
'uniform float runTime;',
'uniform sampler2D texture;',
'uniform sampler2D tex;',
'uniform vec4 textureAnimation;',
'uniform float scale;',
].join( '\n' ),
Expand Down Expand Up @@ -1450,7 +1450,7 @@ SPE.shaderChunks = {
' #endif',

'',
' vec4 rotatedTexture = texture2D( texture, vUv );',
' vec4 rotatedTexture = texture2D( tex, vUv );',
].join( '\n' )
};

Expand Down Expand Up @@ -2464,7 +2464,7 @@ SPE.Group = function( options ) {

// Map of uniforms to be applied to the ShaderMaterial instance.
this.uniforms = {
texture: {
tex: {
type: 't',
value: this.texture
},
Expand Down Expand Up @@ -2629,7 +2629,7 @@ SPE.Group.prototype._applyAttributesToGeometry = function() {

// // Add the attribute to the geometry if it doesn't already exist.
else {
geometry.setAttribute( attr, attribute.bufferAttribute ); // LJS: stop A-Frame warnings "addAttribute()" -> "setAttribute()"
geometry.setAttribute( attr, attribute.bufferAttribute );
}

// Mark the attribute as needing an update the next time a frame is rendered.
Expand Down
5 changes: 3 additions & 2 deletions particles.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<html>
<head>
<script src="js/aframe-master.1.0.4.min.js"></script>
<script src="js/aframe-environment-component.min-old.js"></script>
<script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>
<!-- <script src="js/aframe-master.1.0.4.min.js"></script> -->
<script src="js/aframe-environment-component.js"></script>
<script src="js/aframe-spe-particles-component.js"></script>
<script src="js/extended-wasd-controls.js"></script>
</head>
Expand Down

0 comments on commit a30ad85

Please sign in to comment.