Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 12, 2008, 2:00:15 AM (16 years ago)
Author:
landauf
Message:

Again some heavy changes in ObjectList and Iterator:
there are now two types of iterators:

Iterator<ClassName> can iterate through any objectlist, either given by ObjectList<AnyClassName>::begin() or anyidentifier→getObjects()→begin(). Important note Iterator<ClassName> uses dynamic_cast.
And yes, it's possible to do this: Iterator<WorldEntity> it = ObjectList<SpaceShip>::begin()

ObjectList<ClassName>::iterator is the second iterator - it uses the ObjectList in a templated manner and therefore doesn't need dynamic_cast. But the only thing you can do is iterating through exactly the right ObjectList: ObjectList<ClassName>::iterator it = ObjectList<ClassName>::begin(). Anything else fails.

Those changes bring, at my system, something around +12% FPS compared with trunk and +25% FPS compared with the last revision of core3. Although I have to admit the FPS gain is only that high because iterating through objects is the main thing we're doing ingame right now. It would look totally different with physics, sound, AI, scripts, triggers and so on.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core3/src/core/Identifier.cc

    r1583 r1591  
    3939#include "ConsoleCommand.h"
    4040#include "CommandExecutor.h"
    41 #include "MetaObjectList.h"
     41#include "Iterator.h"
    4242#include "ObjectList.h"
    4343#include "OrxonoxClass.h"
     
    197197
    198198    /**
    199         @brief Adds an object of the given type to the ObjectList.
    200         @param object The object to add
    201     */
    202     void Identifier::addObject(OrxonoxClass* object)
    203     {
    204         COUT(5) << "*** ClassIdentifier: Added object to " << this->getName() << "-list." << std::endl;
    205         object->getMetaList().add(this->objects_, this->objects_->add(object));
     199        @brief Updates the config-values of all existing objects of this class by calling their setConfigValues() function.
     200    */
     201    void Identifier::updateConfigValues() const
     202    {
     203        for (BaseIterator it = this->getObjects()->begin(); it; ++it)
     204            (*it)->setConfigValues();
    206205    }
    207206
Note: See TracChangeset for help on using the changeset viewer.