#####################################################
#                                                   #
#   HEADER                                          #
#                                                   #
#####################################################

header {
	title: "Father of The Great Nation Remix"
	width: 1280
	height: 720	
	music: kekkone.ogg
	bpm: 140.0
}

#####################################################
#                                                   #
#    OBJECTS                                        #
#                                                   #
#####################################################

textures {
	envmap {
		src: envmap.jpg
	}
	*glow {
		width: 640
		height: 360
	}
	*glowTemp {
		width: 640
		height: 360
	}
	*dispMap {
		width: 256
		height: 256
		format: luminance
	}
}

objects {
	cam: camera {
		far: 1000
	}
	env: enviroment {
		lighting: on
		light0.pos.y: 100
		light0.pos.z: 0
		light0.pos.x: 30
		ambient.r: 0.1
		ambient.g: 0.1
		ambient.b: 0.1
	}
	skybox: skyBox {
		top: skybox.jpg
		left: skybox.jpg
		right: skybox.jpg
		front: skybox.jpg
		back: skybox.jpg
		bottom: skybox.jpg
	}
	skybox2: skyBox {
		top: skybox2.jpg
		left: skybox2.jpg
		right: skybox2.jpg
		front: skybox2.jpg
		back: skybox2.jpg
		bottom: skybox2.jpg
	}
	dispMapCube: Father/cube1
	envSphere: 3ds envsphere.3ds {
		scale.x: 200
		scale.y: 200
		scale.z: 200
		shader: envsphere.shader
		generateTexCoords
		materials.default.blend: blend::alpha
		texture: default envmap2.jpg
		materials.default.envMap: 3ds::sphereMap
	}
	pallo: 3ds pallo.3ds {
		meshes.osa1.lighting: off
		meshes.osa2.lighting: off
		texture: default envmap2.jpg
		materials.default.envMap: 3ds::sphereMap
	}
	kekkonen: 3ds kekkonen.3ds {
		meshes.Polla.lighting: off
		texture: head *glow
		materials.head.envMap: 3ds::sphereMap
	}
	laser: 3ds laser.3ds {
		shader: laser.shader
		materials.default.blend: blend::alpha
	}
	daddy: Father/daddy {
		shader.noise: 1
	}
	solmu: 3ds solmu.3ds {
		meshes.cube1.lighting: off
		texture: default *glow
		materials.default.envMap: 3ds::sphereMap
		materials.default.blend: blend::screen
		materials.default.depthTest: false
		materials.default.depthMask: false
	}
	solmu2: duplicate solmu
	solmu3: duplicate solmu
	flares: particles {
		textures: particle.jpg
		maxParticles: 500
		fadeAway: yes
		emitter {
			pos: 0, 0, 0
			radius: 0, 15
			size: 1, 7
			lifeTime: 1, 5
			color.r: 0.75, 1
			color.g: 0.5, 0.75
			color.b: 0, 0.5
		}
		attractor {
			pos: 20, 50, -20
			gravity: 8000
		}
		attractor {
			pos: -20, 35, 0
			gravity: 2000
		}
		attractor {
			pos: 20, 20, 0
			gravity: 3000
		}
	}
	fillerParticles: particles {
		textures: particle.jpg
		maxParticles: 700
		box: -100 -100 -100 100 100 100
		emitter {
			pos: 0, 0, 0
			radius: 50, 100
			size: 0.2, 0.6
			lifeTime: -1
		}
		attractor {
			pos: 0, 40, 0
			gravity: 40000
		}
	}
	kehaet: 3ds satan.3ds {
		materials.image.blend: blend::screen
		materials.image.depthMask: false
		materials.image.diffuse.a: 0.5
	}
	
	# POST PROCESSING
	
	bufImgBlurX: image *buf {
		stretch: yes
		shader: blurx.shader
		shader0.pixel: 0.0015625	# = 1 / 640
		shader0.blur: 20
	}
	bufImgBlurY: image *buf {
		stretch: yes
		shader: blury.shader
		shader0.pixel: 0.0027778	# = 1 / 360
		shader0.blur: 20
	}
	mixBufGlowImg: image *buf *glow *glowTemp noise.jpg {
		stretch: yes
		blend: blend::alpha
		multiTexturing: 1
		shader: mixlayers.shader
		shader0.glowx: 1
		shader0.glowy: 2
		shader0.noise: 3
	}
	image: image intro.jpg kekkogfx1.png kekkogfx2.png kekkogfx3.png kekkogfx4.png kekkogfx5.png kekkogfx6.png kekkogfx7.png kekkogfx8.png charger.png outro.jpg {
		blend: blend::screen
		shader: image.shader
	}
	chargerBar: image charger2.png {
		blend: blend::alpha
	}
	outTvImg: image *mix {
		blend: blend::screen
		shader: tv.shader
		setCoords: ( 200, 70 ), ( 925, 25 ), ( 975, 575 ), ( 85, 575 )
	}
	tvScreen: image tvscreen.jpg {
		stretch: yes
		blend: blend::screen
	}
	tvBorder: image tv.png {
		stretch: yes
		blend: blend::alpha
	}
	outImg: image *mix {
		blend: blend::alpha
		stretch: yes
		shader: sharpen.shader
		shader: tv.shader
	}
	blinder: image black.jpg {
		stretch: yes
		blend: blend::alpha
	}
	
	
	# SPECIAL
	
	dispMapSrc: image kekkonen.jpg {
		stretch: yes
	}
}

