<?xml version="1.0" encoding="utf-8" ?>
<world>
  <variables>
    <variable name="LodM" value="-0.00666667" />
    <variable name="LodA" value="1.33333" />
  </variables>

  <plugins>
    <plugin name="thingfact">crystalspace.mesh.loader.factory.thing</plugin>
    <plugin name="thing">crystalspace.mesh.loader.thing</plugin>
    <plugin name="genmeshFactory">crystalspace.mesh.loader.factory.genmesh</plugin>
    <plugin name="genmesh">crystalspace.mesh.loader.genmesh</plugin>
    <plugin name="genmeshfact">crystalspace.mesh.loader.factory.genmesh</plugin>
    <plugin name="terrainFact">crystalspace.mesh.loader.factory.terrain</plugin>
    <plugin name="terrain">crystalspace.mesh.loader.terrain</plugin>
<!--
    <plugin name="foliageFact">crystalspace.mesh.loader.factory.foliage</plugin>
    <plugin name="foliage">crystalspace.mesh.loader.foliage</plugin>
-->
  </plugins>

  <textures>
<!-- terrain textures -->
    <texture name="Sand00">
      <file>Sand00.png</file>
    </texture>
    <texture name="cracked">
      <file>cracked.png</file>
    </texture>
    <texture name="Sand01.png">
      <file>Sand01.png</file>
    </texture>
    <texture name="matbase.png">
      <file>matbase.png</file>
    </texture>
  </textures>

  <shaders>
    <shader><file>/shader/terrain_fixed_base.xml</file></shader>
    <shader><file>/shader/terrain_fixed_splatting.xml</file></shader>
  </shaders>

  <materials>
<!-- terrain mats -->
    <material name="ScatterSky">
      <color red="1" green="1" blue="1" />
      <texture>sky.jpg</texture>
    </material>
    <material name="Base">
      <!-- <texture>materialmap_base.png</texture>-->
      <texture>matbase.png</texture>
      <shader type="ambient">terrain_fixed_base</shader>
    </material>
    <material name="Sand00">
      <texture>Sand00</texture>
      <shadervar name="texture scale" type="vector2">128,128</shadervar>
      <shader type="terrain splat">terrain_fixed_splatting</shader>
    </material>
    <material name="cracked">
      <texture>cracked</texture>
      <shadervar name="texture scale" type="vector2">128,128</shadervar>
      <shader type="terrain splat">terrain_fixed_splatting</shader>
    </material>
    <material name="Sand01">
      <texture>Sand01.png</texture>
      <shadervar name="texture scale" type="vector2">128,128</shadervar>
      <shader type="terrain splat">terrain_fixed_splatting</shader>
    </material>
    <material name="White">
        <color red="1" green="1" blue="1" />
      <shader type="terrain splat">terrain_fixed_splatting</shader>
    </material>
  </materials>


  <addon>
    <plugin>crystalspace.renderloop.loop.loader</plugin>
    <paramsfile>/shader/std_rloop_terrainfixed.xml</paramsfile>
    <!--old one <paramsfile>/shader/std_rloop_terrainfixed.xml</paramsfile> -->
  </addon>

  <settings>
    <clearzbuf>yes</clearzbuf>
    <lightmapcellsize>16</lightmapcellsize>
	<renderloop>std_rloop_terrainfixed</renderloop>
    <!--old one <renderloop>std_rloop_terrainfixed</renderloop>  -->
  </settings>
  <start name="Camera">
    <sector>Scene</sector>
    <position x="0" y="0" z="0" />
    <forward x="0" y="0" z="1" />
    <up x="0" y="1" z="0" />
  </start>

  <meshfact name="skydome">
    <plugin>genmeshFactory</plugin>
    <params>
      <sphere rimvertices="8" reversed="true">
      <radius x="500000" y="500000" z="500000" />
      </sphere>
    </params>
  </meshfact>

  <addon plugin="crystalspace.terraformer.simple.loader">
      <name>garage</name>
      <heightmap>gheight.png</heightmap>
      <scale x="256" y="32" z="256" />
      <materialmap image="matmap.png" />
  </addon>

  <meshfact name="TerrainFact">
    <plugin>terrainFact</plugin>
    <params>
      <plugin>crystalspace.mesh.object.terrain.bruteblock</plugin>
      <terraformer>garage</terraformer>
      <sampleregion>
        <min x="-256" y="-256" />
        <max x="256" y="256" />
      </sampleregion>
    </params>
  </meshfact>

  <sector name="Scene">

     <ambient red="0.15" green="0.15" blue="0.15" />

     <light name="sun">
       <center x="-50000" y="86030" z="-30000" />
       <color red="0.95903" green="0.80995" blue="0.70420" />
       <radius>1000000</radius>
     </light>

    <meshobj name="sky">
      <plugin>genmesh</plugin>
      <params>
        <factory>skydome</factory>
        <material>ScatterSky</material>
           <color red="1" green="1" blue="1" />
      </params>
      <zfill />
      <priority>sky</priority>
      <camera />
      <noshadows/>
    </meshobj>

    <meshobj name="Terrain">
      <plugin>terrain</plugin>
      <params>
        <factory>TerrainFact</factory>
        <material>Base</material>
	<materialpalette>
          <material>Sand00</material>
          <material>Sand01</material>
          <material>cracked</material>
          <material>Sand00</material>
          <material>White</material>
	</materialpalette>
	<lodvalue name="splatting distance">200</lodvalue>
  	<lodvalue name="block resolution">16</lodvalue>
  	<lodvalue name="block split distance">8</lodvalue>
  	<lodvalue name="minimum block size">32</lodvalue>
  	<lodvalue name="cd resolution">256</lodvalue>
	<staticlighting>yes</staticlighting>
	<castshadows>yes</castshadows>
      </params>
      <move>
        <v x="0" y="-15.5" z="0" />
      </move>
    </meshobj>

   <!--Stops the terrain from fading to black -->
    <fog red="0.8" green="0.8" blue="0.8" density="0.0001"/>
 
  </sector>
</world>
