/*
demo script CPCPCP wef apa hora skit...  by gnilk...

the surface "primary" is handled by the engine, its a regular texture
surface which can be updated and drawn (however that would be silly, since
that is also done by the engine, just before swapping) but the update function
is nice to use..
All filters use the texture of the current active surface, meaning if you
push another surface (surf128 for ex.) you can update its contents and
use it for filters...
See first (in-a-comment-block) render block for details...
Surfaces which you can play with:
surf64 - 64x64 pixels surface
surf128 - 128x128 pixels
surf256 - 256x256 pixels
surf512 - 512x512 pixels
primary - screen res.

depending on what you want to do, choose the surface appropriate for the part...
surface commando

surface [push,pop,update,draw] <name>
Note: POP should _NOT_ have a name, but the other MUST!!!!

ex:
	surface push surf128
	clear
	part	myCoolEffect
	surface update surf128
	surface pop
	surface draw128

The draw statement should come after the pop, since we want to draw to the
primary surface, and it wont be active, until we pop our rendertarget (surf128)
	
ex:
	surface push surf128
	clear
	part	myCoolEffect
	surface update surf128
	part	myFilter		# apply a filter
	surface update surf128		# update again
	surface pop
	surface draw128

The same can ofcourse be done with primary (which is much simpler but
requires some bandwidth):
	clear
	part	myCoolEffect
	surface update primary
	part	myFilter		# apply a filter


see the script for more details....

the various "set" things for effects are truly ambigious

*/

# music demo3.mp3
# timeoffset 108
material krang/littexture.mdef
material krang/particles.mdef
material krang/littexturesphdual.mdef
material krang/littexturesphdual2.mdef
material krang/littexturesphdual3.mdef
material krang/littexturesphdual4.mdef
material krang/texture.mdef
material krang/maskmtrl.mdef

# timeoffset 48
music krang/music.mp3


effect sceneBase object1
set file krang/propeller.y3d
set material all littexture
set translate 0 0 -8
set rotspeed 10 -7 6
set culling false

effect sceneBase object2
set file krang/extrude2.y3d
set material all littexturesphdual2
set translate 0 0 -5
set rotspeed -6 7 -10
set culling false

effect sceneBase object3
set file krang/extrude1.y3d
set material all littexturesphdual
set translate 0 0 -5
set rotspeed -6 7 -10
set culling false

effect sceneBase object4
set file krang/extrude3.y3d
set material all littexturesphdual3
set translate 0 0 -5
set rotspeed 6 -7 10
set culling false

effect gridFxAngular gridEffect
set material littexturesphdual

effect flashEffect flash

effect fullScreenTexture introText
set file krang/plastic.jpg
set file krang/hubble.jpg
set file krang/punch.jpg
set file krang/epos.jpg
set file krang/twixy.jpg
set file krang/gnark.jpg
set file krang/krang.jpg

effect fullScreenTexture greetText
set file krang/greet.jpg
set file krang/fairlight.jpg
set file krang/noice.jpg

effect simpleParticles bubbles
set material particles
set size 0.2
set num 256

effect sceneEffect scene1
set file krang/3dscene2.y3d
set material all littexturesphdual4
set culling false
set camera apawef


#
# Examples on how the rendering could be scheduled
#
# this is not implemented yet!
#

#
# keep in mind that overlapping that each block will be renderd as a whole
# i.e. if blocks overlap in time, and clear statements are overlapped, primary
# surface (i.e. the backbuffer) will be cleared twice which might look strange
#

# this block will overlap the following two blocks, with a clear statement
# this could be written in other ways, just showing how it could be done
# ofcourse the following block could be incorparted as a subblock to this block


#
# example on howto use the backdrawing mechnism on a specific surface
#

#
# here we use the same principle but optimized for "primary" usage
#


render
{
	time 0 10
	clear
	part object1

	part bubbles	
			
	
	part flash
	signal 1 4 flash 
	signal 1 8 flash 
	
}

render
{
	time 10 12
	clear
	part object3
	part bubbles	
				
}

render
{
	time 12 16
	clear
	part object1
	part bubbles
	part flash
	signal 1 12 flash	
}

render
{
	time 16 30
	clear
	part object2

	part introText
	signal 1 18 introText
	signal 2 20 introText
	signal 3 22 introText
	signal 4 24 introText
	signal 5 26 introText
	signal 6 28 introText
	

	part flash
	signal 1 16 flash
	signal 1 20 flash
	signal 1 24 flash
	signal 1 30 flash
}
render
{
	time	30 34
	clear
	part	bubbles
	part	flash
	signal	1 30 flash
	signal	1 32 flash
}
render
{
	time	34 40
	clear
	part	grideffect
	part	flash
	signal	1 34 flash
	signal	1 36 flash
}
render
{
	time	40 44
	clear
	part	object3
	part	bubbles
	part	flash
	signal	1 40 flash
	signal	1 42 flash
}
render
{
	time	44 48
	clear
	part	grideffect
	part	flash
	signal	1 44 flash
}

render
{
	time 48 64
	clear
	part object4
	part bubbles	
				
}

render
{
	time	64 80
	clear	
	part	greetText
	signal	1 68 greetText
	signal  2 72 greetText
	
	part	flash
	signal	1 64 flash
	signal  1 68 flash
	signal  1 72 flash
	part 	bubbles
}
render
{
	time	80	84
	clear
	part	bubbles
}
render
{
	time 84 132
	clear
	part scene1
}