#####################################################
#                                                   #
#    RENDER PASSES                                  #
#                                                   #
#####################################################

renderPasses {
	dispMap {
		objects: dispMapSrc
		output: *dispMap
	}
	main {
		exclude: bufImgBlurX, bufImgBlurY, glowImg, dispMapSrc, mixBufGlowImg, outTvImg, tvScreen, tvBorder, outImg, image, chargerBar, blinder
		output: *buf
	}
	glowBlurX {
		objects: bufImgBlurX
		output: *glowTemp
	}
	glowBlurY {
		objects: bufImgBlurY
		output: *glow
	}
	mix {
		objects: mixBufGlowImg, image, chargerBar
		output: *mix
	}
	out {
		objects: outImg
	}
	outTv {
		objects: outTvImg, tvScreen, tvBorder, outImg, blinder
	}
}

#####################################################
#                                                   #
#    SCRIPT                                         #
#                                                   #
#####################################################

script {
	@0.0 enable cam, env, bufImgBlurX, bufImgBlurY, mixBufGlowImg, outTvImg, tvBorder, tvScreen, outImg
	
	@0.0 call runScene( scene_dispMapCube )
	@16.0 call runScene( scene_palloBoksista )
	@32.0 call runScene( scene_palloJuttui )
	@48.0 call runScene( scene_kekkonenPaljastuu )
	@64.0 call runScene( scene_kekkonenPuhuu )
	@80.0 call runScene( scene_kekkonenAmpuuLaaseria ) 
	@96.0 call runScene( scene_daddy )	
	@112.0 call runScene( scene_kollaasi )
	@128.0 call runScene( scene_outro )

	@0.0 mixBufGlowImg.shader0.noiseOffsetX = rand( 0 to 1 ) for 10000
	@0.0 mixBufGlowImg.shader0.noiseOffsetY = rand( 0 to 1 ) for 10000
	@0.0 mixBufGlowImg.shader0.distort = 0 to 10000 in 10000
	@0.0 loop @16.0 16 times {
		@0.0 mixBufGlowImg.shader0.distortAmount = spline( 1, 1, 0, 0 ) in @1.0
		@14.0 mixBufGlowImg.shader0.distortAmount = spline( 0, 0, 1, 1 ) in @2.0
	}
	
	@0.0 image.shader0.phase = 0 to 100000 in 10000
	@0.0 image.shader0.size = eval( "720 + sin( time * 0.001 ) * 50" ) for 10000

}

runScene: SCENE {
	@0.0 disable dispMapCube, flares, skybox, dispMapSrc, kekkonen
	@0.0 disable fillerParticles, pallo, kehaet, envSphere, laser, solmu
	@0.0 disable image, chargerBar, solmu2, solmu3, daddy, skybox2
	@0.0 enable mixBufGlowImg, outImg, blinder
	@0.0 mixBufGlowImg.shader0.brighten = 1.0
	@0.0 outImg.col.a = 1.0
	@0.0 image.useShader = 0
	@0.0 skybox.texZoom = 0
	@0.0 outImg.useShader = 0
	@0.0 call normalOutput
	@0.0 call SCENE
}

normalOutput {
	@0.0 out.active = true
	@0.0 outTv.active = false
}

tvOutput {
	@0.0 out.active = false
	@0.0 outTv.active = true
}

