<?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="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>
    <texture name="andrew_marble4.jpg">
      <file>andrew_marble4.jpg</file>
    </texture>
    <texture name="chkb-b-y.png">
      <file>chkb-b-y.png</file>
    </texture>
    <texture name="grass.png">
      <file>grass.png</file>
    </texture>
    <texture name="matbase.png">
      <file>matbase.png</file>
    </texture>
    <texture name="clouds">
      <file>clouddome.jpg</file>
    </texture>
  </textures>

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

  <materials>
    <material name="ScatterSky">
      <color red="0" green="0" blue="1" />
    </material>
    <material name="Base">
      <!-- <texture>materialmap_base.png</texture>-->
      <texture>matbase.png</texture>
      <shader type="ambient">terrain_fixed_base</shader>
    </material>
    <material name="Marble">
      <texture>andrew_marble4.jpg</texture>
      <shadervar name="texture scale" type="vector2">16,16</shadervar>
      <shader type="terrain splat">terrain_fixed_splatting</shader>
    </material>
    <material name="CheckerBoardYellow">
      <texture>chkb-b-y.png</texture>
      <shadervar name="texture scale" type="vector2">8,8</shadervar>
      <shader type="terrain splat">terrain_fixed_splatting</shader>
    </material>
    <material name="Grass">
      <texture>grass.png</texture>
      <shadervar name="texture scale" type="vector2">16,16</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>
    <material name="clouds">
      <texture>clouds</texture>
    </material>
  </materials>

  <addon>
    <plugin>crystalspace.renderloop.loop.loader</plugin>
    <paramsfile>/shader/std_rloop_terrainfixed.xml</paramsfile>
  </addon>

  <settings>
    <clearzbuf>yes</clearzbuf>
    <lightmapcellsize>16</lightmapcellsize>
    <renderloop>std_rloop_terrainfixed</renderloop>
  </settings>

  <start name="Camera">
    <sector>track4</sector>
    <position x="12" y="9" z="-28.3" />
    <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>track4</name>
      <heightmap>track.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>track4</terraformer>
      <sampleregion>
        <min x="-256" y="-256" />
        <max x="256" y="256" />
      </sampleregion>
    </params>
  </meshfact>

  <sector name="track4">

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

     <light name="sun">
       <center x="-50000" y="86030" z="0" />
       <color red="0.85903" 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="0" green="0" blue="1" />
      </params>
      <zfill />
      <priority>sky</priority>
      <camera />
      <polymesh> <colldet/> </polymesh>
    </meshobj>

    <meshobj name="ent_scene">
      <plugin>terrain</plugin>
      <params>
        <factory>TerrainFact</factory>
        <material>Base</material>
        <materialpalette>
          <material>Marble</material>
          <material>Grass</material>
          <material>Marble</material>
          <material>Grass</material> <!-- White -->
          <material>CheckerBoardYellow</material>
        </materialpalette>
        <lodvalue name="splatting distance">800</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="0" z="0" />
      </move>
    </meshobj>

    <meshobj name="clouds">
      <plugin>genmesh</plugin>
      <params>
        <factory>skydome</factory>
        <mixmode> <add /> </mixmode>
        <material>clouds</material>
        <lighting>no</lighting>
        <color red="0.5" green="0.5" blue="0.5" />
      </params>
      <znone />
      <priority>portal</priority>
      <noshadows/>
      <camera />
    </meshobj>
    <key name="cmd_AnimateSky" value="clouds,y,.005" />

    <!-- Uncomment for ...fog: -->
    <!-- fog red=".3" green=".27" blue=".27" density="0.002" / -->
  </sector>
</world>
