From 4f6f7989dfa315c698d8753441e294d8f25b67d7 Mon Sep 17 00:00:00 2001 From: Alexander Rose <alex.rose@rcsb.org> Date: Tue, 29 Jan 2019 11:30:58 -0800 Subject: [PATCH] added Mesh.fromArrays --- src/mol-geo/geometry/mesh/mesh.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/mol-geo/geometry/mesh/mesh.ts b/src/mol-geo/geometry/mesh/mesh.ts index e8431f261..272cdfd03 100644 --- a/src/mol-geo/geometry/mesh/mesh.ts +++ b/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; -- GitLab