scene_dispMapCube {
	@0.0 enable dispMapCube, skybox, dispMapSrc, blinder
	@8.0 enable flares
	@0.0 disable outImg
	@8.0 enable outImg
	@0.0 call tvOutput
	
	@0.0 blinder.col.a = 1 to 0 in @2.0
	@2.0 disable blinder
	
	# Intro text
	@0.0 enable image
	@0.0 image.blend = blend::screen
	#@0.0 image.col.a = 0 to 1 in @2.0
	#@6.0 image.col.a = 1 to 0 in @2.0
	@8.0 disable image
	
	# Fade in
	@0.0 mixBufGlowImg.shader0.brighten = 0.0 to 1.0 in @4.0
	@0.0 outImg.col.a = 0
	
	# Zoom TV in
	@0.0 outTvImg.zoom = 0 to 0.1 in @16.0
	@0.0 tvBorder.zoom = 0 to 0.1 in @16.0
	@0.0 tvScreen.zoom = 0 to 0.1 in @16.0
	
		
	# Camera paths
	@0.0 cam.pos.x = eval( "sin(time*0.0001)*50" ) for @16.0
	@0.0 cam.pos.y = eval( "cos(time*0.00015)*50" ) for @16.0
	@0.0 loop @2.0 8 times {
		@0.0.5 cam.pos.z = eval( "sin(time)*50" )
		@0.0.5 cam.fovy = 45 to 60 in @1.3
	}
	
	# Displacement map
	@0.0 dispMapSrc.col.a = 0
	@7.2 dispMapSrc.col.a = 0 to 0.5 in @0.2.5
	
	@8.0 loop @2.0 4 times {
		@0.0.5 dispMapSrc.col.a = 1.0 to 0.0 in @1.3.5
		@0.0.5 outImg.col.a = 1.0 to 0.0 in @0.2
	}

	@8.0 loop @0.1 32 times {
		@0.0 mixBufGlowImg.shader0.brighten = 1.5 to 1.0 in @0.1
	}

	# Cube rotation
	@0.0 dispMapCube.rot.x = 0 to 360 in @16.0
	@0.0 dispMapCube.rot.y = 0 to 720 in @16.0
	@0.0 dispMapCube.rot.z = 0 to 1080 in @16.0
}

scene_palloBoksista {
	@0.0 enable dispMapCube, skybox, dispMapSrc, flares, pallo
	@0.0 call tvOutput
		
	# Zoom TV in
	@0.0 outTvImg.zoom = 0.1 to 0.2 in @16.0
	@0.0 tvBorder.zoom = 0.1 to 0.2 in @16.0
	@0.0 tvScreen.zoom = 0.1 to 0.2 in @16.0
	@0.0 tvScreen.col.a = 1.0 to 0.5 in @16.0

	@0.0 cam.pos.x = eval( "sin(time*0.00015)*50" ) for @16.0
	
	@0.0 loop @2.0 8 times {
		@0.0.5 cam.pos.z = eval( "sin(time)*50" )
		@0.0.5 cam.fovy = 45 to 60 in @1.3
		@0.0.5 outImg.col.a = 1 to 0 in @1.3
	}
	@0.0 loop @2.0 8 times {
		@0.0.5 dispMapSrc.col.a = 1.0 to 0.0 in @1.3.5
	}
	
	@0.0 pallo.rot.y = 0 to 3600 in @16.0

	@0.0 pallo.scale.x = 0 to 1 in @8.0	
	@0.0 pallo.scale.y = 0 to 1 in @8.0	
	@0.0 pallo.scale.z = 0 to 1 in @8.0	
	@0.0 pallo.pos.y = 0 to 40 in @16.0
	@0.0 cam.lookAt.y = 0 to 40 in @16.0
	@0.0 cam.pos.y = -40 to 30 in @16.0
	
	@0.0 loop @0.2 32 times {
		@0.0 mixBufGlowImg.shader0.brighten = 3.0 to 0.5 in @0.1
		@0.1 mixBufGlowImg.shader0.brighten = 2.0 to 0.2 in @0.1
	}

	@0.0 dispMapCube.rot.y = 0 to 720 in @16.0
	
	# Kekkonen overlays
	@0.0 image.blend = blend::alpha
	@0.0 image.frame = 1 to 9 in @16.0
	@0.0 loop @2.0 8 times {
		@0.0 disable image
		@1.0 enable image
		@1.0 image.col.a = 1.0 to 0.1 in @0.2
		@1.2 image.col.a = 0.1 to 0.0 in @0.2
		@1.0 image.zoom = 0.05 to 0 in @1.0
	}
}

scene_palloJuttui {
	@0.0 enable skybox, fillerParticles, kehaet, dispMapSrc
	@0.0 call tvOutput
	
	# Cycle objects
	@0.0 loop @4.0 4 times {
		@0.0.5 enable pallo, skybox, fillerParticles
		@0.0.5 disable solmu, solmu2, solmu3, flares
		@1.0 disable pallo, skybox, dispMapCube
		@1.0 enable solmu, solmu2, solmu3
		@2.0.5 enable pallo, skybox, flares
		@2.0.5 disable solmu, solmu2, solmu3, fillerParticles
		@3.0 disable pallo, skybox
		@3.0 enable dispMapCube
	}
	
	# Zoom TV in
	@0.0 outTvImg.zoom = 0.2 to 0.5 in @16.0
	@0.0 tvBorder.zoom = 0.2 to 0.8 in @16.0
	@0.0 tvScreen.zoom = 0.2 to 0.8 in @16.0
	@0.0 tvScreen.col.a = 0.5 to 0.0 in @16.0
	
	# Camera paths
	@0.0 loop @4.0 4 times {
		@0.0 cam.lookAt.y = 40
		@0.0.5 cam.pos.x = eval( "sin(time) * 50" )
		@0.0.5 cam.pos.y = eval( "cos(time*1.27) * 5" )
		@0.0.5 cam.pos.z = eval( "cos(time) * 30" )
		@0.0.5 cam.fovy = 90 to 45 in @0.0.1
		@0.1 cam.fovy = spline( 45, 45, 60, 60 ) in @0.3
		@0.0.5 outImg.col.a = 1 to 0 in @1.3
		@1.0 loop @0.1 4 times {
			@0.0 cam.fovy = rand( 45 to 90 )
			@0.0 cam.pos.y = rand( 0 to 40 )
			@0.0 cam.lookAt.y = rand( 30 to 50 )
		}
		@2.0 cam.lookAt.y = 40
		@2.0.5 cam.pos.x = eval( "sin(time) * 50" )
		@2.0.5 cam.pos.y = eval( "cos(time*1.27) * 5" )
		@2.0.5 cam.pos.z = eval( "cos(time) * 30" )
		@2.0.5 cam.fovy = 45 to 90 in @0.0.1
		@2.1 cam.fovy = spline( 90, 90, 45, 45 ) in @0.3
		@2.0.5 outImg.col.a = 1 to 0 in @1.3
		@3.0 cam.lookAt.y = 0
		@3.0 loop @0.1 4 times {
			@0.0 cam.fovy = rand( 45 to 90 )
			@0.0 cam.pos.y = rand( 0 to 40 )
		}
	}
	@0.0 cam.up.x = eval( "sin(time*0.0001)" ) for @16.0
	@0.0 cam.up.y = eval( "cos(time*0.00012)" ) for @16.0
	@0.0 cam.up.z = eval( "sin(time*0.00013)" ) for @16.0
	
	# Sphere
	@0.0 pallo.rot.y = 0 to 3600 in @16.0

	# Solomu
	@0.0 solmu.pos.y = 40
	@0.0 solmu2.pos.y = 40
	@0.0 solmu3.pos.y = 40
	@0.0 solmu.rot.x = 0 to 100 in @16.0
	@0.0 solmu.rot.y = 0 to 210 in @16.0
	@0.0 solmu.rot.z = 0 to 320 in @16.0
	@0.0 solmu2.rot.y = 0 to 230 in @16.0
	@0.0 solmu2.rot.z = 0 to 140 in @16.0
	@0.0 solmu2.rot.x = 0 to 250 in @16.0
	@0.0 solmu3.rot.z = 0 to 360 in @16.0
	@0.0 solmu3.rot.x = 0 to 270 in @16.0
	@0.0 solmu3.rot.y = 0 to 180 in @16.0

	# Disp map cube
	@0.0 loop @1.0 16 times {
		@0.0.5 dispMapSrc.col.a = 1.0 to 0.0 in @0.3.5
	}

	# Glow pump
	@0.0 loop @0.1 63 times {
		@0.0 mixBufGlowImg.shader0.brighten = 1.5 to 0.5 in @0.1
	}
	@15.3 mixBufGlowImg.shader0.brighten = 0.5 to 5.0 in @0.1
	
	# SATAN HORRORISM 555
	@0.0 kehaet.scale.x = 20 to 40 in @4.0
	@0.0 kehaet.scale.y = 20 to 40 in @3.3
	@0.0 kehaet.scale.z = 20 to 40 in @4.1
	@8.0 kehaet.scale.x = 40 to 80 in @8.0
	@8.0 kehaet.scale.y = 40 to 80 in @7.3
	@8.0 kehaet.scale.z = 40 to 80 in @7.2
	
	@0.0 kehaet.pos.y = 40
	@0.0 kehaet.meshes.plane1.rot.x = 0 to 1234 in @16.0
	@0.0 kehaet.meshes.plane1.rot.y = 0 to 2345 in @16.0
	@0.0 kehaet.meshes.plane1.rot.z = 0 to 1500 in @16.0
	@0.0 kehaet.meshes.plane2.rot.x = 0 to 234 in @16.0
	@0.0 kehaet.meshes.plane2.rot.y = 0 to 1200 in @16.0
	@0.0 kehaet.meshes.plane2.rot.z = 0 to 1000 in @16.0
	@0.0 kehaet.meshes.plane3.rot.x = 0 to 2000 in @16.0
	@0.0 kehaet.meshes.plane3.rot.y = 0 to 1000 in @16.0
	@0.0 kehaet.meshes.plane3.rot.z = 0 to 500 in @16.0
}

scene_kekkonenPaljastuu {
	@0.0 enable skybox, fillerParticles, kehaet, pallo, kekkonen, envSphere, image
	
	@0.0 kekkonen.pos.y = 40
	
	# Camera paths
	@0.0 loop @1.0 16 times {
		@0.0 cam.lookAt.y = rand( 30 to 50 )
		@0.0 cam.pos.x = eval( "sin(time) * 50" )
		@0.0 cam.pos.y = eval( "cos(time*1.27) * 5 + 40" )
		@0.0 cam.pos.z = eval( "cos(time) * 30" )
	}
	@0.0 cam.up.x = eval( "sin(time*0.0001)" ) for @16.0
	@0.0 cam.up.y = eval( "cos(time*0.00012)" ) for @16.0
	@0.0 cam.up.z = eval( "sin(time*0.00013)" ) for @16.0
	@0.0 loop @0.1 64 times {
		@0.0 cam.fovy = rand( 10 to 160 )
	}

	# Make satanistic arcs disappear
	@0.0 kehaet.scale.x = 80 to 0 in @0.1
	@0.0 kehaet.scale.y = 80 to 0 in @0.1
	@0.0 kehaet.scale.z = 80 to 0 in @0.1
	@0.1 disable kehaet

	# Make satanistic pallo erkanee
	@0.0 pallo.meshes.osa1.pos.y = 0 to 30 in @16.0
	@0.0 pallo.meshes.osa2.pos.y = 0 to -30 in @16.0
	@4.0 pallo.meshes.osa1.rot.x = 0 to 140 in @12.0
	@4.0 pallo.meshes.osa1.rot.y = 0 to 100 in @12.0
	@4.0 pallo.meshes.osa2.rot.y = 0 to -120 in @12.0
	@4.0 pallo.meshes.osa2.rot.z = 0 to -110 in @12.0
	
	# Let's make Kekkonen go round and around!
	@0.0 kekkonen.rot.y = 0 to 720 in @16.0
	
	# Make the background alive
	@0.0 envSphere.shader0.foo = 0 to 10 in @16.0
	@0.0 loop @0.1 63 times {
		@0.0 envSphere.shader0.a = 0.0 to 0.1 in @0.1
	}
	@15.3 envSphere.shader0.a = 0.1 to 1.0 in @0.1

	# Kekkonen overlays
	@0.0 image.blend = blend::alpha
	@0.0 loop @8.0 2 times {
		@0.0 image.frame = 1 to 9 in @8.0
	}
	@0.0 loop @1.0 16 times {
		@0.0 image.col.a = 1 to 0.1 in @0.2
		@0.2 image.col.a = 0.1 to 0 in @0.2
		@0.0 image.zoom = 0.05 to 0 in @1.0
	}

	# Glow pump
	@0.0 loop @0.1 63 times {
		@0.0 mixBufGlowImg.shader0.brighten = 2.0 to 0.0 in @0.1
	}
}

scene_kekkonenPuhuu {
	@0.0 enable fillerParticles, kehaet, kekkonen, skybox, image, chargerBar
	
	@0.0 image.useShader = -1
	
	# Camera paths
	@0.0 cam.lookAt.y = 40
	@0.0 cam.pos.x = eval( "sin(time*0.0001) * 25" ) for @16.0
	@0.0 cam.pos.y = eval( "cos(time*0.000072) * 5 + 40" ) for @16.0
	@0.0 cam.pos.z = eval( "cos(time*0.0001) * 25" ) for @16.0
	@0.0 cam.up.x = eval( "sin(time*0.0001)" ) for @16.0
	@0.0 cam.up.y = eval( "cos(time*0.00012) + 4.0" ) for @16.0
	@0.0 cam.up.z = eval( "sin(time*0.00013)" ) for @16.0
	@0.0 cam.fovy = 160 to 45 in @16.0

	# Make satanistic pallo erkanee more
	@0.0 pallo.meshes.osa1.pos.y = 30 to 60 in @16.0
	@0.0 pallo.meshes.osa2.pos.y = -30 to -60 in @16.0
	
	# Let's make Kekkonen stay
	@0.0 kekkonen.rot.y = 0

	# SATAN HORRORISM 555
	@0.0 kehaet.scale.x = 100
	@0.0 kehaet.scale.y = 100
	@0.0 kehaet.scale.z = 100
	
	@0.0 kehaet.pos.y = 40
	@0.0 loop @2.0 8 times {
		@0.0.5 call scene_kekkonenPuhuu_randomizeKehaet
		@1.0.25 call scene_kekkonenPuhuu_randomizeKehaet
		@1.0.75 call scene_kekkonenPuhuu_randomizeKehaet
	}
	
	# Laser charger
	@0.0 image.col.a = 1
	@0.0 image.frame = 9
	@0.0 image.zoom = 0.1 to 0 in @16.0
	@0.0 chargerBar.zoom = 0.1 to 0 in @16.0
	@0.0 chargerBar.clip.right = 1.0 to 0.0 in @16.0

	# Glow at the end
	@15.0 mixBufGlowImg.shader0.brighten = 1 to 5.0 in @1.0
}

scene_kekkonenPuhuu_randomizeKehaet {
	@0.0 kehaet.meshes.plane1.rot.x = rand( 0 to 360 )
	@0.0 kehaet.meshes.plane1.rot.y = rand( 0 to 360 )
	@0.0 kehaet.meshes.plane1.rot.z = rand( 0 to 360 )
	@0.0 kehaet.meshes.plane2.rot.x = rand( 0 to 360 )
	@0.0 kehaet.meshes.plane2.rot.y = rand( 0 to 360 )
	@0.0 kehaet.meshes.plane2.rot.z = rand( 0 to 360 )
	@0.0 kehaet.meshes.plane3.rot.x = rand( 0 to 360 )
	@0.0 kehaet.meshes.plane3.rot.y = rand( 0 to 360 )
	@0.0 kehaet.meshes.plane3.rot.z = rand( 0 to 360 )
}

scene_kekkonenAmpuuLaaseria {
	@0.0 enable kekkonen, laser, fillerParticles, flares, envSphere
	
	# Solomu
	@0.0 solmu.pos.y = 40
	@0.0 solmu2.pos.y = 40
	@0.0 solmu3.pos.y = 40
	@0.0 solmu.rot.x = 0 to 1000 in @16.0
	@0.0 solmu.rot.y = 0 to 1100 in @16.0
	@0.0 solmu.rot.z = 0 to 1200 in @16.0
	@0.0 solmu2.rot.y = 0 to 1300 in @16.0
	@0.0 solmu2.rot.z = 0 to 1400 in @16.0
	@0.0 solmu2.rot.x = 0 to 1500 in @16.0
	@0.0 solmu3.rot.z = 0 to 1600 in @16.0
	@0.0 solmu3.rot.x = 0 to 1700 in @16.0
	@0.0 solmu3.rot.y = 0 to 1800 in @16.0

	@0.0 loop @2.0 8 times {
		@0.0 disable solmu, solmu2, solmu3
		@1.0 enable solmu, solmu2, solmu3
	}	

	# Make the background alive
	@0.0 envSphere.shader0.foo = 0 to 10 in @16.0
	@0.0 loop @0.1 63 times {
		@0.0 envSphere.shader0.a = 0.0 to 0.1 in @0.1
	}
	@15.3 envSphere.shader0.a = 0.1 to 1.0 in @0.1

	# Make laser say pow	
	@0.0 laser.pos.y = 40
	@0.0 loop @0.1 64 times {
		@0.0 laser.shader0.pos = 0 to 1 in @0.1
	}
	
	# Make kekkonen shoot around
	@0.0 kekkonen.rot.y = 0 to 3600 in @16.0
	@0.0 laser.rot.y = 0 to 3600 in @16.0

	# Camera paths
	@0.0 cam.up.x = eval( "sin(time*0.0005)" ) for @16.0
	@0.0 cam.up.y = eval( "cos(time*0.00052)+2" ) for @16.0
	@0.0 cam.up.z = eval( "sin(time*0.00053)" ) for @16.0
	@0.0 loop @2.0 8 times {
		@0.0 cam.fovy = 45
		@1.0 cam.fovy = 90
		
		@0.0 cam.pos.x = 0
		@0.0 cam.pos.y = 40
		@0.0 loop @0.1 4 times {
			@0.0 cam.pos.z = 25 to 15 in @0.1
		}
		
		@1.0 loop @0.1 4 times {
			@0.0 cam.pos.x = eval( "sin(time*11) * 20" )
			@0.0 cam.pos.y = eval( "cos(time*11) * 20 + 40" )
			@0.0 cam.pos.z = eval( "sin(time*17) * 20" )
		}
	}
	
	# Glow pump
	@0.0 loop @0.1 63 times {
		@0.0 mixBufGlowImg.shader0.brighten = 2.0 to 0.5 in @0.1
	}
	@15.3 mixBufGlowImg.shader0.brighten = 0.5 to 5.0 in @0.1
	
	#
}

scene_daddy {
	@0.0 daddy.shader.foo = 1 to 0 in @15.0
	@15.0 daddy.shader.foo = spline( 1, 0, 1, 10 ) in @1.0

	@0.0 outImg.useShader = 1 # use tv shader

	@0.0 loop @0.3 21 times {
		@0.0 disable daddy
		@0.0 enable envSphere
		@0.1 disable envSphere
		@0.1 enable skybox2
		@0.2 disable skybox2
		@0.2 enable daddy
		@0.0 cam.fovy = 170 to 100 in @0.3
	}

	@0.0 loop @1.0 15 times {
		@0.0 enable fillerParticles
		@0.1 disable fillerParticles
		@0.1 enable kehaet
		@0.2 disable kehaet
		@0.2 enable solmu, solmu2, solmu3
		@0.3 disable solmu, solmu2, solmu3
		@0.3 enable dispMapCube
		@0.4 disable dispMapCube	
	}
	@15.0 enable fillerParticles
	@15.1 disable fillerParticles
	@15.1 enable kehaet
	@15.2 disable kehaet

	# Camera paths
	@0.0 cam.pos.x = eval( "sin(time*0.0007) * 25" ) for @16.0
	@0.0 cam.pos.y = 10 to 80 in @16.0
	@0.0 cam.pos.z = eval( "cos(time*0.0007) * 25" ) for @16.0
	
	@0.0 cam.lookAt.y = 0 to 10 in @16.0
	@0.0 cam.lookAt.x = 0
	@0.0 cam.lookAt.z = 0

	@0.0 cam.up.x = eval( "sin(time*0.0005)" ) for @16.0
	@0.0 cam.up.y = eval( "cos(time*0.00052) + 10.0" ) for @16.0
	@0.0 cam.up.z = eval( "sin(time*0.00053)" ) for @16.0
	
	# Glow pump
	@0.0 loop @1.0 16 times {
		@0.0 mixBufGlowImg.shader0.brighten = 3.0 to 1.0 in @1.0
	}
	@0.0 loop @2.0 8 times {
		@0.0 daddy.shader.foo2 = 0 to 6.28 in @2.0
	}

	# Make the background alive
	@0.0 envSphere.shader0.foo = 0 to 10 in @16.0
	@0.0 loop @0.1 63 times {
		@0.0 envSphere.shader0.a = 0.0 to 0.1 in @0.1
	}
	@15.3 envSphere.shader0.a = 0.1 to 1.0 in @0.1
}

scene_kollaasi {	
	# Cycle objects
	@0.0 loop @4.0 4 times {
		@0.0 enable kekkonen, laser, fillerParticles
		@1.0 disable kekkonen, laser, fillerParticles
		
		@1.0 enable fillerParticles, flares, skybox2
		@2.0 disable fillerParticles, flares, skybox2

		@2.0 enable fillerParticles, pallo, kekkonen
		@3.0 disable fillerParticles, pallo, kekkonen
		@2.0 pallo.scale.x = rand( 1 to 3 )
		@2.0 pallo.scale.y = rand( 1 to 3 )
		
		@3.0 enable dispMapCube, dispMapSrc, flares, pallo
		@4.0 disable dispMapCube, dispMapSrc, flares, pallo
	}
	
	@0.0 loop @3.0 5 times {
		@0.0 enable kehaet
		@1.0 disable kehaet
		@1.0 enable envSphere
		@2.0 disable envSphere
	}

	# Images
	@0.0 loop @1.1 12 times {
		@1.1 enable image
		@1.1 image.col.a = 1 to 0 in @0.1
		@1.2 disable image
	}
	@0.0 image.frame = 1 to 9 in @12.12
	
	# Solomu
	@0.0 solmu.pos.y = 40
	@0.0 solmu2.pos.y = 40
	@0.0 solmu3.pos.y = 40
	@0.0 solmu.rot.x = 0 to 1000 in @16.0
	@0.0 solmu.rot.y = 0 to 1100 in @16.0
	@0.0 solmu.rot.z = 0 to 1200 in @16.0
	@0.0 solmu2.rot.y = 0 to 1300 in @16.0
	@0.0 solmu2.rot.z = 0 to 1400 in @16.0
	@0.0 solmu2.rot.x = 0 to 1500 in @16.0
	@0.0 solmu3.rot.z = 0 to 1600 in @16.0
	@0.0 solmu3.rot.x = 0 to 1700 in @16.0
	@0.0 solmu3.rot.y = 0 to 1800 in @16.0

	@0.0 loop @0.1 64 times {
		@0.0 disable solmu, solmu2, solmu3
		@0.0.5 enable solmu, solmu2, solmu3
	}	

	# Make laser say pow	
	@0.0 laser.pos.y = 40
	@0.0 loop @0.1 64 times {
		@0.0 laser.shader0.pos = 0 to 1 in @0.1
	}
	
	# Make kekkonen shoot around
	@0.0 kekkonen.rot.y = 0 to 3600 in @16.0
	@0.0 laser.rot.y = 0 to 3600 in @16.0

	# Camera paths
	@0.0 loop @0.2 32 times {
		@0.0 cam.fovy = rand( 45 to 130 )
		@0.0 cam.pos.x = rand( -40 to 40 )
		@0.0 cam.pos.y = rand( 0 to 80 )
		@0.0 cam.pos.z = rand( -40 to 40 )
	}
	@0.0 cam.lookAt.x = eval( "sin( time * 0.0015 ) * 10" ) for @16.0
	@0.0 cam.lookAt.y = eval( "cos( time * 0.0014 ) * 20 + 40" ) for @16.0
	@0.0 cam.lookAt.z = eval( "sin( time * 0.0009 ) * 10" ) for @16.0
	@0.0 cam.up.x = eval( "sin( time * 0.001 )" ) for @16.0
	@0.0 cam.up.y = eval( "cos( time * 0.0012 )" ) for @16.0
	@0.0 cam.up.z = eval( "sin( time * 0.0017 )" ) for @16.0

	# SATAN HORRORISM 555
	@0.0 kehaet.scale.x = 100
	@0.0 kehaet.scale.y = 100
	@0.0 kehaet.scale.z = 100
	
	@0.0 kehaet.pos.y = 40
	@0.0 loop @2.0 8 times {
		@0.0.5 call scene_kekkonenPuhuu_randomizeKehaet
		@1.0.25 call scene_kekkonenPuhuu_randomizeKehaet
		@1.0.75 call scene_kekkonenPuhuu_randomizeKehaet
	}
	
	# Glow pump
	@0.0 loop @0.1 32 times {
		@0.0 mixBufGlowImg.shader0.brighten = 3.0 to 1.0 in @0.0.5
		@0.0 skybox.texZoom = rand( -3.0 to 1.0 )
	}
	@8.0 loop @0.0.5 64 times {
		@0.0 mixBufGlowImg.shader0.brighten = 3.0 to 0.0 in @0.0.5
		@0.0 skybox.texZoom = rand( -1.0 to 1.0 )
	}
	
	# Disp map cube
	@0.0 loop @1.0 16 times {
		@0.0.5 dispMapSrc.col.a = 1.0 to 0.0 in @0.3.5
	}

	# Make the background alive
	@0.0 envSphere.shader0.foo = 0 to 10 in @16.0
	@0.0 loop @0.1 63 times {
		@0.0 envSphere.shader0.a = 0.0 to 0.1 in @0.1
	}
	@15.3 envSphere.shader0.a = 0.1 to 1.0 in @0.1

}

