IMaterial Interface
- GetColor
- SetColor
- GetAlpha
- SetAlpha
- GetShininess
- SetShininess
- IsLightingEnabled
- SetLightingEnabled
- GetUseForWire
- SetUseForWire
- GetWireFrameColor
- SetWireFrameColor
- GetUseGlobalWireColor
- SetUseGlobalWireColor
IMaterial can obtained via IEntity_DG > GetAppearance() > IMaterial.
See also Object Array Sample,
Interface List
HRESULT GetColor( int nComponent, float * pfRed, float * pfGreen, float * pfBlue)
Parameters
nComponent
- [in] index of the component - integer value between 0 and 2 for
respectively ambient, diffuse, specular component of the material. For C/C++
languages symbolic values for components are defined in
Samples\VC\Include\DIInterface.h file of the installation directory.
pfRed, pfGreen, pfBlue - [out]
pointers to variable which will
receive three Red, Green, and Blue float components of the color.
Return Values
- S_OK in case of
success.
Remarks
Retrieves ambient, diffuse or specular components of the material.
HRESULT SetColor( int nComponent, float fRed, float fGreen, float fBlue)
Parameters
nComponent
- [in] index of the component - integer value between 0 and 2 for
respectively ambient, diffuse, specular component of the material's color.
fRed, fGreen, fBlue , - [in]
Three Red, Green, and Blue float components of the color.
Return Values
- S_OK in case of
success.
Remarks
Modifies ambient, diffuse or specular components of the material. Normally to
change a color of an object it is recommended to call this method for both nComponent
= 0 and 1 (ambient and diffuse) with the same color values. The specular
component in most situations should remain unchanged with fRed = fGreen
= fBlue = 1
(white color)
HRESULT
GetAlpha( int nComponent, float * pfAlpha)
Parameters
nComponent
- [in] index of the component - integer value between 0 and 2 for
respectively ambient, diffuse, specular component of the material's color and
shininess.
pfAlpha - [out]
pointer to float variable which will receive the value of alpha transparency
component.
Return Values
- S_OK in case of
success.
Remarks
Retrieves the value of alpha transparency component. The alpha component is a
float number in range 0.0 to 1.0. The lower the value the more transparent
material is. See also remarks for SetAlpha
method below.
HRESULT SetAlpha( int nComponent, float fAlpha)
Parameters
nComponent
- [in] index of the component - integer value between 0 and 2 for
respectively ambient, diffuse, specular component of the material's color and
shininess.
fAlpha - [in] New value of alpha
transparency component.
Return Values
- S_OK in case of
success.
Remarks
Sets new value of alpha transparency component. The alpha component is a
float number in range 0.0 to 1.0. The lower the value the more
transparent material is. To have any effect, transparency must be enabled with the help of
IView2.Enable( (int)EEnableBit.eEnableTransparency,
true
). Decimal value 1024 of EEnableBit.
eEnableTransparency or DI_TRANSPARENCY declared in Samples\VC\Include\DIInterface.h
can also be used. for the first parameter.
Normally it is sufficient to call this method with nComponent
= 1 (diffuse component). Alpha values of ambient and specular components
have very little effect.
HRESULT
GetShininess( float * pfShininess)
Parameters
pfShininess - [out]
pointer to float variable, which will receive value of shininess of the
material.
Return Values
- S_OK in case of
success.
Remarks
Retrieves shininess of the material. Shininess is afloat number in range
0.0 to 128.0. The higher the value is, the smaller and brighter are
highlights on the surface.
HRESULT SetShininess( float fShininess)
Parameters
fShininess - [in]
New value of shininess.
Return Values
- S_OK in case of success.
Remarks
Modifies shininess of the material. Shininess is afloat number in range
0.0 to 128.0. The higher the value is, the smaller and brighter are
highlights on the surface.
HRESULT IsLightingEnabled(VARIANT_BOOL* enabled)
enabled - [out,retval]
HRESULT SetLightingEnabled(VARIANT_BOOL enabled)
In this release this attribute is used only for entities with Mesh type geometries, which have
per vertex color
HRESULT GetUseForWire(VARIANT_BOOL* enabled)
Returns UseForWire flag. If it is true surface diffuse color is used for wire of mesh or iso curves
HRESULT SetUseForWire(VARIANT_BOOL enabled)
Sets UseForWire flag. If it is true surface diffuse color is used for wire of mesh or iso curves
HRESULT GetWireFrameColor(float* red, float* green, float* blue)
When UseForWire is false, the wireframe color is used to render wire of mesh or iso curves
HRESULT SetWireFrameColor(float red, float green, float blue)
Modifies wireframe color. When UseForWire is false, the wireframe color is used to render wire of mesh or iso curves
HRESULT GetUseGlobalWireColor(VARIANT_BOOL* bUse)
When UseGlobalWireColor flag of the material is true, the wireframe is rendered with the per view wire color set in the component context
HRESULT SetUseGlobalWireColor(VARIANT_BOOL bUse)
Modifies UseGlobalWireColor flag of the material. See the previous comment
|