PxBoxController.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA CORPORATION and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA CORPORATION is strictly prohibited.
9  */
10 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
11 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
12 
13 
14 #ifndef PX_PHYSICS_CCT_BOX_CONTROLLER
15 #define PX_PHYSICS_CCT_BOX_CONTROLLER
16 
22 
23 #ifndef PX_DOXYGEN
24 namespace physx
25 {
26 #endif
27 
34 {
35 public:
41 
45  PX_INLINE PxBoxControllerDesc(const PxBoxControllerDesc&);
46 
50  PX_INLINE PxBoxControllerDesc& operator=(const PxBoxControllerDesc&);
51 
55  PX_INLINE virtual void setToDefault();
56 
62  PX_INLINE virtual bool isValid() const;
63 
69  PxF32 halfHeight; // Half-height in the "up" direction
70 
76  PxF32 halfSideExtent; // Half-extent in the "side" direction
77 
83  PxF32 halfForwardExtent; // Half-extent in the "forward" direction
84 
85 protected:
86  PX_INLINE void copy(const PxBoxControllerDesc&);
87 };
88 
91  halfHeight (1.0f),
92  halfSideExtent (0.5f),
93  halfForwardExtent (0.5f)
94 {
95 }
96 
98 {
99  copy(other);
100 }
101 
103 {
105  copy(other);
106  return *this;
107 }
108 
110 {
111  halfHeight = other.halfHeight;
114 }
115 
117 {
118  *this = PxBoxControllerDesc();
119 }
120 
122 {
123  if(!PxControllerDesc::isValid()) return false;
124  if(halfHeight<=0.0f) return false;
125  if(halfSideExtent<=0.0f) return false;
126  if(halfForwardExtent<=0.0f) return false;
127  if(stepOffset>2.0f*halfHeight) return false; // Prevents obvious mistakes
128  return true;
129 }
130 
137 {
138 public:
139 
147  virtual PxF32 getHalfHeight() const = 0;
148 
156  virtual PxF32 getHalfSideExtent() const = 0;
157 
165  virtual PxF32 getHalfForwardExtent() const = 0;
166 
177  virtual bool setHalfHeight(PxF32 halfHeight) = 0;
178 
189  virtual bool setHalfSideExtent(PxF32 halfSideExtent) = 0;
190 
201  virtual bool setHalfForwardExtent(PxF32 halfForwardExtent) = 0;
202 
203 protected:
205  virtual ~PxBoxController() {}
206 };
207 
208 #ifndef PX_DOXYGEN
209 } // namespace physx
210 #endif
211 
213 #endif


Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com