<?xml version="1.0" encoding="utf-8" ?>
<world>
  <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>
        <!-- object textures -->
        <texture name="RAMP1.JPG">
          <file>textures/RAMP1.JPG</file>
        </texture>
        <texture name="bridge_1.jpg">
          <file>textures/bridge_1.jpg</file>
        </texture>
        <texture name="BiGRamp.jpg">
          <file>textures/BiGRamp.jpg</file>
        </texture>
        <texture name="base_normalmap">
          <file>textures/normalmap.png</file>
          <class>normalmap</class>
        </texture>
        <texture name="stone-n">
          <file>textures/stone-n.png</file>
          <class>normalmap</class>
        </texture>
        <texture name="sand-n">
          <file>textures/sand-n.png</file>
          <class>normalmap</class>
        </texture>
        <texture name="blank-normalmap">
          <file>/outlaws/textures/blank-normalmap.png</file>
          <class>normalmap</class>
        </texture>
      </textures>
      <shaders>
        <shader><file>/shader/sky_scattering.xml</file></shader>
        <shader><file>/shader/splatting_base.xml</file></shader>
        <shader><file>/shader/splatting_scattering_base.xml</file></shader>
        <shader><file>/shader/splatting_bump.xml</file></shader>
        <shader><file>/shader/splatting_scattering.xml</file></shader>
      </shaders>
      <materials>
        <!-- terrain mats -->
        <material name="ScatterSky">
          <color red="0" green="0" blue="0" /> 
          
      <shadervar type='vector3' name="sky base color">0.2,0.3,0.4</shadervar>
      <shadervar type='vector3' name="sky sun-glow color">0.9,0.5,0.03</shadervar>
      <shadervar type='float' name="sky sun size">0.0004</shadervar>
          <shader type="ambient">sky_scattering</shader>
        </material>
        <material name="Base">
          <texture>matbase.png</texture>
          <shadervar name="tex normal" type="texture">base_normalmap</shadervar>
          <shadervar name="normal scale" type="vector2">128,128</shadervar>
      <shadervar type='vector4' name="scatter sun color">0.15,0.10,0.10,0.01</shadervar>
      <shadervar type='vector3' name="scatter color">0.045,0.04,0.035</shadervar>
      <shadervar type='vector3' name="scatter ground glow">0.035,0.03,0.025</shadervar>
      <shadervar type='vector3' name="scatter world color">0.35,0.3,0.25</shadervar>
      
