Class TMaterialProperties

Unit

Declaration

type TMaterialProperties = class(TObject)

Description

Store information that is naturally associated with a given material or texture in an external file. Documentation and example of such file is on https://castle-engine.io/creating_data_material_properties.php . Right now this allows to define things like:

In the future, it should be possible to express all these properties in pure VRML/X3D (inside Appearance / Material / ImageTexture nodes). Right now, you can do this with bump mapping, see https://castle-engine.io/x3d_extensions.php#section_ext_bump_mapping , but not footsteps or toxic ground. In the future it should also be possible to express these properties in 3D authoring software (like Blender), and easily export them to appropriate VRML/X3D nodes. For now, this TMaterialProperty allows us to easily customize materials in a way that is not possible in Blender.

Using an external file for material properties has also long-term advantages: it can be shared across many 3D models, for example you can define footsteps sound for all grounds using the grass.png textures, in all levels, at once.

You have to load an XML file by setting MaterialProperties.URL property.

Hierarchy

Overview

Methods

Public constructor Create(const AnAutoProcessImageURLs: Boolean);
Public destructor Destroy; override;
Public function FindTextureBaseName(const TextureBaseName: String): TMaterialProperty;
Public function AutoGeneratedTextures: TCastleStringList;

Properties

Public property URL: String read FURL write SetURL;
Public property FileName: String read FURL write SetURL; deprecated 'use URL';

Description

Methods

Public constructor Create(const AnAutoProcessImageURLs: Boolean);
 
Public destructor Destroy; override;
 
Public function FindTextureBaseName(const TextureBaseName: String): TMaterialProperty;

Find material properties for given texture basename. Returns Nil if no material properties are found (in particular, if URL was not set yet).

Public function AutoGeneratedTextures: TCastleStringList;

Get the URLs of all textures that should have automatically generated GPU-compressed and downscaled counterparts. Returns a list of absolute URLs. This actually searches on disk, right now, to find the texture list, applying the include/exclude rules specified in material_properties.xml file.

This is to be used by "castle-engine auto-generate-textures" tool, or similar tools.

The objects on this list refer to TAutoGeneratedTextures objects that define how to process this texture.

Caller is responsible for freeing the returned TCastleStringList list.

Properties

Public property URL: String read FURL write SetURL;

Load material properties from given XML file. Set this to empty string to unload previously loaded properties. See Castle1 and fps_game data for examples how this looks like, in material_properties.xml.

Public property FileName: String read FURL write SetURL; deprecated 'use URL';

Warning: this symbol is deprecated: use URL

 

Generated by PasDoc 0.16.0.