MaterialAPI¶
Interface MaterialAPI
changeMaterial(
materialId: number,
properties: MaterialProperties,
): MaterialProperties;
createMaterial(properties?: MaterialProperties): number;
getMaterialData(materialId: number): MaterialProperties;
getMaterials(): number[];
removeMaterial(materialId: number, safe?: boolean): RemoveState;
}
Hierarchy (View Summary)
- MaterialAPI
Methods
change Material
ExperimentalExperimental. May be changed in the future without notice.
Changes one or more properties of a material with the specified ID and triggers a MaterialChangedEvent.
Parameters
- materialId: number
The ID of the material you want to change.
- properties: MaterialProperties
The properties of the material you want change.
Returns MaterialProperties
An object with the changed properties.
- materialId: number
create Material
ExperimentalExperimental. May be changed in the future without notice.
Creates a new material and triggers a MaterialCreatedEvent.
Parameters
Optionalproperties: MaterialPropertiesInitial properties of the created material.
Returns number
The ID of the newly created material.
get Material Data
ExperimentalExperimental. May be changed in the future without notice.
Returns the properties of the material entity with the specified ID.
Parameters
- materialId: number
The ID of the material entity.
Returns MaterialProperties
The properties of the material entity.
- materialId: number
get Materials
ExperimentalExperimental. May be changed in the future without notice.
Returns the IDs of all material entities in the webvis context.
Returns number[]
The IDs of all available materials
remove Material
ExperimentalExperimental. May be changed in the future without notice.
Removes the material from the scene and all related snapshots and triggers a MaterialRemovedEvent.
Parameters
- materialId: number
The ID of the material.
Optionalsafe: booleanPerforms a safe remove which interrupts the removal process if the material is part of one or more Snapshots. Default: false
Returns RemoveState
The resulting state of the removal process.
- materialId: number
MaterialAPI
Overview
The MaterialAPI provides a set of methods for creating and managing materials in a webvis context. It allows you to:
Quick Start
The fastest way to get familiar with the MaterialAPI is by creating a material and assigning it to a node. The material can then be updated later and removed when it is no longer needed:
Events
The following events are associated with the MaterialAPI: