Explorar el Código

Adding new id for loading screen

David Catuhe hace 9 años
padre
commit
35bf3bfc52

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 20 - 20
dist/preview release/babylon.core.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 1386 - 1378
dist/preview release/babylon.d.ts


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 27 - 27
dist/preview release/babylon.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 267 - 137
dist/preview release/babylon.max.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 27 - 27
dist/preview release/babylon.noworker.js


+ 54 - 6
src/Mesh/babylon.mesh.vertexData.js

@@ -663,15 +663,22 @@ var BABYLON;
             var tessellation = options.tessellation || 24;
             var subdivisions = options.subdivisions || 1;
             var hasRings = options.hasRings;
+            var enclose = options.enclose;
             var arc = (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;
             var sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || BABYLON.Mesh.DEFAULTSIDE;
             var faceUV = options.faceUV || new Array(3);
             var faceColors = options.faceColors;
             // default face colors and UV if undefined
-            for (var f = 0; f < 3; f++) {
+            var quadNb = (arc !== 1 && enclose) ? 2 : 0;
+            var ringNb = (hasRings) ? subdivisions : 1;
+            var colorNb = 2 + (1 + quadNb) * ringNb;
+            var f;
+            for (f = 0; f < colorNb; f++) {
                 if (faceColors && faceColors[f] === undefined) {
                     faceColors[f] = new BABYLON.Color4(1, 1, 1, 1);
                 }
+            }
+            for (f = 0; f < 3; f++) {
                 if (faceUV && faceUV[f] === undefined) {
                     faceUV[f] = new BABYLON.Vector4(0, 0, 1, 1);
                 }
@@ -688,6 +695,10 @@ var BABYLON;
             var tan = (diameterBottom - diameterTop) / 2 / height;
             var ringVertex = BABYLON.Vector3.Zero();
             var ringNormal = BABYLON.Vector3.Zero();
+            var ringFirstVertex = BABYLON.Vector3.Zero();
+            var ringFirstNormal = BABYLON.Vector3.Zero();
+            var quadNormal = BABYLON.Vector3.Zero();
+            var Y = BABYLON.Axis.Y;
             // positions, normals, uvs
             var i;
             var j;
@@ -700,9 +711,11 @@ var BABYLON;
                 for (r = 0; r < ringIdx; r++) {
                     for (j = 0; j <= tessellation; j++) {
                         angle = j * angle_step;
+                        // position
                         ringVertex.x = Math.cos(-angle) * radius;
                         ringVertex.y = -height / 2 + h * height;
                         ringVertex.z = Math.sin(-angle) * radius;
+                        // normal
                         if (diameterTop === 0 && i === subdivisions) {
                             // if no top cap, reuse former normals
                             ringNormal.x = normals[normals.length - (tessellation + 1) * 3];
@@ -715,6 +728,11 @@ var BABYLON;
                             ringNormal.y = Math.sqrt(ringNormal.x * ringNormal.x + ringNormal.z * ringNormal.z) * tan;
                             ringNormal.normalize();
                         }
+                        // keep first values for enclose
+                        if (j === 0) {
+                            ringFirstVertex.copyFrom(ringVertex);
+                            ringFirstNormal.copyFrom(ringNormal);
+                        }
                         positions.push(ringVertex.x, ringVertex.y, ringVertex.z);
                         normals.push(ringNormal.x, ringNormal.y, ringNormal.z);
                         uvs.push(faceUV[1].x + (faceUV[1].z - faceUV[1].x) * j / tessellation, faceUV[1].y + (faceUV[1].w - faceUV[1].y) * h);
@@ -722,20 +740,50 @@ var BABYLON;
                             colors.push(faceColors[1].r, faceColors[1].g, faceColors[1].b, faceColors[1].a);
                         }
                     }
+                    // if enclose, add four vertices and their dedicated normals
+                    if (arc !== 1 && enclose) {
+                        positions.push(ringVertex.x, ringVertex.y, ringVertex.z);
+                        positions.push(0, ringVertex.y, 0);
+                        positions.push(0, ringVertex.y, 0);
+                        positions.push(ringFirstVertex.x, ringFirstVertex.y, ringFirstVertex.z);
+                        BABYLON.Vector3.CrossToRef(Y, ringNormal, quadNormal);
+                        quadNormal.normalize();
+                        normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);
+                        BABYLON.Vector3.CrossToRef(ringFirstNormal, Y, quadNormal);
+                        quadNormal.normalize();
+                        normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);
+                        uvs.push(faceUV[1].x + (faceUV[1].z - faceUV[1].x), faceUV[1].y + (faceUV[1].w - faceUV[1].y));
+                        uvs.push(faceUV[1].x + (faceUV[1].z - faceUV[1].x), faceUV[1].y + (faceUV[1].w - faceUV[1].y));
+                        uvs.push(faceUV[1].x + (faceUV[1].z - faceUV[1].x), faceUV[1].y + (faceUV[1].w - faceUV[1].y));
+                        uvs.push(faceUV[1].x + (faceUV[1].z - faceUV[1].x), faceUV[1].y + (faceUV[1].w - faceUV[1].y));
+                        if (faceColors) {
+                            colors.push(faceColors[1].r, faceColors[1].g, faceColors[1].b, faceColors[1].a);
+                            colors.push(faceColors[1].r, faceColors[1].g, faceColors[1].b, faceColors[1].a);
+                            colors.push(faceColors[1].r, faceColors[1].g, faceColors[1].b, faceColors[1].a);
+                            colors.push(faceColors[1].r, faceColors[1].g, faceColors[1].b, faceColors[1].a);
+                        }
+                    }
                 }
             }
             // indices
