source: GTP/trunk/App/Games/Jungle_Rumble/src/physic/physics/include/NxDistanceJointDesc.h @ 1378

Revision 1378, 3.1 KB checked in by giegl, 18 years ago (diff)

GTPD - Jungle Rumble - integrate into GTP SVN structure

Line 
1#ifndef NX_PHYSICS_NXDISTANCEJOINTDESC
2#define NX_PHYSICS_NXDISTANCEJOINTDESC
3/*----------------------------------------------------------------------------*\
4|
5|                                               Public Interface to NovodeX Technology
6|
7|                                                            www.novodex.com
8|
9\*----------------------------------------------------------------------------*/
10/** \addtogroup physics
11  @{
12*/
13
14#include "Nxp.h"
15#include "NxJointDesc.h"
16#include "NxSpringDesc.h"
17
18/**
19\brief Desc class for distance joint. See #NxDistanceJoint.
20
21<b>Platform:</b>
22\li PC SW: Yes
23\li PPU  : No
24\li PS3  : Yes
25\li XB360: Yes
26
27@see NxDistanceJoint NxJointDesc NxScene.createJoint()
28
29*/
30class NxDistanceJointDesc : public NxJointDesc
31        {
32        public:
33
34        /**
35        \brief The maximum rest length of the rope or rod between the two anchor points.
36
37        <b>Range:</b> [#minDistance,inf)<br>
38        <b>Default:</b> 0.0
39        */
40        NxReal maxDistance;
41
42        /**
43        \brief The minimum rest length of the rope or rod between the two anchor points
44
45        <b>Range:</b> [0,#maxDistance]<br>
46        <b>Default:</b> 0.0
47        */
48        NxReal minDistance;
49       
50        /*
51        \brief How stiff the constraint is, between 0 and 1 (stiffest)
52
53        <b>Range:</b> [0,1]<br>
54        <b>Default:</b> 1.0
55        */
56        //NxReal stiffness;
57
58        /**
59        \brief makes the joint springy. The spring.targetValue field is not used.
60
61        <b>Range:</b> See #NxSpringDesc<br>
62        <b>Default:</b> See #NxSpringDesc
63        */
64        NxSpringDesc spring;
65
66        /**
67        \brief This is a combination of the bits defined by ::NxDistanceJointFlag.
68
69        <b>Default:</b> 0
70        */
71        NxU32  flags;
72
73        /**
74        \brief Constructor sets to default.
75        */
76        NX_INLINE NxDistanceJointDesc();       
77        /**
78        \brief (re)sets the structure to the default.   
79
80        \param[in] fromCtor skip redundant operations if called from contructor.
81        */
82        NX_INLINE void setToDefault(bool fromCtor=false);
83        /**
84        \brief Returns true if the descriptor is valid.
85
86        \return true if the current settings are valid
87        */
88        NX_INLINE bool isValid() const;
89
90        };
91
92NX_INLINE NxDistanceJointDesc::NxDistanceJointDesc() : NxJointDesc(NX_JOINT_DISTANCE)   //constructor sets to default
93        {
94        setToDefault(true);
95        }
96
97NX_INLINE void NxDistanceJointDesc::setToDefault(bool fromCtor)
98        {
99        NxJointDesc::setToDefault();
100        maxDistance = 0.0f;
101        minDistance = 0.0f;
102        //stiffness = 1.0f;
103        flags = 0;
104
105        if (!fromCtor)
106                {
107                //this is redundant if we're being called from the ctor:
108                spring.setToDefault();
109                }
110        }
111
112NX_INLINE bool NxDistanceJointDesc::isValid() const
113        {
114        if (maxDistance < 0) return false;
115        if (minDistance < 0) return false;
116
117        // if both distance constrains are on, the min better be less than or equal to the max.
118        if ((minDistance > maxDistance) && (flags == (NX_DJF_MIN_DISTANCE_ENABLED | NX_DJF_MAX_DISTANCE_ENABLED))) return false;
119//      if (stiffness < 0 || stiffness > 1) return false;
120        if (!spring.isValid()) return false;
121
122        return NxJointDesc::isValid();
123        }
124
125/** @} */
126#endif
127
128
129//AGCOPYRIGHTBEGIN
130///////////////////////////////////////////////////////////////////////////
131// Copyright © 2005 AGEIA Technologies.
132// All rights reserved. www.ageia.com
133///////////////////////////////////////////////////////////////////////////
134//AGCOPYRIGHTEND
135
Note: See TracBrowser for help on using the repository browser.