<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
	<name>Effects/landmass</name>
	<inherits-from>Effects/terrain-default</inherits-from>
	<parameters>
		<texture n="2">
			<image>Textures/Terrain/forest-relief.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>
		<snow-level>
			<use>/environment/snow-level-m</use>
		</snow-level>
		<depth-factor type="float">0.01</depth-factor>
		<canopy-height type="float">15.0</canopy-height>
		<quality-level>
			<use>/sim/rendering/shaders/landmass</use>
		</quality-level>
	<!--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>
	<terminator>
		<use>/environment/terminator-relative-position-m</use>
	</terminator>
	<fogtype>
		<use>/sim/rendering/shaders/skydome</use>
	</fogtype>
	<!-- 	END fog include -->
	</parameters>

	<generate>
		<tangent type="int">6</tangent>
		<binormal type="int">7</binormal>
	</generate>
	<technique n="8">
		<predicate>
			<and>
				<property>/sim/rendering/shaders/quality-level</property>
				<property>/sim/rendering/shaders/landmass</property>
				<less-equal>
					<value type="float">4.0</value>
					<float-property>/sim/rendering/shaders/landmass</float-property>
				</less-equal>
				<equal>
					<value type="float">0.0</value>
					<float-property>/sim/rendering/rembrandt/enabled</float-property>
				</equal>
				<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>
				<extension-supported>GL_EXT_geometry_shader4</extension-supported>
			</and>
		</predicate>
        
        <!--
		<pass>
			<lighting>true</lighting>
			<material>
				<ambient>
					<use>material/ambient</use>
				</ambient>
				<diffuse>
					<use>material/diffuse</use>
				</diffuse>
				<specular>
					<use>material/specular</use>
				</specular>
				<color-mode>ambient-and-diffuse</color-mode>
			</material>
			<alpha-test>
				<use>transparent</use>
			</alpha-test>
			<shade-model>smooth</shade-model>
			<cull-face>back</cull-face>
			<render-bin>
				<bin-number>-1</bin-number>
				<bin-name>RenderBin</bin-name>
			</render-bin>
			<texture-unit>
				<unit>1</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>
			</texture-unit>
			<program>
			<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader> 
				<vertex-shader n="1">Shaders/landmass-g.vert</vertex-shader>
				<geometry-shader>Shaders/landmass.geom</geometry-shader>
				<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
				<fragment-shader n="1">Shaders/terrain-nocolor.frag</fragment-shader>
				<geometry-vertices-out type="int">18</geometry-vertices-out>
				<geometry-input-type>triangles</geometry-input-type>
				<geometry-output-type>triangle-strip</geometry-output-type>
				<attribute>
					<name>tangent</name>
					<index>6</index>
				</attribute>
				<attribute>
					<name>binormal</name>
					<index>7</index>
				</attribute>
			</program>
			<uniform>
				<name>texture</name>
				<type>sampler-2d</type>
				<value type="int">1</value>
			</uniform>
			<uniform>
				<name>canopy_height</name>
				<type>float</type>
				<value>
					<use>canopy-height</use>
				</value>
			</uniform>
			<color-mask type="vec4d">0 0 0 0</color-mask>

			<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>fogType</name>
				<type>int</type>
				<value>
					<use>fogtype</use>
				</value>
			</uniform>
		</pass>
    -->
    
		<pass>
			<lighting>true</lighting>
			<material>
				<ambient>
					<use>material/ambient</use>
				</ambient>
				<diffuse>
					<use>material/diffuse</use>
				</diffuse>
				<specular>
					<use>material/specular</use>
				</specular>
				<color-mode>ambient-and-diffuse</color-mode>
			</material>
			<blend>
				<use>transparent</use>
			</blend>
			<alpha-test>
				<use>transparent</use>
			</alpha-test>
			<shade-model>smooth</shade-model>
			<cull-face>back</cull-face>
			<render-bin>
				<bin-number>
					<use>render-bin/bin-number</use>
				</bin-number>
				<bin-name>
					<use>render-bin/bin-name</use>
				</bin-name>
			</render-bin>
			<texture-unit>
				<unit>0</unit>
				<type>noise</type>
			</texture-unit>
			<texture-unit>
				<unit>1</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>
			</texture-unit>
			<texture-unit>
				<unit>2</unit>
				<image>
					<use>texture[2]/image</use>
				</image>
				<type>
					<use>texture[2]/type</use>
				</type>
				<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>
			<program>
