parser.ts 716 B

123456789101112131415161718192021222324
  1. /**
  2. * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  5. */
  6. import { ReaderResult as Result } from '../result'
  7. import { Task, RuntimeContext } from 'mol-task'
  8. import { Mesh } from 'mol-geo/geometry/mesh/mesh';
  9. async function parseInternal(data: string, ctx: RuntimeContext): Promise<Result<Mesh>> {
  10. // TODO
  11. const mesh: Mesh = Mesh.createEmpty();
  12. // Mesh.computeNormalsImmediate(mesh)
  13. return Result.success(mesh);
  14. }
  15. export function parse(data: string) {
  16. return Task.create<Result<Mesh>>('Parse OBJ', async ctx => {
  17. return await parseInternal(data, ctx);
  18. });
  19. }
  20. export default parse;