Methods
deinstantiate(object, materialMap)
Recursive function to replace instanced objects (cohort trees) with ordinary meshes
Parameters:
Name | Type | Description |
---|---|---|
object |
THREE.Object3D | Root object to deinstantiate |
materialMap |
Map.<number, THREE.Material> | (optional) Avoids duplicate materials |
Returns:
A clone of the object, with all instanced objects replaced with ordinary meshes
drawInstances(geometry, elements, material) → {THREE.InstancedMesh}
Parameters:
Name | Type | Description |
---|---|---|
geometry |
THREE.BufferGeometry | Base geometry to use |
elements |
Array.<any> | |
material |
function | Constructor for a THREE.Material (default THREE.MeshLambertMaterial) |
Returns:
Three.js Object containing the instanced objects
- Type
- THREE.InstancedMesh
drawParticles(positions, colors, size, sizeAttenuation, texturePath) → {THREE.Points}
Draw a particle point cloud
Parameters:
Name | Type | Default | Description |
---|---|---|---|
positions |
Array.<THREE.Vector3> | List of positions for all particles | |
colors |
Array.<THREE.Color> | List of colours for all particles | |
size |
number | 10 | Particle size |
sizeAttenuation |
boolean | true | If true, draw size relative to distance from camera |
texturePath |
string | resources/circle.png | Path to image used as texture |
Returns:
Three.js Object containing the points
- Type
- THREE.Points
idFromData(data) → {string}
Get a unique string for a cohort, patch, and stand
Parameters:
Name | Type | Description |
---|---|---|
data |
Object |
Returns:
Unique string identifying the cohort, patch, and stand
- Type
- string
(async) itemsFromFile(file)
Parse csv-like files with a header line and float values
where the separator is whitespace of variable length.
Parameters:
Name | Type | Description |
---|---|---|
file |
File | Text file |
- Source:
Returns:
List of items with float properties
(async) loadData(files, patchManager)
Loads data from files. Expects one file to have a name containing "veg_struct".
Other files are loaded as yearly data (with no cohort information)
Parameters:
Name | Type | Description |
---|---|---|
files |
FileList | |
patchManager |
PatchManager |
- Source:
Returns:
The populated patch manager