+            var e = (arc !== 1 && enclose) ? tessellation + 4 : tessellation; // correction of number of iteration if enclose
             var s;
             i = 0;
             for (s = 0; s < subdivisions; s++) {
                 for (j = 0; j < tessellation; j++) {
-                    var i0 = i * (tessellation + 1) + j;
-                    var i1 = (i + 1) * (tessellation + 1) + j;
-                    var i2 = i * (tessellation + 1) + (j + 1);
-                    var i3 = (i + 1) * (tessellation + 1) + (j + 1);
+                    var i0 = i * (e + 1) + j;
+                    var i1 = (i + 1) * (e + 1) + j;
+                    var i2 = i * (e + 1) + (j + 1);
+                    var i3 = (i + 1) * (e + 1) + (j + 1);
                     indices.push(i0, i1, i2);
                     indices.push(i3, i2, i1);
                 }
+                if (arc !== 1 && enclose) {
+                    indices.push(i0 + 2, i1 + 2, i2 + 2);
+                    indices.push(i3 + 2, i2 + 2, i1 + 2);
+                    indices.push(i0 + 4, i1 + 4, i2 + 4);
+                    indices.push(i3 + 4, i2 + 4, i1 + 4);
+                }
                 i = (hasRings) ? (i + 2) : (i + 1);
             }
             // Caps
@@ -751,7 +799,7 @@ var BABYLON;
                 var u = (isTop) ? faceUV[2] : faceUV[0];
                 var c;
                 if (faceColors) {
-                    c = (isTop) ? faceColors[2] : faceColors[0];
+                    c = (isTop) ? faceColors[colorNb - 1] : faceColors[0];
                 }
                 // cap center
                 var vbase = positions.length / 3;

+ 14 - 13
src/Mesh/babylon.mesh.vertexData.ts

@@ -819,9 +819,9 @@
             var faceColors: Color4[] = options.faceColors;
     
             // default face colors and UV if undefined
-            var quadNb: number = (arc !==1 && enclose) ? 2 : 0;
+            var quadNb: number = (arc !== 1 && enclose) ? 2 : 0;
             var ringNb: number = (hasRings) ? subdivisions : 1;
