vim-format
Advanced tools
Comparing version 1.0.6-dev.231 to 1.0.6-dev.232
@@ -9,3 +9,3 @@ import { BFast } from "./bfast"; | ||
scene: RemoteValue<G3dScene>; | ||
chunkCache: Map<number, RemoteValue<G3dMesh[]>>; | ||
chunkCache: Map<number, RemoteValue<G3dMesh>>; | ||
constructor(source: BFast | ArrayBuffer | string); | ||
@@ -33,5 +33,5 @@ /** | ||
*/ | ||
getChunk(chunk: number): Promise<G3dMesh[]>; | ||
getChunk(chunk: number): Promise<G3dMesh>; | ||
private requestChunk; | ||
getMesh(mesh: number): Promise<G3dMesh>; | ||
} |
@@ -64,26 +64,16 @@ "use strict"; | ||
const chunkBFast = await this.bfast.getLocalBfast(`chunk_${chunk}`, true); | ||
var ranges = await chunkBFast.getRanges(); | ||
const keys = [...ranges.keys()]; | ||
var bfasts = await Promise.all(keys.map(k => chunkBFast.getBfast(k))); | ||
var meshes = await Promise.all(bfasts.map(b => g3dMesh_1.G3dMesh.createFromBfast(b))); | ||
const scene = await this.scene.get(); | ||
meshes.forEach(m => m.scene = scene); | ||
return meshes; | ||
return g3dMesh_1.G3dMesh.createFromBfast(chunkBFast); | ||
} | ||
async getMesh(mesh) { | ||
var scene = await this.scene.get(); | ||
var chunk = scene.meshChunks[mesh]; | ||
var meshChunk = scene.meshChunks[mesh]; | ||
if (meshChunk === undefined) | ||
return undefined; | ||
var chunk = await this.getChunk(meshChunk); | ||
if (chunk === undefined) | ||
return undefined; | ||
var meshes = await this.getChunk(chunk); | ||
if (meshes === undefined) | ||
return undefined; | ||
var index = scene.meshChunkIndices[mesh]; | ||
var result = meshes[index]; | ||
if (result === undefined) | ||
return undefined; | ||
result.meshIndex = mesh; | ||
return result; | ||
chunk.meshIndex = scene.meshChunkIndices[mesh]; | ||
return chunk; | ||
} | ||
} | ||
exports.RemoteVimx = RemoteVimx; |
@@ -9,3 +9,3 @@ import { BFast } from "./bfast"; | ||
scene: RemoteValue<G3dScene>; | ||
chunkCache: Map<number, RemoteValue<G3dMesh[]>>; | ||
chunkCache: Map<number, RemoteValue<G3dMesh>>; | ||
constructor(source: BFast | ArrayBuffer | string); | ||
@@ -33,5 +33,5 @@ /** | ||
*/ | ||
getChunk(chunk: number): Promise<G3dMesh[]>; | ||
getChunk(chunk: number): Promise<G3dMesh>; | ||
private requestChunk; | ||
getMesh(mesh: number): Promise<G3dMesh>; | ||
} |
{ | ||
"name": "vim-format", | ||
"version": "1.0.6-dev.231", | ||
"version": "1.0.6-dev.232", | ||
"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": { |
814604
18547