Home Page > KernelCAD Components > Interfaces > IMaterial
IMaterial Interface
IMaterial Interface
- GetColor
- SetColor
- GetAlpha
- SetAlpha
- GetShininess
- SetShininess
IMaterial can be queried from the correspondent
ISection.
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.
RRemarks
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 lover 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.
RRemarks
Sets new value of alpha transparency component. The alpha component is a
float number in range 0.0 to 1.0. The lover 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.
|