-            var colorNb: number = 2 + (1 + quadNb) * ringNb; 
+            var colorNb: number = 2 + (1 + quadNb) * ringNb;
             var f: number;
             for (f = 0; f < colorNb; f++) {
                 if (faceColors && faceColors[f] === undefined) {
@@ -850,14 +850,14 @@
             var ringFirstVertex: Vector3 = Vector3.Zero();
             var ringFirstNormal: Vector3 = Vector3.Zero();
             var quadNormal: Vector3 = Vector3.Zero();
-            var Y:Vector3 = Axis.Y;
+            var Y: Vector3 = Axis.Y;
 
             // positions, normals, uvs
             var i: number;
             var j: number;
             var r: number;
             var ringIdx: number = 1;
-            
+
             for (i = 0; i <= subdivisions; i++) {
                 h = i / subdivisions;
                 radius = (h * (diameterTop - diameterBottom) + diameterBottom) / 2;
@@ -900,7 +900,7 @@
                     }
 
                     // if enclose, add four vertices and their dedicated normals
-                    if (arc !== 1 && enclose) {                 
+                    if (arc !== 1 && enclose) {
                         positions.push(ringVertex.x, ringVertex.y, ringVertex.z);
                         positions.push(0, ringVertex.y, 0);
                         positions.push(0, ringVertex.y, 0);
@@ -910,7 +910,7 @@
                         normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);
                         Vector3.CrossToRef(ringFirstNormal, Y, quadNormal);
                         quadNormal.normalize();
-                        normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);                        
+                        normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);
                         uvs.push(faceUV[1].x + (faceUV[1].z - faceUV[1].x), faceUV[1].y + (faceUV[1].w - faceUV[1].y));
                         uvs.push(faceUV[1].x + (faceUV[1].z - faceUV[1].x), faceUV[1].y + (faceUV[1].w - faceUV[1].y));
                         uvs.push(faceUV[1].x + (faceUV[1].z - faceUV[1].x), faceUV[1].y + (faceUV[1].w - faceUV[1].y));
@@ -938,7 +938,7 @@
                     indices.push(i0, i1, i2);
                     indices.push(i3, i2, i1);
                 }
