📄 oasisphysicsresource.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 : oasisPhysicsResource.h
* DESCRIPTION : Physics resource
* AUTHOR : Zephie Greyvenstein
*****************************************************************************/
/// Avoid double inclusion
#ifndef __PHYSICSRESOURCE_H__
#define __PHYSICSRESOURCE_H__
/// Include common stuff
#include "oasisCommon.h"
/// Include the rest of the needed oasis stuff
#include "oasisResource.h"
#include "oasisIterators.h"
namespace Oasis {
/** Physics resource/template
@remarks
This defines a physics template from which physics objects can be
created
*/
class _oasisExport physicsResource : public resource {
/// The physics class needs access to parameter values
friend class physics;
public:
/// Constructor
physicsResource( const string &thisName );
/// Destructor
virtual ~physicsResource( );
/// List of collision proxies
typedef std::list< proxy* > proxyList;
/// Iterator for collision proxies
typedef vectorIterator< proxyList > proxyIterator;
/// Get the mass for this physics
mass *getMass( void ) const;
/// Add a box proxy
boxProxy *addBoxProxy( real width, real height, real depth );
/// Add a sphere proxy
sphereProxy *addSphereProxy( real radius );
/// Add a capped cylinder proxy
ccylinderProxy *addCCylinderProxy( real radius, real length );
/// Remove a proxy
void removeProxy( uint8 index );
/// Remove a proxy
void removeProxy( proxy *oldProxy );
/// Remove all proxies from the physics
void removeAllProxies( void );
/// Get the collision proxy iterator
proxyIterator getProxyIterator( void );
/// Set the softness
void setSoftness( const real newSoftness );
/// Get the softness
const real getSoftness( void ) const;
/// Set the friction
void setFriction( const real newFriction );
/// Get the friction
const real getFriction( void ) const;
/// Set whether to use gravity
void setGravity( bool newState );
/// Get gravity usage
const bool getGravity( void ) const;
/// Set the bounciness
void setBounce( const real coEff, const real velThresh );
/// Get the bounce co-efficient
const real getBounceCoEff( void ) const;
/// Get the bounce velocity threshold
const real getBounceVelThreshold( void ) const;
private:
/// The mass for this physical
mass *usedMass;
/// Collision proxies attached to this physical
proxyList proxies;
/// Gravity usage
bool useGravity;
/// Softness of physics
real softness;
/// Friction of physics
real friction;
/// Bounce co-efficient restitution
real bounceCoeffRest;
/// Bounce velocity threshold
real bounceVelThreshold;
/// Loads the resource for this object. Does nothing at the moment
void load( void ) {}
};
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -