<?xml version="1.0" encoding="utf-8"?>

<PropertyList>
	<name>Effects/glass</name>
	<inherits-from>Effects/model-default</inherits-from>

<parameters>
	<texture n="1">
		<image>Aircraft/Generic/Effects/window_frost.png</image>
		<type>2d</type>
		<filter>linear-mipmap-linear</filter>
		<wrap-s>repeat</wrap-s>
		<wrap-t>repeat</wrap-t>
		<internal-format>normalized</internal-format>
	</texture>
	<!-- placeholder for the function texture used for fogging, wiper area,...-->
	<texture n="2">
		<type>white</type>
	</texture>
	<texture n="3">
		<type>cubemap</type>
		<images>
			<positive-x>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_px.png</positive-x>
			<negative-x>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nx.png</negative-x>
			<positive-y>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_py.png</positive-y>
			<negative-y>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_ny.png</negative-y>
			<positive-z>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_pz.png</positive-z>
			<negative-z>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nz.png</negative-z>
		</images>
		</texture>
	<!--<glass-tint type="vec4d" n="0"> 0.5 0.5 1.0 2.0</glass-tint>-->
	<glass-tint type="vec4d" n="0"> 1.0 1.0 1.0 0.4</glass-tint>
	<splash-x><use>/environment/aircraft-effects/splash-vector-x</use></splash-x>
	<splash-y><use>/environment/aircraft-effects/splash-vector-y</use></splash-y>
	<splash-z><use>/environment/aircraft-effects/splash-vector-z</use></splash-z>
	<rnorm><use>/environment/rain-norm</use></rnorm>
	<gsnorm><use>/environment/aircraft-effects/ground-splash-norm</use></gsnorm>
	<frost-level><use>/environment/aircraft-effects/frost-level</use></frost-level>
	<use-reflection type="int">1</use-reflection>
</parameters>

<technique n="4">
    <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>
    <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>1</bin-number>
		<bin-name>RenderBin</bin-name>
	</render-bin>-->
      <rendering-hint><use>rendering-hint</use></rendering-hint>
      <texture-unit>
        <!-- The texture unit is always active because the shaders expect
             that. -->
        <unit>0</unit>
        <!-- If there is a texture, the type in the derived effect
        will be "2d". -->
        <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>
        <!--
        <internal-format>
          <use>texture[0]/internal-format</use>
        </internal-format>
        -->
      </texture-unit>
      <texture-unit>
        <unit>1</unit>
        <type><use>texture[1]/type</use></type>
        <image><use>texture[1]/image</use></image>
        <filter><use>texture[1]/filter</use></filter>
        <wrap-s><use>texture[1]/wrap-s</use></wrap-s>
        <wrap-t><use>texture[1]/wrap-t</use></wrap-t>
        <internal-format>
          <use>texture[1]/internal-format</use>
        </internal-format>
      </texture-unit>
      <texture-unit>
        <unit>2</unit>
        <type><use>texture[2]/type</use></type>
        <image><use>texture[2]/image</use></image>
        <filter><use>texture[2]/filter</use></filter>
        <wrap-s><use>texture[2]/wrap-s</use></wrap-s>
        <wrap-t><use>texture[2]/wrap-t</use></wrap-t>
        <internal-format>
          <use>texture[2]/internal-format</use>
        </internal-format>
      </texture-unit>
      <texture-unit>
	<unit>3</unit>
	<type><use>texture[3]/type</use></type>
	<images><use>texture[3]/images</use></images>
      </texture-unit>
      <vertex-program-two-side>
        <use>vertex-program-two-side</use>
      </vertex-program-two-side>
      <program>
        <vertex-shader>Shaders/glass-ALS.vert</vertex-shader>
        <fragment-shader>Shaders/glass-ALS.frag</fragment-shader>
        <fragment-shader>Shaders/noise.frag</fragment-shader>
      </program>

     <uniform>
        <name>tint</name>
        <type>float-vec4</type>
        <value><use>glass-tint</use></value>
     </uniform>
     <uniform>
        <name>splash_x</name>
        <type>float</type>
        <value><use>splash-x</use></value>
     </uniform>
     <uniform>
        <name>splash_y</name>
        <type>float</type>
        <value><use>splash-y</use></value>
     </uniform>
     <uniform>
        <name>splash_z</name>
        <type>float</type>
        <value><use>splash-z</use></value>
      </uniform>
      <uniform>
        <name>rain_norm</name>
        <type>float</type>
        <value><use>rnorm</use></value>
      </uniform>
      <uniform>
        <name>ground_splash_norm</name>
        <type>float</type>
        <value><use>gsnorm</use></value>
      </uniform>
      <uniform>
        <name>frost_level</name>
        <type>float</type>
        <value><use>frost-level</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>terminator</name>
	<type>float</type>
	<value><use>terminator</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>air_pollution</name>
        <type>float</type>
        <value><use>air_pollution</use></value>
      </uniform>
      <uniform>
        <name>texture</name>
        <type>sampler-2d</type>
        <value type="int">0</value>
      </uniform>
      <uniform>
        <name>frost_texture</name>
        <type>sampler-2d</type>
        <value type="int">1</value>
      </uniform>
      <uniform>
        <name>func_texture</name>
        <type>sampler-2d</type>
        <value type="int">2</value>
      </uniform>
      <uniform>
	<name>cube_texture</name>
        <type>sampler-cube</type>
	<value type="int">3</value>
      </uniform>
      <uniform>
	<name>use_reflection</name>
	<type>int</type>
	<value><use>use_reflection</use></value>
      </uniform>
      <uniform>
        <name>colorMode</name>
        <type>int</type>
        <value><use>material/color-mode-uniform</use></value>
      </uniform>
    </pass>
  </technique>


</PropertyList>