-                if (arc != 1 && enclose) {      // if enclose, add two quads
+                if (arc !== 1 && enclose) {      // if enclose, add two quads
                     indices.push(i0 + 2, i1 + 2, i2 + 2);
                     indices.push(i3 + 2, i2 + 2, i1 + 2);
                     indices.push(i0 + 4, i1 + 4, i2 + 4);
@@ -1449,7 +1449,7 @@
             return vertexData;
         }
 
-        public static CreateIcoSphere(options: {radius?: number, radiusX?: number, radiusY?: number, radiusZ?: number, flat?: number, subdivisions?: number, sideOrientation?: number}): VertexData {
+        public static CreateIcoSphere(options: { radius?: number, radiusX?: number, radiusY?: number, radiusZ?: number, flat?: number, subdivisions?: number, sideOrientation?: number }): VertexData {
             var sideOrientation = options.sideOrientation || Mesh.DEFAULTSIDE;
             var radius = options.radius || 1;
             var flat = (options.flat === undefined) ? true : options.flat;
@@ -1477,7 +1477,7 @@
             // vertex for uv have aliased position, not for UV
             var vertices_unalias_id = [
                 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
-                // vertex alias
+            // vertex alias
                 0,  // 12: 0 + 12
                 2,  // 13: 2 + 11
                 3,  // 14: 3 + 11
@@ -1498,7 +1498,7 @@
                 5, 1, 3, 1, 6, 4, 0, 0,  // v0-3
                 5, 3, 4, 2, 2, 2, 4, 0,  // v4-7
                 2, 0, 1, 1, 6, 0, 6, 2,  // v8-11
-                // vertex alias (for same vertex on different faces)
+            // vertex alias (for same vertex on different faces)
                 0, 4, // 12: 0 + 12
                 3, 3, // 13: 2 + 11
                 4, 4, // 14: 3 + 11
@@ -1639,7 +1639,7 @@
                 // centroid of triangle is needed to get help normal computation
                 //  (c1,c2) are used for centroid location
 
-                var interp_vertex = (i1: number, i2: number, c1: number, c2: number) =>{
+                var interp_vertex = (i1: number, i2: number, c1: number, c2: number) => {
                     // vertex is interpolated from
                     //   - face_vertex_pos[0..2]
                     //   - face_vertex_uv[0..2]
@@ -1939,7 +1939,7 @@
          */
         public static ComputeNormals(positions: any, indices: any, normals: any) {
             var index = 0;
-            
+
             var p1p2x = 0.0;
             var p1p2y = 0.0;
             var p1p2z = 0.0;
@@ -2004,7 +2004,7 @@
 
                 length = Math.sqrt(faceNormalx * faceNormalx + faceNormaly * faceNormaly + faceNormalz * faceNormalz);
                 length = (length === 0) ? 1.0 : length;
-                faceNormalx /= length;                                 
+                faceNormalx /= length;
                 faceNormaly /= length;
                 faceNormalz /= length;
 
@@ -2073,3 +2073,4 @@
 
 
 
+

+ 1 - 4
src/Mesh/babylon.meshBuilder.ts

@@ -799,7 +799,4 @@
             return extrudedGeneric;
         }
     }
-}
-
-
-
+}

+ 4 - 0
src/PostProcess/babylon.lensRenderingPipeline.js

@@ -1,3 +1,7 @@
+// BABYLON.JS Chromatic Aberration GLSL Shader
+// Author: Olivier Guyot
+// Separates very slightly R, G and B colors on the edges of the screen
+// Inspired by Francois Tarlier & Martins Upitis
 var __extends = (this && this.__extends) || function (d, b) {
     for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
     function __() { this.constructor = d; }

+ 6 - 1
src/PostProcess/babylon.lensRenderingPipeline.ts

@@ -1,3 +1,9 @@
+// BABYLON.JS Chromatic Aberration GLSL Shader
+// Author: Olivier Guyot
+// Separates very slightly R, G and B colors on the edges of the screen
+// Inspired by Francois Tarlier & Martins Upitis
+
+
 module BABYLON {
     export class LensRenderingPipeline extends PostProcessRenderPipeline {
 
@@ -268,6 +274,5 @@ module BABYLON {
             }
             (<DynamicTexture>this._grainTexture).update(false);
         }
-
     }
 }

+ 0 - 5
src/Shaders/chromaticAberration.fragment.fx

@@ -1,8 +1,3 @@
-// BABYLON.JS Chromatic Aberration GLSL Shader
-// Author: Olivier Guyot
-// Separates very slightly R, G and B colors on the edges of the screen
-// Inspired by Francois Tarlier & Martins Upitis
-
 precision highp float;
 
 // samplers

+ 1 - 0
src/Tools/babylon.loadingScreen.js

@@ -21,6 +21,7 @@ var BABYLON;
         DefaultLoadingScreen.prototype.displayLoadingUI = function () {
             var _this = this;
             this._loadingDiv = document.createElement("div");
+            this._loadingDiv.id = "babylonjsLoadingDiv";
             this._loadingDiv.style.opacity = "0";
             this._loadingDiv.style.transition = "opacity 1.5s ease";
             // Loading text

+ 1 - 0
src/Tools/babylon.loadingScreen.ts

@@ -21,6 +21,7 @@ module BABYLON {
 		public displayLoadingUI(): void {
 			this._loadingDiv = document.createElement("div");
 
+		    this._loadingDiv.id = "babylonjsLoadingDiv";
             this._loadingDiv.style.opacity = "0";
             this._loadingDiv.style.transition = "opacity 1.5s ease";