Selaa lähdekoodia

added colors for doubleside orientation

jbousquie 10 vuotta sitten
vanhempi
commit
c04c387f60
1 muutettua tiedostoa jossa 5 lisäystä ja 4 poistoa
  1. 5 4
      src/Mesh/babylon.mesh.vertexData.ts

+ 5 - 4
src/Mesh/babylon.mesh.vertexData.ts

@@ -607,6 +607,8 @@
                 height = options || 1;
                 depth = options || 1;
             }
+            
+            sideOrientation = sideOrientation || options.sideOrientation || Mesh.DEFAULTSIDE;
 
             for (var f = 0; f < 6; f++) {
                 if (faceUV[f] === undefined) {
@@ -615,9 +617,7 @@
                 if (faceColors[f] === undefined) {
                     faceColors[f] = new Color4(1, 1, 1, 1);
                 }
-            }
-
-            sideOrientation = sideOrientation || options.sideOrientation || Mesh.DEFAULTSIDE;
+            }            
 
             var scaleVector = new Vector3(width / 2, height / 2, depth / 2);
 
@@ -675,7 +675,8 @@
             vertexData.positions = positions;
             vertexData.normals = normals;
             vertexData.uvs = uvs;
-            vertexData.colors = colors;
+            var totalColors = (sideOrientation == Mesh.DOUBLESIDE) ? colors.concat(colors) : colors;
+            vertexData.colors = totalColors;
 
             return vertexData;
         }