David Catuhe 9 년 전
부모
커밋
504b283ff1

+ 12 - 13
Tools/Gulp/config.json

@@ -43,19 +43,18 @@
       "../../src/Collisions/babylon.collider.js",
       "../../src/Collisions/babylon.collisionCoordinator.js",
       "../../src/Cameras/babylon.camera.js",
-      "../../src/Cameras/babylon.cameraInputsManager.js",
-      "../../src/Cameras/Inputs/babylon.freecamera.input.mouse.js",
-      "../../src/Cameras/Inputs/babylon.freecamera.input.keyboard.js",
-      "../../src/Cameras/Inputs/babylon.freecamera.input.touch.js",
-      "../../src/Cameras/Inputs/babylon.freecamera.input.deviceorientation.js",
-      "../../src/Cameras/Inputs/babylon.freecamera.input.vrdeviceorientation.js",
-      "../../src/Cameras/Inputs/babylon.freecamera.input.gamepad.js",
-      "../../src/Cameras/Inputs/babylon.freecamera.input.virtualjoystick.js",
-      "../../src/Cameras/Inputs/babylon.arcrotatecamera.input.keyboard.js",
-      "../../src/Cameras/Inputs/babylon.arcrotatecamera.input.mousewheel.js",
-      "../../src/Cameras/Inputs/babylon.arcrotatecamera.input.pointers.js",
-      "../../src/Cameras/Inputs/babylon.arcrotatecamera.input.gamepad.js",
-      "../../src/Cameras/Inputs/babylon.arcrotatecamera.input.vrdeviceorientation.js",
+      "../../src/Cameras/babylon.camerainputsmanager.js",
+      "../../src/Cameras/inputs/babylon.freecamera.input.mouse.js",
+      "../../src/Cameras/inputs/babylon.freecamera.input.keyboard.js",
+      "../../src/Cameras/inputs/babylon.freecamera.input.touch.js",
+      "../../src/Cameras/inputs/babylon.freecamera.input.deviceorientation.js",
+      "../../src/Cameras/inputs/babylon.freecamera.input.vrdeviceorientation.js",
+      "../../src/Cameras/inputs/babylon.freecamera.input.gamepad.js",
+      "../../src/Cameras/inputs/babylon.arcrotatecamera.input.keyboard.js",
+      "../../src/Cameras/inputs/babylon.arcrotatecamera.input.mousewheel.js",
+      "../../src/Cameras/inputs/babylon.arcrotatecamera.input.pointers.js",
+      "../../src/Cameras/inputs/babylon.arcrotatecamera.input.gamepad.js",
+      "../../src/Cameras/inputs/babylon.arcrotatecamera.input.vrdeviceorientation.js",
       "../../src/Cameras/babylon.targetCamera.js",
       "../../src/Cameras/babylon.freeCamera.js",
       "../../src/Cameras/babylon.freeCameraInputsManager.js",

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 6 - 6
dist/preview release/babylon.core.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2000 - 1999
dist/preview release/babylon.d.ts


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 4 - 4
dist/preview release/babylon.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 112 - 82
dist/preview release/babylon.max.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 4 - 4
dist/preview release/babylon.noworker.js


+ 1 - 1
src/Canvas2d/babylon.prim2dBase.js

@@ -628,7 +628,7 @@ var BABYLON;
             if (!_super.prototype.dispose.call(this)) {
                 return false;
             }
-            if (!this._actionManager) {
+            if (this._actionManager) {
                 this._actionManager.dispose();
                 this._actionManager = null;
             }

+ 1 - 0
src/Particles/babylon.solidParticle.js

@@ -9,6 +9,7 @@ var BABYLON;
             this.uvs = new BABYLON.Vector4(0, 0, 1, 1); // uvs
             this.velocity = BABYLON.Vector3.Zero(); // velocity
             this.alive = true; // alive
+            this.isVisible = true; // visibility
             this.idx = particleIndex;
             this._pos = positionIndex;
             this._model = model;

+ 102 - 73
src/Particles/babylon.solidParticleSystem.js

@@ -460,6 +460,7 @@ var BABYLON;
             var colorIndex = 0;
             var uvidx = 0;
             var uvIndex = 0;
+            var pt = 0;
             if (this._computeBoundingBox) {
                 BABYLON.Vector3.FromFloatsToRef(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, this._minimum);
                 BABYLON.Vector3.FromFloatsToRef(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE, this._maximum);
@@ -472,92 +473,120 @@ var BABYLON;
                 this._shapeUV = this._particle._model._shapeUV;
                 // call to custom user function to update the particle properties
                 this.updateParticle(this._particle);
-                // particle rotation matrix
-                if (this.billboard) {
-                    this._particle.rotation.x = 0.0;
-                    this._particle.rotation.y = 0.0;
-                }
-                if (this._computeParticleRotation) {
-                    if (this._particle.rotationQuaternion) {
-                        this._quaternion.copyFrom(this._particle.rotationQuaternion);
-                    }
-                    else {
-                        this._yaw = this._particle.rotation.y;
-                        this._pitch = this._particle.rotation.x;
-                        this._roll = this._particle.rotation.z;
-                        this._quaternionRotationYPR();
-                    }
-                    this._quaternionToRotationMatrix();
-                }
-                for (var pt = 0; pt < this._shape.length; pt++) {
-                    idx = index + pt * 3;
-                    colidx = colorIndex + pt * 4;
-                    uvidx = uvIndex + pt * 2;
-                    this._vertex.x = this._shape[pt].x;
-                    this._vertex.y = this._shape[pt].y;
-                    this._vertex.z = this._shape[pt].z;
-                    if (this._computeParticleVertex) {
-                        this.updateParticleVertex(this._particle, this._vertex, pt);
+                if (this._particle.isVisible) {
+                    // particle rotation matrix
+                    if (this.billboard) {
+                        this._particle.rotation.x = 0.0;
+                        this._particle.rotation.y = 0.0;
                     }
-                    // positions
-                    this._vertex.x *= this._particle.scaling.x;
-                    this._vertex.y *= this._particle.scaling.y;
-                    this._vertex.z *= this._particle.scaling.z;
-                    this._w = (this._vertex.x * this._rotMatrix.m[3]) + (this._vertex.y * this._rotMatrix.m[7]) + (this._vertex.z * this._rotMatrix.m[11]) + this._rotMatrix.m[15];
-                    this._rotated.x = ((this._vertex.x * this._rotMatrix.m[0]) + (this._vertex.y * this._rotMatrix.m[4]) + (this._vertex.z * this._rotMatrix.m[8]) + this._rotMatrix.m[12]) / this._w;
-                    this._rotated.y = ((this._vertex.x * this._rotMatrix.m[1]) + (this._vertex.y * this._rotMatrix.m[5]) + (this._vertex.z * this._rotMatrix.m[9]) + this._rotMatrix.m[13]) / this._w;
-                    this._rotated.z = ((this._vertex.x * this._rotMatrix.m[2]) + (this._vertex.y * this._rotMatrix.m[6]) + (this._vertex.z * this._rotMatrix.m[10]) + this._rotMatrix.m[14]) / this._w;
-                    this._positions32[idx] = this._particle.position.x + this._cam_axisX.x * this._rotated.x + this._cam_axisY.x * this._rotated.y + this._cam_axisZ.x * this._rotated.z;
-                    this._positions32[idx + 1] = this._particle.position.y + this._cam_axisX.y * this._rotated.x + this._cam_axisY.y * this._rotated.y + this._cam_axisZ.y * this._rotated.z;
-                    this._positions32[idx + 2] = this._particle.position.z + this._cam_axisX.z * this._rotated.x + this._cam_axisY.z * this._rotated.y + this._cam_axisZ.z * this._rotated.z;
-                    if (this._computeBoundingBox) {
-                        if (this._positions32[idx] < this._minimum.x) {
-                            this._minimum.x = this._positions32[idx];
+                    if (this._computeParticleRotation) {
+                        if (this._particle.rotationQuaternion) {
+                            this._quaternion.copyFrom(this._particle.rotationQuaternion);
                         }
-                        if (this._positions32[idx] > this._maximum.x) {
-                            this._maximum.x = this._positions32[idx];
+                        else {
+                            this._yaw = this._particle.rotation.y;
+                            this._pitch = this._particle.rotation.x;
+                            this._roll = this._particle.rotation.z;
+                            this._quaternionRotationYPR();
                         }
-                        if (this._positions32[idx + 1] < this._minimum.y) {
-                            this._minimum.y = this._positions32[idx + 1];
+                        this._quaternionToRotationMatrix();
+                    }
+                    // particle vertex loop
+                    for (pt = 0; pt < this._shape.length; pt++) {
+                        idx = index + pt * 3;
+                        colidx = colorIndex + pt * 4;
+                        uvidx = uvIndex + pt * 2;
+                        this._vertex.x = this._shape[pt].x;
+                        this._vertex.y = this._shape[pt].y;
+                        this._vertex.z = this._shape[pt].z;
+                        if (this._computeParticleVertex) {
+                            this.updateParticleVertex(this._particle, this._vertex, pt);
                         }
-                        if (this._positions32[idx + 1] > this._maximum.y) {
-                            this._maximum.y = this._positions32[idx + 1];
+                        // positions
+                        this._vertex.x *= this._particle.scaling.x;
+                        this._vertex.y *= this._particle.scaling.y;
+                        this._vertex.z *= this._particle.scaling.z;
+                        this._w = (this._vertex.x * this._rotMatrix.m[3]) + (this._vertex.y * this._rotMatrix.m[7]) + (this._vertex.z * this._rotMatrix.m[11]) + this._rotMatrix.m[15];
+                        this._rotated.x = ((this._vertex.x * this._rotMatrix.m[0]) + (this._vertex.y * this._rotMatrix.m[4]) + (this._vertex.z * this._rotMatrix.m[8]) + this._rotMatrix.m[12]) / this._w;
+                        this._rotated.y = ((this._vertex.x * this._rotMatrix.m[1]) + (this._vertex.y * this._rotMatrix.m[5]) + (this._vertex.z * this._rotMatrix.m[9]) + this._rotMatrix.m[13]) / this._w;
+                        this._rotated.z = ((this._vertex.x * this._rotMatrix.m[2]) + (this._vertex.y * this._rotMatrix.m[6]) + (this._vertex.z * this._rotMatrix.m[10]) + this._rotMatrix.m[14]) / this._w;
+                        this._positions32[idx] = this._particle.position.x + this._cam_axisX.x * this._rotated.x + this._cam_axisY.x * this._rotated.y + this._cam_axisZ.x * this._rotated.z;
+                        this._positions32[idx + 1] = this._particle.position.y + this._cam_axisX.y * this._rotated.x + this._cam_axisY.y * this._rotated.y + this._cam_axisZ.y * this._rotated.z;
+                        this._positions32[idx + 2] = this._particle.position.z + this._cam_axisX.z * this._rotated.x + this._cam_axisY.z * this._rotated.y + this._cam_axisZ.z * this._rotated.z;
+                        if (this._computeBoundingBox) {
+                            if (this._positions32[idx] < this._minimum.x) {
+                                this._minimum.x = this._positions32[idx];
+                            }
+                            if (this._positions32[idx] > this._maximum.x) {
+                                this._maximum.x = this._positions32[idx];
+                            }
+                            if (this._positions32[idx + 1] < this._minimum.y) {
+                                this._minimum.y = this._positions32[idx + 1];
+                            }
+                            if (this._positions32[idx + 1] > this._maximum.y) {
+                                this._maximum.y = this._positions32[idx + 1];
+                            }
+                            if (this._positions32[idx + 2] < this._minimum.z) {
+                                this._minimum.z = this._positions32[idx + 2];
+                            }
+                            if (this._positions32[idx + 2] > this._maximum.z) {
+                                this._maximum.z = this._positions32[idx + 2];
+                            }
                         }
-                        if (this._positions32[idx + 2] < this._minimum.z) {
-                            this._minimum.z = this._positions32[idx + 2];
+                        // normals : if the particles can't be morphed then just rotate the normals, what if much more faster than ComputeNormals()
+                        if (!this._computeParticleVertex && !this.billboard) {
+                            this._normal.x = this._fixedNormal32[idx];
+                            this._normal.y = this._fixedNormal32[idx + 1];
+                            this._normal.z = this._fixedNormal32[idx + 2];
+                            this._w = (this._normal.x * this._rotMatrix.m[3]) + (this._normal.y * this._rotMatrix.m[7]) + (this._normal.z * this._rotMatrix.m[11]) + this._rotMatrix.m[15];
+                            this._rotated.x = ((this._normal.x * this._rotMatrix.m[0]) + (this._normal.y * this._rotMatrix.m[4]) + (this._normal.z * this._rotMatrix.m[8]) + this._rotMatrix.m[12]) / this._w;
+                            this._rotated.y = ((this._normal.x * this._rotMatrix.m[1]) + (this._normal.y * this._rotMatrix.m[5]) + (this._normal.z * this._rotMatrix.m[9]) + this._rotMatrix.m[13]) / this._w;
+                            this._rotated.z = ((this._normal.x * this._rotMatrix.m[2]) + (this._normal.y * this._rotMatrix.m[6]) + (this._normal.z * this._rotMatrix.m[10]) + this._rotMatrix.m[14]) / this._w;
+                            this._normals32[idx] = this._cam_axisX.x * this._rotated.x + this._cam_axisY.x * this._rotated.y + this._cam_axisZ.x * this._rotated.z;
+                            this._normals32[idx + 1] = this._cam_axisX.y * this._rotated.x + this._cam_axisY.y * this._rotated.y + this._cam_axisZ.y * this._rotated.z;
+                            this._normals32[idx + 2] = this._cam_axisX.z * this._rotated.x + this._cam_axisY.z * this._rotated.y + this._cam_axisZ.z * this._rotated.z;
                         }
-                        if (this._positions32[idx + 2] > this._maximum.z) {
-                            this._maximum.z = this._positions32[idx + 2];
+                        if (this._computeParticleColor) {
+                            this._colors32[colidx] = this._particle.color.r;
+                            this._colors32[colidx + 1] = this._particle.color.g;
+                            this._colors32[colidx + 2] = this._particle.color.b;
+                            this._colors32[colidx + 3] = this._particle.color.a;
+                        }
+                        if (this._computeParticleTexture) {
+                            this._uvs32[uvidx] = this._shapeUV[pt * 2] * (this._particle.uvs.z - this._particle.uvs.x) + this._particle.uvs.x;
+                            this._uvs32[uvidx + 1] = this._shapeUV[pt * 2 + 1] * (this._particle.uvs.w - this._particle.uvs.y) + this._particle.uvs.y;
                         }
                     }
-                    // normals : if the particles can't be morphed then just rotate the normals
-                    if (!this._computeParticleVertex && !this.billboard) {
-                        this._normal.x = this._fixedNormal32[idx];
-                        this._normal.y = this._fixedNormal32[idx + 1];
-                        this._normal.z = this._fixedNormal32[idx + 2];
-                        this._w = (this._normal.x * this._rotMatrix.m[3]) + (this._normal.y * this._rotMatrix.m[7]) + (this._normal.z * this._rotMatrix.m[11]) + this._rotMatrix.m[15];
-                        this._rotated.x = ((this._normal.x * this._rotMatrix.m[0]) + (this._normal.y * this._rotMatrix.m[4]) + (this._normal.z * this._rotMatrix.m[8]) + this._rotMatrix.m[12]) / this._w;
-                        this._rotated.y = ((this._normal.x * this._rotMatrix.m[1]) + (this._normal.y * this._rotMatrix.m[5]) + (this._normal.z * this._rotMatrix.m[9]) + this._rotMatrix.m[13]) / this._w;
-                        this._rotated.z = ((this._normal.x * this._rotMatrix.m[2]) + (this._normal.y * this._rotMatrix.m[6]) + (this._normal.z * this._rotMatrix.m[10]) + this._rotMatrix.m[14]) / this._w;
-                        this._normals32[idx] = this._cam_axisX.x * this._rotated.x + this._cam_axisY.x * this._rotated.y + this._cam_axisZ.x * this._rotated.z;
-                        this._normals32[idx + 1] = this._cam_axisX.y * this._rotated.x + this._cam_axisY.y * this._rotated.y + this._cam_axisZ.y * this._rotated.z;
-                        this._normals32[idx + 2] = this._cam_axisX.z * this._rotated.x + this._cam_axisY.z * this._rotated.y + this._cam_axisZ.z * this._rotated.z;
-                    }
-                    if (this._computeParticleColor) {
-                        this._colors32[colidx] = this._particle.color.r;
-                        this._colors32[colidx + 1] = this._particle.color.g;
-                        this._colors32[colidx + 2] = this._particle.color.b;
-                        this._colors32[colidx + 3] = this._particle.color.a;
-                    }
-                    if (this._computeParticleTexture) {
-                        this._uvs32[uvidx] = this._shapeUV[pt * 2] * (this._particle.uvs.z - this._particle.uvs.x) + this._particle.uvs.x;
-                        this._uvs32[uvidx + 1] = this._shapeUV[pt * 2 + 1] * (this._particle.uvs.w - this._particle.uvs.y) + this._particle.uvs.y;
+                }
+                else {
+                    for (pt = 0; pt < this._shape.length; pt++) {
+                        idx = index + pt * 3;
+                        colidx = colorIndex + pt * 4;
+                        uvidx = uvIndex + pt * 2;
+                        this._positions32[idx] = this._camera.position.x;
+                        this._positions32[idx + 1] = this._camera.position.y;
+                        this._positions32[idx + 2] = this._camera.position.z;
+                        this._normals32[idx] = 0.0;
+                        this._normals32[idx + 1] = 0.0;
+                        this._normals32[idx + 2] = 0.0;
+                        if (this._computeParticleColor) {
+                            this._colors32[colidx] = this._particle.color.r;
+                            this._colors32[colidx + 1] = this._particle.color.g;
+                            this._colors32[colidx + 2] = this._particle.color.b;
+                            this._colors32[colidx + 3] = this._particle.color.a;
+                        }
+                        if (this._computeParticleTexture) {
+                            this._uvs32[uvidx] = this._shapeUV[pt * 2] * (this._particle.uvs.z - this._particle.uvs.x) + this._particle.uvs.x;
+                            this._uvs32[uvidx + 1] = this._shapeUV[pt * 2 + 1] * (this._particle.uvs.w - this._particle.uvs.y) + this._particle.uvs.y;
+                        }
                     }
                 }
+                // increment indexes for the next particle
                 index = idx + 3;
                 colorIndex = colidx + 4;
                 uvIndex = uvidx + 2;
             }
+            // if the VBO must be updated
             if (update) {
                 if (this._computeParticleColor) {
                     this.mesh.updateVerticesData(BABYLON.VertexBuffer.ColorKind, this._colors32, false, false);
@@ -568,7 +597,7 @@ var BABYLON;
                 this.mesh.updateVerticesData(BABYLON.VertexBuffer.PositionKind, this._positions32, false, false);
                 if (!this.mesh.areNormalsFrozen) {
                     if (this._computeParticleVertex || this.billboard) {
-                        // recompute the normals only if the particles can be morphed, update then the normal reference array
+                        // recompute the normals only if the particles can be morphed, update then also the normal reference array _fixedNormal32[]
                         BABYLON.VertexData.ComputeNormals(this._positions32, this._indices, this._normals32);
                         for (var i = 0; i < this._normals32.length; i++) {
                             this._fixedNormal32[i] = this._normals32[i];

+ 4 - 4
src/Shaders/rect2d.vertex.fx

@@ -72,13 +72,13 @@ void main(void) {
 
 		if (segi == 0.0) {
 			pos2 = vec2(1.0, 1.0);
-		} 
+		}
 		else if (segi == 1.0) {
 			pos2 = vec2(1.0, 0.0);
 		}
 		else if (segi == 2.0) {
 			pos2 = vec2(0.0, 0.0);
-		} 
+		}
 		else {
 			pos2 = vec2(0.0, 1.0);
 		}
@@ -102,7 +102,7 @@ void main(void) {
 		}
 #endif
 	}
-	else 
+	else
 	{
 #ifdef Border
 		float w = properties.x;
@@ -114,7 +114,7 @@ void main(void) {
 
 		float segi = index;
 		if (index < rsub) {
-			borderOffset = vec2(1.0-(borderThickness*2.0 / w), 1.0-(borderThickness*2.0 / h));
+			borderOffset = vec2(1.0 - (borderThickness*2.0 / w), 1.0 - (borderThickness*2.0 / h));
 		}
 		else {
 			segi -= rsub;