Skip to content

[mxcad_3d API Document](../README. md)/Mx3dGeMaterial

Class: Mx3dGeMaterial ​

Representing material properties in 3D graphics, encapsulating various properties and setting methods of materials.

Hierarchy ​

Table of contents ​

Constructors ​

Methods ​

Constructors ​

constructor ​

• new Mx3dGeMaterial()

Create a default material object.

Overrides ​

Mx3dBaseObject.constructor

• new Mx3dGeMaterial(theName)

Create a material object with a specified name.

Parameters ​

NameTypeDescription
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 ​

Mx3dGeColor

Environmental light color.


Color ​

▸ Color(): Mx3dGeColor

Return the color of the material.

Returns ​

Mx3dGeColor

The color of the material.


DiffuseColor ​

▸ DiffuseColor(): Mx3dGeColor

Return diffuse color.

Returns ​

Mx3dGeColor

Diffuse reflection color.


EmissiveColor ​

▸ EmissiveColor(): Mx3dGeColor

Return the glowing color.

Returns ​

Mx3dGeColor

Luminous color.


IncreaseShine ​

▸ IncreaseShine(theDelta): void

Increase glossiness.

Parameters ​

NameTypeDescription
The Deltanumberpercentage increase

Returns ​

void


IsDifferent ​

▸ IsDifferent(theOther): boolean

Check if the current material is different from another material.

Parameters ​

NameTypeDescription
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 ​

NameTypeDescription
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 ​

MxTypeOfMaterial

Material type, see MdGe MxTypeOfMaterial。


Name ​

▸ Name(): MxNameOfMaterial

Return the name of the material.

Returns ​

MxNameOfMaterial

Material name.


ReflectionMode ​

▸ ReflectionMode(theType): boolean

Check if the specified type of reflection mode is enabled.

Parameters ​

NameTypeDescription
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 ​

MxNameOfMaterial

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 ​

NameTypeDescription
TheValueNumberOpacity coefficient (0.0 to 1.0)

Returns ​

void


SetAmbientColor ​

▸ SetAmbientColor(theColor): void

Set the ambient light color.

Parameters ​

NameTypeDescription
TheColor[Mx3dGeColor] (Mx3dGeColor. md)New ambient light color

Returns ​

void


SetColor ​

▸ SetColor(theColor): void

Set the color of the material.

Parameters ​

NameTypeDescription
TheColor[Mx3dGeColor] (Mx3dGeColor. md)New color

Returns ​

void


SetDiffuseColor ​

▸ SetDiffuseColor(theColor): void

Set diffuse reflection color.

Parameters ​

NameTypeDescription
TheColor[Mx3dGeColor] (Mx3dGeColor. md)New diffuse color

Returns ​

void


SetEmissiveColor ​

▸ SetEmissiveColor(theColor): void

Set the glowing color.

Parameters ​

NameTypeDescription
TheColor[Mx3dGeColor] (Mx3dGeColor. md)New glowing color

Returns ​

void


SetMaterialName ​

▸ SetMaterialName(theName): void

Set the name of the material.

Parameters ​

NameTypeDescription
TheNameStringNew material name

Returns ​

void


SetMaterialType ​

▸ SetMaterialType(theType): void

Set the material type.

Parameters ​

NameTypeDescription
TheType[MxTypeOfMaterial] (../enums/MdGe. MxTypeOfMaterial. md)New material types, see MdGe MxTypeOfMaterial。

Returns ​

void


SetRefractionIndex ​

▸ SetRefractionIndex(theValue): void

Set the refractive index.

Parameters ​

NameTypeDescription
TheValueNumberThe 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 ​

NameTypeDescription
TheValueNumberNew glossiness value (usually between 0 and 1)

Returns ​

void


SetSpecularColor ​

▸ SetSpecularColor(theColor): void

Set the specular reflection color.

Parameters ​

NameTypeDescription
TheColor[Mx3dGeColor] (Mx3dGeColor. md)New specular reflection color

Returns ​

void


SetTransparency ​

▸ SetTransparency(theValue): void

Set the transparency coefficient.

Parameters ​

NameTypeDescription
TheValueNumberTransparency 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 ​

Mx3dGeColor

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.