<!-- 				<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader> -->
				<vertex-shader n="1">Shaders/landmass-g.vert</vertex-shader>
				<geometry-shader>Shaders/landmass.geom</geometry-shader>
				<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
				<fragment-shader n="1">Shaders/landmass.frag</fragment-shader>
				<geometry-vertices-out type="int">18</geometry-vertices-out>
				<geometry-input-type>triangles</geometry-input-type>
				<geometry-output-type>triangle-strip</geometry-output-type>
				<attribute>
					<name>tangent</name>
					<index>6</index>
				</attribute>
				<attribute>
					<name>binormal</name>
					<index>7</index>
				</attribute>
			</program>
			<uniform>
				<name>NoiseTex</name>
				<type>sampler-3d</type>
				<value type="int">0</value>
			</uniform>
			<uniform>
				<name>BaseTex</name>
				<type>sampler-2d</type>
				<value type="int">1</value>
			</uniform>
			<uniform>
				<name>NormalTex</name>
				<type>sampler-2d</type>
				<value type="int">2</value>
			</uniform>
			<uniform>
				<name>depth_factor</name>
				<type>float</type>
				<value>
					<use>depth-factor</use>
				</value>
			</uniform>
			<uniform>
				<name>snowlevel</name>
				<type>float</type>
				<value>
					<use>snow-level</use>
				</value>
			</uniform>
			<uniform>
				<name>canopy_height</name>
				<type>float</type>
				<value>
					<use>canopy-height</use>
				</value>
			</uniform>
			<uniform>
				<name>quality_level</name>
				<type>float</type>
				<value>
					<use>quality-level</use>
				</value>
			</uniform>
			<depth>
				<function>lequal</function>
			<!--	<write-mask type="bool">false</write-mask> -->
			</depth>
			<!-- 	    BEGIN fog include -->
			<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>fogType</name>
				<type>int</type>
				<value>
					<use>fogtype</use>
				</value>
			</uniform>
			<!-- 			END fog include -->
		</pass>
	</technique>
	<technique n="9">
		<predicate>
			<and>
				<property>/sim/rendering/shaders/quality-level</property>
				<property>/sim/rendering/shaders/landmass</property>
				<equal>
					<value type="float">0.0</value>
					<float-property>/sim/rendering/rembrandt/enabled</float-property>
				</equal>
				<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>
				<ambient>
					<use>material/ambient</use>
				</ambient>
				<diffuse>
					<use>material/diffuse</use>
				</diffuse>
				<specular>
					<use>material/specular</use>
				</specular>
				<color-mode>ambient-and-diffuse</color-mode>
			</material>
			<blend>
				<use>transparent</use>
			</blend>
			<alpha-test>
				<use>transparent</use>
			</alpha-test>
			<shade-model>smooth</shade-model>
			<cull-face>back</cull-face>
			<render-bin>
				<bin-number>
					<use>render-bin/bin-number</use>
				</bin-number>
				<bin-name>
					<use>render-bin/bin-name</use>
				</bin-name>
			</render-bin>
			<texture-unit>
				<unit>0</unit>
				<type>noise</type>
			</texture-unit>
			<texture-unit>
				<unit>1</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>
			</texture-unit>
			<texture-unit>
				<unit>2</unit>
				<image>
					<use>texture[2]/image</use>
				</image>
				<type>
					<use>texture[2]/type</use>
				</type>
				<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>
			<program>
<!-- 				<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader> -->
				<vertex-shader n="1">Shaders/landmass.vert</vertex-shader>
				<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
				<fragment-shader n="1">Shaders/landmass.frag</fragment-shader>
				<attribute>
					<name>tangent</name>
					<index>6</index>
				</attribute>
				<attribute>
					<name>binormal</name>
					<index>7</index>
				</attribute>
			</program>
			<uniform>
				<name>NoiseTex</name>
				<type>sampler-3d</type>
				<value type="int">0</value>
			</uniform>
			<uniform>
				<name>BaseTex</name>
				<type>sampler-2d</type>
				<value type="int">1</value>
			</uniform>
			<uniform>
				<name>NormalTex</name>
				<type>sampler-2d</type>
				<value type="int">2</value>
			</uniform>
			<uniform>
				<name>depth_factor</name>
				<type>float</type>
				<value>
					<use>depth-factor</use>
				</value>
			</uniform>
			<uniform>
				<name>snowlevel</name>
				<type>float</type>
				<value>
					<use>snow-level</use>
				</value>
			</uniform>
			<uniform>
				<name>quality_level</name>
				<type>float</type>
				<value>
					<use>quality-level</use>
				</value>
			</uniform>

			<!-- 	    BEGIN fog include -->
			<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>fogType</name>
				<type>int</type>
				<value>
					<use>fogtype</use>
				</value>
			</uniform>
			<!-- 			END fog include -->
		</pass>
	</technique>
</PropertyList>