<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
	<name>Effects/shadow</name>
	<!-- 	<inherits-from>Effects/shadow</inherits-from> -->
	<parameters>
		<texture n ="0">
			<type>white</type>
		</texture>
		<vertex-program-two-side type="bool">false</vertex-program-two-side>
		<material>
			<color-mode-uniform>1</color-mode-uniform>
			<!-- DIFFUSE -->
		</material>
		<material-id>0</material-id>
		<!-- 		BEGIN fog include -->
		<visibility><use>/environment/ground-visibility-m</use></visibility>
		<avisibility><use>/environment/visibility-m</use></avisibility>
		<lthickness><use>/environment/ground-haze-thickness-m</use></lthickness>
		<scattering><use>/rendering/scene/scattering</use></scattering>
		<ground_scattering><use>/environment/surface/scattering</use></ground_scattering>
		<terminator><use>/environment/terminator-relative-position-m</use></terminator>
		<terrain_alt><use>/environment/mean-terrain-elevation-m</use></terrain_alt>
    		<overcast><use>/rendering/scene/overcast</use></overcast>
    		<eye_alt><use>/sim/rendering/eye-altitude-m</use></eye_alt>
 		<cloud_self_shading><use>/environment/cloud-self-shading</use></cloud_self_shading>
    		<moonlight><use>/environment/moonlight</use></moonlight>
    		<alt_agl><use>/position/altitude-agl-m</use></alt_agl>
		<model-pitch><use>/orientation/model/pitch-deg</use></model-pitch>
		<model-roll><use>/orientation/model/roll-deg</use></model-roll>
    		<gear_clearance>0.5</gear_clearance>
		<!-- 		END fog include -->
	</parameters>

  <technique n="5">
    <predicate>
      <and>
        <property>/sim/rendering/shaders/skydome</property>
        <or>
          <less-equal>
            <value type="float">2.0</value>
            <glversion/>
          </less-equal>
          <and>
            <extension-supported>GL_ARB_shader_objects</extension-supported>
            <extension-supported>GL_ARB_shading_language_100</extension-supported>
            <extension-supported>GL_ARB_vertex_shader</extension-supported>
            <extension-supported>GL_ARB_fragment_shader</extension-supported>
          </and>
        </or>
      </and>
    </predicate>
  
  <!-- first pass so that the depth buffer is filled, we then render only the uppermost
       layer of the projected shadow volume in the second pass to avod drawing multiple
         transparent layers on top of each other-->
  <pass>
      <lighting>true</lighting>
      <material>
        <active><use>material/active</use></active>
        <ambient><use>material/ambient</use></ambient>
        <diffuse><use>material/diffuse</use></diffuse>
        <specular><use>material/specular</use></specular>
        <emissive><use>material/emissive</use></emissive>
        <shininess><use>material/shininess</use></shininess>
        <color-mode><use>material/color-mode</use></color-mode>
      </material>
      <blend>
        <active><use>blend/active</use></active>
        <source><use>blend/source</use></source>
        <destination><use>blend/destination</use></destination>
      </blend>
      <shade-model><use>shade-model</use></shade-model>
      <cull-face><use>cull-face</use></cull-face>
       <render-bin>
        <bin-number>10</bin-number>
        <bin-name>DepthSortedBin</bin-name>
      </render-bin>
      <rendering-hint><use>rendering-hint</use></rendering-hint>
      <texture-unit>
        <unit>0</unit>
        <type><use>texture[0]/type</use></type>
        <image><use>texture[0]/image</use></image>
        <filter><use>texture[0]/filter</use></filter>
        <wrap-s><use>texture[0]/wrap-s</use></wrap-s>
        <wrap-t><use>texture[0]/wrap-t</use></wrap-t>
      </texture-unit>
      <program>
        <vertex-shader>Shaders/shadow-vol-ALS.vert</vertex-shader>
        <fragment-shader>Shaders/shadow-ALS.frag</fragment-shader>
      </program>
       <uniform>
        <name>hazeLayerAltitude</name>
        <type>float</type>
        <value><use>lthickness</use></value>
      </uniform>
      <uniform>
        <name>scattering</name>
        <type>float</type>
        <value><use>scattering</use></value>
      </uniform>
      <uniform>
	<name>terminator</name>
	<type>float</type>
	<value><use>terminator</use></value>
      </uniform>
      <uniform>
        <name>ground_scattering</name>
        <type>float</type>
        <value><use>ground_scattering</use></value>
      </uniform>
      <uniform>
        <name>terrain_alt</name>
        <type>float</type>
        <value><use>terrain_alt</use></value>
      </uniform>
      <uniform>
        <name>overcast</name>
        <type>float</type>
        <value><use>overcast</use></value>
      </uniform>
     <uniform>
        <name>eye_alt</name>
        <type>float</type>
        <value><use>eye_alt</use></value>
      </uniform>
      <uniform>
        <name>moonlight</name>
        <type>float</type>
        <value><use>moonlight</use></value>
      </uniform>
      <uniform>
	<name>alt_agl</name>
	<type>float</type>
	<value><use>alt_agl</use></value>
      </uniform>
      <uniform>
	<name>pitch</name>
	<type>float</type>
	<value><use>model-pitch</use></value>
      </uniform>
      <uniform>
	<name>roll</name>
	<type>float</type>
	<value><use>model-roll</use></value>
      </uniform>
      <uniform>
	<name>gear_clearance</name>
	<type>float</type>
	<value><use>gear_clearance</use></value>
      </uniform>
      <depth>
	<function>lequal</function>
	<write-mask type="bool">true</write-mask>
      </depth>
      <color-mask type="vec4d">0 0 0 0</color-mask>
    </pass>

    <pass>
      <lighting>true</lighting>
      <material>
        <active><use>material/active</use></active>
        <ambient><use>material/ambient</use></ambient>
        <diffuse><use>material/diffuse</use></diffuse>
        <specular><use>material/specular</use></specular>
        <emissive><use>material/emissive</use></emissive>
        <shininess><use>material/shininess</use></shininess>
        <color-mode><use>material/color-mode</use></color-mode>
      </material>
      <blend>
        <active><use>blend/active</use></active>
        <source><use>blend/source</use></source>
        <destination><use>blend/destination</use></destination>
      </blend>
      <shade-model><use>shade-model</use></shade-model>
      <cull-face>back</cull-face>
       <render-bin>
        <bin-number>10</bin-number>
        <bin-name>DepthSortedBin</bin-name>
      </render-bin>
      <rendering-hint><use>rendering-hint</use></rendering-hint>
      <texture-unit>
        <unit>0</unit>
        <type><use>texture[0]/type</use></type>
        <image><use>texture[0]/image</use></image>
        <filter><use>texture[0]/filter</use></filter>
        <wrap-s><use>texture[0]/wrap-s</use></wrap-s>
        <wrap-t><use>texture[0]/wrap-t</use></wrap-t>
      </texture-unit>
      <program>
        <vertex-shader>Shaders/shadow-vol-ALS.vert</vertex-shader>
        <fragment-shader>Shaders/shadow-ALS.frag</fragment-shader>
      </program>
      <uniform>
        <name>visibility</name>
        <type>float</type>
        <value><use>visibility</use></value>
      </uniform>
      <uniform>
        <name>avisibility</name>
        <type>float</type>
        <value><use>avisibility</use></value>
      </uniform>
       <uniform>
        <name>hazeLayerAltitude</name>
        <type>float</type>
        <value><use>lthickness</use></value>
      </uniform>
      <uniform>
        <name>scattering</name>
        <type>float</type>
        <value><use>scattering</use></value>
      </uniform>
      <uniform>
	<name>terminator</name>
	<type>float</type>
	<value><use>terminator</use></value>
      </uniform>
      <uniform>
        <name>ground_scattering</name>
        <type>float</type>
        <value><use>ground_scattering</use></value>
      </uniform>
      <uniform>
        <name>terrain_alt</name>
        <type>float</type>
        <value><use>terrain_alt</use></value>
      </uniform>
      <uniform>
        <name>overcast</name>
        <type>float</type>
        <value><use>overcast</use></value>
      </uniform>
     <uniform>
        <name>eye_alt</name>
        <type>float</type>
        <value><use>eye_alt</use></value>
      </uniform>
      <uniform>
        <name>cloud_self_shading</name>
        <type>float</type>
        <value><use>cloud_self_shading</use></value>
      </uniform>
      <uniform>
        <name>moonlight</name>
        <type>float</type>
        <value><use>moonlight</use></value>
      </uniform>
      <uniform>
	<name>alt_agl</name>
	<type>float</type>
	<value><use>alt_agl</use></value>
      </uniform>
      <uniform>
	<name>pitch</name>
	<type>float</type>
	<value><use>model-pitch</use></value>
      </uniform>
      <uniform>
	<name>roll</name>
	<type>float</type>
	<value><use>model-roll</use></value>
      </uniform>
      <uniform>
	<name>gear_clearance</name>
	<type>float</type>
	<value><use>gear_clearance</use></value>
      </uniform>
      <depth>
	<function>lequal</function>
	<write-mask type="bool">true</write-mask>
      </depth>
    </pass>
  </technique>


	<technique n="13">
		<pass>
			<lighting>true</lighting>
			<material>
				<active>
					<use>material/active</use>
				</active>
				<ambient>
					<use>material/ambient</use>
				</ambient>
				<diffuse>
					<use>material/diffuse</use>
				</diffuse>
				<specular>
					<use>material/specular</use>
				</specular>
				<emissive>
					<use>material/emissive</use>
				</emissive>
				<shininess>
					<use>material/shininess</use>
				</shininess>
				<color-mode>
					<use>material/color-mode</use>
				</color-mode>
			</material>
			<blend>
				<active>
					<use>blend/active</use>
				</active>
				<source>
					<use>blend/source</use>
				</source>
				<destination>
					<use>blend/destination</use>
				</destination>
			</blend>
			<shade-model>
				<use>shade-model</use>
			</shade-model>
			<cull-face>
				<use>cull-face</use>
			</cull-face>
			<rendering-hint>
				<use>rendering-hint</use>
			</rendering-hint>
			<texture-unit>
				<active>
					<use>texture[0]/active</use>
				</active>
				<unit>0</unit>
				<image>
					<use>texture[0]/image</use>
				</image>
                <type>
                    <use>texture[0]/type</use>
                </type>
				<filter>
					<use>texture[0]/filter</use>
				</filter>
				<wrap-s>
					<use>texture[0]/wrap-s</use>
				</wrap-s>
				<wrap-t>
					<use>texture[0]/wrap-t</use>
				</wrap-t>
				<!--
          <internal-format>
            <use>texture[0]/internal-format</use>
          </internal-format>
          -->
				<environment>
					<mode>modulate</mode>
				</environment>
			</texture-unit>
			<!-- A two-sided lighting model is set by default near the root
           of the scene graph. Perhaps that ought to be set in this
           effect?
        -->
		</pass>
	</technique>
</PropertyList>