topical media & game development

talk show tell print

lib-game-delta3d-demos-fireFighter-fireactor.h / h



  /* -*-c++-*-
   * Delta3D Open Source Game and Simulation Engine
   * Copyright (C) 2006, Alion Science and Technology, BMH Operation
   *
   * This library is free software; you can redistribute it and/or modify it under
   * the terms of the GNU Lesser General Public License as published by the Free
   * Software Foundation; either version 2.1 of the License, or (at your option)
   * any later version.
   *
   * This library is distributed in the hope that it will be useful, but WITHOUT
   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
   * details.
   *
   * You should have received a copy of the GNU Lesser General Public License
   * along with this library; if not, write to the Free Software Foundation, Inc.,
   * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
   *
   * William E. Johnson II
   */
  
  ifndef DELTA_FIRE_FIGHTER_FIRE_ACTOR
  define DELTA_FIRE_FIGHTER_FIRE_ACTOR
  
  include <fireFighter/gameitemactor.h>
  include <fireFighter/export.h>
  include <osg/Vec4>
  include <vector>
  
  namespace dtDAL
  {
     class ActorProxyIcon;
  }
  
  namespace dtCore
  {
     class ParticleSystem;
     class PositionalLight;
  }
  
  class FIRE_FIGHTER_EXPORT FireActor : public GameItemActor
  {
     public:
  
  
Constructor FireActor(dtGame::GameActorProxy& proxy);

        
Sets the filename of the flame particle system.
parameter: filename the new filename

  
        void SetFlameFilename(const std::string& filename);
  
        
Sets the filename of the spark particle system.
parameter: filename the new filename

  
        void SetSparkFilename(const std::string& filename);
  
        
Sets the filename of the smoke particle system.
parameter: filename the new filename

  
        void SetSmokeFilename(const std::string& filename);
  
        
Sets the filename of the smoke ceiling particle system.
parameter: filename the new filename

  
        void SetSmokeCeilingFilename(const std::string& filename);
  
        
Sets the radius of the fire.
parameter: radius the new radius

  
        void SetRadius(float radius);
  
        
Returns the radius of the fire.
returns: the current radius

  
        float GetRadius() const;
  
        
Sets the intensity of the fire.
parameter: intensity the new intensity

  
        void SetIntensity(float intensity);
  
        
Decreases the intensity of the fire
parameter: intensity The intensity to subtract

  
        void DecreaseIntensity(float intensity);
  
        
Returns the intensity of the fire.
returns: the current intensity

  
        float GetIntensity() const;
  
        
Adds a boundary plane to contain the particle systems associated with this fire.
parameter: plane the boundary plane to add

  
        void AddBoundaryPlane(const osg::Vec4& plane);
  
        
Removes the boundary plane at the specified index.
parameter: index the index of the boundary plane to remove

  
        void RemoveBoundaryPlane(int index);
  
        
Gets the number of active boundary planes.
returns: the number of active boundary planes

  
        int GetBoundaryPlaneCount() const;
  
        
Gets the boundary plane at the specified index.
parameter: dest the destination vector to hold the plane parameters
parameter: index the index of the boundary plane to retrieve

  
        void GetBoundaryPlane(osg::Vec4& dest, int index) const;
  
        
Message handler.
parameter: data the received message

  
        void OnTickLocal(const dtGame::TickMessage& msg);
  
  
Invokable that plays the fire sound when the hatch door is opened or closed void PlayFireSound(const dtGame::Message& msg);

  
Invokable to stop all sounds associated with this actor void StopSounds(const dtGame::Message& msg);

        
Sets the light rotation
parameter: rotation The rotation to set

  
        void SetLightRotation(const osg::Vec3& rotation);
  
        
Gets the light rotation
returns: The rotation

  
        osg::Vec3 GetLightRotation() const;
  
        
Sets the light rotation
parameter: rotation The rotation to set

  
        void SetLightTranslation(const osg::Vec3& xyz);
  
        
Gets the light rotation
returns: The rotation

  
        osg::Vec3 GetLightTranslation() const;
  
     protected:
  
  
Called when the actor is added to the game manager virtual void OnEnteredWorld();

  
Destructor virtual ~FireActor();

     private:
  
        dtCore::RefPtr<dtCore::ParticleSystem> mFlameSystem, mSparkSystem, mSmokeSystem, mCeilingSystem;
  
        dtCore::RefPtr<dtCore::PositionalLight> mLight;
  
  
The radius of the fire. float mRadius;

  
The intensity of the fire. float mIntensity;

  
The boundary planes that limit the particle systems. std::vector<osg::Vec4> mBoundaryPlanes; };

  class FIRE_FIGHTER_EXPORT FireActorProxy : public GameItemActorProxy
  {
     public:
  
  
Constructor FireActorProxy();

  
Builds the properties of this actor virtual void BuildPropertyMap();

  
Builds the invokables of this actor virtual void BuildInvokables();

  
Instantiates the actor itself virtual void CreateActor() { SetActor(*new FireActor(*this)); }

        // Used in STAGE
        dtDAL::ActorProxyIcon* GetBillBoardIcon();
  
        virtual const dtDAL::ActorProxy::RenderMode& GetRenderMode()
        {
           return dtDAL::ActorProxy::RenderMode::DRAW_ACTOR;
        }
  
     protected:
  
  
Called when the actor is added to the game manager virtual void OnEnteredWorld();

  
Destructor virtual ~FireActorProxy();

     private:
  
        dtCore::RefPtr<dtDAL::ActorProxyIcon> mBillBoardIcon;
  };
  
  endif
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.