diff --git a/src/mol-geo/geometry/mesh/mesh.ts b/src/mol-geo/geometry/mesh/mesh.ts index 287b364ac2b3524a438c7e5918057411cfadd62e..0c8c2b398823b0cf2efe826077373d5180d97ab1 100644 --- a/src/mol-geo/geometry/mesh/mesh.ts +++ b/src/mol-geo/geometry/mesh/mesh.ts @@ -177,12 +177,18 @@ export namespace Mesh { ValueCell.update(mesh.vertexBuffer, v); } - type OriginalData = { + export type OriginalData = { indexBuffer: Uint32Array vertexCount: number triangleCount: number } + /** Meshes may contain some original data in case any processing was done. */ + export function getOriginalData(x: Mesh | MeshValues) { + const { originalData } = 'kind' in x ? x.meta : x.meta.ref.value as Mesh['meta']; + return originalData as OriginalData | undefined; + } + /** * Ensure that each vertices of each triangle have the same group id. * Note that normals are copied over and can't be re-created from the new mesh. diff --git a/src/mol-gl/renderable/mesh.ts b/src/mol-gl/renderable/mesh.ts index 0e0586c8f6f444434d033e6c35e37a6449d2ff0b..6cf6789a3037a5b5372405cfc963121e8f1826e9 100644 --- a/src/mol-gl/renderable/mesh.ts +++ b/src/mol-gl/renderable/mesh.ts @@ -22,7 +22,7 @@ export const MeshSchema = { dFlipSided: DefineSpec('boolean'), dIgnoreLight: DefineSpec('boolean'), dXrayShaded: DefineSpec('boolean'), - meta: ValueSpec('any') + meta: ValueSpec('unknown') } as const; export type MeshSchema = typeof MeshSchema export type MeshValues = Values<MeshSchema> diff --git a/src/mol-gl/renderable/schema.ts b/src/mol-gl/renderable/schema.ts index 427bceb06d55e1e4c50dde6737df23d7f76cc481..9c8686e761b33128ebcb05609ded33c39416cc81 100644 --- a/src/mol-gl/renderable/schema.ts +++ b/src/mol-gl/renderable/schema.ts @@ -17,6 +17,7 @@ export type ValueKindType = { 'string': string 'boolean': boolean 'any': any + 'unknown': unknown 'm4': Mat4, 'float32': Float32Array