00001 #ifndef __THESTAGE_JOINT__
00002 #define __THESTAGE_JOINT__
00003
00014
00015
00016
00017
00018
00019
00020 #include "engineAbstract.h"
00021
00022
00023
00030 #define JOINT_NUM 0x0001
00031
00037 #define NODEJOINT_NUM 0x0002
00038
00044 #define PROPERTYJOINT_NUM 0x0004
00045
00051 #define PARTICLEJOINT_NUM 0x0008
00052
00053
00054
00061 #define OUT_OF_BOUNDS -1
00062
00069 #define MASSIVE_POINTER_FAILURE -2
00070
00071
00072
00073
00074 #include <iostream>
00075 #include <string>
00076
00077 using namespace std;
00078
00079
00080
00081
00082
00112 enum JointPart
00113 {
00114 JP_ACTION_CODE = 0,
00115 JP_NAME,
00116 JP_SUPPLEMENTAL_DATA,
00117 JP_VALUE,
00118 JP_VALUE_START,
00119 JP_VALUE_END,
00120 JP_TARGET
00121 };
00122
00140 enum NodeAction
00141 {
00142 NA_NOTHING = 0,
00143 NA_ROTATE,
00144 NA_TRANSLATE
00145 };
00146
00202 enum PuppetProperty
00203 {
00204 PP_NOTHING = 50,
00205 PP_POSITION,
00206 PP_SCALE,
00207 PP_LIGHT_R,
00208 PP_LIGHT_G,
00209 PP_LIGHT_B,
00210 PP_LIGHT_RADIUS,
00211 PP_PARTICLE_SPAWN_RATE = 100,
00212 PP_PARTICLE_GRAVITY,
00213 PP_PARTICLE_R,
00214 PP_PARTICLE_G,
00215 PP_PARTICLE_B,
00216 PP_PARTICLE_LIFETIME,
00217 PP_PARTICLE_VEL_X,
00218 PP_PARTICLE_VEL_Y,
00219 PP_PARTICLE_VEL_Z
00220 };
00221
00229 class Joint
00230 {
00231 protected:
00238 uint16 actionCode;
00239 public:
00245 string name;
00246 protected:
00253 VECTOR_TYPE supplementalData;
00254
00255 public:
00263 virtual uint16 JointType( void ) = 0;
00285 virtual void Modify( JointPart part, float mVal ) = 0;
00286 virtual void Modify( JointPart part, string &mVal ) = 0;
00287 virtual void Modify( JointPart part, uint16 mVal ) = 0;
00288 virtual void Modify( JointPart part, VECTOR_TYPE mVal ) = 0;
00297 virtual void SetValue( float newValue ) = 0;
00298 };
00299
00305 typedef Joint *JointPtr;
00306
00313 class NodeJoint : public Joint
00314 {
00315 private:
00321 uint16 affectedNode;
00328 float value;
00334 float valueMaximum;
00340 float valueMinimum;
00341
00342 public:
00348 NodeJoint( void );
00362 NodeJoint( uint16 aC, uint16 aN, float v, float vMax, float vMin, string &n, VECTOR_TYPE sup );
00368 ~NodeJoint( void );
00369 #ifdef __ENGINE_LITHTECH__
00370
00378 void ApplyJoint( LTMatrix *modifyMe );
00379 #endif
00380
00386 uint16 GetAffectedNode( void );
00399 void Init( uint16 aC, uint16 aN, float v, float vMax, float vMin, string &n, VECTOR_TYPE sup );
00406 uint16 JointType( void );
00428 void Modify( JointPart part, float mVal );
00429 void Modify( JointPart part, string &mVal );
00430 void Modify( JointPart part, uint16 mVal );
00431 void Modify( JointPart part, VECTOR_TYPE mVal );
00440 void SetValue( float newValue );
00441 };
00442
00443
00444
00453 class PropertyJoint : public Joint
00454 {
00455 protected:
00462 PuppetProperty affectedProperty;
00468 HANDLE_TYPE puppetHandle;
00476 VECTOR_TYPE value;
00480 VECTOR_TYPE valueBeginRange;
00484 VECTOR_TYPE valueEndRange;
00485
00486 public:
00487
00488 \brief Empty constructor
00489
00490 This constructor ssigns joint to a non-existant property with no action.
00491 */
00492 PropertyJoint( void );
00506 PropertyJoint( PuppetProperty aP, VECTOR_TYPE vBegin, VECTOR_TYPE vEnd, string &n, VECTOR_TYPE sup, HANDLE_TYPE pH );
00512 ~PropertyJoint( void );
00526 void Init( PuppetProperty aP, VECTOR_TYPE vBegin, VECTOR_TYPE vEnd, string &n, VECTOR_TYPE sup );
00533 uint16 JointType( void );
00555 void Modify( JointPart part, float mVal );
00556 void Modify( JointPart part, string &mVal );
00557 void Modify( JointPart part, uint16 mVal );
00558 void Modify( JointPart part, VECTOR_TYPE mVal );
00568 void SetValue( float newValue );
00569 };
00570
00579 class ParticleJoint : public PropertyJoint
00580 {
00581 private:
00588 void *puppetData;
00589 public:
00603 ParticleJoint( PuppetProperty aP, VECTOR_TYPE vBegin, VECTOR_TYPE vEnd, string &n, VECTOR_TYPE sup, void *pD );
00610 uint16 JointType( void );
00620 void SetValue( float newValue );
00621 };
00622
00623 #endif