Skip to content
Snippets Groups Projects
Commit 4f6f7989 authored by Alexander Rose's avatar Alexander Rose
Browse files

added Mesh.fromArrays

parent d9bd2b29
No related branches found
No related tags found
No related merge requests found
...@@ -64,6 +64,19 @@ export namespace Mesh { ...@@ -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) { export function computeNormalsImmediate(mesh: Mesh) {
if (mesh.normalsComputed) return; if (mesh.normalsComputed) return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment