00001 #include "TestScene.h" 00002 #include "TerminalObject.h" 00003 #include "DLODObject.h" 00004 #include "GroupObject.h" 00005 #include "Teapot.h" 00006 #include "Cube.h" 00007 #include "Textures.h" 00008 #include "Torus.h" 00009 00010 void TestScene::Init () 00011 { 00012 Light * light; 00013 00014 RawObject * cube; 00015 GraphicalObject * terminal; 00016 00017 // create 3 cubes that are textured with perlin noise 00018 cube = new TexturedCube (30.0f, Textures::GetId (T_PERLIN), true); 00019 terminal = new TerminalObject (cube); 00020 terminal->position->SetConstantPosition (0.0f, -35.0f, 0.0f, 0.0f, 0.0f, 0.0f); 00021 AddObject (terminal); 00022 00023 cube = new TexturedCube (30.0f, Textures::GetId (T_PERLIN2), true); 00024 terminal = new TerminalObject (cube); 00025 terminal->position->SetConstantPosition (.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); 00026 AddObject (terminal); 00027 00028 cube = new TexturedCube (30.0f, Textures::GetId (T_PERLIN3), true); 00029 terminal = new TerminalObject (cube); 00030 terminal->position->SetConstantPosition (0.0f, 35.0f, 0.0f, 0.0f, 0.0f, 0.0f); 00031 AddObject (terminal); 00032 00033 00034 /* 00035 // Create teapot group 00036 GroupObject * teapot_cluster = new GroupObject (); 00037 00038 // Create 6 teapots 00039 RawObject * raw_teapot_red = new Teapot (5.0f); 00040 GraphicalObject * teapot_red = new TerminalObject (raw_teapot_red); 00041 raw_teapot_red->SetColor (1.0f, 0.0f, 0.0f, 0.0f); 00042 teapot_red->position->StartPath (0, 20.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); 00043 teapot_red->position->SetDuration (20000); 00044 teapot_red->position->SetTransitionModes (PP_LINEAR, PP_LINEAR, PP_LINEAR, PP_LINEAR, PP_SINE, PP_COSINE); 00045 teapot_red->position->SetParameters (0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); 00046 teapot_red->position->CompletePath (20.0f, 0.0f, 0.0f, 0.0f, 3600.0f, 3600.0f); 00047 //teapot_red->position->SetConstantPosition (20.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); 00048 teapot_cluster->AddChild (teapot_red); 00049 00050 RawObject * raw_teapot_yellow = new Teapot (5.0f); 00051 GraphicalObject * teapot_yellow = new TerminalObject (raw_teapot_yellow); 00052 raw_teapot_yellow->SetColor (1.0f, 1.0f, 0.0f, 0.0f); 00053 teapot_yellow->position->StartPath (0, -20.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); 00054 teapot_yellow->position->SetDuration (20000); 00055 teapot_yellow->position->SetGlobalTransition (PP_LINEAR, 0.0f); 00056 teapot_yellow->position->CompletePath (-20.0f, 0.0f, 0.0f, 0.0f, 0.0f, 3600.0f); 00057 //teapot_yellow->position->SetConstantPosition (-20.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); 00058 teapot_cluster->AddChild (teapot_yellow); 00059 00060 teapot_yellow->position->PrintToConsole (); 00061 00062 RawObject * raw_teapot_green = new Teapot (5.0f); 00063 GraphicalObject * teapot_green = new TerminalObject (raw_teapot_green); 00064 raw_teapot_green->SetColor (0.0f, 1.0f, 0.0f, 0.0f); 00065 teapot_green->position->StartPath (0, 0.0f, 20.0f, 0.0f, 0.0f, 0.0f, 0.0f); 00066 teapot_green->position->SetDuration (20000); 00067 teapot_green->position->SetTransitionModes (PP_LINEAR, PP_LINEAR, PP_LINEAR, PP_SINE, PP_COSINE, PP_LINEAR); 00068 teapot_green->position->SetParameters (0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); 00069 teapot_green->position->CompletePath (0.0f, 20.0f, 0.0f, 3600.0f, 3600.0f, 0.0f); 00070 //teapot_green->position->SetConstantPosition (0.0f, 20.0f, 0.0f, 0.0f, 0.0f, 0.0f); 00071 teapot_cluster->AddChild (teapot_green); 00072 00073 RawObject * raw_teapot_lightblue = new Teapot (5.0f); 00074 GraphicalObject * teapot_lightblue = new TerminalObject (raw_teapot_lightblue); 00075 raw_teapot_lightblue->SetColor (0.0f, 1.0f, 1.0f, 0.0f); 00076 teapot_lightblue->position->StartPath (0, 0.0f, -20.0f, 0.0f, 0.0f, 0.0f, 0.0f); 00077 teapot_lightblue->position->SetDuration (20000); 00078 teapot_lightblue->position->SetGlobalTransition (PP_LINEAR, 0.0f); 00079 teapot_lightblue->position->CompletePath (0.0f, -20.0f, 0.0f, 0.0f, 3600.0f, 0.0f); 00080 //teapot_lightblue->position->SetConstantPosition (0.0f, -20.0f, 0.0f, 0.0f, 0.0f, 0.0f); 00081 teapot_cluster->AddChild (teapot_lightblue); 00082 00083 RawObject * raw_teapot_darkblue = new Teapot (5.0f); 00084 GraphicalObject * teapot_darkblue = new TerminalObject (raw_teapot_darkblue); 00085 raw_teapot_darkblue->SetColor (0.0f, 0.0f, 1.0f, 0.0f); 00086 teapot_darkblue->position->StartPath (0, 0.0f, 0.0f, 20.0f, 0.0f, 0.0f, 0.0f); 00087 teapot_darkblue->position->SetDuration (20000); 00088 teapot_darkblue->position->SetTransitionModes (PP_LINEAR, PP_LINEAR, PP_LINEAR, PP_COSINE, PP_LINEAR, PP_SINE); 00089 teapot_darkblue->position->SetParameters (0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); 00090 teapot_darkblue->position->CompletePath (0.0f, 0.0f, 20.0f, 3600.0f, 0.0f, 3600.0f); 00091 //teapot_darkblue->position->SetConstantPosition (0.0f, 0.0f, 20.0f, 0.0f, 0.0f, 0.0f); 00092 teapot_cluster->AddChild (teapot_darkblue); 00093 00094 RawObject * raw_teapot_pink = new Teapot (5.0f); 00095 GraphicalObject * teapot_pink = new TerminalObject (raw_teapot_pink); 00096 raw_teapot_pink->SetColor (1.0f, 0.0f, 1.0f, 0.0f); 00097 teapot_pink->position->StartPath (0, 0.0f, 0.0f, -20.0f, 0.0f, 0.0f, 0.0f); 00098 teapot_pink->position->SetDuration (20000); 00099 teapot_pink->position->SetGlobalTransition (PP_LINEAR, 0.0f); 00100 teapot_pink->position->CompletePath (0.0f, 0.0f, -20.0f, 3600.0f, 0.0f, 0.0f); 00101 //teapot_pink->position->SetConstantPosition (0.0f, 0.0f, -20.0f, 0.0f, 0.0f, 0.0f); 00102 teapot_cluster->AddChild (teapot_pink); 00103 00104 this->AddObject (teapot_cluster); 00105 00106 // Set the camera 00107 camera = new Camera (); 00108 camera->SetAttributes (45, 1.333, 1.0, 7000.0); 00109 00110 camera->position->StartPath (0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -180.0f); 00111 camera->position->SetDuration (6000); 00112 camera->position->SetGlobalTransition (PP_COSINE, 0.0f); 00113 camera->position->AddCheckpoint (50.0f, 0.0f, 20.0f, 0.0f, 0.0f, -180.0f); 00114 camera->position->SetDuration (6000); 00115 camera->position->SetGlobalTransition (PP_SINE, 0.0f); 00116 camera->position->AddCheckpoint (50.0f, 0.0f, 50.0f, 0.0f, 30.0f, -180.0f); 00117 camera->position->SetDuration (3000); 00118 camera->position->SetGlobalTransition (PP_LINEAR, 0.0f); 00119 camera->position->AddCheckpoint (60.0f, 60.0f, 60.0f, 0.0f, 30.0f, -135.0f); 00120 camera->position->SetDuration (6000); 00121 camera->position->SetGlobalTransition (PP_JUMP, 0.5f); 00122 camera->position->CompletePath (40.0f, 40.0f, 40.0f, 0.0f, 30.0f, -135.0f); 00123 camera->position->StartPath (0, 30.f, 30.0f, 30.0f, 0.0f, 30.0f, -135.0f); 00124 camera->position->SetDuration (6000); 00125 camera->position->SetGlobalTransition (PP_JUMP, 0.5f); 00126 camera->position->CompletePath (20.0f, 20.0f, 20.0f, 0.0f, 30.0f, -135.0f); 00127 */ 00128 00129 // Set the camera 00130 camera = new Camera (); 00131 camera->SetAttributes (45, 1.333, 1.0, 600.0); 00132 camera->position->SetConstantPosition (120.0f, 0.0f, 30.0f, 0.0f, 10.0f, 180.0f); 00133 00134 00135 // add one light at (0,0,0) 00136 light = new Light (); 00137 light->position->SetConstantPosition (20.0f, 20.0f, 20.0f, 0.0f, 0.0f, 0.0f); 00138 light->SetDiffuse (1.0f, 1.0f, 1.0f, 1.0f); 00139 light->SetSpecular (1.0f, 1.0f, 1.0f, 1.0f); 00140 light->SetAmbient (0.6f, 0.6f, 0.6f, 1.0f); 00141 AddLight (light); 00142 00143 }