function build()
    print("Scene Building!");
    rootNode = scene.getRoot();
	
	cubeBufferNode = object.new("sceneCubeBuffer", 128, 128, "RGBA" );
    rootNode:addChild( cubeBufferNode );
	
	mainSceneNode = object.new("sceneBuffer", window.getWidth(), window.getHeight(), 1, true, "RGBA16F", window.getFSAALevel() );
    rootNode:addChild( mainSceneNode );
	
	--[[
    ringNode = object.new("ring", 25.0, 4.0);
    ringNode:setRotation( vector3.new( 90.0, 0.0, 25.0 ) );
    rootNode:addChild(ringNode);
    
    ringNode2 = object.new("ring", 25.0, 4.0);
    ringNode2:setRotation( vector3.new( 90.0, 0.0, -25.0 ) );
    rootNode:addChild(ringNode2);
    
    cubeNode = object.new("cube");
    rootNode:addChild(cubeNode);
    --]]
    
    --[[
    gridNode = object.new("grid");
    gridNode:setPosition( vector3.new( 0.0, -30.0, 0.0 ) );
    rootNode:addChild(gridNode);
    --]]
	
	--[[
    sphereNode = object.new("sphere", 16, 32, 100.0);
    sphereNode:setPosition( vector3.new( 0.0, 0.0, 0.0 ) );
    rootNode:addChild(sphereNode);
    --]]
	
    fishNode = object.new("texturedModel", "res/models/BL_WHALE_HR.exm", "res/textures/whale.jpg" );
    fishNode:setPosition( vector3.new( 0.0, 425.0, 0.0 ) );
    fishNode:setScale( vector3.new( 8.0, 8.0, 8.0 ) );
    mainSceneNode:addChild(fishNode);
    
    
    oceanNode = object.new("ocean", 128, 0.5, 32, 8, 0.2, 0.8);
    oceanNode:setPosition( vector3.new( 0.0, 500.0, 0.0 ) );
    --oceanNode:setVisible( false );
    --oceanNode:setRotation( vector3.new( 0.0, 240.0, 0.0 ) );
    mainSceneNode:addChild(oceanNode);
    
    
    skydomeNode = object.new("skydome", 128, 256, 2500.0);
    skydomeNode:setPosition( vector3.new( 0.0, 0.0, 0.0 ) );
    --skydomeNode:setScale( vector3.new( 10000.0, 10000.0, 10000.0 ) );
    --mainSceneNode:addChild(skydomeNode);
	mainSceneNode:addChild(skydomeNode);
	
	cubeSkydomeNode = object.new("skydome", 128, 256, 2500.0);
    cubeSkydomeNode:setPosition( vector3.new( 0.0, 0.0, 0.0 ) );
    --skydomeNode:setScale( vector3.new( 10000.0, 10000.0, 10000.0 ) );
    --mainSceneNode:addChild(skydomeNode);
	cubeBufferNode:addChild(cubeSkydomeNode);
	
	--[[
	for i=1,2500 do
      flakeObject = object.new("flake");
      local randX = math.random() * 2.0 - 1.0;
      local randY = math.random() * 2.0 - 1.0;
      local randZ = math.random() * 2.0 - 1.0;
      local randDist = 1.0;
      local startPos = vector3.new( randX * randDist, 450 + randY * randDist, randZ * randDist );
      flakeObject:setPosition( startPos );
      
      rootNode:addChild(flakeObject);
    end
	--]]
    
    
    underseaNode = object.new("underseaBox");
    underseaNode:setPosition( vector3.new( 0.0, 0.0, 0.0 ) );
    underseaNode:setScale( vector3.new( 10000.0, 10000.0, 10000.0 ) );
    mainSceneNode:addChild(underseaNode);
    
    seaFloorNode = object.new("seaFloorGrid", 1024, 3.0);
    seaFloorNode:setPosition( vector3.new( 0.0, 0.0, 0.0 ) );
    mainSceneNode:addChild(seaFloorNode);
    
    --[[
    cubes = {};
    cubeDirs = {};
    for i=1,300 do
      cubes[i] = object.new("cube");
      local randX = math.random() * 2.0 - 1.0;
      local randY = math.random() * 2.0 - 1.0;
      local randZ = math.random() * 2.0 - 1.0;
      local randDist = 25.0;
      local startPos = vector3.new( randX * randDist, randY * randDist, randZ * randDist );
      cubes[i]:setPosition( startPos );
      
      cubeDirs[i] = startPos:normalize();
      
      rootNode:addChild(cubes[i]);
    end
    
    --]]
	
	particleCloud = object.new("particleCloud", 4096, vector3.new( 1.0, 1.0, 1.0 ));
    particleCloud:setPosition( vector3.new( 0.0, 400.0, 0.0 ) );
    particleCloud:setScale( vector3.new( 100.0, 100.0, 100.0 ) );
    mainSceneNode:addChild(particleCloud);
	
	particleCloudYellow = object.new("particleCloud", 4096, vector3.new( 0.3, 0.3, 0.0 ));
    particleCloudYellow:setPosition( vector3.new( 0.0, 400.0, 0.0 ) );
    particleCloudYellow:setScale( vector3.new( 100.0, 100.0, 100.0 ) );
    mainSceneNode:addChild(particleCloudYellow);
    
	particleCloudBlue = object.new("particleCloud", 4096, vector3.new( 0.0, 1.0, 1.0 ));
    particleCloudBlue:setPosition( vector3.new( 0.0, 400.0, 0.0 ) );
    particleCloudBlue:setScale( vector3.new( 100.0, 100.0, 100.0 ) );
    mainSceneNode:addChild(particleCloudBlue);
	
	particleCloudPink = object.new("particleCloud", 4096, vector3.new( 1.0, 0.25, 0.4 ));
    particleCloudPink:setPosition( vector3.new( 0.0, 400.0, 0.0 ) );
    particleCloudPink:setScale( vector3.new( 100.0, 100.0, 100.0 ) );
    mainSceneNode:addChild(particleCloudPink);
	
	particleCloudOrange = object.new("particleCloud", 4096, vector3.new( 0.5, 0.3, 0.0 ));
    particleCloudOrange:setPosition( vector3.new( 0.0, 400.0, 0.0 ) );
    particleCloudOrange:setScale( vector3.new( 100.0, 100.0, 100.0 ) );
    mainSceneNode:addChild(particleCloudOrange);
    
	particleCloudGreen = object.new("particleCloud", 4096, vector3.new( 0.25, 1.0, 0.25 ));
    particleCloudGreen:setPosition( vector3.new( 0.0, 400.0, 0.0 ) );
    particleCloudGreen:setScale( vector3.new( 100.0, 100.0, 100.0 ) );
    mainSceneNode:addChild(particleCloudGreen);
	
	particleCloudPurple = object.new("particleCloud", 4096, vector3.new( 0.5, 0.0, 0.5 ));
    particleCloudPurple:setPosition( vector3.new( 0.0, 400.0, 0.0 ) );
    particleCloudPurple:setScale( vector3.new( 100.0, 100.0, 100.0 ) );
    mainSceneNode:addChild(particleCloudPurple);
	
	particleCloudGray = object.new("particleCloud", 4096, vector3.new( 0.25, 0.25, 0.25 ));
    particleCloudGray:setPosition( vector3.new( 0.0, 400.0, 0.0 ) );
    particleCloudGray:setScale( vector3.new( 100.0, 100.0, 100.0 ) );
    mainSceneNode:addChild(particleCloudGray);
	
	cameraNode = object.new("camera");
	mainSceneNode:addChild(cameraNode);
	scene.setActiveCamera(cameraNode);
	
    return true;
