<?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="waterFact">crystalspace.mesh.loader.factory.watermesh</plugin>
    <plugin name="water">crystalspace.mesh.loader.watermesh</plugin>
  </plugins>
  
  <shaders>
    <shader>
      <file>/shader/water/water.xml</file>
    </shader>
    <shader>
        <file>/shader/lighting/fullbright.xml</file>
    </shader>
  </shaders>
  
  <textures>    
    <texture name="normal map 1">
      <file>/water/723-normal.jpg</file>
    </texture>
    
    <texture name="normal map 2">
      <file>/water/w_normalmap.png</file>
    </texture>
    
    <texture name="normal map 3">
      <file>/water/940-bump.jpg</file>
    </texture>
    
    <texture name="clouds">
      <file>/lev/terrainf/clouddome.jpg</file>
    </texture>
    <texture name="sky_up">
        <file>/lev/terrainf/skybox_u.jpg</file>
    </texture>
    <texture name="sky_down">
        <file>/lev/terrainf/skybox_d.jpg</file>
    </texture>
    <texture name="sky_left">
        <file>/lev/terrainf/skybox_l.jpg</file>
    </texture>
    <texture name="sky_right">
       <file>/lev/terrainf/skybox_r.jpg</file>
    </texture>
    <texture name="sky_front">
       <file>/lev/terrainf/skybox_f.jpg</file>
    </texture>
    <texture name="sky_back">
       <file>/lev/terrainf/skybox_b.jpg</file>
    </texture>
  </textures>
  
  <!-- Material like this necessary for proper ocean rendering -->
  <materials>
    <material name="oceanMat">
      <shader type="standard">water</shader>
      <shadervar name="tex normal" type="texture">normal map 2</shadervar>
    </material>
    
    <material name="clouds">
      <texture>clouds</texture>
      <shader type="base">lighting_fullbright</shader>
    </material>
    <material name="sky_up">
      <texture>sky_up</texture>
      <shader type="base">lighting_fullbright</shader>
    </material>
    <material name="sky_down">
      <texture>sky_down</texture>
      <shader type="base">lighting_fullbright</shader>
    </material>
    <material name="sky_left">
      <texture>sky_left</texture>
      <shader type="base">lighting_fullbright</shader>
    </material>
    <material name="sky_right">
      <texture>sky_right</texture>
      <shader type="base">lighting_fullbright</shader>
    </material>
    <material name="sky_front">
      <texture>sky_front</texture>
      <shader type="base">lighting_fullbright</shader>
    </material>
    <material name="sky_back">
      <texture>sky_back</texture>
      <shader type="base">lighting_fullbright</shader>
     </material>
  </materials>

  <meshfact name="skydome">
      <plugin>genmeshFactory</plugin>
      <params>
          <sphere rimvertices="6" reversed="true">
              <radius x="1000" y="1000" z="1000" />
          </sphere>
      </params>
  </meshfact>

  <meshfact name="factory_room_sky">
      <plugin>crystalspace.mesh.loader.factory.genmesh</plugin>
      <params>
          <numvt>24</numvt>
          <v x="-1000" y="1000" z="-1000" u="0.005" v="0.005" />
          <v x="-1000" y="1000" z="1000" u="0.995" v="0.005" />
          <v x="-1000" y="-1000" z="1000" u="0.995" v="0.995" />
          <v x="-1000" y="-1000" z="-1000" u="0.00500003" v="0.995" />
          <v x="-1000" y="1000" z="1000" u="0.005" v="0.005" />
          <v x="1000" y="1000" z="1000" u="0.995" v="0.005" />
          <v x="1000" y="-1000" z="1000" u="0.995" v="0.995" />
          <v x="-1000" y="-1000" z="1000" u="0.00500003" v="0.995" />
          <v x="-1000" y="1000" z="-1000" u="0.005" v="0.005" />
          <v x="1000" y="1000" z="-1000" u="0.995" v="0.005" />
          <v x="1000" y="1000" z="1000" u="0.995" v="0.995" />
          <v x="-1000" y="1000" z="1000" u="0.00500003" v="0.995" />
          <v x="1000" y="-1000" z="-1000" u="0.005" v="0.005" />
          <v x="-1000" y="-1000" z="-1000" u="0.995" v="0.005" />
          <v x="-1000" y="-1000" z="1000" u="0.995" v="0.995" />
          <v x="1000" y="-1000" z="1000" u="0.00500003" v="0.995" />
          <v x="1000" y="1000" z="1000" u="0.005" v="0.005" />
          <v x="1000" y="1000" z="-1000" u="0.995" v="0.005" />
          <v x="1000" y="-1000" z="-1000" u="0.995" v="0.995" />
          <v x="1000" y="-1000" z="1000" u="0.00500003" v="0.995" />
          <v x="1000" y="1000" z="-1000" u="0.005" v="0.005" />
          <v x="-1000" y="1000" z="-1000" u="0.995" v="0.005" />
          <v x="-1000" y="-1000" z="-1000" u="0.995" v="0.995" />
          <v x="1000" y="-1000" z="-1000" u="0.00500003" v="0.995" />
          <mixmode>
              <copy />
          </mixmode>
          <n x="1" y="0" z="0" />
          <n x="1" y="0" z="0" />
          <n x="1" y="0" z="0" />
          <n x="1" y="0" z="0" />
          <n x="0" y="0" z="-1" />
          <n x="0" y="0" z="-1" />
          <n x="0" y="0" z="-1" />
          <n x="0" y="0" z="-1" />
          <n x="0" y="-1" z="0" />
          <n x="0" y="-1" z="0" />
          <n x="0" y="-1" z="0" />
          <n x="0" y="-1" z="0" />
          <n x="0" y="1" z="0" />
          <n x="0" y="1" z="0" />
          <n x="0" y="1" z="0" />
          <n x="0" y="1" z="0" />
          <n x="-1" y="0" z="0" />
          <n x="-1" y="0" z="0" />
          <n x="-1" y="0" z="0" />
          <n x="-1" y="0" z="0" />
          <n x="0" y="0" z="1" />
          <n x="0" y="0" z="1" />
          <n x="0" y="0" z="1" />
          <n x="0" y="0" z="1" />
          <submesh name="0">
              <material>sky_left</material>
              <indexbuffer components="1" type="uint" indices="yes">
                  <e c0="0" />
                  <e c0="1" />
                  <e c0="2" />
                  <e c0="0" />
                  <e c0="2" />
                  <e c0="3" />
              </indexbuffer>
          </submesh>
          <submesh name="0">
              <material>sky_front</material>
              <indexbuffer components="1" type="uint" indices="yes">
                  <e c0="4" />
                  <e c0="5" />
                  <e c0="6" />
                  <e c0="4" />
                  <e c0="6" />
                  <e c0="7" />
              </indexbuffer>
          </submesh>
          <submesh name="0">
              <material>sky_down</material>
              <indexbuffer components="1" type="uint" indices="yes">
                  <e c0="12" />
                  <e c0="13" />
                  <e c0="14" />
                  <e c0="12" />
                  <e c0="14" />
                  <e c0="15" />
              </indexbuffer>
          </submesh>
          <submesh name="0">
              <material>sky_back</material>
              <indexbuffer components="1" type="uint" indices="yes">
                  <e c0="20" />
                  <e c0="21" />
                  <e c0="22" />
                  <e c0="20" />
                  <e c0="22" />
                  <e c0="23" />
              </indexbuffer>
          </submesh>
          <submesh name="0">
              <material>sky_right</material>
              <indexbuffer components="1" type="uint" indices="yes">
                  <e c0="16" />
                  <e c0="17" />
                  <e c0="18" />
                  <e c0="16" />
                  <e c0="18" />
                  <e c0="19" />
              </indexbuffer>
          </submesh>
          <submesh name="0">
              <material>sky_up</material>
              <indexbuffer components="1" type="uint" indices="yes">
                  <e c0="8" />
                  <e c0="9" />
                  <e c0="10" />
                  <e c0="8" />
                  <e c0="10" />
                  <e c0="11" />
              </indexbuffer>
          </submesh>
          <renderbuffer name="texture coordinate lightmap" components="2" type="float">
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
              <e c0="0" c1="0" />
          </renderbuffer>
      </params>
  </meshfact>

  <meshfact name="oceantest">
    <plugin>waterFact</plugin>
    <params>
	  <isocean>yes</isocean>
    </params>
  </meshfact>
    
  <sector name="room">
    
    <meshobj name="ocean">
      <plugin>water</plugin>
      <params>
        <factory>oceantest</factory>
        <material>oceanMat</material>
      </params>
    </meshobj>
    
    <meshobj name="clouds">
        <plugin>genmesh</plugin>
        <params>
            <factory>skydome</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>factory_room_sky</factory>
            <color red="1" green="1" blue="1" />
            <manualcolors />
            <mixmode>
                <copy />
            </mixmode>
        </params>
        <camera />
        <zfill />
        <priority>sky</priority>
    </meshobj>
    <key name="cmd_AnimateSky" value="clouds,y,.005" />
    
    <light>
    	<center x="1" y="3" z="1"/>
    	<radius>10</radius>
    	<color red="1" green="0" blue="0"/>
    </light>
    
    <light>
    	<center x="1" y="3" z="9"/>
    	<radius>10</radius>
    	<color red="0" green="0" blue="1"/>
    </light>
    
    <light>
    	<center x="19" y="3" z="1"/>
    	<radius>10</radius>
    	<color red="0" green="1" blue="0"/>
    </light>
    
    <light>
    	<center x="19" y="3" z="9"/>
    	<radius>10</radius>
    	<color red="1" green="1" blue="1"/>
    </light>
  </sector>
  <start>
  	<sector>room</sector>
  	<position x="0" y="0" z="0" />
  </start>
</world>
