JointData.h

Go to the documentation of this file.
00001 /*************************************************************************
00002 *                                                                       *
00003 * Open Physics Abstraction Layer                                        *
00004 * Copyright (C) 2004-2005                                               *
00005 * Alan Fischer  alan.fischer@gmail.com                                  *
00006 * Andres Reinot  andres@reinot.com                                      *
00007 * Tyler Streeter  tylerstreeter@gmail.com                               *
00008 * All rights reserved.                                                  *
00009 * Web: opal.sourceforge.net                                             *
00010 *                                                                       *
00011 * This library is free software; you can redistribute it and/or         *
00012 * modify it under the terms of EITHER:                                  *
00013 *   (1) The GNU Lesser General Public License as published by the Free  *
00014 *       Software Foundation; either version 2.1 of the License, or (at  *
00015 *       your option) any later version. The text of the GNU Lesser      *
00016 *       General Public License is included with this library in the     *
00017 *       file license-LGPL.txt.                                          *
00018 *   (2) The BSD-style license that is included with this library in     *
00019 *       the file license-BSD.txt.                                       *
00020 *                                                                       *
00021 * This library is distributed in the hope that it will be useful,       *
00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
00024 * license-LGPL.txt and license-BSD.txt for more details.                *
00025 *                                                                       *
00026 *************************************************************************/
00027 
00028 #ifndef OPAL_JOINT_DATA_H
00029 #define OPAL_JOINT_DATA_H
00030 
00031 #include "Defines.h"
00032 
00033 namespace opal
00034 {
00036     struct JointLimits
00037     {
00038         JointLimits()
00039         {
00040             low = defaults::joint::lowLimit;
00041             high = defaults::joint::highLimit;
00042             hardness = defaults::joint::limitHardness;
00043             bounciness = defaults::joint::limitBounciness;
00044         }
00045 
00047         real low;
00048 
00050         real high;
00051 
00054         real hardness;
00055 
00058         real bounciness;
00059     };
00060 
00062     struct JointAxis
00063     {
00064         JointAxis()
00065         {
00066             direction = defaults::joint::axis0Direction;
00067             // "limits" is initialized in its own constructor.
00068             limitsEnabled = defaults::joint::limitsEnabled;
00069         }
00070 
00072         Vec3r direction;
00073 
00075         bool limitsEnabled;
00076 
00078         JointLimits limits;
00079     };
00080 
00082     class JointData
00083     {
00084         public:
00085             OPAL_DECL JointData()
00086             {
00087                 mType = defaults::joint::type;
00088                 enabled = defaults::joint::enabled;
00089                 name = "";
00090                 solid0 = NULL;
00091                 solid1 = NULL;
00092                 internal_solid0Index = 0;
00093                 internal_solid1Index = 0;
00094                 solid0BlueprintRefName = "";
00095                 solid1BlueprintRefName = "";
00096                 anchor = defaults::joint::anchor;
00097                 axis[ 0 ].direction = defaults::joint::axis0Direction;
00098                 axis[ 1 ].direction = defaults::joint::axis1Direction;
00099                 axis[ 2 ].direction = defaults::joint::axis2Direction;
00100                 // The rest of the data from the axes are initialized in the
00101                 // JointAxis constructor.
00102                 breakMode = defaults::joint::breakMode;
00103                 breakThresh = defaults::joint::breakThresh;
00104                 accumThresh = defaults::joint::accumThresh;
00105                 accumDamage = 0;
00106                 contactsEnabled = defaults::joint::contactsEnabled;
00107                 isBroken = false;
00108             }
00109 
00111             OPAL_DECL JointData( const JointData& data )
00112             {
00113                 ( *this ) = data;
00114             }
00115 
00116             OPAL_DECL virtual ~JointData()
00117             {}
00118 
00120             OPAL_DECL void operator=( const JointData& data )
00121             {
00122                 mType = data.mType;
00123                 enabled = data.enabled;
00124                 name = data.name;
00125                 solid0 = data.solid0;
00126                 solid1 = data.solid1;
00127                 internal_solid0Index = data.internal_solid0Index;
00128                 internal_solid1Index = data.internal_solid1Index;
00129                 solid0BlueprintRefName = data.solid0BlueprintRefName;
00130                 solid1BlueprintRefName = data.solid1BlueprintRefName;
00131                 anchor = data.anchor;
00132 
00133                 for ( int i = 0; i < 3; ++i )
00134                 {
00135                     axis[ i ] = data.axis[ i ];
00136                 }
00137 
00138                 breakMode = data.breakMode;
00139                 breakThresh = data.breakThresh;
00140                 accumThresh = data.accumThresh;
00141                 accumDamage = data.accumDamage;
00142                 contactsEnabled = data.contactsEnabled;
00143                 isBroken = data.isBroken;
00144             }
00145 
00147             OPAL_DECL virtual void OPAL_CALL setType( JointType type )
00148             {
00149                 mType = type;
00150             }
00151 
00153             OPAL_DECL virtual JointType OPAL_CALL getType() const
00154             {
00155                 return mType;
00156             }
00157 
00159             bool enabled;
00160 
00162             std::string name;
00163 
00165             Solid* solid0;
00166 
00168             Solid* solid1;
00169 
00171             int internal_solid0Index;
00172 
00174             int internal_solid1Index;
00175 
00177             std::string solid0BlueprintRefName;
00178 
00180             std::string solid1BlueprintRefName;
00181 
00184             Point3r anchor;
00185 
00188             JointAxis axis[ 3 ];
00189 
00191             JointBreakMode breakMode;
00192 
00194             real breakThresh;
00195 
00197             real accumThresh;
00198 
00200             real accumDamage;
00201 
00206             bool contactsEnabled;
00207 
00209 
00212             bool isBroken;
00213 
00214         protected:
00216             JointType mType;
00217 
00218         private:
00219     };
00220 }
00221 
00222 #endif

Generated on Tue May 16 17:49:51 2006 for OPAL by  doxygen 1.4.6-NO