end

local lastTime = 0;

function update( deltaTime )
end

function render( time )
  skydomeNode:setVisible( sync.getBool( "Sky.Visible" ) );
  fishNode:setPosition( vector3.new( 0.0, 475.0, sync.getFloat( "Fish.Z" ) ) );
  particleCloud:setVisible( sync.getBool( "Particles.WhiteVisible" ) );
  particleCloudYellow:setVisible( sync.getBool( "Particles.YellowVisible" ) );
  particleCloudBlue:setVisible( sync.getBool( "Particles.BlueVisible" ) );
  particleCloudPink:setVisible( sync.getBool( "Particles.PinkVisible" ) );
  particleCloudOrange:setVisible( sync.getBool( "Particles.OrangeVisible" ) );
  particleCloudGreen:setVisible( sync.getBool( "Particles.GreenVisible" ) );
  particleCloudPurple:setVisible( sync.getBool( "Particles.PurpleVisible" ) );
  particleCloudGray:setVisible( sync.getBool( "Particles.GrayVisible" ) );
  
  particleCloudYellow:setRotation( vector3.new( 0.0, 0.0, 1.0 * time ) );
  particleCloudBlue:setRotation( vector3.new( 0.0, 1.0 * time, 0.0 ) );
  particleCloudPink:setRotation( vector3.new( 1.0 * time, 0.0, 0.0 ) );
  particleCloudOrange:setRotation( vector3.new( 0.0, 0.0, -1.0 * time ) );
  particleCloudGreen:setRotation( vector3.new( 0.0, -1.0 * time, 0.0 ) );
  particleCloudPurple:setRotation( vector3.new( -1.0 * time, 0.0, 0.0 ) );
  particleCloudGray:setRotation( vector3.new( 0.0, 0.0, 0.0 ) );
  
  fishNode:setVisible( sync.getBool( "Fish.Visible" ) );
  oceanNode:setVisible( sync.getBool( "Ocean.Visible" ) );
  seaFloorNode:setVisible( sync.getBool( "SeaFloor.Visible" ) );
  --skydomeNode:setRotation( vector3.new( 0.0, time * 45.0, 0.0 ) );
  --oceanNode:setRotation( vector3.new( 0.0, time * 15.0, 0.0 ) );
  --cubeNode:setPosition( scene.getSunPosition() );
  --radialGridNode:setRotation( vector3.new( 0.0, time * 2.0, 0.0 ) );
  --[[
  local ringScale = math.mod( time * 1.0, 3.0 );
  ringNode:setScale( vector3.new( ringScale, ringScale, 1.0 ) );
  ringNode2:setScale( vector3.new( ringScale, ringScale, 1.0 ) );
  
  local cubeScale = 1.0 + math.mod( time, 1.10 ) * -10.0;
  cubeNode:setScale( vector3.new( cubeScale, cubeScale, cubeScale ) );
  cubeNode:setRotation( vector3.new( time * 45.0, time * -45.0, 0.0 ) );
  
  --gridNode:setRotation( vector3.new( 0.0, time * 45.0, 0.0 ) );
  
  for i=1,300 do
    local sinVal = math.sin( time * 5.0 );
    local cosVal = math.cos( time * 5.0 );
    local endPos = cubeDirs[i] * time * 5.0;
    cubes[i]:setPosition( endPos );
    cubes[i]:setRotation( vector3.new( time * 45.0, time * 45.0, 0.0 ) );
  end
  --]]
  
	--cubeBufferNode:render( time );
	--sphereNode:render( time );
	rootNode:render( time );
	scene.postProcessBufferNode( mainSceneNode );
end
