00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "Teddy/SpaceGame/ObjectManager.h"
00026 #include "Teddy/Graphics/ImageFileTexture.h"
00027 #include "Teddy/Graphics/View.h"
00028 #include "Teddy/Imports/LWMesh.h"
00029 #include "Teddy/Materials/Material.h"
00030 #include "Teddy/Models/Box.h"
00031 #include "Teddy/Models/Cone.h"
00032 #include "Teddy/Models/ModelInstance.h"
00033 #include "Teddy/Models/Sphere.h"
00034 #include "Teddy/Models/Torus.h"
00035 #include "Teddy/Models/Tube.h"
00036 #include "Teddy/Models/Vertex.h"
00037 #include "Teddy/Scenes/Scene.h"
00038 #include "Teddy/SysSupport/FileScan.h"
00039 using namespace Teddy::Imports;
00040 using namespace Teddy::Models;
00041 using namespace Teddy::Scenes;
00042
00043
00044 namespace Teddy {
00045 namespace SpaceGame {
00046
00047
00049 void ObjectManager::addPrimitives(){
00050 Material *m1 = new Material( "Test Material m1" );
00051 m1->setEmission( Color(0,0,0) );
00052 m1->setAmbient ( Color(0.3f,0.2f,0.1f) );
00053 m1->setDiffuse ( Color(0.3f,0.2f,0.1f) );
00054 m1->setSpecular( Color(0.4f,0.4f,0.8f) );
00055 m1->setBorder ( Color(0,0,1) );
00056 m1->setMode ( RENDER_MODE_FILL );
00057 m1->setLighting( RENDER_LIGHTING_SIMPLE );
00058 m1->setOptions (
00059 RENDER_OPTION_CULL_FACE_M |
00060 RENDER_OPTION_DEPTH_TEST_M |
00061 RENDER_OPTION_AMBIENT_M |
00062 RENDER_OPTION_DIFFUSE_M |
00063 RENDER_OPTION_SPECULAR_M |
00064 RENDER_OPTION_EMISSION_M |
00065 RENDER_OPTION_SHINYNESS_M |
00066 RENDER_OPTION_SMOOTH_M
00067 );
00068 m1->setShininess( 8.0f );
00069
00070
00071 Torus *torus = new Torus( "Torus", 1000.0, 200.0, 5, 4 );
00072 ModelInstance *mi_torus = new ModelInstance( "Torus 1", torus );
00073 mi_torus->setPosition( 1000.0, 1000, 0 );
00074 mi_torus->setMaterial( &Material::RED );
00075 scene->addInstance( mi_torus );
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 Box *box = new Box( "Box", 800, 400, 400, 8, 4, 4 );
00101 ModelInstance *mi_box = new ModelInstance( "Box", box );
00102 mi_box->setPosition( -1000, 1000, 0 );
00103 mi_box->setMaterial( &Material::CYAN );
00104 scene->addInstance( mi_box );
00105
00106 }
00107
00108
00109 };
00110 };
00111