Class TPhongMaterialInfo

Unit

Declaration

type TPhongMaterialInfo = class(TMaterialInfo)

Description

Material information that defines parameters for Phong lighting equations. This hides differences between various material nodes, like TMaterialNode and TCommonSurfaceShaderNode.

Hierarchy

Overview

Fields

Public nested const DefaultAmbientColor: TVector3 = (X: 0.2; Y: 0.2; Z: 0.2);
Public nested const DefaultAmbientIntensity = 0.2;
Public nested const DefaultDiffuseColor: TVector3 = (X: 0.8; Y: 0.8; Z: 0.8);
Public nested const DefaultSpecularColor: TVector3 = (X: 0; Y: 0; Z: 0);
Public nested const DefaultEmissiveColor: TVector3 = (X: 0; Y: 0; Z: 0);
Public nested const DefaultShininess = 0.2;
Public nested const DefaultShininessExp = DefaultShininess * 128;
Public nested const DefaultReflectionColor: TVector3 = (X: 0; Y: 0; Z: 0);
Public nested const DefaultTransmissionColor: TVector3 = (X: 0; Y: 0; Z: 0);
Public nested const DefaultReflSpecularExp = 1000000;
Public nested const DefaultTransSpecularExp = 1000000;

Methods

Protected function GetDiffuseColor: TVector3; virtual; abstract;
Protected procedure SetDiffuseColor(const Value: TVector3); virtual; abstract;
Protected function GetSpecularColor: TVector3; virtual; abstract;
Protected procedure SetSpecularColor(const Value: TVector3); virtual; abstract;
Public function AmbientColor: TVector3; virtual; abstract;
Public function PureEmissive: boolean;
Public function Shininess: Single; virtual; abstract;
Public function ShininessExp: Single;
Public function ReflectionColor: TVector3; virtual; abstract;
Public function TransmissionColor: TVector3; virtual;
Public function ReflSpecular: TVector3; virtual;
Public function ReflDiffuse: TVector3; virtual;
Public function TransSpecular: TVector3; virtual;
Public function TransDiffuse: TVector3; virtual;
Public function ReflSpecularExp: Single; virtual;
Public function TransSpecularExp: Single; virtual;
Public function MainColor: TVector3; override;

Properties

Public property DiffuseColor: TVector3 read GetDiffuseColor write SetDiffuseColor;
Public property SpecularColor: TVector3 read GetSpecularColor write SetSpecularColor;

Description

Fields

Public nested const DefaultAmbientColor: TVector3 = (X: 0.2; Y: 0.2; Z: 0.2);

Default material parameters.

They luckily match between all the material-like nodes:

The AmbientColor is an exception. In X3D the effective AmbientColor is an AmbientIntensity * DiffuseColor, thus it has a default value of DefaultAmbientIntensity * DefaultiffuseColor = (0.2 * 0.8, 0.2 * 0.8, 0.2 * 0.8).

Public nested const DefaultAmbientIntensity = 0.2;
 
Public nested const DefaultDiffuseColor: TVector3 = (X: 0.8; Y: 0.8; Z: 0.8);
 
Public nested const DefaultSpecularColor: TVector3 = (X: 0; Y: 0; Z: 0);
 
Public nested const DefaultEmissiveColor: TVector3 = (X: 0; Y: 0; Z: 0);
 
Public nested const DefaultShininess = 0.2;
 
Public nested const DefaultShininessExp = DefaultShininess * 128;
 
Public nested const DefaultReflectionColor: TVector3 = (X: 0; Y: 0; Z: 0);
 
Public nested const DefaultTransmissionColor: TVector3 = (X: 0; Y: 0; Z: 0);
 
Public nested const DefaultReflSpecularExp = 1000000;
 
Public nested const DefaultTransSpecularExp = 1000000;
 

Methods

Protected function GetDiffuseColor: TVector3; virtual; abstract;
 
Protected procedure SetDiffuseColor(const Value: TVector3); virtual; abstract;
 
Protected function GetSpecularColor: TVector3; virtual; abstract;
 
Protected procedure SetSpecularColor(const Value: TVector3); virtual; abstract;
 
Public function AmbientColor: TVector3; virtual; abstract;
 
Public function PureEmissive: boolean;

Only the emissiveColor is not black (zero), which means that the material behaves like unlit.

This checks that ambient and diffuse and specular colors are all zero. It's an important information about the material sometimes. We can optimize this case when rendering.

Public function Shininess: Single; virtual; abstract;
 
Public function ShininessExp: Single;

Shininess exponent for Phong lighting equations.

Remember that the X3D Shininess field is "normalized", which means that it has to be multiplied by 128.0 to get actual exponent for lighting equations. This function returns the real exponent (already multiplied by 128.0, if necessary).

Public function ReflectionColor: TVector3; virtual; abstract;
 
Public function TransmissionColor: TVector3; virtual;
 
Public function ReflSpecular: TVector3; virtual;

Warning: this symbol is deprecated.

Used by path-tracer. See https://castle-engine.io/x3d_extensions.php#section_ext_material_phong_brdf_fields . Not useful for normal CGE rendering.

Public function ReflDiffuse: TVector3; virtual;
 
Public function TransSpecular: TVector3; virtual;
 
Public function TransDiffuse: TVector3; virtual;
 
Public function ReflSpecularExp: Single; virtual;
 
Public function TransSpecularExp: Single; virtual;
 
Public function MainColor: TVector3; override;

Main color of Phong material is DiffuseColor.

Properties

Public property DiffuseColor: TVector3 read GetDiffuseColor write SetDiffuseColor;
 
Public property SpecularColor: TVector3 read GetSpecularColor write SetSpecularColor;
 

Generated by PasDoc 0.16.0.