You can configure material properties using an XML file. This is useful to configure behavior that is naturally dependent on a given material or texture. Right now this allows to define things like:
See TMaterialProperties docs.
In code, you have to load this file like this:
uses ..., CastleMaterialProperties; ... MaterialProperties.URL := 'castle-data:/material_properties.xml';
It's usually best to do it as early as possible, for example
at the beginning on Application.OnInitialize
(if you
use CastleWindow
) or TForm.OnCreate
(if you use CastleControl
in Lazarus).
This is a sample material_properties.xml
file
with links to documentation for every attribute.
<?xml version="1.0"?> <properties> <!-- Contains a list of <property> elements. Only the "texture_base_name" attribute is required, and it must be unique. --> <property texture_base_name="test_texture" footsteps_sound=""> <toxic> <damage const="0.0" random="0.0" time="0.0" /> </toxic> </property> <property texture_base_name="test_texture_2" normal_map="test_normal_map.png" alpha_channel="TEST" /> <!-- You can use as many <property> elements as you like... --> <!-- You can also use <auto_generated_textures> elements as documented in the next chapter: <auto_generated_textures>...</auto_generated_textures> --> </properties>
Copyright Michalis Kamburelis and Castle Game Engine Contributors.
This webpage is also open-source and we welcome pull requests to improve it.
We use cookies for analytics. See our privacy policy.