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 > Sections > Mesh interfaces > IMeshShading_KC
IMeshShading_KC Interface

IMeshShading_KC(64) Interface

SetShadingType
GetShadingType
SetVertexColor
GetVertexColor
IsShaderInitOK
DeleteShader

IMeshShading_KC allows to define per vertex color of an object as opposed the default flat color defined by material properties

IMeshAlgor can be obtained from IMesh via query: kernelCAD > GetModel() > IModel > GetSection() > ISection > IMesh > IMeshShading_KC

See also: Morph sample


HRESULT SetShadingType(int type)

Parameters

type - [in] 0 to disable shading, 1 - to enable shading

Remarks:

Call this methos with type = 1 to enable shading and type = 0 to disable it. When type is 0, and there are internal memory resources (shader) allocated, the shader is not deleted and the colors can be redisplayed by call to SetShadingType(1). If requeried, use DeleteShader() method below to free the resources.

Warning: When the section which owns the mesh is current in the model the shading is not displayed. Either switch the current section or call IModel2.SetCurrentObject(null) to make it not current.


HRESULT GetShadingType(int* type)

Remarks:

Returns the value set for the mesh in the last SetShadingType() call.


HRESULT SetVertexColor(int vertex, byte red, byte green, byte blue, byte alpha)

Parameters

vertex- [in] Position of the vertex in the mesh. See remarks

red, green, blue, alpha- [in] Components of the color. The numbers must be in range 0 to 255, where 255 means the maximal intensity of the component

Remarks:

Modifies color of the vertex. The vertex is defined by its position in the mesh. Use IMesh > GetVertexIterator() > IIterator.GetHeadPosition(), IIterator.GetNext() to browse vertices of the mesh. By default color of all vertices is black.

The first call to this method allocates memory resources for the shader, which keeps the colors. Call DeleteShader() method below to release the resources when shading is not longer needed.


HRESULT GetVertexColor(int vertex, byte* red, byte* green, byte* blue, byte* alpha)

Parameters

vertex- [in] Position of the vertex in the mesh. See remarks for SetVertexColor() above

red, green, blue, alpha- [out] Components of the color. The numbers are in range 0 to 255, where 255 means the maximal intensity of the component

Remarks:

The method returns the color set with a call to SetVertexColor() above


HRESULT IsShaderInitOK(VARIANT_BOOL* ret)

Remarks:

The method returns true if the current shading type is 1 as set with a SetShadingType() call and there was at least one call to SetVertexColor() so that resources are allocated for the shader


HRESULT DeleteShader()

Remarks:

The method releases resources allocated for the shader. The shader is automatically deleted on destruction of the mesh. This method is useful to reduce memory consumption for large meshes when it is know that shading in no longer required for the mesh.