Browse Source

added Mesh.fromArrays

Alexander Rose 6 years ago
parent
commit
4f6f7989df
1 changed files with 13 additions and 0 deletions
  1. 13 0
      src/mol-geo/geometry/mesh/mesh.ts

+ 13 - 0
src/mol-geo/geometry/mesh/mesh.ts

@@ -64,6 +64,19 @@ export namespace Mesh {
         }
     }
 
+    export function fromArrays(vertices: Float32Array, indices: Uint32Array, normals: Float32Array, groups: Float32Array, vertexCount: number, triangleCount: number, normalsComputed: boolean): Mesh {
+        return {
+            kind: 'mesh',
+            vertexCount,
+            triangleCount,
+            vertexBuffer: ValueCell.create(vertices),
+            indexBuffer: ValueCell.create(indices),
+            normalBuffer: ValueCell.create(normals),
+            groupBuffer: ValueCell.create(groups),
+            normalsComputed,
+        }
+    }
+
     export function computeNormalsImmediate(mesh: Mesh) {
         if (mesh.normalsComputed) return;