Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals

pge::sgfmeshmodelfactory Namespace Reference


Functions

SGFMeshModelcreateSGFMeshModel (const std::string &filename, Vector3f bottomCenter, float scaleFactor)
SGFMeshModelcreateSGFMeshModelWithLights (const std::string &filename, Vector3f bottomCenter, float scaleFactor, World *world)


Function Documentation

SGFMeshModel * pge::sgfmeshmodelfactory::createSGFMeshModel const std::string &  filename,
Vector3f  bottomCenter,
float  scaleFactor
 

Definition at line 20 of file SGFMeshModelFactory.cpp.

00020                                                                                                                       {
00021                         SGFFile file(filename);
00022                         SGFMeshModel *model = new SGFMeshModel(&file, bottomCenter, scaleFactor, NULL);
00023 
00024                         return model;
00025                 }

SGFMeshModel * pge::sgfmeshmodelfactory::createSGFMeshModelWithLights const std::string &  filename,
Vector3f  bottomCenter,
float  scaleFactor,
World *  world
 

Definition at line 33 of file SGFMeshModelFactory.cpp.

References pge::World::addLight(), pge::MeshModel::getBottomCenterDifference(), pge::SGFFile::getLights(), and pge::SGFFile::SGFLight::m_position.

00034                                                          {
00035 
00036                                 std::vector<SGFFile::SGFLight>::iterator it;
00037 
00038                                 // Load model and create meshmodel.
00039                                 SGFFile file(filename);
00040                                 SGFMeshModel *model = new SGFMeshModel(&file, bottomCenter, scaleFactor, NULL);
00041 
00042                                 // Add the lights to the world.
00043                                 for(it = file.getLights()->begin(); it != file.getLights()->end(); it++) {
00044                                         SGFFile::SGFLight light = *it;
00045                                         Light *worldLight = new Light();
00046 
00047                                         // The bottomcenter is set, so calculate the difference to the light
00048                                         // position.
00049                                         light.m_position = light.m_position + model->getBottomCenterDifference();
00050 
00051                                         // TODO: Ambient and specular values!
00052                                         SGFFile::sgfLightToLight(&light, worldLight, Vector4f(0.1f, 0.1f, 0.1f, 1.0f),
00053                                                 Vector4f(0.1f, 0.1f, 0.1f, 1.0f));
00054 
00055                                         world->addLight(worldLight);
00056 
00057                                 }
00058 
00059                                 return model;
00060                 }

Here is the call graph for this function:


Generated on Mon Oct 16 12:10:02 2006 for Phobosengine by doxygen 1.3.4