Materials
Index
Constructors
Properties
Accessors
Methods
Constructors
publicconstructor
Materials constructor.
Parameters
_isBackfaceCullingEnabled: boolean = true
Returns Materials
Properties
publicreadonlyreservedGpuPickClearColor
Color used to as scene.clearColor when doing gpu picking.
Accessors
publicavailableObjectCount
Number of objects (IFC products or TextureObject) that can still be added to this instance
Returns number
publicisBackfaceCullingEnabled
Returns boolean
Parameters
value: boolean
Returns void
publicmaxObjectCount
Maximum number of Ifc products and TextureObject instances material can hold.
Returns number
publicobjectCount
Number of objects (IFC products or TextureObject) this instance currently holds. Cannot be higher than maxObjectCount.
Returns number
publicstate
Changed whenever colors or properties on objects, managed by this Materials instance, change. Useful when performing checks (for exemple during rendering) to determine if something has changed between one frame and another. Let your code keep a reference to state. Whenever you need to check whether something has changed just compare your local reference with state. If they differ then colors or properties of objects have changed since the last frame. Dont forget to update the local reference afterwards.
Returns Record<string, never>
Methods
publicadd
Parameters
ifcFiles: IBimIfcLoaderElement[]
Returns void
publicclear
Returns void
publiccopyColorTo
Parameters
mesh: BimProductMesh
dst: Writeable<ArrayLike<number>>
dstOffset: number = 0
Returns void
publiccreateGpuTextureObject
Create a TextureObject.
Returns undefined | TextureObject
A valid TextureObject or undefined if the maximum number of gpu texture objects have been reached.
publicdeleteGpuTextureObject
Deletes a TextureObject.
Parameters
textureObject: number | TextureObject
Object to delete.
Returns boolean
True if deleted, otherwise false.
publicget
Parameters
isTransparent: boolean
scene: Scene
Returns Material
publicgetBabylonMeshCustomDepthMaterial
Creates a custom depth material that is used for Babylon meshes for two reasons:
- It correctly excludes the invisible fragments from the IFC meshes
- It uses a camera with a nearplane that is further away, to increase precision and thereforce reduce z fighting for effects that use depth textures written to with this material
Parameters
scene: Scene
The scene for which the depth material should be created
storeNonLinearDepth: boolean
Whether the custom depth material should write the depth linearly or logarithmically
Returns BabylonMeshDepthMaterial
The custom depth material, which was created for the scene
publicgetBimProductAndMeshById
Parameters
id: number
Returns undefined | BimProductMesh
publicgetColorComponent
Parameters
mesh: BimProductMesh
colorComponent: RgbaComponent
Returns number
publicgetGpuPickingMaterial
Parameters
sceneOrMesh: Scene | AbstractMesh
Returns Material
publicgetIFCMeshCustomDepthMaterial
Creates a custom depth material that is used for IFC meshes instead of Babylons normal depth material for two reasons:
- It correctly excludes the invisible fragments from the IFC meshes
- It uses a camera with a nearplane that is further away, to increase precision and thereforce reduce z fighting for effects that use depth textures written to with this material
Parameters
scene: Scene
The scene for which the depth material should be created
storeNonLinearDepth: boolean
Wheter the custom depth material should write the depth linearly or logarithmic
Returns IfcMeshDepthMaterial
The custom depth material, which was created for the scene
publicgetOutlineMaterial
Parameters
sceneOrMesh: Scene | AbstractMesh
Returns Material
publicgpuPickRgbToInt32
Parameters
pixels: ArrayLike<number>
offset: number
Returns number
publicintToGpuPickRgbaInPlace
Type parameters
- T: Writeable<ArrayLike<number>>
Parameters
pixelValue: number
alpha: number
dst: T
Returns T
publicrenderPropertiesFor
Sets various on/off properties pertaining to rendering of a BimProductMesh instance. A mask representing the bits that you want to flip, Legend: idw: Depth write, single bit, represents a bool, wheter the object is written into the postprocess depth buffer or not v: Visibility, 1 bit wheter the object is visible or not o: Outline, 1 bit wheter the object is outlined or not h: Highlight, 2 bits for a total of 3 different highlight colors, or no highlight if all bits are turned off p1: Plane1, if plane1 can clip the product p2: Plane2, if plane2 can clip the product p3: Plane3, if plane3 can clip the product s: Shininess, 4 bits, represents a number 0: unused bit [0|0|0|0 0|0|0|0] [0|0|0|0 0|p3|p2|p1] [0|0|0|0 s|s|s|s] [0|0|0|o h|h|v|idw]
Parameters
mesh: BimProductMesh
Mesh to read/write properties for.
Returns Uint32Bits
A Unit32Bits instance. Use to manipulate the bits in the property mask for the BimProductAndMesh instance.
publicsetColor
Parameters
mesh: BimProductMesh
color: ArrayLike<number>
Returns boolean
publicupdateDitherTexture
Parameters
ditherOptions: DitheringOptions
Returns void
Materials used by Twinfinity for rendering of IFC products and other objects.