Class: Materials
Class containing material options
Hierarchy
- Materials
Index
Properties
Methods
- _createThreeMaterial
- _getColorHexString
- _getColorName
- _getSize
- _getTextureDefinition
- _loadTexture
- _loadTextures
- getColorString
- getMaterial
- getMaterialDisplayName
- getMaterialId
- getPhysicsMaterial
- getPlateMaterialDisplayName
- getPlateMaterialId
- getStiffness
- getTexture
- getTextureSurfaceUrlsAndColor
- loadExternalObjectMaterial
- loadThreeMaterial
- materialsEqual
- plateMaterialsEqual
Properties
Static Private renderWireframe
▪ renderWireframe: boolean = Config.getAndWatch("rendering.renderWireframe", v => (Materials.renderWireframe = v)) || false
Defined in src/model/visualization/materials/Materials.ts:78
Methods
Static Private _createThreeMaterial
▸ _createThreeMaterial(materialDefinition: MaterialDefinition, textureKey: TextureKey): MixMapEngravingMaterial
Defined in src/model/visualization/materials/Materials.ts:290
Parameters:
| Name | Type |
|---|---|
materialDefinition |
MaterialDefinition |
textureKey |
TextureKey |
Returns: MixMapEngravingMaterial
Static Private _getColorHexString
▸ _getColorHexString(color: number | null): string
Defined in src/model/visualization/materials/Materials.ts:261
Parameters:
| Name | Type |
|---|---|
color |
number | null |
Returns: string
the color as string of the form "#ff0000". If null is given, returns an empty string
Static Private _getColorName
▸ _getColorName(color: number): string
Defined in src/model/visualization/materials/Materials.ts:265
Parameters:
| Name | Type |
|---|---|
color |
number |
Returns: string
Static Private _getSize
▸ _getSize(materialDefinition: MaterialDefinition, textureKey: TextureKey): object
Defined in src/model/visualization/materials/Materials.ts:269
Parameters:
| Name | Type |
|---|---|
materialDefinition |
MaterialDefinition |
textureKey |
TextureKey |
Returns: object
-
height: number
-
width: number
Static Private _getTextureDefinition
▸ _getTextureDefinition(materialDefinition: MaterialDefinition, textureKey: TextureKey): ITextureDefinition
Defined in src/model/visualization/materials/Materials.ts:277
Parameters:
| Name | Type |
|---|---|
materialDefinition |
MaterialDefinition |
textureKey |
TextureKey |
Returns: ITextureDefinition
Static Private _loadTexture
▸ _loadTexture(textureUrl: string): Promise‹threeTexture›
Defined in src/model/visualization/materials/Materials.ts:345
Parameters:
| Name | Type |
|---|---|
textureUrl |
string |
Returns: Promise‹threeTexture›
Static Private _loadTextures
▸ _loadTextures(textureUrls: string[]): Promise‹threeTexture[]›
Defined in src/model/visualization/materials/Materials.ts:341
Parameters:
| Name | Type |
|---|---|
textureUrls |
string[] |
Returns: Promise‹threeTexture[]›
Static getColorString
▸ getColorString(material: IMaterial): string
Defined in src/model/visualization/materials/Materials.ts:173
Parameters:
| Name | Type |
|---|---|
material |
IMaterial |
Returns: string
the hex color string for the fallback color of the given material (e.g. #ffaabb). If the material is transparent, white is added to the color accordingly. If the material is colored, the color is added accordingly.
Static getMaterial
▸ getMaterial(material: IMaterial): MaterialDefinition
Defined in src/model/visualization/materials/Materials.ts:248
Parameters:
| Name | Type |
|---|---|
material |
IMaterial |
Returns: MaterialDefinition
an instance of MaterialDefinition with the given properties
Static getMaterialDisplayName
▸ getMaterialDisplayName(material: IMaterial): string
Defined in src/model/visualization/materials/Materials.ts:98
Parameters:
| Name | Type |
|---|---|
material |
IMaterial |
Returns: string
a string that describes the material in a way that is suitable for displaying it to the user
Static getMaterialId
▸ getMaterialId(material: IMaterial): string
Defined in src/model/visualization/materials/Materials.ts:107
Parameters:
| Name | Type |
|---|---|
material |
IMaterial |
Returns: string
a string that uniquely identifies the given material
Static getPhysicsMaterial
▸ getPhysicsMaterial(material: IMaterial): CANNON.Material
Defined in src/model/visualization/materials/Materials.ts:187
Parameters:
| Name | Type |
|---|---|
material |
IMaterial |
Returns: CANNON.Material
a shared instance of a CANNON.Material with the parameters of the material specified by material
Static getPlateMaterialDisplayName
▸ getPlateMaterialDisplayName(material: IPlateMaterial): string
Defined in src/model/visualization/materials/Materials.ts:114
Parameters:
| Name | Type |
|---|---|
material |
IPlateMaterial |
Returns: string
a string that describes the plate material in a way that is suitable for displaying it to the user
Static getPlateMaterialId
▸ getPlateMaterialId(material: IPlateMaterial): Promise‹string›
Defined in src/model/visualization/materials/Materials.ts:121
Parameters:
| Name | Type |
|---|---|
material |
IPlateMaterial |
Returns: Promise‹string›
a string that uniquely identifies the given material
Static getStiffness
▸ getStiffness(material: IMaterial): number
Defined in src/model/visualization/materials/Materials.ts:199
Parameters:
| Name | Type |
|---|---|
material |
IMaterial |
Returns: number
Static getTexture
▸ getTexture(material: IMaterial, textureKey: TextureKey, shared: boolean, renderCutouts: boolean): KyubTexture
Defined in src/model/visualization/materials/Materials.ts:136
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
material |
IMaterial | - | - |
textureKey |
TextureKey | - | the key for the texture (usually either Surface, Side or PolishedSide) |
shared |
boolean | true | whether the used THREE.Material may be shared with other objects. If true, you should consider the returned object immutable. Set this to false if you want an instance you can modify. |
renderCutouts |
boolean | true | whether the material is supposed to have renderCutouts set (used for plate margins) |
Returns: KyubTexture
a new Texture instance with the right material for the right textureKey
Static getTextureSurfaceUrlsAndColor
▸ getTextureSurfaceUrlsAndColor(material: IMaterial): object
Defined in src/model/visualization/materials/Materials.ts:152
Parameters:
| Name | Type |
|---|---|
material |
IMaterial |
Returns: object
the available textures for the surface of this material, as file path and the colorization of the textures, if any, given as a color string (e.g. #ff0000) and the strength of of the colorization as number between 0 and 1
-
colorStrength? : number
-
colorString? : string
-
textureUrls: string[]
Static loadExternalObjectMaterial
▸ loadExternalObjectMaterial(materialType: string): void
Defined in src/model/visualization/materials/Materials.ts:239
Parameters:
| Name | Type |
|---|---|
materialType |
string |
Returns: void
Static loadThreeMaterial
▸ loadThreeMaterial(material: IMaterial, textureKey: TextureKey, share: boolean, renderCutouts: boolean): MixMapEngravingMaterial
Defined in src/model/visualization/materials/Materials.ts:203
Parameters:
| Name | Type | Default |
|---|---|---|
material |
IMaterial | - |
textureKey |
TextureKey | - |
share |
boolean | true |
renderCutouts |
boolean | true |
Returns: MixMapEngravingMaterial
Static materialsEqual
▸ materialsEqual(materialA: IMaterial, materialB: IMaterial): boolean
Defined in src/model/visualization/materials/Materials.ts:91
Parameters:
| Name | Type |
|---|---|
materialA |
IMaterial |
materialB |
IMaterial |
Returns: boolean
if two given materials are strictly equal (===) regarding every IMaterial property.
Static plateMaterialsEqual
▸ plateMaterialsEqual(materialA: IPlateMaterial, materialB: IPlateMaterial): boolean
Defined in src/model/visualization/materials/Materials.ts:84
Parameters:
| Name | Type |
|---|---|
materialA |
IPlateMaterial |
materialB |
IPlateMaterial |
Returns: boolean
if two given plate materials are strictly equal (===) regarding every IPlateMaterials property.