Applications use the methods of the Direct3DRMMaterial2 interface to interact with material objects.
A material defines how a surface reflects light. A material has two components: an emissive property and a specular property, whose brightness is determined by a power setting. The value of the power determines the sharpness of the reflected highlights, with a value of 5 giving a metallic appearance and higher values giving a more plastic appearance.
An application can control the emission of a material by using the GetEmissive and SetEmissive methods, the specular component by using the GetSpecular and SetSpecular methods, and the power by using the GetPower and SetPower methods.
A Direct3DRMMaterial2 object uses the object's face color as the ambient color until SetAmbient is called.
The methods of the Direct3DRMMaterial2 interface can be organized into the following groups.
Ambient GetAmbient SetAmbient Emission GetEmissive SetEmissive Power for specular exponent GetPower SetPower Specular GetSpecular SetSpecular
The Direct3DRMMaterial2 interface inherits the following methods from the Direct3DRMObject interface.
Obtain the Direct3DRMMaterial object by using the Direct3DRM3.CreateMaterial method.
Retrieves the current ambient value for the material.
Syntax
object.GetAmbient(r As Single, g As Single, b As Single)
Parts
- object
- Object expression that resolves to a Direct3DRMMaterial2 object.
- r
- Red component of the ambient color.
- g
- Green component of the ambient color.
- b
- Blue component of the ambient color.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
Retrieves the setting for the emissive property of a material. The setting of this property is the color and intensity of the light the object emits.
Syntax
object.GetEmissive(r As Single, g As Single, b As Single)
Parts
- object
- Object expression that resolves to a Direct3DRMMaterial2 object.
- r, g, and b
- Red, green, and blue components of the emissive color.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
See Also
Retrieves the power used for the specular exponent in the given material.
Syntax
object.GetPower( ) As Single
Parts
- object
- Object expression that resolves to a Direct3DRMMaterial2 object.
Return Value
Returns the value specifying the power of the specular exponent.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
See Also
Retrieves the color of the specular highlights of a material.
Syntax
object.GetSpecular(r As Single, g As Single, b As Single)
Parts
- object
- Object expression that resolves to a Direct3DRMMaterial2 object.
- r, g, and b
- Red, green, and blue components of the color of the specular highlights when the method returns.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
See Also
Sets the ambient value for the material. The default is the diffuse color.
Syntax
object.SetAmbient(r As Single, g As Single, b As Single)
Parts
- object
- Object expression that resolves to a Direct3DRMMaterial2 object.
- r
- Red component of the ambient color.
- g
- Green component of the ambient color.
- b
- Blue component of the ambient color.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
Sets the emissive property of a material.
Syntax
object.SetEmissive(r As Single, g As Single, b As Single)
Parts
- object
- Object expression that resolves to a Direct3DRMMaterial2 object.
- r, g, and b
- Red, green, and blue components of the emissive color.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
Remarks
This method is also used to add an emissive property key to a Direct3DRMMaterialInterpolator object.
See Also
Sets the power used for the specular exponent in a material.
Syntax
object.SetPower(power As Single)
Parts
- object
- Object expression that resolves to a Direct3DRMMaterial2 object.
- power
- New specular exponent.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
Remarks
This method is also used to add a spectral power key to a Direct3DRMMaterialInterpolator object.
See Also
Sets the color of the specular highlights for a material.
Syntax
object.SetSpecular(r As Single, g As Single, b As Single)
Parts
- object
- Object expression that resolves to a Direct3DRMMaterial2 object.
- r, g, and b
- Red, green, and blue components of the color of the specular highlights.
Error Values
For a list of possible errors, see Direct3D Retained Mode Error Values.
Remarks
This method is also used to add a spectral color key to a Direct3DRMMaterialInterpolator object.
See Also
Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.