vim-format
Advanced tools
Comparing version 1.0.6-dev.204 to 1.0.6-dev.205
@@ -9,3 +9,3 @@ import { BFast } from "./bfast"; | ||
scene: RemoteValue<G3dScene>; | ||
chunkCache: Map<number, G3dMesh[]>; | ||
chunkCache: Map<number, RemoteValue<G3dMesh[]>>; | ||
constructor(bfast: BFast); | ||
@@ -34,3 +34,4 @@ static fromPath(path: string): Promise<RemoteVimx>; | ||
getChunk(chunk: number): Promise<G3dMesh[]>; | ||
private requestChunk; | ||
getMesh(mesh: number): Promise<G3dMesh>; | ||
} |
@@ -56,4 +56,9 @@ "use strict"; | ||
if (cached !== undefined) { | ||
return cached; | ||
return cached.get(); | ||
} | ||
var value = new remoteValue_1.RemoteValue(() => this.requestChunk(chunk)); | ||
this.chunkCache.set(chunk, value); | ||
return value.get(); | ||
} | ||
async requestChunk(chunk) { | ||
const chunkBFast = await this.bfast.getLocalBfast(`chunk_${chunk}`, true); | ||
@@ -64,3 +69,2 @@ var ranges = await chunkBFast.getRanges(); | ||
var meshes = await Promise.all(bfasts.map(b => g3dMesh_1.G3dMesh.createFromBfast(b))); | ||
this.chunkCache.set(chunk, meshes); | ||
return meshes; | ||
@@ -67,0 +71,0 @@ } |
{ | ||
"name": "vim-format", | ||
"version": "1.0.6-dev.204", | ||
"version": "1.0.6-dev.205", | ||
"description": "The VIM format is a modern and efficient open 3D data interchange format designed for BIM and manufacturing data optimized for efficient loading and rendering on low-power devices.", | ||
@@ -5,0 +5,0 @@ "directories": { |
819413
18684