Class TMaterial

Unit

Declaration

type TMaterial = class(TObject)

Description

Define a material.

A material is defined by different components, each one of a different color. It may also contain a texture that will be mixed with the other components.

See also
TMaterialList
A list of materials.

Hierarchy

  • TObject
  • TMaterial

Overview

Methods

Public CONSTRUCTOR Create (aFreeTexture: Boolean = True);
Public destructor Destroy; override;
Public PROCEDURE Apply; VIRTUAL;

Properties

Public property Ambient: TColorDescription READ fAmbient WRITE fAmbient;
Public property Diffuse: TColorDescription READ fDiffuse WRITE fDiffuse;
Public property Specular: TColorDescription READ fSpecular WRITE fSpecular;
Public property Emission: TColorDescription READ fEmission WRITE fEmission;
Public property Shininess: GLfloat READ fShininess WRITE fShininess;
Public property Name: AnsiString read fName write Setname;
Public property TextureName: AnsiString read fTextureName write fTextureName;
Public property OwnsTexture: Boolean read fOwnsTexture write fOwnsTexture;
Public property Texture: ALLEGRO_BITMAPptr read fTexture write SetTexture;

Description

Methods

Public CONSTRUCTOR Create (aFreeTexture: Boolean = True);

Creates a material.

It sets all components as a neutral white material.

Parameters
aFreeTextures
Should texture be freed when destroyed?
See also
OwnsTexture
Should the material free the texture when destroyed.
Public destructor Destroy; override;

Destructor.

If OwnsTexture is True it will destroy the Texture.

Public PROCEDURE Apply; VIRTUAL;

Apply the material.

Apply will activate or deactivate 2D texturing depending it has a Texture assigned.

Properties

Public property Ambient: TColorDescription READ fAmbient WRITE fAmbient;

Ambient property.

Public property Diffuse: TColorDescription READ fDiffuse WRITE fDiffuse;

Diffuse property.

Public property Specular: TColorDescription READ fSpecular WRITE fSpecular;

Specular property.

Public property Emission: TColorDescription READ fEmission WRITE fEmission;

Emission property.

Public property Shininess: GLfloat READ fShininess WRITE fShininess;

Shininess property.

Public property Name: AnsiString read fName write Setname;

Material name.

See also
TMaterialList.Find
Search material by name.
Public property TextureName: AnsiString read fTextureName write fTextureName;

Texture name.

This is just to identify the Texture. It's not used by the texture itself.

Assigning it won't imply the Texture is assigned.

Public property OwnsTexture: Boolean read fOwnsTexture write fOwnsTexture;

Should the material free the texture when destroyed.

Default is True.

See also
TMaterial.Create
Creates a material.
TMaterial.Texture
Texture bitmap.
TMaterial.Destroy
Destructor.
Public property Texture: ALLEGRO_BITMAPptr read fTexture write SetTexture;

Texture bitmap.

When assigned, if OwnsTexture is True the previous texture will be destroyed.


Generated by PasDoc 0.15.0. Generated on 2025-07-31 11:41:01.