KernelCAD Documentation

DInsight Home
Skip Navigation Links.
Start page
Quick Start
Installation
Overview of the software
What is new
Collapse KernelCAD ModelsKernelCAD Models
Collapse KernelCAD ComponentsKernelCAD Components
KernelCAD Control
KernelCAD .NET Control
Methods and Properties
Menu
Model Explorer
Birds Eye View
Programming
Direct User Access
Direct Operations
Interface Queries
Printing Support
Data Types
Modes of KernelCAD Control
DIObjectGenerator class
Properties
FlatObjectArray Poperty
Context
64 bit development
Dual Mode
Initialisation Context
Overlay Editor
Memory Management
Input validation
Collapse Advanced functionalityAdvanced functionality
Collapse InterfacesInterfaces
Alphabetical list
I3DGrid
I3DBugger
I3Dpt
IAxiBase
IAxis
IBoolSection
IBoolSectionEx
IBoundary
IColor
IConstraint
IData
IDiffSurface_KC
IDIFont
IDraw
IDrawUtil
IDraw2
IElem
IElement
IKCLine
ILightSource
ILocation
ILocationEx
IMaterial
IMetrics
IMetrics2
IModel
IModel2
IModelEx
IPatch
IKCPathCollisionDetector
IProfiles
IPropertyArray
IPropertyArray2
IStdShape
IStrip
ISurface
IText
ITexture
ITransform
IUnknown
Collapse Open Cascade TechnologyOpen Cascade Technology
Collapse DataData
Collapse MovementMovement
Collapse FramesFrames
Collapse Oriented ObjectsOriented Objects
Collapse SectionsSections
Collapse GeneralGeneral
Collapse Topological InterfacesTopological Interfaces
Collapse Viewing InterfacesViewing Interfaces
Collapse Lines And CurvesLines And Curves
Collapse Symmetry InterfacesSymmetry Interfaces
Collapse Clipping plane interfacesClipping plane interfaces
Collapse AlgorithmsAlgorithms
Collapse 2D Geometry2D Geometry
Collapse Programming Samples and TutorialsProgramming Samples and Tutorials
Collapse OverviewOverview
Collapse DeploymentDeployment
Collapse .NET Samples.NET Samples
Collapse C++ SamplesC++ Samples
Collapse Visual Basic SamplesVisual Basic Samples
Collapse Delphi SamplesDelphi Samples
Collapse 3D Debugger3D Debugger
Collapse DeploymentDeployment
Licensing
Model Viewer
Open C++ Source
Technical Support
Skip Navigation LinksHome 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.