<?xml ?>
<world>
    <variables>
        <variable name="LodM" value="-0.00666667" />
        <variable name="LodA" value="1.33333" />
    </variables>
    <plugins>
        <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="terrainFact">crystalspace.mesh.loader.factory.terrain2</plugin>
        <plugin name="terrain">crystalspace.mesh.loader.terrain2</plugin>
        <plugin name="foliageFact">crystalspace.mesh.loader.factory.foliage</plugin>
        <plugin name="foliage">crystalspace.mesh.loader.foliage</plugin>
        <!--
    <plugin name="instFact">crystalspace.mesh.loader.factory.instmesh</plugin>
    <plugin name="inst">crystalspace.mesh.loader.instmesh</plugin>
    -->
    </plugins>
    <library>lightmaps.cslib</library>
    <textures>
        <texture name="andrew_marble4.jpg">
            <file>/lib/stdtex/andrew_marble4.jpg</file>
        </texture>
        <texture name="marble-detail">
            <file>/lev/terrain/marble-detail.png</file>
        </texture>
        <texture name="stone4.gif">
            <file>/lib/std/stone4.gif</file>
        </texture>
        <texture name="stone4_n.png">
            <file>stone4_n.png</file>
            <class>normalmap</class>
        </texture>
        <texture name="grass.png">
            <file>/lev/terrain/grass.png</file>
        </texture>
        <texture name="materialmap_base.png">
            <file>materialmap_base.png</file>
	    <clamp />
	    <class>nosharpen</class>
        </texture>
        <texture name="black">
            <color red="0" green="0" blue="0" />
        </texture>
        <texture name="clouds">
            <file>clouddome.jpg</file>
        </texture>
        <texture name="sky">
            <type>crystalspace.texture.loader.cubemap</type>
            <params>
                <north>skybox_f.jpg</north>
                <south>skybox_b.jpg</south>
                <east>skybox_r.jpg</east>
                <west>skybox_l.jpg</west>
                <top>skybox_u.jpg</top>
                <bottom>skybox_d.jpg</bottom>
            </params>
        </texture>
    </textures>
    <shaders>
        <shader>
            <file>/shader/sky/basic_cubemap.xml</file>
        </shader>
        <shader>
            <file>/shader/terrain/basemap.xml</file>
        </shader>
        <shader>
            <file>/shader/terrain/splatbase.xml</file>
        </shader>
        <shader>
            <file>/shader/terrain/splat.xml</file>
        </shader>
        <shader>
            <file>/shader/terrain/splat-detail.xml</file>
        </shader>
        <shader>
            <file>/shader/lighting/fullbright.xml</file>
        </shader>
    </shaders>
    <materials>
        <material name="ScatterSky">
            <texture>black</texture>
        </material>
        <material name="Base">
            <texture>materialmap_base.png</texture>
            <shader type="base">terrain_basemap</shader>
        </material>
        <material name="splatbase">
            <shader type="base">terrain_splatbase</shader>
        </material>
        <material name="Marble">
            <texture>andrew_marble4.jpg</texture>
            <shadervar name="texture scale" type="vector2">32,32</shadervar>
            <shader type="terrain splat">terrain_splatting-detail</shader>
            <shadervar name="tex detail" type="texture">marble-detail</shadervar>
            <shadervar name="tex detail scale" type="vector2">5,5</shadervar>
        </material>
        <material name="Stone">
            <texture>stone4.gif</texture>
            <shader type="terrain splat">terrain_splatting</shader>
            <shadervar name="tex normal" type="texture">stone4_n.png</shadervar>
            <shadervar name="texture scale" type="vector2">256,256</shadervar>
            <shadervar name="specular" type="vector3">0,0,0</shadervar>
        </material>
        <material name="Grass">
            <texture>grass.png</texture>
            <shadervar name="texture scale" type="vector2">256,256</shadervar>
            <shader type="terrain splat">terrain_splatting</shader>
        </material>
        <material name="box1">
            <texture>grass.png</texture>
        </material>
        <material name="box2">
            <texture>andrew_marble4.jpg</texture>
        </material>
        <material name="clouds">
            <texture>clouds</texture>
            <shader type="base">lighting_fullbright</shader>
        </material>
        <material name="sky">
            <shader type="base">sky_basic_cubemap</shader>
            <shader type="diffuse">sky_basic_cubemap</shader>
            <shadervar type="texture" name="tex sky">sky</shadervar>
        </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>
    <start>
        <sector>room</sector>
        <position x="0" y="30" z="0" />
        <forward x="0" y="0" z="1" />
        <up x="0" y="1" z="0" />
    </start>
    <meshfact name="clouds">
        <plugin>genmeshFactory</plugin>
        <nolighting />
        <params>
            <sphere rimvertices="6" reversed="true">
                <radius x="1000" y="1000" z="1000" />
            </sphere>
        </params>
    </meshfact>
    <meshfact name="sky">
        <plugin>genmeshFactory</plugin>
        <nolighting />
        <params>
            <sphere rimvertices="6" reversed="true">
                <radius x="1000" y="1000" z="1000" />
            </sphere>
        </params>
    </meshfact>
    <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>-1</maxloadedcells>
            <cells>
                <celldefault>
                    <gridsize width="257" height="257" />
                    <materialmapsize width="512" height="512" />
                    <size x="256" y="15" z="256" />
                    <splatbasematerial>splatbase</splatbasematerial>
                    <renderproperties>
                        <param name="splat render priority">object2</param>
                    </renderproperties>
                </celldefault>
                <cell>
                    <name>0</name>
                    <position x="-127" y="-127" />
                    <basematerial>Base</basematerial>
                    <feederproperties>
                        <param name="heightmap source">/lev/terrain/heightmap.png</param>
                        <param name="materialmap source">/lev/terrain/materialmap.png</param>
                    </feederproperties>
                </cell>
            </cells>
        </params>
    </meshfact>
    <sector name="room">
        <light name="sun">
            <center x="-50000" y="86030" z="0" />
            <color red="1.25903" green="1.20995" blue="1.10420" />
            <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>
                <cells>
                    <cell>
                        <name>0</name>
                        <renderproperties>
                            <shadervar name="tex lightmap" type="texture">lightmaps_terrainf_0_png</shadervar>
                            <shadervar name="tex lightmap dir 1" type="texture">lightmaps_terrainf_0_d1_png</shadervar>
                            <shadervar name="tex lightmap dir 2" type="texture">lightmaps_terrainf_0_d2_png</shadervar>
                            <shadervar name="tex lightmap dir 3" type="texture">lightmaps_terrainf_0_d3_png</shadervar>
                            <!-- basemap scale is: (w-1)/w,(h-1)/h,0.5/w,0.5/h -->
                            <shadervar name="basemap scale" type="vector4">0.999023438,0.999023438,0.00048828125,0.00048828125</shadervar>
                        </renderproperties>
                    </cell>
                </cells>
            </params>
            <move>
                <v x="0" y="0" z="0" />
            </move>
            <priority>wall</priority>
            <staticlit />
        </meshobj>
        <meshobj name="clouds">
            <plugin>genmesh</plugin>
            <params>
                <factory>clouds</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>
        <meshobj name="sky">
            <noshadows />
            <plugin>crystalspace.mesh.loader.genmesh</plugin>
            <params>
                <factory>sky</factory>
                <color red="1" green="1" blue="1" />
                <manualcolors />
                <mixmode>
                    <copy />
                </mixmode>
                <material>sky</material>
                <lighting>no</lighting>
            </params>
            <camera />
            <zfill />
            <priority>sky</priority>
        </meshobj>
        <key name="cmd_AnimateSky" value="clouds,y,.005" />
        <meshgen name="grass">
	    <densityfactormap name="fertile">
		<image>/lev/terrain/density_fertile.png</image>
		<scale w="256" h="256" />
	    </densityfactormap>
	    <densityfactormap name="stone">
		<image>/lev/terrain/density_stone.png</image>
		<scale w="256" h="256" />
	    </densityfactormap>
	    <densityfactormap name="road">
		<image>/lev/terrain/density_road.png</image>
		<scale w="256" h="256" />
	    </densityfactormap>
            <geometry>
                <factory maxdist="30" name="treebark_bare" />
                <radius>.3</radius>
                <density>0.02</density>
		<densityfactormap factor=".7">stone</densityfactormap>
		<densityfactormap factor=".7">road</densityfactormap>
		<densityfactormap factor=".4">fertile</densityfactormap>
            </geometry>
            <geometry>
                <factory maxdist="30" name="tree" />
                <radius>.3</radius>
                <density>0.02</density>
		<densityfactormap factor=".1">stone</densityfactormap>
		<densityfactormap factor=".1">road</densityfactormap>
		<densityfactormap factor="1">fertile</densityfactormap>
            </geometry>
            <geometry>
                <factory maxdist="30" name="tree_skimp" />
                <radius>.3</radius>
                <density>0.01</density>
		<densityfactormap factor=".1">stone</densityfactormap>
		<densityfactormap factor=".1">road</densityfactormap>
		<densityfactormap factor="1">fertile</densityfactormap>
            </geometry>
            <geometry>
                <factory maxdist="10" name="Grass" />
                <factory maxdist="30" name="GrassLow" />
                <radius>0</radius>
                <density>5</density>
                <windbias>0.1</windbias>
                <winddirection x=".1" y=".1" />
                <windspeed>0.3</windspeed>
		<densityfactormap factor=".01">stone</densityfactormap>
		<densityfactormap factor=".01">road</densityfactormap>
		<densityfactormap factor="1">fertile</densityfactormap>
            </geometry>
            <geometry>
                <factory maxdist="30" name="bush2" />
                <radius>0.1</radius>
                <density>0.4</density>
		<densityfactormap factor="1">stone</densityfactormap>
		<densityfactormap factor="1">road</densityfactormap>
		<densityfactormap factor=".1">fertile</densityfactormap>
            </geometry>
            <geometry>
                <factory maxdist="10" name="TallGrass" />
                <factory maxdist="30" name="TallGrassLow" />
                <radius>0.1</radius>
                <density>.1</density>
                <windbias>0.1</windbias>
                <winddirection x=".1" y=".1" />
                <windspeed>0.3</windspeed>
		<densityfactormap factor=".1">stone</densityfactormap>
		<densityfactormap factor=".1">road</densityfactormap>
		<densityfactormap factor="1">fertile</densityfactormap>
            </geometry>
            <geometry>
                <factory maxdist="30" name="Rock" />
                <radius>0.1</radius>
                <density>.01</density>
		<densityfactormap factor="1">stone</densityfactormap>
		<densityfactormap factor="0">road</densityfactormap>
		<densityfactormap factor=".3">fertile</densityfactormap>
            </geometry>
            <geometry>
                <factory maxdist="30" name="RockSmall" />
                <radius>0.1</radius>
                <density>.10</density>
		<densityfactormap factor="1">stone</densityfactormap>
		<densityfactormap factor="0">road</densityfactormap>
		<densityfactormap factor=".3">fertile</densityfactormap>
            </geometry>
            <!--<densityscale mindist="26" maxdist="30" maxfactor="0" />-->
            <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>
        <!-- Uncomment for ...fog: -->
        <!--fog red=".3" green=".27" blue=".27" density="0.002" /-->
    </sector>
</world>
