<?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>

<!--foliage textures -->
    <texture name='sage2.png'>
      <file>textures/sage2.png</file>
      <alpha> <binary/> </alpha>
    </texture>

    <texture name="grass.dds">
      <file>textures/grass.dds</file>
      <alpha><binary/></alpha>
    </texture>

    <texture name="rocky_surface.jpg">
      <file>textures/rocky_surface.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>
<!-- 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>

<!-- TEMP!!! -->
    <material name='SaddleBrno'>
      <texture>no</texture>
    </material>
    <material name='BurlyWoono'>
      <texture>no</texture>
    </material>
    <material name='Goldenrono'>
      <texture>no</texture>
    </material>
    <material name='Siennano'>
      <texture>no</texture>
    </material>
    <material name='DarkGoldno'>
      <texture>no</texture>
    </material>
    <material name='FrontColorno'>
      <texture>no</texture>
    </material> 
<!-- TEMP!!! -->

<!--foliage mats-->
    <material name='sage2.png'>
      <texture>sage2.png</texture>
    </material>
    <material name="grass.dds">
      <texture>grass.dds</texture>
    </material>
    <material name="rocky_surface.jpg">
      <texture>rocky_surface.jpg</texture>
    </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>

  <library>factories/grass.lib</library>
  <library>factories/rock.lib</library>
  <library>factories/bush2.lib</library>

  <start name="Camera">
    <sector>Garage</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>garagesimple</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>garagesimple</terraformer>
      <sampleregion>
        <min x="-256" y="-256" />
        <max x="256" y="256" />
      </sampleregion>
    </params>
  </meshfact>

  <sector name="Garage">

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

     <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 />
      <trimesh> <id>colldet</id> </trimesh>
    </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>

    <!-- Uncomment for ...fog: -->
    <!-- <fog red=".4" green=".4" blue=".6" density="0.001" /> -->

<!--
    <meshgen name="grass">
        <geometry>
	    <factory maxdist="30" name="Grass" />
	    <factory maxdist="50" name="GrassLow" />
	    <radius>1</radius>
	    <density>0.01</density>
	    <materialfactor material="cracked" factor="1" />
	    <materialfactor material="Sand00" factor="1" />
        </geometry>
        <geometry>
	    <factory maxdist="50" name="bush2" />
	    <radius>1</radius>
	    <density>0.01</density>
	    <materialfactor material="Sand00" factor="1" />
	    <materialfactor material="Sand01" factor="0" />
	    <defaultmaterialfactor>0.009</defaultmaterialfactor>
        </geometry>


	<alphascale mindist="22" maxdist="30" />
	<samplebox>
	    <min x="-256" y="-200" z="-256" />
	    <max x="256" y="200" z="256" />
	</samplebox>
	<meshobj>Terrain</meshobj>
     </meshgen> -->
  </sector>
</world>
