Back to the drawing board on this one. After going after pretty much every single XML related wiki page I realized the nasal avenue was not recommended. Also I am looking at implementing lightmaps to most of my AI aricrafts but with slight variations in "Day/Night" switching time so I don't want to set up tons of nasal listeners.
I came to the same conclusion than it0uchpods in this
THREAD that I should use a Gain Filter to pass on the result of my calculation onto a property and then use it in my lightmap factor
Current Implementation is
Filter in my AI aircraft main.xml as follow :
- Code: Select all
<?xml version="1.0"?>
<PropertyList>
<description>Airbus A380-800</description>
<author>Ian(Yves) Tolosa. July 2016 </author>
<path>Models/388.ac</path>
<!-- Gear Showed only < 180 knotspeed -->
<animation>
<type>select</type>
<object-name>Gear</object-name>
<condition>
<less-than>
<property>velocities/true-airspeed-kt</property>
<value>180</value>
</less-than>
</condition>
</animation>
<!-- Lightmap Switch -->
<filter>
<name>NightSwitch</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs>1</update-interval-secs>
<input>
<expression>
<floor>
<div>
<property>/sim/time/sun-angle-rad</property>
<value>1.6</value>
</div>
</floor>
</expression>
</input>
<output>
<property type="float">/ai/lightmapswitch</property>
</output>
</filter>
<!-- Lightmap Effect -->
<effect>
<inherits-from>AI/Aircraft/A380/Effects/388-lightMap</inherits-from>
<object-name>388</object-name>
</effect>
</PropertyList>
An effect file and related png n a subfolder ; note the lightmap works perfectly when manually set to manual activation using <lightmap-factor>1</lightmap-factor>
- Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<!-- Lighting of Tail, Flanks and Windows -->
<PropertyList>
<name>A388-Lightmap</name>
<inherits-from>Effects/model-combined-deferred</inherits-from>
<parameters>
<normalmap-enabled type="int">0</normalmap-enabled>
<reflection-enabled type="int">0</reflection-enabled>
<reflection-dynamic type="int">0</reflection-dynamic>
<reflect_map-enabled type="int">0</reflect_map-enabled>
<reflection-correction type="float">0</reflection-correction>
<!-- Enable 3 colors RGB LigntMap -->
<lightmap-enabled type="int">1</lightmap-enabled>
<lightmap-multi type="int">1</lightmap-multi>
<!-- Red Channel (Tail) - Night Activation and Color -->
<lightmap-factor type="float" n="0">
<use>
<property>/ai/lightmapswitch</property>
</use>
</lightmap-factor>
<lightmap-color type="vec3d" n="0">1.0 1.0 1.0</lightmap-color>
<!-- Green Channel (Windows) Multiplying Factor and Color -->
<lightmap-factor type="float" n="1">1.0</lightmap-factor>
<lightmap-color type="vec3d" n="1">1.0 1.0 0.0</lightmap-color>
<!-- Blue Channel (Flanks) Multiplying Factor and Color -->
<lightmap-factor type="float" n="2">1.0</lightmap-factor>
<lightmap-color type="vec3d" n="2">1.0 1.0 1.0</lightmap-color>
<!-- Alpha Channel (OFF) Multiplying Factor and Color -->
<lightmap-factor type="float" n="3">0.0</lightmap-factor>
<lightmap-color type="vec3d" n="3">1.0 1.0 1.0</lightmap-color>
<!-- LightMap Image Location -->
<texture n="3">
<image>AI/Aircraft/A380/Effects/388-lightMap.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>clamp</wrap-s>
<wrap-t>clamp</wrap-t>
<internal-format>normalized</internal-format>
</texture>
</parameters>
</PropertyList>
Still I cannot get that switch to work and kinda going crazy as I don't seem able to make any sense of the xml properties documentation in the FG wikis
1. Do I have the right implementation? I am under the impression you can create a new property 'on the fly' so I have not added/registered/declared my new ai/lightmapswitch property anywhere else than in the the filter in aircraft's main.xml. Is this enough for FG to create it and populate every time an A388 AI aircraft is used and displayed ? Am I missing something ?
2. I cannot debug : I was under the impression that once my new property added to my xml it would automatically appear in the list of properties in "Debug/Browse internal properties" (so I can check the expression result and the property content before adding it to the effect) but I do not see it in there. I noticed that if I alias the property and add a <use alias ... in tee lightmap factor then the property appear in the internal properties list but with no content.
I d appreciate a bit of help on this one
Thanks in advance
Ian