Class TMaterialNode

Unit

Declaration

type TMaterialNode = class(TAbstractOneSidedMaterialNode)

Description

Material determines how the geometry looks on the screen, by providing parameters to the lighting equations. This is the material responsible for the Phong lighting model.

It specifies how light affects one side of the surface.

Note: Whether the shape is visible from both sides depends on the geometry TAbstractGeometryNode.Solid field, and is independent of whether you use this node or TTwoSidedMaterialNode.

Hierarchy

Overview

Methods

Public constructor Create(const AX3DName: string = ''; const ABaseUrl: string = ''); override;
Public destructor Destroy; override;
Public class function ForVRMLVersion(const Version: TX3DVersion): boolean; override;
Public function Opacity: Single;
Public function ShininessExp: Single;
Public function MaterialInfo: TMaterialInfo; override;
Public function PureEmissive: boolean;
Public procedure ForcePureEmissive; deprecated 'use TUnlitMaterialNode for unlit materials';
Public procedure CreateNode; override;
Public class function ClassX3DType: string; override;
Public procedure SetReflSpecular(const Value: array of TCastleColorRGB); overload;
Public procedure SetReflSpecular(const Value: TVector3List); overload;
Public procedure SetReflDiffuse(const Value: array of TCastleColorRGB); overload;
Public procedure SetReflDiffuse(const Value: TVector3List); overload;
Public procedure SetTransSpecular(const Value: array of TCastleColorRGB); overload;
Public procedure SetTransSpecular(const Value: TVector3List); overload;
Public procedure SetTransDiffuse(const Value: array of TCastleColorRGB); overload;
Public procedure SetTransDiffuse(const Value: TVector3List); overload;

Properties

Public property FdAmbientIntensity: TSFFloat read FFdAmbientIntensity;
Public property AmbientIntensity: Single read GetAmbientIntensity write SetAmbientIntensity;
Public property FdAmbientTexture: TSFNode read FFdAmbientTexture;
Public property AmbientTexture: TAbstractSingleTextureNode read GetAmbientTexture write SetAmbientTexture;
Public property FdAmbientTextureMapping: TSFString read FFdAmbientTextureMapping;
Public property AmbientTextureMapping: String read GetAmbientTextureMapping write SetAmbientTextureMapping;
Public property FdDiffuseColor: TSFColor read FFdDiffuseColor;
Public property DiffuseColor: TCastleColorRGB read GetDiffuseColor write SetDiffuseColor;
Public property FdDiffuseTexture: TSFNode read FFdDiffuseTexture;
Public property DiffuseTexture: TAbstractSingleTextureNode read GetDiffuseTexture write SetDiffuseTexture;
Public property FdDiffuseTextureMapping: TSFString read FFdDiffuseTextureMapping;
Public property DiffuseTextureMapping: String read GetDiffuseTextureMapping write SetDiffuseTextureMapping;
Public property FdOcclusionStrength: TSFFloat read FFdOcclusionStrength;
Public property OcclusionStrength: Single read GetOcclusionStrength write SetOcclusionStrength;
Public property FdOcclusionTexture: TSFNode read FFdOcclusionTexture;
Public property OcclusionTexture: TAbstractSingleTextureNode read GetOcclusionTexture write SetOcclusionTexture;
Public property FdOcclusionTextureMapping: TSFString read FFdOcclusionTextureMapping;
Public property OcclusionTextureMapping: String read GetOcclusionTextureMapping write SetOcclusionTextureMapping;
Public property FdShininess: TSFFloat read FFdShininess;
Public property Shininess: Single read GetShininess write SetShininess;
Public property FdShininessTexture: TSFNode read FFdShininessTexture;
Public property ShininessTexture: TAbstractSingleTextureNode read GetShininessTexture write SetShininessTexture;
Public property FdShininessTextureMapping: TSFString read FFdShininessTextureMapping;
Public property ShininessTextureMapping: String read GetShininessTextureMapping write SetShininessTextureMapping;
Public property FdSpecularColor: TSFColor read FFdSpecularColor;
Public property SpecularColor: TCastleColorRGB read GetSpecularColor write SetSpecularColor;
Public property FdSpecularTexture: TSFNode read FFdSpecularTexture;
Public property SpecularTexture: TAbstractSingleTextureNode read GetSpecularTexture write SetSpecularTexture;
Public property FdSpecularTextureMapping: TSFString read FFdSpecularTextureMapping;
Public property SpecularTextureMapping: String read GetSpecularTextureMapping write SetSpecularTextureMapping;
Public property FdTransparency: TSFFloat read FFdTransparency;
Public property Transparency: Single read GetTransparency write SetTransparency;
Public property FdFogImmune: TSFBool read FFdFogImmune;
Public property FogImmune: Boolean read GetFogImmune write SetFogImmune;
Public property FdMirror: TSFFloat read FFdMirror;
Public property Mirror: Single read GetMirror write SetMirror;
Public property FdReflSpecular: TMFColor read FFdReflSpecular;
Public property FdReflDiffuse: TMFColor read FFdReflDiffuse;
Public property FdTransSpecular: TMFColor read FFdTransSpecular;
Public property FdTransDiffuse: TMFColor read FFdTransDiffuse;
Public property FdReflSpecularExp: TSFFloat read FFdReflSpecularExp;
Public property ReflSpecularExp: Single read GetReflSpecularExp write SetReflSpecularExp;
Public property FdTransSpecularExp: TSFFloat read FFdTransSpecularExp;
Public property TransSpecularExp: Single read GetTransSpecularExp write SetTransSpecularExp;

Description

Methods

Public constructor Create(const AX3DName: string = ''; const ABaseUrl: string = ''); override;

This item has no description. Showing description inherited from TX3DNode.Create.

Constructor. Initializes various properties:

  • Name, BaseUrl are initialized from given parameters.

  • The Fields, Events lists are filled in every descendant, to have all the fields/events defined by the specification.

  • DefaultContainerField, and other node-specific stuff, is filled in descendants. This is actually implemented in CreateNode, that is called at the end of this constructor.

Public destructor Destroy; override;

This item has no description.

Public class function ForVRMLVersion(const Version: TX3DVersion): boolean; override;

This item has no description. Showing description inherited from TX3DNode.ForVRMLVersion.

Some nodes are present only in specific VRML/X3D version. This functions decides it.

For example some nodes can only work in VRML < 2.0, some others only in VRML >= 2.0. There are even some pairs of nodes: for example TConeNode_1 works with VRML < 2.0, TConeNode works with VRML >= 2.0.

NodesManager will use this.

Default implementation of this function returns always True. Generally, I don't try to set this too aggresively — in other words, for all cases when it's sensible, I allow nodes to be used in every VRML/X3D version, even when official specification doesn't. This means that when reading VRML 1.0 files actually a large part of VRML 2.0 is allowed too, and also while reading VRML 2.0 many constructs from VRML 1.0 (officially no longer present in VRML 2.0) are allowed too. I'm trying to support what I call a "sum of VRML 1.0 and 2.0".

In practice I only use this function when various VRML/X3D versions specify the same node name but

  • With different fields.

    For example Cone and Cylinder have slightly different fields, due to the fact that VRML 2.0 resigned from using TSFBitMask fields.

  • With different behavior.

    For example definitions of Sphere for VRML 1.0 and 2.0 are practically equal. However, the behavior from where to take texture and material info is different — in VRML 1.0 we take last Texture2, Material etc. nodes, while in VRML 2.0 we look in parent Shape's "appearance" field. So once again two different Sphere classes are needed.

Public function Opacity: Single;

Opacity is just a 1 - FdTransparency.Value. Defined for your comfort — for OpenGL you will usually want to pass Opacity, not Transparency.

Public function ShininessExp: Single;

ShininessExp is just 128 * FdShininess.Value, this is the "real" exponent indicated by shininess field value. Defined for your comfort — for any graphic library you will usually want to pass the "real" exponent given by this function, not just value of shininess field.

Public function MaterialInfo: TMaterialInfo; override;

This item has no description. Showing description inherited from TAbstractMaterialNode.MaterialInfo.

Material information based on this node. It is automatically updated when properties of this material change. Do not free it yourself, it will be automatically freed when this node is freed.

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. It is similar to the NULL material situation (when "Appearance.material=NULL" case), but the color and transparency are still configurable (using FdEmissiveColor and FdTransparency fields).

We can optimize this case when rendering.

Public procedure ForcePureEmissive; deprecated 'use TUnlitMaterialNode for unlit materials';

Warning: this symbol is deprecated: use TUnlitMaterialNode for unlit materials

Force the material pure emissive (see PureEmissive) by setting other colors to black.

Public procedure CreateNode; override;

This item has no description. Showing description inherited from TAbstractMaterialNode.CreateNode.

Automatically generated node properties.

Do not edit this file manually! To add new properties: - add them to the text files in tools/internal/x3d-nodes-to-pascal/nodes-specification/ , - and regenerate include files by running x3d-nodes-to-pascal

Public class function ClassX3DType: string; override;

This item has no description. Showing description inherited from TX3DNode.ClassX3DType.

Node type name in VRML/X3D, for this class. Normal VRML/X3D node classes should override this to return something non-empty, and then X3DType automatically will return the same value.

Empty for classes that don't have a hardcoded VRML/X3D node name, like a special TX3DUnknownNode. Such special classes should override then X3DType to return actual non-empty name there.

You usually should call X3DType. The only use of this method is that it works on classes (it's "class function"), without needing at actual instance.

Public procedure SetReflSpecular(const Value: array of TCastleColorRGB); overload;

This item has no description.

Public procedure SetReflSpecular(const Value: TVector3List); overload;

This item has no description.

Public procedure SetReflDiffuse(const Value: array of TCastleColorRGB); overload;

This item has no description.

Public procedure SetReflDiffuse(const Value: TVector3List); overload;

This item has no description.

Public procedure SetTransSpecular(const Value: array of TCastleColorRGB); overload;

This item has no description.

Public procedure SetTransSpecular(const Value: TVector3List); overload;

This item has no description.

Public procedure SetTransDiffuse(const Value: array of TCastleColorRGB); overload;

This item has no description.

Public procedure SetTransDiffuse(const Value: TVector3List); overload;

This item has no description.

Properties

Public property FdAmbientIntensity: TSFFloat read FFdAmbientIntensity;

Internal wrapper for property AmbientIntensity. This wrapper API may change, we advise to access simpler AmbientIntensity instead.

Public property AmbientIntensity: Single read GetAmbientIntensity write SetAmbientIntensity;

This item has no description.

Public property FdAmbientTexture: TSFNode read FFdAmbientTexture;

Internal wrapper for property AmbientTexture. This wrapper API may change, we advise to access simpler AmbientTexture instead.

Public property AmbientTexture: TAbstractSingleTextureNode read GetAmbientTexture write SetAmbientTexture;

This item has no description.

Public property FdAmbientTextureMapping: TSFString read FFdAmbientTextureMapping;

Internal wrapper for property AmbientTextureMapping. This wrapper API may change, we advise to access simpler AmbientTextureMapping instead.

Public property AmbientTextureMapping: String read GetAmbientTextureMapping write SetAmbientTextureMapping;

This item has no description.

Public property FdDiffuseColor: TSFColor read FFdDiffuseColor;

Internal wrapper for property DiffuseColor. This wrapper API may change, we advise to access simpler DiffuseColor instead.

Public property DiffuseColor: TCastleColorRGB read GetDiffuseColor write SetDiffuseColor;

The primary way to control the color of object with Phong material. The object reflects light sources depending on the angle of the surface with respect to the light source. The more directly the surface faces the light, the more diffuse light reflects.

Public property FdDiffuseTexture: TSFNode read FFdDiffuseTexture;

Internal wrapper for property DiffuseTexture. This wrapper API may change, we advise to access simpler DiffuseTexture instead.

Public property DiffuseTexture: TAbstractSingleTextureNode read GetDiffuseTexture write SetDiffuseTexture;

The primary texture to control the color of object with Phong material. The RGB channel of this texture is multiplied with DiffuseColor, and alpha channel is multiplied with the opacity (1-Transparency).

Public property FdDiffuseTextureMapping: TSFString read FFdDiffuseTextureMapping;

Internal wrapper for property DiffuseTextureMapping. This wrapper API may change, we advise to access simpler DiffuseTextureMapping instead.

Public property DiffuseTextureMapping: String read GetDiffuseTextureMapping write SetDiffuseTextureMapping;

This item has no description.

Public property FdOcclusionStrength: TSFFloat read FFdOcclusionStrength;

Internal wrapper for property OcclusionStrength. This wrapper API may change, we advise to access simpler OcclusionStrength instead.

Public property OcclusionStrength: Single read GetOcclusionStrength write SetOcclusionStrength;

This item has no description.

Public property FdOcclusionTexture: TSFNode read FFdOcclusionTexture;

Internal wrapper for property OcclusionTexture. This wrapper API may change, we advise to access simpler OcclusionTexture instead.

Public property OcclusionTexture: TAbstractSingleTextureNode read GetOcclusionTexture write SetOcclusionTexture;

This item has no description.

Public property FdOcclusionTextureMapping: TSFString read FFdOcclusionTextureMapping;

Internal wrapper for property OcclusionTextureMapping. This wrapper API may change, we advise to access simpler OcclusionTextureMapping instead.

Public property OcclusionTextureMapping: String read GetOcclusionTextureMapping write SetOcclusionTextureMapping;

This item has no description.

Public property FdShininess: TSFFloat read FFdShininess;

Internal wrapper for property Shininess. This wrapper API may change, we advise to access simpler Shininess instead.

Public property Shininess: Single read GetShininess write SetShininess;

This item has no description.

Public property FdShininessTexture: TSFNode read FFdShininessTexture;

Internal wrapper for property ShininessTexture. This wrapper API may change, we advise to access simpler ShininessTexture instead.

Public property ShininessTexture: TAbstractSingleTextureNode read GetShininessTexture write SetShininessTexture;

This item has no description.

Public property FdShininessTextureMapping: TSFString read FFdShininessTextureMapping;

Internal wrapper for property ShininessTextureMapping. This wrapper API may change, we advise to access simpler ShininessTextureMapping instead.

Public property ShininessTextureMapping: String read GetShininessTextureMapping write SetShininessTextureMapping;

This item has no description.

Public property FdSpecularColor: TSFColor read FFdSpecularColor;

Internal wrapper for property SpecularColor. This wrapper API may change, we advise to access simpler SpecularColor instead.

Public property SpecularColor: TCastleColorRGB read GetSpecularColor write SetSpecularColor;

Color of specular highlight, on shiny objects.

Public property FdSpecularTexture: TSFNode read FFdSpecularTexture;

Internal wrapper for property SpecularTexture. This wrapper API may change, we advise to access simpler SpecularTexture instead.

Public property SpecularTexture: TAbstractSingleTextureNode read GetSpecularTexture write SetSpecularTexture;

This item has no description.

Public property FdSpecularTextureMapping: TSFString read FFdSpecularTextureMapping;

Internal wrapper for property SpecularTextureMapping. This wrapper API may change, we advise to access simpler SpecularTextureMapping instead.

Public property SpecularTextureMapping: String read GetSpecularTextureMapping write SetSpecularTextureMapping;

This item has no description.

Public property FdTransparency: TSFFloat read FFdTransparency;

Internal wrapper for property Transparency. This wrapper API may change, we advise to access simpler Transparency instead.

Public property Transparency: Single read GetTransparency write SetTransparency;

Setting Transparency to value > 0 makes the object partially-transparent. Setting it to 1.0 makes it even invisible (but still collidable). If you want to render the object using blending (which is usually the case for partially-transparent) it is recommended to specify it explicitly using TAppearanceNode.AlphaMode.

Public property FdFogImmune: TSFBool read FFdFogImmune;

Internal wrapper for property FogImmune. This wrapper API may change, we advise to access simpler FogImmune instead.

Public property FogImmune: Boolean read GetFogImmune write SetFogImmune;

This item has no description.

Public property FdMirror: TSFFloat read FFdMirror;

Internal wrapper for property Mirror. This wrapper API may change, we advise to access simpler Mirror instead.

Public property Mirror: Single read GetMirror write SetMirror;

This item has no description.

Public property FdReflSpecular: TMFColor read FFdReflSpecular;

Internal wrapper for property ReflSpecular. This wrapper API may change, we advise to access simpler ReflSpecular instead.

Public property FdReflDiffuse: TMFColor read FFdReflDiffuse;

Internal wrapper for property ReflDiffuse. This wrapper API may change, we advise to access simpler ReflDiffuse instead.

Public property FdTransSpecular: TMFColor read FFdTransSpecular;

Internal wrapper for property TransSpecular. This wrapper API may change, we advise to access simpler TransSpecular instead.

Public property FdTransDiffuse: TMFColor read FFdTransDiffuse;

Internal wrapper for property TransDiffuse. This wrapper API may change, we advise to access simpler TransDiffuse instead.

Public property FdReflSpecularExp: TSFFloat read FFdReflSpecularExp;

Internal wrapper for property ReflSpecularExp. This wrapper API may change, we advise to access simpler ReflSpecularExp instead.

Public property ReflSpecularExp: Single read GetReflSpecularExp write SetReflSpecularExp;

This item has no description.

Public property FdTransSpecularExp: TSFFloat read FFdTransSpecularExp;

Internal wrapper for property TransSpecularExp. This wrapper API may change, we advise to access simpler TransSpecularExp instead.

Public property TransSpecularExp: Single read GetTransSpecularExp write SetTransSpecularExp;

This item has no description.


Generated by PasDoc 0.16.0.