You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
174 lines
5.6 KiB
174 lines
5.6 KiB
14 years ago
|
/*==LICENSE==*
|
||
|
|
||
|
CyanWorlds.com Engine - MMOG client, server and tools
|
||
13 years ago
|
Copyright (C) 2011 Cyan Worlds, Inc.
|
||
14 years ago
|
|
||
|
This program is free software: you can redistribute it and/or modify
|
||
|
it under the terms of the GNU General Public License as published by
|
||
|
the Free Software Foundation, either version 3 of the License, or
|
||
|
(at your option) any later version.
|
||
|
|
||
|
This program is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 years ago
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 years ago
|
GNU General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU General Public License
|
||
13 years ago
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
|
||
|
Additional permissions under GNU GPL version 3 section 7
|
||
|
|
||
|
If you modify this Program, or any covered work, by linking or
|
||
|
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||
|
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||
|
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||
|
(or a modified version of those libraries),
|
||
|
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||
|
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||
|
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||
|
licensors of this Program grant you additional
|
||
|
permission to convey the resulting work. Corresponding Source for a
|
||
|
non-source form of such a combination shall include the source code for
|
||
|
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||
|
work.
|
||
14 years ago
|
|
||
|
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||
|
or by snail mail at:
|
||
|
Cyan Worlds, Inc.
|
||
|
14617 N Newport Hwy
|
||
|
Mead, WA 99021
|
||
|
|
||
|
*==LICENSE==*/
|
||
|
#include "../plAvatar/plPhysicalControllerCore.h"
|
||
|
|
||
|
class NxCapsuleController;
|
||
|
class NxActor;
|
||
12 years ago
|
class NxCapsule;
|
||
|
class PXControllerHitReport;
|
||
14 years ago
|
class plPhysicalProxy;
|
||
|
class plDrawableSpans;
|
||
|
class hsGMaterial;
|
||
|
class plSceneObject;
|
||
12 years ago
|
class plPXPhysical;
|
||
14 years ago
|
class plCollideMsg;
|
||
|
|
||
12 years ago
|
#ifndef PLASMA_EXTERNAL_RELEASE
|
||
14 years ago
|
class plDbgCollisionInfo
|
||
|
{
|
||
|
public:
|
||
|
plSceneObject *fSO;
|
||
|
hsVector3 fNormal;
|
||
|
hsBool fOverlap;
|
||
|
};
|
||
|
#endif // PLASMA_EXTERNAL_RELEASE
|
||
12 years ago
|
|
||
14 years ago
|
class plPXPhysicalControllerCore: public plPhysicalControllerCore
|
||
|
{
|
||
|
public:
|
||
12 years ago
|
plPXPhysicalControllerCore(plKey ownerSO, hsScalar height, hsScalar radius, bool human);
|
||
14 years ago
|
~plPXPhysicalControllerCore();
|
||
12 years ago
|
|
||
|
// An ArmatureMod has its own idea about when physics should be enabled/disabled.
|
||
|
// Use plArmatureModBase::EnablePhysics() instead.
|
||
14 years ago
|
virtual void Enable(bool enable);
|
||
12 years ago
|
|
||
|
// Subworld
|
||
|
virtual void SetSubworld(plKey world);
|
||
|
|
||
14 years ago
|
// For the avatar SDL only
|
||
|
virtual void GetState(hsPoint3& pos, float& zRot);
|
||
|
virtual void SetState(const hsPoint3& pos, float zRot);
|
||
12 years ago
|
|
||
|
// Movement strategy
|
||
|
virtual void SetMovementStrategy(plMovementStrategy* strategy);
|
||
|
|
||
|
// Global location
|
||
|
virtual void SetGlobalLoc(const hsMatrix44& l2w);
|
||
|
|
||
|
// Local Sim Position
|
||
|
virtual void GetPositionSim(hsPoint3& pos);
|
||
|
|
||
|
// Move kinematic controller
|
||
|
virtual void Move(hsVector3 displacement, unsigned int collideWith, unsigned int &collisionResults);
|
||
|
|
||
|
// Set linear velocity on dynamic controller
|
||
|
virtual void SetLinearVelocitySim(const hsVector3& linearVel);
|
||
|
|
||
|
// Sweep the controller path from startPos through endPos
|
||
|
virtual int SweepControllerPath(const hsPoint3& startPos, const hsPoint3& endPos, hsBool vsDynamics,
|
||
|
hsBool vsStatics, UInt32& vsSimGroups, std::vector<plControllerSweepRecord>& hits);
|
||
|
|
||
|
// any clean up for the controller should go here
|
||
14 years ago
|
virtual void LeaveAge();
|
||
12 years ago
|
|
||
|
// Capsule
|
||
|
void GetWorldSpaceCapsule(NxCapsule& cap) const;
|
||
|
|
||
|
// Create Proxy for debug rendering
|
||
|
plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo);
|
||
|
|
||
|
// Dynamic hits
|
||
|
void AddDynamicHit(plPXPhysical* phys);
|
||
14 years ago
|
|
||
|
//////////////////////////////////////////
|
||
|
//Static Helper Functions
|
||
|
////////////////////////////////////////
|
||
12 years ago
|
|
||
|
// Call pre-sim to apply movement to controllers
|
||
|
static void Apply(hsScalar delSecs);
|
||
|
|
||
|
// Call post-sim to update controllers
|
||
|
static void Update(int numSubSteps, hsScalar alpha);
|
||
|
|
||
|
// Update controllers when not performing a physics step
|
||
|
static void UpdateNonPhysical(hsScalar alpha);
|
||
|
|
||
|
// Rebuild the controller cache, required when a static actor in the scene has changed.
|
||
|
static void RebuildCache();
|
||
|
|
||
|
// Returns the plPXPhysicalControllerCore associated with the given NxActor
|
||
|
static plPXPhysicalControllerCore* GetController(NxActor& actor);
|
||
|
|
||
|
// Subworld controller queries
|
||
14 years ago
|
static bool AnyControllersInThisWorld(plKey world);
|
||
|
static int GetNumberOfControllersInThisSubWorld(plKey world);
|
||
12 years ago
|
static int GetControllersInThisSubWorld(plKey world, int maxToReturn, plPXPhysicalControllerCore** bufferout);
|
||
|
|
||
|
// Controller count
|
||
|
static int NumControllers();
|
||
|
static void SetMaxNumberOfControllers(int max) { fPXControllersMax = max; }
|
||
14 years ago
|
static int fPXControllersMax;
|
||
|
|
||
12 years ago
|
#ifndef PLASMA_EXTERNAL_RELEASE
|
||
|
static hsBool fDebugDisplay;
|
||
|
#endif
|
||
14 years ago
|
|
||
|
protected:
|
||
|
friend class PXControllerHitReport;
|
||
12 years ago
|
|
||
|
virtual void IHandleEnableChanged();
|
||
|
|
||
|
void IInformDetectors(bool entering);
|
||
|
|
||
|
void ICreateController(const hsPoint3& pos);
|
||
14 years ago
|
void IDeleteController();
|
||
12 years ago
|
|
||
|
void IDispatchQueuedMsgs();
|
||
|
void IProcessDynamicHits();
|
||
|
|
||
14 years ago
|
#ifndef PLASMA_EXTERNAL_RELEASE
|
||
|
void IDrawDebugDisplay();
|
||
12 years ago
|
hsTArray<plDbgCollisionInfo> fDbgCollisionInfo;
|
||
14 years ago
|
#endif
|
||
12 years ago
|
|
||
|
std::vector<plCollideMsg*> fQueuedCollideMsgs;
|
||
|
std::vector<plPXPhysical*> fDynamicHits;
|
||
|
|
||
|
NxCapsuleController* fController;
|
||
|
NxActor* fActor;
|
||
|
|
||
|
plPhysicalProxy* fProxyGen;
|
||
|
bool fKinematicCCT;
|
||
12 years ago
|
bool fHuman;
|
||
14 years ago
|
};
|