Sfoglia il codice sorgente

Fix for case when options.cap = Mesh.NO_CAP

When options.cap was explicitly set to Mesh.NO_CAP, it was treated as Mesh.CAP_ALL (as if the default option was wanted).
This is because Mesh.NO_CAP evaluates to 0 and 0 || 3 = 3 (=Mesh.CAP_ALL).
With this change, the cap will remain Mesh.NO_CAP when you specify this as the value for options.cap parameter.
When you omit the options.cap parameter, the cap will keep defaulting to Mesh.CAP_ALL as desired.
https://forum.babylonjs.com/t/meshbuilder-cap-parameter-for-cylinder-extrudepolygon-sides-parameter-for-box/2959/6
QuintusHegie 6 anni fa
parent
commit
c3d1b16183
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      src/Meshes/Builders/cylinderBuilder.ts

+ 1 - 1
src/Meshes/Builders/cylinderBuilder.ts

@@ -16,7 +16,7 @@ VertexData.CreateCylinder = function(options: { height?: number, diameterTop?: n
     var subdivisions: number = options.subdivisions || 1;
     var hasRings: boolean = options.hasRings ? true : false;
     var enclose: boolean = options.enclose ? true : false;
-    var cap = options.cap || Mesh.CAP_ALL;
+    var cap = (options.cap === 0) ? 0 : options.cap || Mesh.CAP_ALL;
     var arc: number = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;
     var sideOrientation: number = (options.sideOrientation === 0) ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;
     var faceUV: Vector4[] = options.faceUV || new Array<Vector4>(3);