Selaa lähdekoodia

added idxInShape member

jbousquie 9 vuotta sitten
vanhempi
commit
7453b027f2
1 muutettua tiedostoa jossa 19 lisäystä ja 15 poistoa
  1. 19 15
      src/Particles/babylon.solidParticle.ts

+ 19 - 15
src/Particles/babylon.solidParticle.ts

@@ -1,26 +1,30 @@
 module BABYLON {
 
     export class SolidParticle {
-        public idx: number;
-        public color = new Color4(1, 1, 1, 1);
-        public position = Vector3.Zero();
-        public rotation = Vector3.Zero();
-        public quaternion: Vector4;
-        public scale = new Vector3(1, 1, 1);
-        public uvs = new Vector4(0, 0, 1, 1);
-        public velocity = Vector3.Zero();
-        public alive = true;
-        public _pos: number;
-        public _shape: Vector3[];
-        public _shapeUV: number[];
-        public previous: SolidParticle;
-        public next: SolidParticle;
+        public idx: number;                     // particle global index
+        public color = new Color4(1, 1, 1, 1);  // color
+        public position = Vector3.Zero();       // position
+        public rotation = Vector3.Zero();       // rotation
+        public quaternion: Vector4;             // quaternion, will overwrite rotation
+        public scale = new Vector3(1, 1, 1);    // scale
+        public uvs = new Vector4(0, 0, 1, 1);   // uvs
+        public velocity = Vector3.Zero();       // velocity
+        public alive = true;                    // alive
+        public _pos: number;                    // index of this particle in the global "positions" array
+        public _shape: Vector3[];               // model shape array reference
+        public _shapeUV: number[];              // model shape UVs array reference
+        public shapeId: number;                 // model shape id
+        public previous: SolidParticle;         // pointer to the previous particle in the global particles array
+        public next: SolidParticle;             // pointer to the next particle in the global particles array
+        public idxInShape: number;              // index of the particle in its shape id
 
-        constructor(particleIndex: number, positionIndex: number, shape: Vector3[], shapeUV: number[], public shapeId: number) {
+        constructor(particleIndex: number, positionIndex: number, shape: Vector3[], shapeUV: number[], shapeId: number, idxInShape: number) {
             this.idx = particleIndex;
             this._pos = positionIndex;
             this._shape = shape;
             this._shapeUV = shapeUV;
+            this._shapeId = shapeId;
+            this.idxInShape = idxInShape;
         }
     }
 }