[mxcad_3d API Document](../README. md)/Mx3dGeMaterial
Class: Mx3dGeMaterial 
Representing material properties in 3D graphics, encapsulating various properties and setting methods of materials.
Hierarchy 
- ↳ - Mx3dGeMaterial
Table of contents 
Constructors 
Methods 
- Alpha
- AmbientColor
- Color
- DiffuseColor
- EmissiveColor
- IncreaseShine
- IsDifferent
- IsEqual
- MaterialName
- MaterialType
- Name
- ReflectionMode
- RefractionIndex
- RequestedName
- Reset
- SetAlpha
- SetAmbientColor
- SetColor
- SetDiffuseColor
- SetEmissiveColor
- SetMaterialName
- SetMaterialType
- SetRefractionIndex
- SetShininess
- SetSpecularColor
- SetTransparency
- Shininess
- SpecularColor
- StringName
- Transparency
Constructors 
constructor 
• new Mx3dGeMaterial()
Create a default material object.
Overrides 
Mx3dBaseObject.constructor
• new Mx3dGeMaterial(theName)
Create a material object with a specified name.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheName | [MxNameOfMaterial] (../enums/MdGe. MxNameOfMaterial. md) | Material name, see MdGe MxNameOfMaterial。 | 
Overrides 
Mx3dBaseObject.constructor
Methods 
Alpha 
▸ Alpha(): number
Return the opacity coefficient (0.0 is completely transparent, 1.0 is completely opaque).
Returns 
number
Transparency coefficient.
AmbientColor 
▸ AmbientColor(): Mx3dGeColor
Return the ambient light color.
Returns 
Environmental light color.
Color 
▸ Color(): Mx3dGeColor
Return the color of the material.
Returns 
The color of the material.
DiffuseColor 
▸ DiffuseColor(): Mx3dGeColor
Return diffuse color.
Returns 
Diffuse reflection color.
EmissiveColor 
▸ EmissiveColor(): Mx3dGeColor
Return the glowing color.
Returns 
Luminous color.
IncreaseShine 
▸ IncreaseShine(theDelta): void
Increase glossiness.
Parameters 
| Name | Type | Description | 
|---|---|---|
| The Delta | number | percentage increase | 
Returns 
void
IsDifferent 
▸ IsDifferent(theOther): boolean
Check if the current material is different from another material.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheOther | [Mx3dGeMaterial. md] | Another material object | 
Returns 
boolean
If the current material is different from another material, return true; otherwise, return false.
IsEqual 
▸ IsEqual(theOther): boolean
Check if the current material is equal to another material.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheOther | [Mx3dGeMaterial. md] | Another material object | 
Returns 
boolean
If the current material is equal to another material, return true; otherwise, return false.
MaterialName 
▸ MaterialName(): string
Return the name of the material (in string form).
Returns 
string
The string name of the material.
MaterialType 
▸ MaterialType(): MxTypeOfMaterial
Return the material type.
Returns 
Material type, see MdGe MxTypeOfMaterial。
Name 
▸ Name(): MxNameOfMaterial
Return the name of the material.
Returns 
Material name.
ReflectionMode 
▸ ReflectionMode(theType): boolean
Check if the specified type of reflection mode is enabled.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheType | [MxTypeOfReflection] (../enums/MdGe. MxTypeOfReflection. md) | Reflection type, see MdGe MxTypeOfReflection。 | 
Returns 
boolean
If the reflection mode of the specified type is enabled, return true; otherwise, return false.
RefractionIndex 
▸ RefractionIndex(): number
Return refractive index.
Returns 
number
Refractive index value.
RequestedName 
▸ RequestedName(): MxNameOfMaterial
Return the requested material name.
Returns 
The name of the requested material.
Reset 
▸ Reset(): void
Reset material properties to default values.
Returns 
void
SetAlpha 
▸ SetAlpha(theValue): void
Set the opacity coefficient.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheValue | Number | Opacity coefficient (0.0 to 1.0) | 
Returns 
void
SetAmbientColor 
▸ SetAmbientColor(theColor): void
Set the ambient light color.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheColor | [Mx3dGeColor] (Mx3dGeColor. md) | New ambient light color | 
Returns 
void
SetColor 
▸ SetColor(theColor): void
Set the color of the material.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheColor | [Mx3dGeColor] (Mx3dGeColor. md) | New color | 
Returns 
void
SetDiffuseColor 
▸ SetDiffuseColor(theColor): void
Set diffuse reflection color.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheColor | [Mx3dGeColor] (Mx3dGeColor. md) | New diffuse color | 
Returns 
void
SetEmissiveColor 
▸ SetEmissiveColor(theColor): void
Set the glowing color.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheColor | [Mx3dGeColor] (Mx3dGeColor. md) | New glowing color | 
Returns 
void
SetMaterialName 
▸ SetMaterialName(theName): void
Set the name of the material.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheName | String | New material name | 
Returns 
void
SetMaterialType 
▸ SetMaterialType(theType): void
Set the material type.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheType | [MxTypeOfMaterial] (../enums/MdGe. MxTypeOfMaterial. md) | New material types, see MdGe MxTypeOfMaterial。 | 
Returns 
void
SetRefractionIndex 
▸ SetRefractionIndex(theValue): void
Set the refractive index.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheValue | Number | The new refractive index value must be greater than or equal to 1.0 | 
Returns 
void
SetShininess 
▸ SetShininess(theValue): void
Set the glossiness of the material.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheValue | Number | New glossiness value (usually between 0 and 1) | 
Returns 
void
SetSpecularColor 
▸ SetSpecularColor(theColor): void
Set the specular reflection color.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheColor | [Mx3dGeColor] (Mx3dGeColor. md) | New specular reflection color | 
Returns 
void
SetTransparency 
▸ SetTransparency(theValue): void
Set the transparency coefficient.
Parameters 
| Name | Type | Description | 
|---|---|---|
| TheValue | Number | Transparency coefficient (0.0 to 1.0) | 
Returns 
void
Shininess 
▸ Shininess(): number
Return the glossiness of the material.
Returns 
number
Glossiness value.
SpecularColor 
▸ SpecularColor(): Mx3dGeColor
Return the specular reflection color.
Returns 
Mirror reflection color.
StringName 
▸ StringName(): string
Return the string representation of the material.
Returns 
string
The string name of the material.
Transparency 
▸ Transparency(): number
Return the transparency coefficient (0.0 is completely transparent, 1.0 is completely opaque).
Returns 
number
Transparency coefficient.