scene_outro {
	@0.0 enable fillerParticles, kehaet, kekkonen, skybox, image
	@0.0 call tvOutput
		
	# Zoom TV out
	@0.0 outTvImg.zoom = 0.1 to 0 in @8.0
	@0.0 tvBorder.zoom = 0.1 to 0 in @8.0
	@0.0 tvScreen.zoom = 0.1 to 0 in @8.0
	@0.0 outImg.col.a = 1 to 0 in @2.0
	
	# Outro image
	@0.0 image.frame = 10
	@0.0 image.col.a = 0
	@2.0 image.col.a = 0 to 1 in @8.0
	@0.0 image.zoom = 0.05 to 0 in @8.0
	
	# Camera paths
	@0.0 cam.pos.x = eval( "sin(time*0.0001) * 25" ) for @16.0
	@0.0 cam.pos.y = eval( "cos(time*0.000072) * 5 + 40" ) for @16.0
	@0.0 cam.pos.z = eval( "cos(time*0.0001) * 25" ) for @16.0
	@0.0 cam.up.x = eval( "sin(time*0.0001)" ) for @16.0
	@0.0 cam.up.y = eval( "cos(time*0.00012) + 4.0" ) for @16.0
	@0.0 cam.up.z = eval( "sin(time*0.00013)" ) for @16.0
	@0.0 cam.fovy = 160 to 45 in @16.0

	# Glow pump
	@0.0 mixBufGlowImg.shader0.brighten = 5.0 to 1.0 in @1.0

	# Make satanistic pallo erkanee more
	@0.0 pallo.meshes.osa1.pos.y = 30 to 60 in @16.0
	@0.0 pallo.meshes.osa2.pos.y = -30 to -60 in @16.0
	
	# Let's make Kekkonen stay
	@0.0 kekkonen.rot.y = 0

	# SATAN HORRORISM 555
	@0.0 kehaet.scale.x = 100
	@0.0 kehaet.scale.y = 100
	@0.0 kehaet.scale.z = 100
	
	@0.0 kehaet.pos.y = 40
	@0.0 loop @2.0 8 times {
		@0.0.5 call scene_kekkonenPuhuu_randomizeKehaet
	}
	
	# Tv shutdown
	@10.0 loop @8.0 1 times {
		@0.0 disable fillerParticles, kehaet, kekkonen, skybox
		@0.0 image.zoom.y = 0 to -0.498 in @0.0.5
		@0.0.5 image.zoom.x = 0 to -0.498 in @0.0.5
		@0.1 outTvImg.col.a = 1 to 0 in @0.1
		@0.2 enable blinder
		@0.2 blinder.col.a = 0 to 1 in @1.0
	}
	@12.0 end
}