<!--      <shadervar type='vector4' name="scatter sun color">0.90,0.10,0.10,0.01</shadervar>
      <shadervar type='vector3' name="scatter color">0.06,0.05,0.04</shadervar>
      <shadervar type='vector3' name="scatter ground glow">0.04,0.03,0.01</shadervar>
      <shadervar type='vector3' name="scatter world color">0.7,0.3,0.30</shadervar>-->
          
          <shader type="ambient">splatting_scattering_base</shader>
        </material>
        <material name="Sand00">
          <texture>Sand00</texture>
          <shadervar name="texture scale" type="vector2">128,128</shadervar>
          <shadervar name="normal scale" type="vector2">128,128</shadervar>
          <shadervar name="tex normal" type="texture">sand-n</shadervar>
          <shader type="terrain splat">splatting_scattering</shader>
        </material>
        <material name="cracked">
          <texture>cracked</texture>
          <shadervar name="texture scale" type="vector2">128,128</shadervar>
          <shadervar name="normal scale" type="vector2">128,128</shadervar>
          <shadervar name="tex normal" type="texture">sand-n</shadervar>
          <shader type="terrain splat">splatting_scattering</shader>
        </material>
        <material name="Sand01">
          <texture>Sand01.png</texture>
          <shadervar name="texture scale" type="vector2">128,128</shadervar>
          <shadervar name="normal scale" type="vector2">128,128</shadervar>
          <shadervar name="tex normal" type="texture">sand-n</shadervar>
          <shader type="terrain splat">splatting_scattering</shader>
        </material>
        <material name="White">
          <color red="1" green="1" blue="1" />
        </material>
        <!-- object mats -->
        <material name="Rampmat">
          <texture>RAMP1.JPG</texture>
          <shader type="diffuse">light_spec_bumpmap</shader>
          <shader type="ambient">ambient</shader>
          <shadervar type="texture" name="tex normal">blank-normalmap</shadervar>
        </material>
        <material name="bridge_1.jpg">
          <texture>bridge_1.jpg</texture>
          <shader type="diffuse">light_spec_bumpmap</shader>
          <shader type="ambient">ambient</shader>
          <shadervar type="texture" name="tex normal">blank-normalmap</shadervar>
        </material>
        <material name="01 - DefaultBiGRamp.jpg">
          <texture>BiGRamp.jpg</texture>
          <shader type="diffuse">light_spec_bumpmap</shader>
          <shader type="ambient">ambient</shader>
          <shadervar type="texture" name="tex normal">blank-normalmap</shadervar>
        </material>
      </materials>
      <addon>
        <plugin>crystalspace.renderloop.loop.loader</plugin>
        <paramsfile>/shader/std_rloop_terrain.xml</paramsfile>
      </addon>
      <settings>
        <clearzbuf>yes</clearzbuf>
        <lightmapcellsize>16</lightmapcellsize>
        <renderloop>std_rloop_terrain</renderloop>
      </settings>
      <library>factories/genRamp</library>
      <library>factories/genBridge</library>
      <library>factories/genBigRamp</library>
      
      <start name="Camera">
        <sector>Scene</sector>
        <position x="15" y="37" z="10" />
        <forward x="0" y="0" z="1" />
        <up x="0" y="1" z="0" />
      </start>
      <start name="Camera1">
        <sector>Scene</sector>
        <position x="19" y="37" z="10" />
        <forward x="0" y="0" z="1" />
        <up x="0" y="1" z="0" />
      </start>
      <start name="Camera2">
        <sector>Scene</sector>
        <position x="11" y="37" z="10" />
        <forward x="0" y="0" z="1" />
        <up x="0" y="1" z="0" />
      </start>
      <start name="Camera3">
        <sector>Scene</sector>
        <position x="15" y="37" z="6" />
        <forward x="0" y="0" z="1" />
        <up x="0" y="1" z="0" />
      </start>
      <start name="Camera4">
        <sector>Scene</sector>
        <position x="15" y="37" z="14" />
        <forward x="0" y="0" z="1" />
        <up x="0" y="1" z="0" />
      </start>
      <meshfact name="skydome">
        <plugin>genmeshFactory</plugin>
        <params>
          <sphere rimvertices="64" reversed="true">
            <radius x="500000" y="500000" z="500000" />
          </sphere>
        </params>
      </meshfact>
      <addon plugin="crystalspace.terraformer.simple.loader">
        <name>cod</name>
        <heightmap>cod.png</heightmap>
        <scale x="256" y="116" z="256" />
        <materialmap image="matmap.png" />
      </addon>
      <meshfact name="TerrainFact">
        <plugin>terrainFact</plugin>
        <params>
          <plugin>crystalspace.mesh.object.terrain.bruteblock</plugin>
          <terraformer>cod</terraformer>
          <sampleregion>
            <min x="-256" y="-256" />
            <max x="256" y="256" />
          </sampleregion>
        </params>
      </meshfact>
      <sector name="Scene">
        <cullerp plugin="crystalspace.culling.frustvis" />
       <ambient red="0.2" green="0.2" blue="0.2" />
        <light name="sun">
          <center x="4000000" y="5000000" z="-4000000" />
          <radius>0</radius>
          <color red="0.85903" green="0.80995" blue="0.80420" />
          <influenceradius>10000000</influenceradius>
          <attenuation>realistic</attenuation>
        </light>

        
        <meshobj name="sky">
          <plugin>genmesh</plugin>
          <params>
            <factory>skydome</factory>
            <material>ScatterSky</material>
            <color red="0" green="0" blue="0" />
          </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">400</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>
          </params>
          <move>
            <v x="0" y="0" z="0" />
          </move>
        </meshobj>
        <!-- Objects -->
        <meshobj name="RampModel">
          <plugin>genmesh</plugin>
          <params>
            <factory>genRamp</factory>
            <material>Rampmat</material>
          </params>
          <move>
            <v y="48.2" x="-70" z="-50" />
            <matrix>
              <roty>4</roty>
              <rotz>0</rotz>
              <rotx>0</rotx>
            </matrix>
          </move>
        </meshobj>
        <meshobj name="RampModel1">
          <plugin>genmesh</plugin>
          <params>
            <factory>genRamp</factory>
            <material>Rampmat</material>
          </params>
          <move>
            <v y="48.2" x="-68" z="32" />
            <matrix>
              <roty>2.3</roty>
              <rotz>0</rotz>
              <rotx>0</rotx>
            </matrix>
          </move>
        </meshobj>
        <meshobj name="BridgeModel">
          <plugin>genmesh</plugin>
          <params>
            <factory>genBridge</factory>
            <material>bridge_1.jpg</material>
          </params>
          <move>
            <v y="43.7" x="146" z="-12" />
            <matrix>
              <roty>1.5707</roty>
              <rotz>0</rotz>
              <rotx>0</rotx>
            </matrix>
          </move>
        </meshobj>
        <meshobj name="BridgeModel1">
          <plugin>genmesh</plugin>
          <params>
            <factory>genBridge</factory>
            <material>bridge_1.jpg</material>
          </params>
          <move>
            <v y="43.69" x="130" z="-12" />
            <matrix>
              <roty>1.5707</roty>
              <rotz>0</rotz>
              <rotx>0</rotx>
            </matrix>
          </move>
        </meshobj>
        <meshobj name="BridgeModel2">
          <plugin>genmesh</plugin>
          <params>
            <factory>genBridge</factory>
            <material>bridge_1.jpg</material>
          </params>
          <move>
            <v y="43.9" x="-135" z="-8" />
            <matrix>
              <roty>0</roty>
              <rotz>0</rotz>
              <rotx>0</rotx>
            </matrix>
          </move>
        </meshobj>
        <meshobj name="BridgeModel3">
          <plugin>genmesh</plugin>
          <params>
            <factory>genBridge</factory>
            <material>bridge_1.jpg</material>
          </params>
          <move>
            <v y="43.89" x="-135" z="-24" />
            <matrix>
              <roty>0</roty>
              <rotz>0</rotz>
              <rotx>0</rotx>
            </matrix>
          </move>
        </meshobj>
        <meshobj name="BigRamp">
          <plugin>genmesh</plugin>
          <params>
            <factory>genBigRamp</factory>
            <material>01 - DefaultBiGRamp.jpg</material>
          </params>
          <move>
            <v y="35.0" x="30" z="-12" />
            <matrix>
              <roty>1.5707</roty>
              <rotz>0</rotz>
              <rotx>0</rotx>
            </matrix>
          </move>
        </meshobj>
      </sector>
    </world>
