瀏覽代碼

Update stlSerializer.ts

aWeirdo 4 年之前
父節點
當前提交
5ce679aa95
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      serializers/src/stl/stlSerializer.ts

+ 5 - 2
serializers/src/stl/stlSerializer.ts

@@ -13,9 +13,10 @@ export class STLExport {
     * @param fileName changes the downloads fileName.
     * @param fileName changes the downloads fileName.
     * @param binary changes the STL to a binary type.
     * @param binary changes the STL to a binary type.
     * @param isLittleEndian toggle for binary type exporter.
     * @param isLittleEndian toggle for binary type exporter.
+    * @param doNotBakeTransform toggle if meshes transforms should be baked or not.
     * @returns the STL as UTF8 string
     * @returns the STL as UTF8 string
     */
     */
-    public static CreateSTL(meshes: Mesh[], download: boolean = true, fileName: string = 'stlmesh', binary: boolean = false, isLittleEndian: boolean = true): any {
+    public static CreateSTL(meshes: Mesh[], download: boolean = true, fileName: string = 'stlmesh', binary: boolean = false, isLittleEndian: boolean = true, doNotBakeTransform: boolean = false): any {
 
 
         //Binary support adapted from https://gist.github.com/paulkaplan/6d5f0ab2c7e8fdc68a61
         //Binary support adapted from https://gist.github.com/paulkaplan/6d5f0ab2c7e8fdc68a61
 
 
@@ -70,7 +71,9 @@ export class STLExport {
 
 
         for (let i = 0; i < meshes.length; i++) {
         for (let i = 0; i < meshes.length; i++) {
             let mesh = meshes[i];
             let mesh = meshes[i];
-            mesh.bakeCurrentTransformIntoVertices();
+            if (!doNotBakeTransform) {
+                mesh.bakeCurrentTransformIntoVertices();
+            }
             let vertices = mesh.getVerticesData(VertexBuffer.PositionKind) || [];
             let vertices = mesh.getVerticesData(VertexBuffer.PositionKind) || [];
             let indices = mesh.getIndices() || [];
             let indices = mesh.getIndices() || [];