Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 11, 2010, 8:55:13 AM (14 years ago)
Author:
dafrick
Message:

Merged presentation3 branch into trunk.

Location:
code/trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/modules/objects/CMakeLists.txt

    r5781 r7163  
    1515  PCH_FILE
    1616    ObjectsPrecompiledHeaders.h
    17   DEFINE_SYMBOL
    18     "OBJECTS_SHARED_BUILD"
    1917  LINK_LIBRARIES
    2018    orxonox
  • code/trunk/src/modules/objects/ObjectsPrereqs.h

    r6906 r7163  
    4343//-----------------------------------------------------------------------
    4444
    45 #if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(ORXONOX_STATIC_BUILD)
     45#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(OBJECTS_STATIC_BUILD)
    4646#  ifdef OBJECTS_SHARED_BUILD
    4747#    define _ObjectsExport __declspec(dllexport)
  • code/trunk/src/modules/objects/Planet.cc

    r6501 r7163  
    7070        {
    7171            Camera* activeCamera = CameraManager::getInstance().getActiveCamera();
    72             if (activeCamera)
     72            if (activeCamera && this->billboard_.getBillboardSet())
    7373            {
    7474                float distance = this->getPosition().distance( activeCamera->getWorldPosition() );
     
    8989    void Planet::init()
    9090    {
    91         float scaleFactor = this->getScale();
    92 
    93 #if OGRE_VERSION >= 0x010700
    94         Ogre::Mesh::LodValueList distList;
    95 #else
    96         Ogre::Mesh::LodDistanceList distList;
    97 #endif
    98 
    99         distList.push_back(10.0f*scaleFactor);
    100         distList.push_back(19.0f*scaleFactor);
    101         distList.push_back(27.0f*scaleFactor);
    102         distList.push_back(34.0f*scaleFactor);
    103         distList.push_back(40.0f*scaleFactor);
    104         distList.push_back(45.0f*scaleFactor);
    105         distList.push_back(49.0f*scaleFactor);
    106         distList.push_back(52.0f*scaleFactor);
    107         distList.push_back(54.0f*scaleFactor);
    108         distList.push_back(55.0f*scaleFactor);
    109 
    110         float reductionValue = 0.2f;
    111 
    112         this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
    113         billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->atmosphere_, Vector3(0,0,0));
    114 
    115         this->attachOgreObject(this->billboard_.getBillboardSet());
    116         this->billboard_.getBillboardSet()->setUseAccurateFacing(true);
    117         this->setCastShadows(true);
    118         this->billboard_.getBillboardSet()->setRenderQueueGroup(this->mesh_.getEntity()->getRenderQueueGroup());
    119         this->mesh_.setCastShadows(true);
    12091    }
    12192
    12293    void Planet::changedMesh()
    12394    {
    124         if (this->mesh_.getEntity())
    125             this->detachOgreObject(this->mesh_.getEntity());
     95        if( GameMode::showsGraphics() )
     96        {
     97            if (this->mesh_.getEntity())
     98                this->detachOgreObject(this->mesh_.getEntity());
    12699
    127         this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
     100            this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_);
    128101
    129         if (this->mesh_.getEntity())
    130         {
    131             this->attachOgreObject(this->mesh_.getEntity());
    132             this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
    133             this->mesh_.setVisible(this->isVisible());
     102            if (this->mesh_.getEntity())
     103            {
     104                this->attachOgreObject(this->mesh_.getEntity());
     105                this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
     106                this->mesh_.setVisible(this->isVisible());
     107
     108                float scaleFactor = this->getScale();
     109
     110    #if OGRE_VERSION >= 0x010700
     111                Ogre::Mesh::LodValueList distList;
     112    #else
     113                Ogre::Mesh::LodDistanceList distList;
     114    #endif
     115
     116                distList.push_back(10.0f*scaleFactor);
     117                distList.push_back(19.0f*scaleFactor);
     118                distList.push_back(27.0f*scaleFactor);
     119                distList.push_back(34.0f*scaleFactor);
     120                distList.push_back(40.0f*scaleFactor);
     121                distList.push_back(45.0f*scaleFactor);
     122                distList.push_back(49.0f*scaleFactor);
     123                distList.push_back(52.0f*scaleFactor);
     124                distList.push_back(54.0f*scaleFactor);
     125                distList.push_back(55.0f*scaleFactor);
     126
     127                float reductionValue = 0.2f;
     128
     129                this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
     130                billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->atmosphere_, Vector3(0,0,0));
     131
     132                this->attachOgreObject(this->billboard_.getBillboardSet());
     133                this->billboard_.getBillboardSet()->setUseAccurateFacing(true);
     134                this->setCastShadows(true);
     135                this->billboard_.getBillboardSet()->setRenderQueueGroup(this->mesh_.getEntity()->getRenderQueueGroup());
     136                this->mesh_.setCastShadows(true);
     137            }
    134138        }
    135         this->init();
    136139    }
    137140
     
    151154        SUPER(Planet, XMLPort, xmlelement, mode);
    152155
    153         if (GameMode::showsGraphics())
    154         {
    155             XMLPortParam(Planet, "atmosphere", setAtmosphere, getAtmosphere, xmlelement, mode).defaultValues("planet/Atmosphere");
    156             XMLPortParam(Planet, "atmospheresize", setAtmosphereSize, getAtmosphereSize, xmlelement,mode);
    157             XMLPortParam(Planet, "imagesize", setImageSize, getImageSize, xmlelement,mode);
    158             XMLPortParam(Planet, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
    159             XMLPortParam(Planet, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
    160         }
     156        XMLPortParam(Planet, "atmosphere", setAtmosphere, getAtmosphere, xmlelement, mode).defaultValues("planet/Atmosphere");
     157        XMLPortParam(Planet, "atmospheresize", setAtmosphereSize, getAtmosphereSize, xmlelement,mode);
     158        XMLPortParam(Planet, "imagesize", setImageSize, getImageSize, xmlelement,mode);
     159        XMLPortParam(Planet, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
     160        XMLPortParam(Planet, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
    161161    }
    162162
     
    164164    {
    165165        registerVariable(this->atmosphere_, VariableDirection::ToClient);
     166        registerVariable(this->atmosphereSize, VariableDirection::ToClient);
     167        registerVariable(this->imageSize, VariableDirection::ToClient);
     168        // Note: the meshSrc should be synchronised after atmosphere and other values, because the meshSrc callback setts the atmosphere billboards
    166169        registerVariable(this->meshSrc_, VariableDirection::ToClient, new NetworkCallback<Planet>(this, &Planet::changedMesh));
    167170        registerVariable(this->bCastShadows_, VariableDirection::ToClient, new NetworkCallback<Planet>(this, &Planet::changedShadows));
    168         registerVariable(this->atmosphereSize, VariableDirection::ToClient);
    169         registerVariable(this->imageSize, VariableDirection::ToClient);
    170171    }
    171172
  • code/trunk/src/modules/objects/Planet.h

    r6501 r7163  
    9494
    9595        protected:
    96             void registerVariables();
    9796
    9897        private:
     98            void registerVariables();
    9999
    100100            void changedMesh();
  • code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.h

    r5781 r7163  
    4343            virtual ~BoxCollisionShape();
    4444
    45             void registerVariables();
    4645            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4746
     
    6766
    6867        private:
     68            void registerVariables();
     69
    6970            btCollisionShape* createNewShape() const;
    7071
  • code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.h

    r5781 r7163  
    4141            virtual ~ConeCollisionShape();
    4242
    43             void registerVariables();
    4443            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4544
     
    5554
    5655        private:
     56            void registerVariables();
     57
    5758            btCollisionShape* createNewShape() const;
    5859
  • code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.h

    r5781 r7163  
    4343            virtual ~PlaneCollisionShape();
    4444
    45             void registerVariables();
    4645            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4746
     
    5756
    5857        private:
     58            void registerVariables();
     59
    5960            btCollisionShape* createNewShape()const;
    6061
  • code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.h

    r5781 r7163  
    4141            virtual ~SphereCollisionShape();
    4242
    43             void registerVariables();
    4443            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4544
     
    5049
    5150        private:
     51            void registerVariables();
     52
    5253            btCollisionShape* createNewShape() const;
    5354
  • code/trunk/src/modules/objects/eventsystem/EventListener.cc

    r6856 r7163  
    6161            return;
    6262        }
    63        
     63
    6464        COUT(4) << "EventListener, processing event: originator: " << event.originator_->getIdentifier()->getName() << " (&" << event.originator_ << ")" << ", activate: " << event.activate_ << ", name: " << event.name_ << std::endl;
    6565
  • code/trunk/src/modules/objects/triggers/CheckPoint.cc

    r5929 r7163  
    3838    CreateFactory(CheckPoint);
    3939
    40     CheckPoint::CheckPoint(BaseObject* creator) : DistanceTrigger(creator)
     40    CheckPoint::CheckPoint(BaseObject* creator)
     41        : DistanceTrigger(creator)
     42        , RadarViewable(creator, static_cast<WorldEntity*>(this))
    4143    {
    4244        RegisterObject(CheckPoint);
  • code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc

    • Property svn:eol-style set to native
    r6906 r7163  
    4040namespace orxonox
    4141{
    42    
     42
    4343    CreateFactory(DistanceMultiTrigger);
    4444
    4545    /**
    4646    @brief
    47         Default Constructor. Registers the object and initializes default values. 
     47        Default Constructor. Registers the object and initializes default values.
    4848    */
    4949    DistanceMultiTrigger::DistanceMultiTrigger(BaseObject* creator) : MultiTrigger(creator)
    5050    {
    5151        RegisterObject(DistanceMultiTrigger);
    52        
     52
    5353        this->distance_ = 100.0f;
    5454        this->targetName_ = BLANKSTRING;
     
    9898                continue;
    9999            }
    100            
     100
    101101            Vector3 distanceVec = entity->getWorldPosition() - this->getWorldPosition();
    102102            // If the object is no longer in range.
     
    154154                if(this->singleTargetMode_)
    155155                    entity = entity->getParent();
    156                
     156
    157157                // If no queue has been created, yet.
    158158                if(queue == NULL)
     
    166166            }
    167167        }
    168        
     168
    169169        return queue;
    170170    }
    171    
     171
    172172}
  • code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h

    • Property svn:eol-style set to native
    r6906 r7163  
    5656    class _ObjectsExport DistanceMultiTrigger : public MultiTrigger
    5757    {
    58        
     58
    5959        public:
    6060            DistanceMultiTrigger(BaseObject* creator); //!< Default Constructor. Registers the object and initializes default values.
    6161            ~DistanceMultiTrigger(); //!< Destructor.
    62            
     62
    6363            void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a DistanceMultiTrigger object through XML.
    6464
     
    7575            inline const std::string& getTargetName(void)
    7676                { return this->targetName_; }
    77            
     77
    7878            /**
    7979            @brief Set the distance at which the DistanceMultiTrigger triggers.
     
    8888            inline float getDistance() const
    8989                { return this->distance_; }
    90                
     90
    9191        protected:
    9292            virtual std::queue<MultiTriggerState*>* letTrigger(void); //!< This method is called by the MultiTrigger to get information about new trigger events that need to be looked at.
     
    106106            inline bool removeFromRange(WorldEntity* entity)
    107107                { WeakPtr<WorldEntity>* weakptr = this->range_.find(entity)->second; bool erased = this->range_.erase(entity) > 0; if(erased) delete weakptr; return erased; }
    108                
     108
    109109        private:
    110110            float distance_; //!< The distance at which the DistanceMultiTrigger triggers.
    111111            std::string targetName_; //!< The target name, used in singleTargetMode.
    112112            bool singleTargetMode_; //!< To indicate whe the MultiDistanceTrigger is in single-target-mode.
    113            
     113
    114114            std::map<WorldEntity*, WeakPtr<WorldEntity>* > range_; //!< The set of entities that currently are in range of the DistanceMultiTrigger.
    115        
     115
    116116    };
    117    
     117
    118118}
    119119
  • code/trunk/src/modules/objects/triggers/DistanceTrigger.cc

    r6906 r7163  
    136136          continue;
    137137      }
    138      
     138
    139139      Vector3 distanceVec = entity->getWorldPosition() - this->getWorldPosition();
    140140      if (distanceVec.length() < this->distance_)
     
    155155      }
    156156    }
     157
    157158    return false;
    158159  }
  • code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.cc

    • Property svn:eol-style set to native
    r6906 r7163  
    3535
    3636    CreateFactory(DistanceTriggerBeacon);
    37    
     37
    3838    DistanceTriggerBeacon::DistanceTriggerBeacon(BaseObject* creator) : StaticEntity(creator)
    3939    {
    4040        RegisterObject(DistanceTriggerBeacon);
    4141    }
    42    
     42
    4343}
  • code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.h

    • Property svn:eol-style set to native
    r6906 r7163  
    3939    class _ObjectsExport DistanceTriggerBeacon : public StaticEntity
    4040    {
    41        
     41
    4242        public:
    4343
  • code/trunk/src/modules/objects/triggers/EventMultiTrigger.cc

    • Property svn:eol-style set to native
    r6864 r7163  
    5252    EventMultiTrigger::~EventMultiTrigger()
    5353    {
    54        
     54
    5555    }
    5656
     
    6161        this->setBroadcast(true);
    6262    }
    63    
     63
    6464    void EventMultiTrigger::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
    6565    {
  • code/trunk/src/modules/objects/triggers/EventMultiTrigger.h

    • Property svn:eol-style set to native
    r6864 r7163  
    4444    class _ObjectsExport EventMultiTrigger : public MultiTrigger
    4545    {
    46        
     46
    4747        public:
    4848            EventMultiTrigger(BaseObject* creator);
  • code/trunk/src/modules/objects/triggers/MultiTrigger.cc

    • Property svn:eol-style set to native
    r6864 r7163  
    4747    /*static*/ const std::string MultiTrigger::or_s = "or";
    4848    /*static*/ const std::string MultiTrigger::xor_s = "xor";
    49    
     49
    5050    CreateFactory(MultiTrigger);
    5151
     
    6565        this->bSwitch_ = false;
    6666        this->bStayActive_ = false;
    67        
     67
    6868        this->remainingActivations_ = INF_s;
    6969        this->maxNumSimultaniousTriggerers_ = INF_s;
     
    7575
    7676        this->parentTrigger_ = NULL;
    77        
     77
    7878        this->targetMask_.exclude(Class(BaseObject));
    7979
    8080        this->setSyncMode(0x0);
    8181    }
    82    
     82
    8383    /**
    8484    @brief
     
    9595        }
    9696    }
    97    
     97
    9898    /**
    9999    @brief
     
    117117        //TODO: Maybe nicer with explicit subgroup, e.g. triggers
    118118        XMLPortObject(MultiTrigger, MultiTrigger, "", addTrigger, getTrigger, xmlelement, mode);
    119        
     119
    120120        COUT(4) << "MultiTrigger '" << this->getName() << "' (&" << this << ") created." << std::endl;
    121121    }
    122    
     122
    123123
    124124    /**
     
    131131    {
    132132        // If this is the first tick.
    133         //TODO: Determine need for this, else kick it out. 
     133        //TODO: Determine need for this, else kick it out.
    134134        if(this->bFirstTick_)
    135135        {
     
    174174                    delete state;
    175175                }
    176                
     176
    177177                queue->pop();
    178178            }
     
    185185            MultiTriggerState* state;
    186186            float timeRemaining;
    187            
     187
    188188            // Go through all pending states.
    189189            for(int size = this->stateQueue_.size(); size >= 1; size--)
     
    212212                                this->triggered_.erase(state->originator);
    213213                            }
    214                            
     214
    215215                            bStateChanged = true;
    216216                        }
     
    229229
    230230                            bool bFire = true;
    231                            
     231
    232232                            // Add the originator to the objects activating this MultiTrigger.
    233233                            if(bActive == true)
     
    266266                                else
    267267                                    this->fire(bActive, state->originator);
    268                                
     268
    269269                                bStateChanged = true;
    270270                            }
     
    289289                        }
    290290                    }
    291                    
     291
    292292                    // Remove the state from the state queue.
    293293                    this->stateQueue_.pop_front();
     
    509509            return returnVal;
    510510        }
    511        
     511
    512512        return true;
    513513    }
    514    
     514
    515515    /**
    516516    @brief
     
    547547            return;
    548548        }
    549        
     549
    550550        MultiTriggerContainer* container = new MultiTriggerContainer(this, this, originator);
    551551        this->fireEvent(status, container);
     
    563563    {
    564564        ClassTreeMask& targetMask = this->getTargetMask();
    565        
     565
    566566        for(ClassTreeMaskObjectIterator it = targetMask.begin(); it != targetMask.end(); ++it)
    567567        {
     
    580580    {
    581581        assert(state);
    582        
     582
    583583        // If the originator is no target of this MultiTrigger.
    584584        if(!this->isTarget(state->originator))
    585585            return false;
    586        
     586
    587587        // Add it ot the state queue.
    588588        this->stateQueue_.push_back(std::pair<float, MultiTriggerState*>(this->delay_, state));
  • code/trunk/src/modules/objects/triggers/MultiTrigger.h

    • Property svn:eol-style set to native
    r6864 r7163  
    9494            MultiTrigger(BaseObject* creator); //!< Constructor. Registers the objects and initializes default values.
    9595            ~MultiTrigger(); //!< Destructor.
    96            
     96
    9797            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a MultiTrigger object through XML.
    9898            virtual void tick(float dt); //!< A method that is executed each tick.
    99            
     99
    100100            bool isActive(BaseObject* triggerer = NULL); //!< Get whether the MultiTrigger is active for a given object.
    101101
     
    215215            void addTargets(const std::string& targets); //!< Add some target to the MultiTrigger.
    216216            void removeTargets(const std::string& targets); //!< Remove some target from the MultiTrigger.
    217            
     217
    218218            void addTrigger(MultiTrigger* trigger); //!< Adds a MultiTrigger as a sub-trigger to the trigger.
    219219            const MultiTrigger* getTrigger(unsigned int index) const; //!< Get the sub-trigger of this MultiTrigger at the given index.
    220            
     220
    221221        protected:
    222222            virtual std::queue<MultiTriggerState*>* letTrigger(void); //!< This method is called by the MultiTrigger to get information about new trigger events that need to be looked at.
    223223
    224224            void changeTriggered(BaseObject* originator = NULL); //!< This method can be called by any class inheriting from MultiTrigger to change it's triggered status for a specified originator.
    225            
     225
    226226            bool isModeTriggered(BaseObject* triggerer = NULL); //!< Checks whetherx the MultiTrigger is triggered concerning it's sub-triggers.
    227227            bool isTriggered(BaseObject* triggerer = NULL); //!< Get whether the MultiTrigger is triggered for a given object.
     
    236236            inline void addParentTrigger(MultiTrigger* parent)
    237237                { this->parentTrigger_ = parent; }
    238            
     238
    239239            /**
    240240            @brief Get the target mask used to identify the targets of this MultiTrigger.
     
    248248            //TODO: Check if something mus be done here.
    249249            virtual void notifyMaskUpdate(void) {}
    250            
     250
    251251        private:
    252252            static const int INF_s; //!< Magic number for infinity.
     
    257257
    258258            void subTrigggerActivityChanged(BaseObject* originator); //!< This method is called by any sub-trigger to advertise changes in it's state to it's parent-trigger.
    259            
     259
    260260            bool addState(MultiTriggerState* state); //!< Helper method. Adds a state to the state queue, where the state will wait to become active.
    261            
     261
    262262            bool checkAnd(BaseObject* triggerer); //!< Checks whether the sub-triggers amount to true for the 'and' mode for a given object.
    263263            bool checkOr(BaseObject* triggerer); //!< Checks whether the sub-triggers amount to true for the 'or' mode for a given object.
     
    276276            bool bSwitch_; //!< Bool for the switch-mode, if true the MultiTrigger behaves like a switch.
    277277            bool bStayActive_; //!< Bool for the stay-active-mode, if true the MultiTrigger stays active after its last activation.;
    278            
     278
    279279            int remainingActivations_; //!< The remaining activations of this MultiTrigger.
    280280            int maxNumSimultaniousTriggerers_; //!< The maximum number of objects simultaniously trigggering this MultiTrigger.
     
    287287            MultiTrigger* parentTrigger_;
    288288            std::set<MultiTrigger*> subTriggers_; //!< The sub-triggers of this MultiTrigger.
    289            
     289
    290290            std::set<BaseObject*> active_; //!< The set of all objects the MultiTrigger is active for.
    291291            std::set<BaseObject*> triggered_; //!< The set of all objects the MultiTrigger is triggered for.
    292292
    293293            std::deque< std::pair<float, MultiTriggerState*> > stateQueue_; //!< The queue of states waiting to become active.
    294            
     294
    295295            ClassTreeMask targetMask_; //!< The target mask, masking all objects that can trigger this MultiTrigger.
    296            
     296
    297297    };
    298298
  • code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc

    • Property svn:eol-style set to native
    r6859 r7163  
    4040
    4141    CreateUnloadableFactory(MultiTriggerContainer);
    42    
     42
    4343    /**
    4444    @brief
     
    7373    MultiTriggerContainer::~MultiTriggerContainer()
    7474    {
    75        
     75
    7676    }
    7777
  • code/trunk/src/modules/objects/triggers/MultiTriggerContainer.h

    • Property svn:eol-style set to native
    r6856 r7163  
    5050    class _ObjectsExport MultiTriggerContainer : public BaseObject
    5151    {
    52        
     52
    5353        public:
    5454            MultiTriggerContainer(BaseObject* creator); //!< Default constructor. Registers the object and creates an empty container.
     
    6868            inline BaseObject* getData(void)
    6969                { return this->data_; }
    70            
     70
    7171        private:
    7272            MultiTrigger* originator_; //!< The originator.
    7373            BaseObject* data_; //!< The data.
    7474    };
    75    
     75
    7676}
    7777
Note: See TracChangeset for help on using the changeset viewer.