⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oasisphysical.h

📁 使用stl技术,(还没看,是听说的)
💻 H
字号:
/******************************************************************************

 * This source file is part of Bad Camel Gaming

 * Copyright (C) 2003  Zephie Greyvenstein

 * See Readme.html for acknowledgements

 *

 * 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

 *****************************************************************************/



/******************************************************************************

 * FILENAME    : oasisPhysical.h

 * DESCRIPTION : A physical object

 * AUTHOR      : Zephie Greyvenstein

 *****************************************************************************/



/// Avoid double inclusion

#ifndef __PHYSICAL_H__

#define __PHYSICAL_H__



/// Include common stuff

#include "oasisCommon.h"

/// Include the rest of the needed oasis stuff

#include "oasisMovable.h"

#include "oasisPhysics.h"

#include "oasisCollisionListener.h"



namespace Oasis {

  /// A physical object, which is a movable driven by physics

  class _oasisExport physical : public movable  {

    /// Physics need to access private position/orientation setting methods

    friend class physics;

  public: 

    /// Constructor

    physical( );

    /// Destructor

    virtual ~physical( );



    /// Override to consider physics

    void setPosition( const vector3 &position );   

//    virtual void setPosition( real x, real y, real z );

    /// Override to consider physics

    void setOrientation( const quaternion &newOrientation );



    /// Set state of physics

    void enablePhysics( bool usePhysics );



    /// Set the physics to use

    void setPhysics( physics *physicsToUse );

    /// Set the physics to use

    physics *setPhysics( const string &templateName );

    /// Get the physics this object is using

    physics *getPhysics( void ) const;



    /// Remove the physics

    void removePhysics( void );

    /// Remove and destroy the physics

    void removeAndDestroyPhysics( void );



    /// Add a collision listener

    void addCollisionListener( collisionListener *listener );

    /// Remove a collision listener

    void removeCollisionListener( collisionListener *listener );

    /// Remove all collision listeners

    void removeAllCollisionListeners( void );



   protected:

    /// Physics driving this object

    physics *drivingPhysics;



    /// A set of collision listeners

    typedef std::set< collisionListener* > collisionListenerSet;

    /// The registered collision listeners

    collisionListenerSet listeners;



    /// Physics will set the position and orientation here

    void updatePhysics( const vector3 &newPosition,

			const quaternion &newOrientation );



    /// Notify that there was a collision

    void notifyCollision( collisionListener::CollisionInfo &info );

			  

  };

};



#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -