📄 oasismass.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 : oasisMass.h
* DESCRIPTION : A mass object
* AUTHOR : Zephie Greyvenstein
*****************************************************************************/
/// Avoid double inclusion
#ifndef __MASS_H__
#define __MASS_H__
/// Include common stuff
#include "oasisCommon.h"
/// Include the rest of the needed oasis stuff
#include "oasisVector3.h"
/// Forward declare ODE stuff
struct dMass;
class dBody;
namespace Oasis {
/// This is a mass object that is used to control the weight of physics
class _oasisExport mass {
/// Physics needs to control this object
friend class physics;
public:
/// Mass types
enum MassType {
/// Box mass
MT_BOX = 0,
/// Sphere mass
MT_SPHERE = 1,
/// Capped cylinder mass
MT_CCYLINDER = 2,
/// Cylinder mass
MT_CYLINDER = 3
};
/// Constructor
mass( );
/// Destructor
virtual ~mass( );
/// Set the mass as a box
void setBox( real newDensity,
real newLength,
real newHeight,
real newDepth );
/// Set the mass as a sphere
void setSphere( real newDensity, real newRadius );
/// Set the mass as a capped cylinder
void setCCylinder( real newDensity, real newRadius, real newLength );
/// Set the mass as a cylinder
void setCylinder( real newDensity, real newRadius, real newLength );
/// Get the type of mass this is using
const MassType getType( void ) const;
/// Get the density of this mass
const real getDensity( void ) const;
/// Get the length of the mass ( meaningless for sphere )
const real getLength( void ) const;
/// Get the height of the mass ( meaningless for sphere and cylinders )
const real getHeight( void ) const;
/// Get the depth of the mass ( meaningless for sphere and cylinders )
const real getDepth( void ) const;
/// Get the radius of the mass ( meaningless for box )
const real getRadius( void ) const;
/// Copy parameters of another mass
void copyParameters( const mass *otherMass );
protected:
/// The mass object
dMass *odeMass;
/// The body parent
dBody *parent;
/// This type of mass
MassType type;
/// Density of the mass
real density;
/// The length of the mass
real length;
/// The height of the mass
real height;
/// The depth of the mass
real depth;
/// The radius of the mass
real radius;
/// Set the ODE body this mass needs to update to
void setODEBodyParent( dBody *parent );
/// Reassigns the mass to it's body parent when a change is made
void _reAssignToParent( void );
};
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -