record TMaterial

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TMaterial = record

Description

Struct for holding parameters for a material renderer.
You may notice that some methods and fields from irr::SMaterial are missing. SMaterial Methods accessing texture properties simply forward attributes or methods of TMaterialLayer. The flag attributes are packed in the source code and therefore not portable. Use SetFlag / GetFlag instead.

Overview

Fields

TextureLayer: array[0..MaxMaterialTextures-1] of TMaterialLayer;
MaterialType: EnumType;
AmbientColor: TARGBColor;
DiffuseColor: TARGBColor;
EmissiveColor: TARGBColor;
SpecularColor: TARGBColor;
Shininess: Single;
MaterialTypeParam: Single;
MaterialTypeParam2: Single;
Thickness: Single;

Methods

function GetFlag(Flag: TMaterialFlag): Boolean; inline;
procedure Reset; inline;
procedure SetFlag(Flag: TMaterialFlag; Value: Boolean); inline;

Properties

property ColorMask: LongWord read GetColorMask write SetColorMask;
property ColorMaterial: LongWord read GetColorMaterial write SetColorMaterial;

Description

Fields

TextureLayer: array[0..MaxMaterialTextures-1] of TMaterialLayer;
 
MaterialType: EnumType;

Type of the material. Specifies how everything is blended together.

AmbientColor: TARGBColor;

Specifies how much ambient light (a global light) is reflected by this material.
The default is full white, meaning objects are completely globally illuminated. Reduce this if you want to see diffuse or specular light effects.

DiffuseColor: TARGBColor;

How much diffuse light coming from a light source is reflected by this material.
The default is full white.

EmissiveColor: TARGBColor;

Light emitted by this material. Default is to emit no light.

SpecularColor: TARGBColor;

How much specular light (highlights from a light) is reflected.
The default is to reflect white specular light. See TMaterial.Shininess on how to enable specular lights.

Shininess: Single;

Value affecting the size of specular highlights.
A value of 20 is common. If set to 0, no specular highlights are being used. To activate, simply set the shininess of a material to a value in the range [0.5;128]:

    SceneNode.Materials[0.Shininess := 20;
                

You can change the color of the highlights using

    SceneNode.Materials[0.SpecularColor := ARGBColor(255,255,255,255);
                

The specular color of the dynamic lights (TLight.SpecularColor) will influence the the highlight color too, but they are set to a useful value by default when creating the light scene node. Here is a simple example on how to use specular highlights:

    // load and display mesh
    var Node: TAnimatedMeshSceneNode;
        Light: TLightSceneNode;
    ...
    Node := SceneManager.AddAnimatedMeshSceneNode(SceneManager.GetMesh('data/faerie.md2'));
    Node.SetMaterialTexture(0, VideoDriver.GetTexture("data/Faerie2.pcx")); // set diffuse texture
    Node.SetMaterialFlag(mfLighting, True); // enable dynamic lighting
    Node.Materials[0].Shininess := 20; // set size of specular highlights

    // add white light
    Light = SceneManager.AddLightSceneNode(nil, Vector3D(5,5,5), ARGBColor(1.0f, 1.0f, 1.0f));
                

MaterialTypeParam: Single;

Free parameter, dependent on the material type.
Mostly ignored, used for example in mtParallaxMapSolid and mtTransparentAlphaChannel.

MaterialTypeParam2: Single;

Second free parameter, dependent on the material type.
Mostly ignored.

Thickness: Single;

Thickness of non-3dimensional elements such as lines and points.

Methods

function GetFlag(Flag: TMaterialFlag): Boolean; inline;

Gets a material flag.

Parameters
Flag
The flag to read.
Returns

Boolean indicating whether the flag is set.

procedure Reset; inline;
 
procedure SetFlag(Flag: TMaterialFlag; Value: Boolean); inline;

Modifies a material flag.

Parameters
Flag
The flag to modify.
Value
Whether to set the flag.

Properties

property ColorMask: LongWord read GetColorMask write SetColorMask;

Defines the enabled color planes.
Values are defined as or'ed values of the TColorPlane enum. Only enabled color planes will be rendered to the current render target. Typical use is to disable all colors when rendering only to depth or stencil buffer, or using Red and Green for Stereo rendering.

property ColorMaterial: LongWord read GetColorMaterial write SetColorMaterial;

Defines the interpretation of vertex color in the lighting equation.
Values should be chosen from TColorMaterial. When lighting is enabled, vertex color can be used instead of the material values for light modulation. This allows to easily change e.g. the diffuse light behavior of each face. The default, cmDiffuse, will result in a very similar rendering as with lighting turned off, just with light shading.


Generated by PasDoc 0.12.1 on 2012-09-14 17:32:22