<?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>
            <!-- 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>
        </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>
            <!-- object mats -->
            <material name="Rampmat">
                <texture>RAMP1.JPG</texture>
            </material>
            <material name="bridge_1.jpg">
                <texture>bridge_1.jpg</texture>
            </material>
            <material name="01 - DefaultBiGRamp.jpg">
                <texture>BiGRamp.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>no</clearzbuf>
            <lightmapcellsize>16</lightmapcellsize>
            <renderloop>std_rloop_terrainfixed</renderloop>
            <!--old one <renderloop>std_rloop_terrainfixed</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="8" reversed="true">
                    <radius x="500" y="500" z="500" />
                </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.15" green="0.15" blue="0.15" />                                                       
            <!--Stops the terrain from fading to black -->
            <!--<fog red="0.8" green="0.8" blue="0.8" density="0.0001"/>-->
            <light name="sun">
            <center x="-20000" y="12500" z="5000" />
            <color red="0.9" green="0.875" blue="0.875" />
            <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="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>
