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
(if you use
CastleControl in Lazarus).
This is a sample
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 other Castle Game Engine developers.
Thank you to Paweł Wojciechowicz from Cat-astrophe Games for various graphics.
This documentation is also open-source and you can even redistribute it on open-source terms.