Class: BufferGeometry

SolidML.BufferGeometry(scriptopt, criteriaopt, geometryHashopt)

THREE.BufferGeometry constructed by SolidML. SolidMLBUfferGeometry.js depends on three.js and SolidML.js. Import after these dependent files.

Constructor

new BufferGeometry(scriptopt, criteriaopt, geometryHashopt)

THREE.BufferGeometry constructed by SolidML script.
Parameters:
Name Type Attributes Default Description
script string <optional>
null script to construct object. call SolidML.BufferGeometry#build inside.
criteria object <optional>
null default criteria of this structure, specified by "set *" commands in script.
geometryHash Object.<BufferGeometry> <optional>
null hash map of source geometries and keys like {"box":new THREE.BoxBufferGeometry(1, 1, 1)}. The source geometory should be indexed.
Source:

Extends

  • THREE.BufferGeometry

Members

geometryFilter :function

filtering function(SolidML.BuildStatus)=>boolean.
Type:
  • function
Source:

indexCount :int

index count, same as BufferGeometry.index.count after build()
Type:
  • int
Source:

objectCount :int

object count. one continuous mesh is counted as 1 object.
Type:
  • int
Source:

solidML :SolidML

SolidML instance to construct object.
Type:
Source:

vertexCount :int

vertex count, same as BufferGeometry.attributes.position.count after build()
Type:
  • int
Source:

Methods

allocBuffers(isDynamicopt, indexCountopt, vertexCountopt) → {SolidML.BufferGeometry}

allocate index buffer and vertex buffer
Parameters:
Name Type Attributes Default Description
isDynamic boolean <optional>
true set THREE.BufferAttribute.dynamic
indexCount int <optional>
0 index buffer size. pass 0 to allocate by SolidML.BufferGeometry.indexCount estimated by SolidML.BufferGeometry#estimateBufferCount
vertexCount int <optional>
0 vertex buffer size. pass 0 to allocate by SolidML.BufferGeometry.vertexCount estimated by SolidML.BufferGeometry#estimateBufferCount
Source:
Returns:
this instance
Type
SolidML.BufferGeometry

build(script, criteriaopt, isDynamicopt, indexMarginopt, vertexMarginopt, filteropt) → {SolidML.BufferGeometry}

Parameters:
Name Type Attributes Default Description
script string script to construct object.
criteria object <optional>
null default criteria of this structure, specified by "set *" commands in script.
isDynamic boolean <optional>
false set THREE.BufferAttribute.dynamic
indexMargin int <optional>
0 margin for index buffer, added to requierd index buffer count
vertexMargin int <optional>
0 margin for vertex buffer, added to requierd vertex buffer count
filter function <optional>
null filter filtering function(SolidML.BuildStatus)=>boolean.
Source:
Returns:
this instance
Type
SolidML.BufferGeometry

compile(script, criteriaopt) → {SolidML.BufferGeometry}

Parse script, make a structure of recursive calls inside.
Parameters:
Name Type Attributes Default Description
script string script to construct object.
criteria object <optional>
null default criteria of this structure, specified by "set *" commands in script.
Source:
Returns:
this instance
Type
SolidML.BufferGeometry

estimateBufferCount(indexMarginopt, vertexMarginopt) → {SolidML.BufferGeometry}

estimate index, vertex and object count with some margins. Counted values are set at SolidML.BufferGeometry.indexCount, SolidML.BufferGeometry.vertexCount and SolidML.BufferGeometry.objectCount.
Parameters:
Name Type Attributes Default Description
indexMargin int <optional>
0 margin for index buffer, added to requierd index buffer count
vertexMargin int <optional>
0 margin for vertex buffer, added to requierd vertex buffer count
Source:
Returns:
this instance
Type
SolidML.BufferGeometry

isCompiled() → {boolean}

returns true when the script is already compiled
Source:
Returns:
Type
boolean

update(sortingDotProductopt) → {SolidML.BufferGeometry}

update vertex buffer and send data to gpu.
Parameters:
Name Type Attributes Default Description
sortingDotProduct THREE.Vector3 <optional>
null sort geometries by dot product with specified vector. pass null to sort by generated order. meshes are not sorted.
Source:
Returns:
this instance
Type
SolidML.BufferGeometry