vim-format
Advanced tools
Comparing version 1.0.6-dev.230 to 1.0.6-dev.231
@@ -11,2 +11,3 @@ /** | ||
export declare class MeshAttributes { | ||
static meshSubmeshOffset: string; | ||
static meshOpaqueSubmeshCount: string; | ||
@@ -18,3 +19,2 @@ static submeshIndexOffsets: string; | ||
static indices: string; | ||
static all: string[]; | ||
} | ||
@@ -31,3 +31,4 @@ /** | ||
meshIndex: number; | ||
readonly meshOpaqueSubmeshCount: number; | ||
readonly meshSubmeshOffset: Int32Array; | ||
readonly meshOpaqueSubmeshCount: Int32Array; | ||
readonly submeshIndexOffset: Int32Array; | ||
@@ -44,14 +45,14 @@ readonly submeshVertexOffset: Int32Array; | ||
static readonly DEFAULT_COLOR: Float32Array; | ||
constructor(meshOpaqueSubmeshCount: number, submeshIndexOffsets: Int32Array, submeshVertexOffsets: Int32Array, submeshMaterials: Int32Array, indices: Int32Array | Uint32Array, positions: Float32Array); | ||
constructor(meshSubmeshOffset: Int32Array, meshOpaqueSubmeshCount: Int32Array, submeshIndexOffsets: Int32Array, submeshVertexOffsets: Int32Array, submeshMaterials: Int32Array, indices: Int32Array | Uint32Array, positions: Float32Array); | ||
static createFromBfast(bfast: BFast): Promise<G3dMesh>; | ||
getVertexStart(section?: MeshSection): number; | ||
getVertexEnd(section?: MeshSection): number; | ||
getVertexCount(section?: MeshSection): number; | ||
getIndexStart(section?: MeshSection): number; | ||
getIndexEnd(section?: MeshSection): number; | ||
getIndexCount(section?: MeshSection): number; | ||
getHasTransparency(): boolean; | ||
getSubmeshStart(section: MeshSection): number; | ||
getSubmeshEnd(section: MeshSection): number; | ||
getSubmeshCount(section: MeshSection): number; | ||
getVertexStart(mesh: number, section?: MeshSection): number; | ||
getVertexEnd(mesh: number, section?: MeshSection): number; | ||
getVertexCount(mesh: number, section?: MeshSection): number; | ||
getIndexStart(mesh: number, section?: MeshSection): number; | ||
getIndexEnd(mesh: number, section?: MeshSection): number; | ||
getIndexCount(mesh: number, section?: MeshSection): number; | ||
getHasTransparency(mesh: number): boolean; | ||
getSubmeshStart(mesh: number, section: MeshSection): number; | ||
getSubmeshEnd(mesh: number, section: MeshSection): number; | ||
getSubmeshCount(mesh: number, section: MeshSection): number; | ||
getSubmeshIndexStart(submesh: number): number; | ||
@@ -58,0 +59,0 @@ getSubmeshIndexEnd(submesh: number): number; |
@@ -14,2 +14,3 @@ "use strict"; | ||
exports.MeshAttributes = MeshAttributes; | ||
MeshAttributes.meshSubmeshOffset = 'g3d:mesh:submeshOffset:0:int32:1'; | ||
MeshAttributes.meshOpaqueSubmeshCount = 'g3d:mesh:opaquesubmeshcount:0:int32:1'; | ||
@@ -21,10 +22,2 @@ MeshAttributes.submeshIndexOffsets = 'g3d:submesh:indexoffset:0:int32:1'; | ||
MeshAttributes.indices = 'g3d:corner:index:0:int32:1'; | ||
MeshAttributes.all = [ | ||
MeshAttributes.meshOpaqueSubmeshCount, | ||
MeshAttributes.submeshIndexOffsets, | ||
MeshAttributes.submeshVertexOffsets, | ||
MeshAttributes.submeshMaterials, | ||
MeshAttributes.positions, | ||
MeshAttributes.indices, | ||
]; | ||
/** | ||
@@ -38,3 +31,4 @@ * G3D is a simple, efficient, generic binary format for storing and transmitting geometry. | ||
class G3dMesh { | ||
constructor(meshOpaqueSubmeshCount, submeshIndexOffsets, submeshVertexOffsets, submeshMaterials, indices, positions) { | ||
constructor(meshSubmeshOffset, meshOpaqueSubmeshCount, submeshIndexOffsets, submeshVertexOffsets, submeshMaterials, indices, positions) { | ||
this.meshSubmeshOffset = meshSubmeshOffset; | ||
this.meshOpaqueSubmeshCount = meshOpaqueSubmeshCount; | ||
@@ -49,3 +43,4 @@ this.submeshIndexOffset = submeshIndexOffsets; | ||
const values = await Promise.all([ | ||
bfast.getValue(MeshAttributes.meshOpaqueSubmeshCount, 0).then(v => v), | ||
bfast.getInt32Array(MeshAttributes.meshOpaqueSubmeshCount), | ||
bfast.getInt32Array(MeshAttributes.meshSubmeshOffset), | ||
bfast.getInt32Array(MeshAttributes.submeshIndexOffsets), | ||
@@ -60,44 +55,45 @@ bfast.getInt32Array(MeshAttributes.submeshVertexOffsets), | ||
// ------------- Mesh ----------------- | ||
getVertexStart(section = 'all') { | ||
const sub = this.getSubmeshStart(section); | ||
getVertexStart(mesh, section = 'all') { | ||
const sub = this.getSubmeshStart(mesh, section); | ||
return this.getSubmeshVertexStart(sub); | ||
} | ||
getVertexEnd(section = 'all') { | ||
const sub = this.getSubmeshEnd(section); | ||
getVertexEnd(mesh, section = 'all') { | ||
const sub = this.getSubmeshEnd(mesh, section); | ||
return this.getSubmeshVertexStart(sub); | ||
} | ||
getVertexCount(section = 'all') { | ||
return this.getVertexEnd(section) - this.getVertexStart(section); | ||
getVertexCount(mesh, section = 'all') { | ||
return this.getVertexEnd(mesh, section) - this.getVertexStart(mesh, section); | ||
} | ||
getIndexStart(section = 'all') { | ||
const sub = this.getSubmeshStart(section); | ||
getIndexStart(mesh, section = 'all') { | ||
const sub = this.getSubmeshStart(mesh, section); | ||
return this.getSubmeshIndexStart(sub); | ||
} | ||
getIndexEnd(section = 'all') { | ||
const sub = this.getSubmeshEnd(section); | ||
getIndexEnd(mesh, section = 'all') { | ||
const sub = this.getSubmeshEnd(mesh, section); | ||
return this.getSubmeshIndexStart(sub); | ||
} | ||
getIndexCount(section = 'all') { | ||
return this.getIndexEnd(section) - this.getIndexStart(section); | ||
getIndexCount(mesh, section = 'all') { | ||
return this.getIndexEnd(mesh, section) - this.getIndexStart(mesh, section); | ||
} | ||
getHasTransparency() { | ||
return this.meshOpaqueSubmeshCount < this.submeshIndexOffset.length; | ||
getHasTransparency(mesh) { | ||
return this.getSubmeshCount(mesh, 'transparent') > 0; | ||
} | ||
// ------------- Submeshes ----------------- | ||
getSubmeshStart(section) { | ||
if (section === 'all') | ||
return 0; | ||
if (section === 'opaque') | ||
return 0; | ||
return this.meshOpaqueSubmeshCount; | ||
getSubmeshStart(mesh, section) { | ||
if (section === 'all' || section === 'opaque') { | ||
return this.meshSubmeshOffset[mesh]; | ||
} | ||
return this.meshSubmeshOffset[mesh] + this.meshOpaqueSubmeshCount[mesh]; | ||
} | ||
getSubmeshEnd(section) { | ||
if (section === 'all') | ||
return this.submeshIndexOffset.length; | ||
if (section === 'transparent') | ||
return this.submeshIndexOffset.length; | ||
return this.meshOpaqueSubmeshCount; | ||
getSubmeshEnd(mesh, section) { | ||
if (section === 'opaque') { | ||
return this.meshSubmeshOffset[mesh] + this.meshOpaqueSubmeshCount[mesh]; | ||
} | ||
if (mesh + 1 < this.meshSubmeshOffset.length) { | ||
return this.meshSubmeshOffset[mesh + 1]; | ||
} | ||
return this.submeshIndexOffset.length; | ||
} | ||
getSubmeshCount(section) { | ||
return this.getSubmeshEnd(section) - this.getSubmeshStart(section); | ||
getSubmeshCount(mesh, section) { | ||
return this.getSubmeshEnd(mesh, section) - this.getSubmeshStart(mesh, section); | ||
} | ||
@@ -104,0 +100,0 @@ getSubmeshIndexStart(submesh) { |
@@ -11,2 +11,3 @@ /** | ||
export declare class MeshAttributes { | ||
static meshSubmeshOffset: string; | ||
static meshOpaqueSubmeshCount: string; | ||
@@ -18,3 +19,2 @@ static submeshIndexOffsets: string; | ||
static indices: string; | ||
static all: string[]; | ||
} | ||
@@ -31,3 +31,4 @@ /** | ||
meshIndex: number; | ||
readonly meshOpaqueSubmeshCount: number; | ||
readonly meshSubmeshOffset: Int32Array; | ||
readonly meshOpaqueSubmeshCount: Int32Array; | ||
readonly submeshIndexOffset: Int32Array; | ||
@@ -44,14 +45,14 @@ readonly submeshVertexOffset: Int32Array; | ||
static readonly DEFAULT_COLOR: Float32Array; | ||
constructor(meshOpaqueSubmeshCount: number, submeshIndexOffsets: Int32Array, submeshVertexOffsets: Int32Array, submeshMaterials: Int32Array, indices: Int32Array | Uint32Array, positions: Float32Array); | ||
constructor(meshSubmeshOffset: Int32Array, meshOpaqueSubmeshCount: Int32Array, submeshIndexOffsets: Int32Array, submeshVertexOffsets: Int32Array, submeshMaterials: Int32Array, indices: Int32Array | Uint32Array, positions: Float32Array); | ||
static createFromBfast(bfast: BFast): Promise<G3dMesh>; | ||
getVertexStart(section?: MeshSection): number; | ||
getVertexEnd(section?: MeshSection): number; | ||
getVertexCount(section?: MeshSection): number; | ||
getIndexStart(section?: MeshSection): number; | ||
getIndexEnd(section?: MeshSection): number; | ||
getIndexCount(section?: MeshSection): number; | ||
getHasTransparency(): boolean; | ||
getSubmeshStart(section: MeshSection): number; | ||
getSubmeshEnd(section: MeshSection): number; | ||
getSubmeshCount(section: MeshSection): number; | ||
getVertexStart(mesh: number, section?: MeshSection): number; | ||
getVertexEnd(mesh: number, section?: MeshSection): number; | ||
getVertexCount(mesh: number, section?: MeshSection): number; | ||
getIndexStart(mesh: number, section?: MeshSection): number; | ||
getIndexEnd(mesh: number, section?: MeshSection): number; | ||
getIndexCount(mesh: number, section?: MeshSection): number; | ||
getHasTransparency(mesh: number): boolean; | ||
getSubmeshStart(mesh: number, section: MeshSection): number; | ||
getSubmeshEnd(mesh: number, section: MeshSection): number; | ||
getSubmeshCount(mesh: number, section: MeshSection): number; | ||
getSubmeshIndexStart(submesh: number): number; | ||
@@ -58,0 +59,0 @@ getSubmeshIndexEnd(submesh: number): number; |
{ | ||
"name": "vim-format", | ||
"version": "1.0.6-dev.230", | ||
"version": "1.0.6-dev.231", | ||
"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": { |
815059
18557