<?xml version="1.0" encoding="utf-8"?>
<m3danim length="10">
  <video-clips>
    <random-movie-clip-playlist name="clips1" length="10" clip-length="3.33"/>
    <random-movie-clip-playlist name="clips2" length="10" clip-length="3.33" offset="0.25" />
    <random-movie-clip-playlist name="clips3" length="10" clip-length="3.33" offset="0.5" />
    <random-movie-clip-playlist name="clips4" length="10" clip-length="3.33" offset="0.75" />
  </video-clips>
  
  <render-targets>
    <render-target texture="scene[0]" size="1024" initial-color="#FF000000"/>
    <render-target texture="scene[1]" size="1024" initial-color="#FF000000"/>
	  <!--<render-target texture="background[0]" size="1024" initial-color="#FF00FF00"/>
    <render-target texture="background[1]" size="1024" initial-color="#FFFF0000"/>-->
    <render-target texture="text" size="1024"/>
  </render-targets>
  
  <viewports>
    <viewport name="blend-scene[0]" world="blend-scene[0]">
      <projection-transform>
        <orthogonal/>
      </projection-transform>
    </viewport>

	<!-- <viewport name="copy-background[0]" world="copy-background[0]">
      <projection-transform>
        <orthogonal/>
      </projection-transform>
    </viewport>
	
	<viewport name="next-background[0]" world="next-background[0]">
      <projection-transform>
        <orthogonal/>
      </projection-transform>
    </viewport>-->
	
    <viewport name="scene[0]" world="scene[0]">
      <projection-transform>
        <orthogonal/>
      </projection-transform>
    </viewport>
    <viewport name="new-scene-background" world="new-scene-background">
      <projection-transform>
        <orthogonal/>
      </projection-transform>
    </viewport>
	<viewport name="background" world="background">
      <projection-transform>
        <perspective />
      </projection-transform>
    </viewport>
    <viewport name="scene" world="scene">
      <projection-transform>
        <perspective />
      </projection-transform>
    </viewport>
    <viewport name="text" world="text">
      <projection-transform>
        <orthogonal/>
      </projection-transform>
    </viewport>
    <viewport name="menu" world="menu">
      <projection-transform>
        <menu-screen/>
      </projection-transform>
    </viewport>
  </viewports>
  
  <worlds>
    <world name="text">
      <container>
        <text text-id="disc.title" font-weight="bold" font-name="Arial Bold" font-size="80" align="center" valign="center" font-top-color="#FFA3ADFF" font-bottom-color="#FF2A3CC1">
          My first self-encoded DVD!
        </text>
        <transforms>
          <scale x="1" y="1" />
        </transforms>
      </container>
    </world>


    <world name="scene">
      <rect>
        <texture video-clip="clips1"/>
        <transforms>
          <translate y="2"/>
          <rotate-x angle="90" />
        </transforms>
        <shader vertexshader="wallmove" pixelshader="wallmove">
          <float name="start_offset" value="0" />
        </shader>
      </rect>

      <rect>
        <texture video-clip="clips2"/>
        <transforms>
          <translate y="-2"/>
          <rotate-x angle="-90" />
        </transforms>
        <shader vertexshader="wallmove" pixelshader="wallmove">
          <float name="start_offset" value="0.25" />
        </shader>
      </rect>

      <rect>
        <texture video-clip="clips3"/>
        <transforms>
          <translate x="1"/>
          <rotate-y angle="-90" />
        </transforms>
        <shader vertexshader="wallmove" pixelshader="wallmove">
          <float name="start_offset" value="0.5" />
        </shader>
      </rect>

      <rect>
        <texture video-clip="clips4"/>
        <transforms>
          <translate x="-1"/>
          <rotate-y angle="90" />
        </transforms>
        <shader vertexshader="wallmove" pixelshader="wallmove">
          <float name="start_offset" value="0.75" />
        </shader>
      </rect>
    </world>
    <world name="blend-scene[0]">
      <rect>
        <color>
          CCFFFFFF
          CCFFFFFF
          CCFFFFFF
          CCFFFFFF
        </color>
        <texture render-target="scene[0]"/>
      </rect>
    </world>
	<!--<world name="copy-background[0]">
      <rect>
        <texture render-target="background[0]"/>
      </rect>
    </world>	
	
	<world name="next-background[0]">
      <rect>
        <texture render-target="background[1]"/>
		<transforms>
		    <rotate-z angle="-3.6"/>
			<scale x="1.1" y="1.1"/>			
		</transforms>
      </rect>
	  <array count="10">
		  <rect>
	        <texture static-src="bg.png"/>
			<transforms>
				<scale x="0.1" y="0.1"/>
			</transforms>
			<shader vertexshader="bgmove" pixelshader="id"/>
	      </rect>
	  </array>
    </world>	
	
	 <world name="background">
      <rect>
        <texture static-src="bg.png"/>
		<shader vertexshader="bgmove" pixelshader="id">
			<float name="bgmove_start" value="2.0"/>
			<float name="bgmove_factor" value="2.0"/>
		</shader>
      </rect>
	  <rect>
        <texture static-src="bg.png"/>
		<shader vertexshader="bgmove" pixelshader="id">
			<float name="bgmove_start" value="0"/>
			<float name="bgmove_factor" value="2.0"/>
		</shader>
      </rect>
    </world>-->
	
	<world name="background">
	  <rect>
		<texture static-src="bg.png"/>		
		<transforms>
			<translate z="-0.9"/>
			<scale x="1.9" y="1.9"/>
		</transforms>
      <shader vertexshader="bgmove" pixelshader="../common/id">
        <float name="rot_speed" value="1"/>
      </shader>
	  </rect>
    <rect>
      <texture static-src="bg.png"/>
      <transforms>
        <translate z="-0.9"/>
        <scale x="1.9" y="1.9"/>
      </transforms>
      <shader vertexshader="bgmove" pixelshader="blendovertime">    
        <float name="rot_speed" value="2"/>
        <float name="blend_end" value="0.4"/>
        <float name="blend_start" value="0.4"/>        
        <!--float name="zoom_factor" value="0.7"/-->
      </shader>
    </rect>      
    </world>	
	
    <world name="scene[0]">
      <rect>
        <texture render-target="scene[0]"/>
      </rect>
    </world>
    <world name="new-scene-background">
      <rect>
        <texture render-target="scene[1]"/>
      </rect>
    </world>
    <world name="menu">
      <container>        
        <container>
          <trianglestrip>
            <xyz>
              0.5   -0.5  0.0
              -0.5  -0.5  0.0
              0.5   0.5   0.0
              -0.5 0.5   0.0
            </xyz>
            <texcoord>
              1.0   1.0
              0.0   1.0
              1.0   0.0
              0.0   0.0
            </texcoord>
            <!--color>
              5FFFFFF
              5FFFFFF
              5FFFFFF
              5FFFFFF
            </color-->
            <texture render-target="text"/>
          </trianglestrip>
          <transforms>
            <translate x="0.5" y="0.1"/>
          </transforms>
        </container>
      </container>

	  <!-- button texts and the shared button background-->
      <container>	   
		<trianglestrip>
		  <xyz>
			0.5  -0.5  0.0
			-0.5  -0.5  0.0
			0.5   0.5  0.0
			-0.5   0.5  0.0
		  </xyz>
		  <texcoord>
			1.0   1.0
			0     1.0
			1.0   0
			0     0
		  </texcoord>
		  <shader vertexshader="button" pixelshader="../common/id"/>
		  <texture static-src="main_buttonbar.png"/>		
		</trianglestrip>	       
		<container>
			<text text-id="button.play" 
					font-weight="bold" 
					font-name="Arial Bold" 
					font-size="16" 
					align="right" 
					valign="baseline" 
					font-color="#FF000000">
			  Play
			</text>
			<transforms>
				<translate x="-0.1" y="0.014"/>
			</transforms>
		</container>	        
		<container>
			<text text-id="button.scenes" 
					font-weight="bold" 
					font-name="Arial Bold" 
					font-size="16" 
					align="left" 
					valign="baseline" 
					font-color="#FF000000">
			Scenes
			</text>
			<transforms>
				<translate x="0.1" y="0.014"/>
			</transforms>
		</container>        
		<transforms>
			<translate x="0.5" y="0.835"/>
		</transforms>
      </container>
  </world>
  </worlds>
  <initial-render-instructions>
    <render-to clear-color="#00FFFFFF" texture="text" viewport="text"/>
  </initial-render-instructions>
  <render-instructions>
    <render-to clear-depth="1" texture="scene[1]" viewport="blend-scene[0]"/>
	<!--<render-to clear-depth="1" texture="background[1]" viewport="copy-background[0]"/>
	
	<render-to clear-depth="1" clear-color="#00FFFFFF" texture="background[0]" viewport="next-background[0]"/>-->
 	
    <render-to clear-depth="1" clear-color="#00FFFFFF" texture="scene[0]" viewport="new-scene-background"/>
    <render-to clear-depth="1" texture="scene[0]" viewport="scene"/>
	
	<!--<render-to clear-depth="1" clear-color="#FF000000" buffer="back" viewport="copy-background[0]"/>-->
	
	<render-to clear-depth="1" clear-color="#FF000000" buffer="back" viewport="background"/>
	
    <render-to buffer="back" viewport="scene[0]"/>
	
    <render-to buffer="back" viewport="menu" />
  </render-instructions>
</m3danim>
