Documentation


EngineGroup.cpp

Go to the documentation of this file.
00001 //
00002 // C++ Implementation: EngineGroup
00003 //
00004 // Description:
00005 //
00006 //
00007 // Author: François Faure <>, (C) 2004
00008 //
00009 // Copyright: See COPYING file that comes with this distribution
00010 //
00011 //
00012 #include "EngineGroup.h"
00013 
00014 namespace animal
00015 {
00016 
00017 EngineGroup::EngineGroup()
00018         : Engine()
00019 {}
00020 
00021 
00022 EngineGroup::~EngineGroup()
00023 {}
00024 
00026 void EngineGroup::init()
00027 {
00028     for( Engines::iterator i=m_engines.begin(); i!=m_engines.end(); ++i )
00029     {
00030         (*i)->init();
00031     }
00032 }
00033 
00034 
00036 void EngineGroup::reset()
00037 {
00038     for( Engines::iterator i=m_engines.begin(); i!=m_engines.end(); ++i )
00039     {
00040         (*i)->reset();
00041     }
00042 }
00043 
00045 void EngineGroup::move(double dt)
00046 {
00047     for( Engines::iterator i=m_engines.begin(); i!=m_engines.end(); ++i )
00048     {
00049         (*i)->move(dt);
00050     }
00051 }
00052 
00053 // /// Draw the engine
00054 // void EngineGroup::draw()
00055 // {
00056 //     for( Engines::iterator i=m_engines.begin(); i!=m_engines.end(); ++i )
00057 //     {
00058 //         (*i)->draw();
00059 //     }
00060 // }
00061 
00063 void EngineGroup::getBoundingBox( float & minX, float & minY, float & minZ,
00064                                   float & maxX, float & maxY, float & maxZ)
00065 {
00066     if( !m_engines.empty() )
00067     {
00068         Engines::iterator i=m_engines.begin();
00069         (*i)->getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
00070         for( ++i; i!=m_engines.end(); ++i )
00071         {
00072             float x,y,z,X,Y,Z;
00073             (*i)->getBoundingBox(x,y,z,X,Y,Z);
00074             if( x<minX ) minX=x;
00075             if( y<minY ) minY=y;
00076             if( z<minZ ) minZ=z;
00077             if( X>maxX ) maxX=X;
00078             if( Y>maxY ) maxY=Y;
00079             if( Z>maxZ ) maxZ=Z;
00080         }
00081     }
00082     else Engine::getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
00083 }
00084 
00085 ConstrainedItem* EngineGroup::pickPoint( float* orig, float* dist, float t )
00086 {
00087     ConstrainedItem* c = 0;
00088     for( Engines::iterator i=m_engines.begin(); i!=m_engines.end() && !c; ++i )
00089     {
00090         c=(*i)->pickPoint(orig,dist,t);
00091     }
00092     return c;
00093 }
00094 
00095 };

Generated on Thu Dec 23 13:52:24 2004 by doxygen 1.3.6