<?xml version="1.0" encoding="utf-8" ?> 
<world>
  <plugins>
    <plugin name="terrainFact">crystalspace.mesh.loader.factory.terrain2</plugin>
    <plugin name="terrain">crystalspace.mesh.loader.terrain2</plugin>
  </plugins>

  <textures>
    <texture name="andrew_marble4.jpg">
      <file>/lib/stdtex/andrew_marble4.jpg</file>
    </texture>
    <texture name="stone4.gif">
      <file>/lib/std/stone4.gif</file>
    </texture>
    <texture name="grass.png">
      <file>/lev/terrain/grass.png</file>
    </texture>
    <texture name="materialmap_base.png">
      <file>/lev/terrain/materialmap_base.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>
    <material name="ScatterSky">
      <color red="0" green="0" blue="0" />
    </material>
    <material name="Base">
      <texture>materialmap_base.png</texture>
      <shader type="ambient">terrain_fixed_base</shader>
    </material>
    <material name="Marble">
      <texture>andrew_marble4.jpg</texture>
      <shadervar name="texture scale" type="vector2">32,32</shadervar>
      <shader type="terrain splat">terrain_fixed_splatting</shader>
    </material>
    <material name="Stone">
      <texture>stone4.gif</texture>
      <shadervar name="texture scale" type="vector2">128,128</shadervar>
      <shader type="terrain splat">terrain_fixed_splatting</shader>
    </material>
    <material name="Grass">
      <texture>grass.png</texture>
      <shadervar name="texture scale" type="vector2">256,256</shadervar>
      <shader type="terrain splat">terrain_fixed_splatting</shader>
    </material>
    <material name="box1">
      <texture>grass.png</texture>
    </material>
    <material name="box2">
      <texture>andrew_marble4.jpg</texture>
    </material>
  </materials>

  <library>grass.lib</library>
  <library>rock.lib</library>
  <library>tree.lib</library>
  <library>tree_skimp.lib</library>
  <library>treebark_bare.lib</library>
  <library>bush2.lib</library>

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

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

  <start>
    <sector>room</sector>
    <position x="0" y="200" z="0" />
    <forward x="0" y="0" z="1" />
    <up x="0" y="1" z="0" />
  </start>

  <meshfact name="TerrainFact">
    <plugin>terrainFact</plugin>
    <params>
      <renderer>crystalspace.mesh.object.terrain2.bruteblockrenderer</renderer>
      <collider>crystalspace.mesh.object.terrain2.collider</collider>
      <feeder>crystalspace.mesh.object.terrain2.simpledatafeeder</feeder>

      <maxloadedcells>20</maxloadedcells>

      <cells>
        <celldefault>
          <gridsize width="257" height="257" />
          <materialmapsize width="512" height="512" />

          <size x="256" y="32" z="256" />

          <basematerial>Base</basematerial>

          <renderproperties>
            <param name="block resolution">16</param>
            <param name="lod splitcoeff">8</param>
          </renderproperties>

          <feederproperties>
            <param name="heightmap source">/lev/terraini/heightmap_257x257.png</param>
            <param name="materialmap source">/lev/terrain/materialmap.png</param>
          </feederproperties>
        </celldefault>
        
        <cell>
          <position x="-256" y="-256" />         
        </cell>
        
        <cell>
          <position x="0" y="-256" />
        </cell>

        <cell>
          <position x="-256" y="0" />
        </cell>

        <cell>
          <position x="0" y="0" />
        </cell>
        
      </cells>
    </params>
  </meshfact>

  <sector name="room">
     <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="Terrain">
      <plugin>terrain</plugin>
      <params>
        <factory>TerrainFact</factory>
        <materialpalette>
          <material>Grass</material>
          <material>Marble</material>
          <material>Stone</material>
        </materialpalette>
      </params>
      <move> 
        <v x="0" y="0" z="0" /> 
      </move>
      <priority>wall</priority>
    </meshobj>

  </sector>
</world>
