IMaterial interface overview

File      : API\rend\IMaterial.h
Namespace : rend

Description

Material interface. Materials in ZModeler are actually tree-structured and can inherit or supress some parameters from parent materials. Materials are refered by zero-based index with zero index of a so-called "Default Material".

Materials are created, organized and maintained by services::IMaterialsService which also implements a dialog for user control on materials (Materials Editor).

Instances of IMaterial interface are not meaningful by themselves, unless they are placed into a set of materials in materials service and some geometry refers to according material index. In such a case, material can act in rendering of according geometry primitives. Before rendering geometry, this IMaterial a apply method is called and provided with rendering device, so material can invoke Direct3D-specific methods to set up rendering device properly.

In current implementation materials are expecting a usage of fixed function pipeline, not a shaders. So, material's apply method sets up color, states, blending modes and assigns texture layers as specified by texture layer parameters. It is, however, possible to implement materials that will set up shaders for your geometry.

Interface methods

getClassName Provides fully-qualified class name that implements current instance of material.
duplicate Creates a copy of material. Usually it creates an instance of the same class and copies all arguments directly, but it's not a must.
setParentMaterial Sets parent material for current material.
getParentMaterial Provides parent material for current material.
setName Sets material name to be displayed in materials editor.
getName Provides material name.
apply Grants control to material before rendering geometry. Material should set up rendering device with respect to material settings.
setColor Sets color on material. There could be several color components on material specified by a value of eColorType enumeration.
getColor Provides on of material colors specified by a value of eColorType enumeration.
setOpacity Sets material opacity level.
getOpacity Provides material opacity level.
getRenderExtensions Provides a set of material extensions.
setRenderExtensions Sets a set of material extensions.
getSpecular Provides specular level.
setSpecular Sets specular level. Specular highlight is not enabled on material unless you set an according material extension.
getAlphaBlend Provides alpha blending options, including source/destination blending modes for color/alpha arguments.
setAlphaBlend Sets alpha blending options, including source/destination blending modes for color/alpha arguments (when alpha separation is enabled).
setAlphaSeparation Enables or disables separate blend mode for alpha.
isAlphaSeparate Specifies whether alpha separation is currently enabled.
getAlphaTest Provides alpha-test options set on material.
setAlphaTest Sets alpha-test options on material.
getTextureLayer Provides texture layer with according index. Texture layer is specified as a struct tTextureLayerInfo.
setTextureLayer Sets texture layer at specified index. Texture layer is specified as a struct tTextureLayerInfo.
addTextureLayer Adds texture layer into a set of texture layers. Texture layer is added with the latest index (last), but you can set texture layer priority to make it act earlier or first.
deleteTextureLayer Deletes texture layer at specified position. Position indicates absolute texture layer index with respect to inherited texture layers.
getTextureLayersCount Provides amount of texture layers on material.
getPreferableVerticesFormat Provides preferable vertices format or 0 if this class uses fixed-function pipeline and does not depend on vertices format.
enumSupportedVerticesFormat Provides enumeration of supported vertices format. Vertices format set to zero means that class uses fixed-function pipeline and does not depend on vertices format.
See Also:
overview of namespace rend
services::IMaterialsService interface.
IMaterialsService::createMaterial method.
IMaterialsService::getMaterial method.
enum rend::eColorType.
struct rend::tTextureLayerInfo.