mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 10:52:46 +00:00
Merge remote-tracking branch 'origin/master' into plString
Conflicts: Sources/Plasma/CoreLib/hsStream.h Sources/Plasma/FeatureLib/pfAudio/plListener.cpp Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp Sources/Plasma/FeatureLib/pfPython/cyMisc.h Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h Sources/Plasma/FeatureLib/pfPython/pyImage.cpp Sources/Plasma/FeatureLib/pfPython/pyJournalBook.cpp Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h Sources/Plasma/NucleusLib/pnKeyedObject/plFixedKey.cpp Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h Sources/Plasma/NucleusLib/pnMessage/plMessage.h Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.h Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.cpp Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.h Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.h Sources/Plasma/PubUtilLib/plNetTransport/plNetTransportMember.h Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.h Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.cpp Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.h Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.cpp
This commit is contained in:
@ -74,7 +74,7 @@ public:
|
||||
|
||||
bool GotHit() { return fDist != FLT_MAX; }
|
||||
plKey GetObj() { return fHitObj; }
|
||||
hsScalar GetDistance() { return fDist; }
|
||||
float GetDistance() { return fDist; }
|
||||
const hsVector3& GetNormal() { return fNormal; }
|
||||
const hsPoint3& GetPoint() { return fPoint; }
|
||||
void ResetHitObj(){fHitObj=nil;}
|
||||
@ -85,7 +85,7 @@ private:
|
||||
plPXPhysical* phys = (plPXPhysical*)hitActor.userData;
|
||||
|
||||
plKey objKey = nil;
|
||||
UInt16 objDB = plSimDefs::kLOSDBNone;
|
||||
uint16_t objDB = plSimDefs::kLOSDBNone;
|
||||
|
||||
if (phys)
|
||||
{
|
||||
@ -153,7 +153,7 @@ private:
|
||||
plKey fHitObj;
|
||||
hsVector3 fNormal;
|
||||
hsPoint3 fPoint;
|
||||
hsScalar fDist;
|
||||
float fDist;
|
||||
} gMyReport;
|
||||
|
||||
plLOSDispatch::plLOSDispatch()
|
||||
@ -213,7 +213,7 @@ hsBool plLOSDispatch::MsgReceive(plMessage* msg)
|
||||
gMyReport.InitCast(requestMsg->GetRequestType(), requestMsg->GetTestType());
|
||||
|
||||
hsVector3 norm = hsVector3(at - from);
|
||||
hsScalar dist = norm.Magnitude();
|
||||
float dist = norm.Magnitude();
|
||||
norm.Normalize();
|
||||
|
||||
NxRay worldRay;
|
||||
@ -238,7 +238,7 @@ hsBool plLOSDispatch::MsgReceive(plMessage* msg)
|
||||
// If we have a cull db, adjust the length of the raycast to be from the
|
||||
// original point to the object we hit. If we find anything from the cull
|
||||
// db in there, the cast fails.
|
||||
hsScalar dist = gMyReport.GetDistance();
|
||||
float dist = gMyReport.GetDistance();
|
||||
if(dist!=0.0)
|
||||
{
|
||||
gMyReport.InitCast(requestMsg->GetCullDB(), plLOSRequestMsg::kTestAny);
|
||||
@ -290,7 +290,7 @@ plMessage* plLOSDispatch::ICreateHitMsg(plLOSRequestMsg* requestMsg, hsMatrix44&
|
||||
{
|
||||
plKey ourKey = GetKey();
|
||||
plKey rcvKey = requestMsg->GetSender();
|
||||
plLOSHitMsg* hitMsg = TRACKED_NEW plLOSHitMsg(ourKey, rcvKey, nil);
|
||||
plLOSHitMsg* hitMsg = new plLOSHitMsg(ourKey, rcvKey, nil);
|
||||
hitMsg->fNoHit = false;
|
||||
hitMsg->fObj = gMyReport.GetObj();
|
||||
hitMsg->fDistance = gMyReport.GetDistance();
|
||||
@ -304,7 +304,7 @@ plMessage* plLOSDispatch::ICreateMissMsg(plLOSRequestMsg* requestMsg)
|
||||
{
|
||||
plKey ourKey = GetKey();
|
||||
plKey rcvKey = requestMsg->GetSender();
|
||||
plLOSHitMsg* missMsg = TRACKED_NEW plLOSHitMsg(ourKey, rcvKey, nil);
|
||||
plLOSHitMsg* missMsg = new plLOSHitMsg(ourKey, rcvKey, nil);
|
||||
missMsg->fNoHit = true;
|
||||
missMsg->fObj = nil;
|
||||
missMsg->fRequestID = requestMsg->GetRequestID();
|
||||
|
@ -212,7 +212,7 @@ static void MakeBoxFromHull(NxConvexMesh* convexMesh, NxBoxShapeDesc& box)
|
||||
NxConvexMeshDesc desc;
|
||||
convexMesh->saveToDesc(desc);
|
||||
|
||||
hsScalar minX, minY, minZ, maxX, maxY, maxZ;
|
||||
float minX, minY, minZ, maxX, maxY, maxZ;
|
||||
minX = minY = minZ = FLT_MAX;
|
||||
maxX = maxY = maxZ = -FLT_MAX;
|
||||
|
||||
@ -265,11 +265,11 @@ void plPXPhysical::IMakeHull(NxConvexMesh* convexMesh, hsMatrix44 l2w)
|
||||
delete [] fSaveTriangles;
|
||||
|
||||
fHullNumberPlanes = desc.numTriangles;
|
||||
fSaveTriangles = TRACKED_NEW hsPoint3[fHullNumberPlanes*3];
|
||||
fSaveTriangles = new hsPoint3[fHullNumberPlanes*3];
|
||||
|
||||
for (int i = 0; i < desc.numTriangles; i++)
|
||||
{
|
||||
UInt32* triangle = (UInt32*)(((char*)desc.triangles) + desc.triangleStrideBytes*i);
|
||||
uint32_t* triangle = (uint32_t*)(((char*)desc.triangles) + desc.triangleStrideBytes*i);
|
||||
float* vertex1 = (float*)(((char*)desc.points) + desc.pointStrideBytes*triangle[0]);
|
||||
float* vertex2 = (float*)(((char*)desc.points) + desc.pointStrideBytes*triangle[1]);
|
||||
float* vertex3 = (float*)(((char*)desc.points) + desc.pointStrideBytes*triangle[2]);
|
||||
@ -288,7 +288,7 @@ void plPXPhysical::ISetHullToWorldWTriangles()
|
||||
// if we have a detector hull and the world hasn't been updated
|
||||
if (fWorldHull == nil)
|
||||
{
|
||||
fWorldHull = TRACKED_NEW hsPlane3[fHullNumberPlanes];
|
||||
fWorldHull = new hsPlane3[fHullNumberPlanes];
|
||||
// use the local2world from the physics engine so that it matches the transform of the positions from the triggerees
|
||||
hsMatrix44 l2w;
|
||||
plPXConvert::Matrix(fActor->getGlobalPose(), l2w);
|
||||
@ -546,12 +546,12 @@ hsBool plPXPhysical::Init(PhysRecipe& recipe)
|
||||
if (GetProperty(plSimulationInterface::kSuppressed_DEAD))
|
||||
IEnable(false);
|
||||
|
||||
plNodeRefMsg* refMsg = TRACKED_NEW plNodeRefMsg(fSceneNode, plRefMsg::kOnCreate, -1, plNodeRefMsg::kPhysical);
|
||||
plNodeRefMsg* refMsg = new plNodeRefMsg(fSceneNode, plRefMsg::kOnCreate, -1, plNodeRefMsg::kPhysical);
|
||||
hsgResMgr::ResMgr()->AddViaNotify(GetKey(), refMsg, plRefFlags::kActiveRef);
|
||||
|
||||
if (fWorldKey)
|
||||
{
|
||||
plGenRefMsg* ref = TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kPhysRefWorld);
|
||||
plGenRefMsg* ref = new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kPhysRefWorld);
|
||||
hsgResMgr::ResMgr()->AddViaNotify(fWorldKey, ref, plRefFlags::kActiveRef);
|
||||
}
|
||||
|
||||
@ -563,7 +563,7 @@ hsBool plPXPhysical::Init(PhysRecipe& recipe)
|
||||
hsAssert(sceneObj, "nil sceneObject, failed to create and attach SDL modifier");
|
||||
|
||||
delete fSDLMod;
|
||||
fSDLMod = TRACKED_NEW plPhysicalSDLModifier;
|
||||
fSDLMod = new plPhysicalSDLModifier;
|
||||
sceneObj->AddModifier(fSDLMod);
|
||||
}
|
||||
|
||||
@ -612,7 +612,7 @@ hsBool plPXPhysical::MsgReceive( plMessage* msg )
|
||||
// right now, we're only worrying about the subworlds
|
||||
hsBool plPXPhysical::HandleRefMsg(plGenRefMsg* refMsg)
|
||||
{
|
||||
UInt8 refCtxt = refMsg->GetContext();
|
||||
uint8_t refCtxt = refMsg->GetContext();
|
||||
plKey refKey = refMsg->GetRef()->GetKey();
|
||||
plKey ourKey = GetKey();
|
||||
PhysRefType refType = PhysRefType(refMsg->fType);
|
||||
@ -804,7 +804,7 @@ void plPXPhysical::SendNewLocation(hsBool synchTransform, hsBool isSynchUpdate)
|
||||
|
||||
hsMatrix44 w2l;
|
||||
fCachedLocal2World.GetInverse(&w2l);
|
||||
plCorrectionMsg *pCorrMsg = TRACKED_NEW plCorrectionMsg(GetObjectKey(), fCachedLocal2World, w2l, synchTransform);
|
||||
plCorrectionMsg *pCorrMsg = new plCorrectionMsg(GetObjectKey(), fCachedLocal2World, w2l, synchTransform);
|
||||
pCorrMsg->Send();
|
||||
if (fProxyGen)
|
||||
fProxyGen->SetTransform(fCachedLocal2World, w2l);
|
||||
@ -1035,7 +1035,7 @@ void plPXPhysical::Read(hsStream* stream, hsResMgr* mgr)
|
||||
recipe.sceneNode = mgr->ReadKey(stream);
|
||||
recipe.worldKey = mgr->ReadKey(stream);
|
||||
|
||||
mgr->ReadKeyNotifyMe(stream, TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kPhysRefSndGroup), plRefFlags::kActiveRef);
|
||||
mgr->ReadKeyNotifyMe(stream, new plGenRefMsg(GetKey(), plRefMsg::kOnCreate, 0, kPhysRefSndGroup), plRefFlags::kActiveRef);
|
||||
|
||||
hsPoint3 pos;
|
||||
hsQuat rot;
|
||||
@ -1071,7 +1071,7 @@ void plPXPhysical::Read(hsStream* stream, hsResMgr* mgr)
|
||||
hsAssert(!fProxyGen, "Already have proxy gen, double read?");
|
||||
|
||||
hsColorRGBA physColor;
|
||||
hsScalar opac = 1.0f;
|
||||
float opac = 1.0f;
|
||||
|
||||
if (fGroup == plSimDefs::kGroupAvatar)
|
||||
{
|
||||
@ -1117,7 +1117,7 @@ void plPXPhysical::Read(hsStream* stream, hsResMgr* mgr)
|
||||
physColor.Set(0.6f,0.6f,0.6f,1.f);
|
||||
}
|
||||
|
||||
fProxyGen = TRACKED_NEW plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac);
|
||||
fProxyGen = new plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac);
|
||||
fProxyGen->Init(this);
|
||||
}
|
||||
|
||||
@ -1190,7 +1190,7 @@ void plPXPhysical::Write(hsStream* stream, hsResMgr* mgr)
|
||||
// TESTING SDL
|
||||
// Send phys sendState msg to object's plPhysicalSDLModifier
|
||||
//
|
||||
hsBool plPXPhysical::DirtySynchState(const char* SDLStateName, UInt32 synchFlags )
|
||||
hsBool plPXPhysical::DirtySynchState(const char* SDLStateName, uint32_t synchFlags )
|
||||
{
|
||||
if (GetObjectKey())
|
||||
{
|
||||
@ -1272,21 +1272,21 @@ inline hsPoint3& GetTrimeshVert(NxTriangleMeshDesc& desc, int idx)
|
||||
return *((hsPoint3*)(((char*)desc.points)+desc.pointStrideBytes*idx));
|
||||
}
|
||||
|
||||
void GetTrimeshTri(NxTriangleMeshDesc& desc, int idx, UInt16* out)
|
||||
void GetTrimeshTri(NxTriangleMeshDesc& desc, int idx, uint16_t* out)
|
||||
{
|
||||
if (hsCheckBits(desc.flags, NX_MF_16_BIT_INDICES))
|
||||
{
|
||||
UInt16* descTris = ((UInt16*)(((char*)desc.triangles)+desc.pointStrideBytes*idx));
|
||||
uint16_t* descTris = ((uint16_t*)(((char*)desc.triangles)+desc.pointStrideBytes*idx));
|
||||
out[0] = descTris[0];
|
||||
out[1] = descTris[1];
|
||||
out[2] = descTris[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt32* descTris = ((UInt32*)(((char*)desc.triangles)+desc.pointStrideBytes*idx));
|
||||
out[0] = (UInt16)descTris[0];
|
||||
out[1] = (UInt16)descTris[1];
|
||||
out[2] = (UInt16)descTris[2];
|
||||
uint32_t* descTris = ((uint32_t*)(((char*)desc.triangles)+desc.pointStrideBytes*idx));
|
||||
out[0] = (uint16_t)descTris[0];
|
||||
out[1] = (uint16_t)descTris[1];
|
||||
out[2] = (uint16_t)descTris[2];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1296,26 +1296,26 @@ inline hsPoint3& GetConvexVert(NxConvexMeshDesc& desc, int idx)
|
||||
return *((hsPoint3*)(((char*)desc.points)+desc.pointStrideBytes*idx));
|
||||
}
|
||||
|
||||
void GetConvexTri(NxConvexMeshDesc& desc, int idx, UInt16* out)
|
||||
void GetConvexTri(NxConvexMeshDesc& desc, int idx, uint16_t* out)
|
||||
{
|
||||
if (hsCheckBits(desc.flags, NX_MF_16_BIT_INDICES))
|
||||
{
|
||||
UInt16* descTris = ((UInt16*)(((char*)desc.triangles)+desc.pointStrideBytes*idx));
|
||||
uint16_t* descTris = ((uint16_t*)(((char*)desc.triangles)+desc.pointStrideBytes*idx));
|
||||
out[0] = descTris[0];
|
||||
out[1] = descTris[1];
|
||||
out[2] = descTris[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt32* descTris = ((UInt32*)(((char*)desc.triangles)+desc.pointStrideBytes*idx));
|
||||
out[0] = (UInt16)descTris[0];
|
||||
out[1] = (UInt16)descTris[1];
|
||||
out[2] = (UInt16)descTris[2];
|
||||
uint32_t* descTris = ((uint32_t*)(((char*)desc.triangles)+desc.pointStrideBytes*idx));
|
||||
out[0] = (uint16_t)descTris[0];
|
||||
out[1] = (uint16_t)descTris[1];
|
||||
out[2] = (uint16_t)descTris[2];
|
||||
}
|
||||
}
|
||||
|
||||
// Make a visible object that can be viewed by users for debugging purposes.
|
||||
plDrawableSpans* plPXPhysical::CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo)
|
||||
plDrawableSpans* plPXPhysical::CreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo)
|
||||
{
|
||||
plDrawableSpans* myDraw = addTo;
|
||||
hsMatrix44 l2w, unused;
|
||||
@ -1332,7 +1332,7 @@ plDrawableSpans* plPXPhysical::CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& i
|
||||
trimeshShape->getTriangleMesh().saveToDesc(desc);
|
||||
|
||||
hsTArray<hsPoint3> pos;
|
||||
hsTArray<UInt16> tris;
|
||||
hsTArray<uint16_t> tris;
|
||||
|
||||
const int kMaxTris = 10000;
|
||||
const int kMaxVerts = 32000;
|
||||
@ -1411,7 +1411,7 @@ plDrawableSpans* plPXPhysical::CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& i
|
||||
convexShape->getConvexMesh().saveToDesc(desc);
|
||||
|
||||
hsTArray<hsPoint3> pos;
|
||||
hsTArray<UInt16> tris;
|
||||
hsTArray<uint16_t> tris;
|
||||
|
||||
pos.SetCount(desc.numVertices);
|
||||
tris.SetCount(desc.numTriangles * 3);
|
||||
|
@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include "hsMatrix44.h"
|
||||
#include "plPhysical/plSimDefs.h"
|
||||
#include "hsBitVector.h"
|
||||
#include "hsUtils.h"
|
||||
|
||||
|
||||
class NxActor;
|
||||
class NxConvexMesh;
|
||||
@ -74,12 +74,12 @@ class PhysRecipe
|
||||
public:
|
||||
PhysRecipe();
|
||||
|
||||
hsScalar mass;
|
||||
hsScalar friction;
|
||||
hsScalar restitution;
|
||||
float mass;
|
||||
float friction;
|
||||
float restitution;
|
||||
plSimDefs::Bounds bounds;
|
||||
plSimDefs::Group group;
|
||||
UInt32 reportsOn;
|
||||
uint32_t reportsOn;
|
||||
plKey objectKey;
|
||||
plKey sceneNode;
|
||||
plKey worldKey;
|
||||
@ -91,7 +91,7 @@ public:
|
||||
NxTriangleMesh* triMesh;
|
||||
|
||||
// For spheres only
|
||||
hsScalar radius;
|
||||
float radius;
|
||||
hsPoint3 offset;
|
||||
|
||||
// For Boxes
|
||||
@ -151,10 +151,10 @@ public:
|
||||
|
||||
virtual int GetGroup() const { return fGroup; }
|
||||
|
||||
virtual void AddLOSDB(UInt16 flag) { hsSetBits(fLOSDBs, flag); }
|
||||
virtual void RemoveLOSDB(UInt16 flag) { hsClearBits(fLOSDBs, flag); }
|
||||
virtual UInt16 GetAllLOSDBs() { return fLOSDBs; }
|
||||
virtual hsBool IsInLOSDB(UInt16 flag) { return hsCheckBits(fLOSDBs, flag); }
|
||||
virtual void AddLOSDB(uint16_t flag) { hsSetBits(fLOSDBs, flag); }
|
||||
virtual void RemoveLOSDB(uint16_t flag) { hsClearBits(fLOSDBs, flag); }
|
||||
virtual uint16_t GetAllLOSDBs() { return fLOSDBs; }
|
||||
virtual hsBool IsInLOSDB(uint16_t flag) { return hsCheckBits(fLOSDBs, flag); }
|
||||
|
||||
virtual hsBool DoDetectorHullWorkaround() { return fSaveTriangles ? true : false; }
|
||||
virtual hsBool Should_I_Trigger(hsBool enter, hsPoint3& pos);
|
||||
@ -178,7 +178,7 @@ public:
|
||||
|
||||
virtual void ExcludeRegionHack(hsBool cleared);
|
||||
|
||||
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo);
|
||||
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo);
|
||||
|
||||
hsBool DoReportOn(plSimDefs::Group group) const { return hsCheckBits(fReportsOn, 1<<group); }
|
||||
|
||||
@ -191,7 +191,7 @@ public:
|
||||
//this partially for exclude regions vs avatar capsule
|
||||
virtual hsBool OverlapWithCapsule(NxCapsule& cap);
|
||||
|
||||
virtual hsScalar GetMass() {return fMass;}
|
||||
virtual float GetMass() {return fMass;}
|
||||
protected:
|
||||
void IGetPositionSim(hsPoint3& pos) const;
|
||||
void IGetRotationSim(hsQuat& rot) const;
|
||||
@ -207,7 +207,7 @@ protected:
|
||||
//
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
void IConvertGroups(UInt32 memberOf, UInt32 reportsOn, UInt32 collideWith);
|
||||
void IConvertGroups(uint32_t memberOf, uint32_t reportsOn, uint32_t collideWith);
|
||||
|
||||
/** See if the object is in a valid, non-overlapping position.
|
||||
A valid overlap is one which is approved by the collision
|
||||
@ -224,7 +224,7 @@ protected:
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
/** Remember that we need to do a synch soon. */
|
||||
hsBool DirtySynchState(const char* SDLStateName, UInt32 synchFlags );
|
||||
hsBool DirtySynchState(const char* SDLStateName, uint32_t synchFlags );
|
||||
|
||||
double GetLastSyncTime() { return fLastSyncTime; }
|
||||
|
||||
@ -243,8 +243,8 @@ protected:
|
||||
|
||||
plSimDefs::Bounds fBoundsType;
|
||||
plSimDefs::Group fGroup;
|
||||
UInt32 fReportsOn; // bit vector for groups we report interactions with
|
||||
UInt16 fLOSDBs; // Which LOS databases we get put into
|
||||
uint32_t fReportsOn; // bit vector for groups we report interactions with
|
||||
uint16_t fLOSDBs; // Which LOS databases we get put into
|
||||
hsBitVector fProps; // plSimulationInterface::plSimulationProperties kept here
|
||||
float fMass;
|
||||
|
||||
@ -253,13 +253,13 @@ protected:
|
||||
|
||||
// PHYSX FIXME - need to create a plasma hull so that we can determine if inside
|
||||
hsPlane3* fWorldHull;
|
||||
UInt32 fHullNumberPlanes;
|
||||
uint32_t fHullNumberPlanes;
|
||||
hsPoint3* fSaveTriangles;
|
||||
hsBool fInsideConvexHull;
|
||||
void ISetHullToWorldWTriangles();
|
||||
inline hsBool ITestPlane(const hsPoint3 &pos, const hsPlane3 &plane)
|
||||
{
|
||||
hsScalar dis = plane.fN.InnerProduct(pos);
|
||||
float dis = plane.fN.InnerProduct(pos);
|
||||
dis += plane.fD;
|
||||
if (dis == 0.f)
|
||||
return false;
|
||||
|
@ -91,7 +91,7 @@ plPhysicalController* plPhysicalController::Create(plKey ownerSO, hsScalar heigh
|
||||
hsScalar radius = width / 2.f;
|
||||
//hsScalar realHeight = height - width;
|
||||
hsScalar realHeight = height - radius + kPhysicalHeightFudge;
|
||||
return TRACKED_NEW plPXPhysicalController(ownerSO, radius, realHeight);
|
||||
return new plPXPhysicalController(ownerSO, radius, realHeight);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -187,7 +187,7 @@ int plPXPhysicalController::GetNumberOfControllersInThisSubWorld(plKey world)
|
||||
void plPXPhysicalController::Update(bool prestep, hsScalar delSecs)
|
||||
{
|
||||
// Apparently the user data field of the controllers is broken
|
||||
// UInt32 count = gControllerMgr.getNbControllers();
|
||||
// uint32_t count = gControllerMgr.getNbControllers();
|
||||
// NxController* controllers = (NxController*)gControllerMgr.getControllers();
|
||||
//
|
||||
// for (int i = 0; i < count; i++)
|
||||
@ -247,7 +247,7 @@ void plPXPhysicalController::IInformDetectors(bool entering)
|
||||
plPXPhysical* physical = (plPXPhysical*)myactor->userData;
|
||||
if (physical)
|
||||
{
|
||||
plCollideMsg* msg = TRACKED_NEW plCollideMsg;
|
||||
plCollideMsg* msg = new plCollideMsg;
|
||||
|
||||
msg->fOtherKey = fOwner;
|
||||
msg->fEntering = entering;
|
||||
@ -321,7 +321,7 @@ public:
|
||||
obj->SetNetGroupConstant(plNetGroup::kNetGroupLocalPhysicals);
|
||||
|
||||
// Tell all the other clients that we own this physical
|
||||
plSetNetGroupIDMsg* setNetGroupID = TRACKED_NEW plSetNetGroupIDMsg;
|
||||
plSetNetGroupIDMsg* setNetGroupID = new plSetNetGroupIDMsg;
|
||||
setNetGroupID->fId = plNetGroup::kNetGroupRemotePhysicals;
|
||||
setNetGroupID->SetBCastFlag(plMessage::kNetPropagate | plMessage::kNetForce);
|
||||
setNetGroupID->SetBCastFlag(plMessage::kLocalPropagate, false);
|
||||
@ -705,11 +705,11 @@ void plPXPhysicalController::GetKinematicPosition(hsPoint3& pos)
|
||||
|
||||
void plPXPhysicalController::IApply(hsScalar delSecs)
|
||||
{
|
||||
/*static const UInt32 collideFlags =
|
||||
/*static const uint32_t collideFlags =
|
||||
1<<plSimDefs::kGroupStatic |
|
||||
1<<plSimDefs::kGroupAvatarBlocker |
|
||||
1<<plSimDefs::kGroupDynamic;*/
|
||||
UInt32 collideFlags =
|
||||
uint32_t collideFlags =
|
||||
1<<plSimDefs::kGroupStatic |
|
||||
1<<plSimDefs::kGroupAvatarBlocker |
|
||||
1<<plSimDefs::kGroupDynamic;
|
||||
@ -1039,7 +1039,7 @@ void plPXPhysicalController::ISendUpdates(hsScalar delSecs)
|
||||
fLastGlobalLoc = l2w * fLastGlobalLoc;
|
||||
}
|
||||
|
||||
plCorrectionMsg* corrMsg = TRACKED_NEW plCorrectionMsg;
|
||||
plCorrectionMsg* corrMsg = new plCorrectionMsg;
|
||||
corrMsg->fLocalToWorld = fLastGlobalLoc;
|
||||
corrMsg->fLocalToWorld.GetInverse(&corrMsg->fWorldToLocal);
|
||||
corrMsg->fDirtySynch = true;
|
||||
@ -1197,7 +1197,7 @@ void plPXPhysicalController::ICreateController()
|
||||
opac = 0.8f;
|
||||
|
||||
// the avatar proxy doesn't seem to work... not sure why?
|
||||
fProxyGen = TRACKED_NEW plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac);
|
||||
fProxyGen = new plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac);
|
||||
fProxyGen->Init(this);
|
||||
}
|
||||
|
||||
@ -1219,7 +1219,7 @@ void plPXPhysicalController::IDeleteController()
|
||||
}
|
||||
|
||||
// Make a visible object that can be viewed by users for debugging purposes.
|
||||
plDrawableSpans* plPXPhysicalController::CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo)
|
||||
plDrawableSpans* plPXPhysicalController::CreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo)
|
||||
{
|
||||
plDrawableSpans* myDraw = addTo;
|
||||
|
||||
@ -1250,7 +1250,7 @@ void plPXPhysicalController::IDrawDebugDisplay()
|
||||
plDebugText &debugTxt = plDebugText::Instance();
|
||||
char strBuf[ 2048 ];
|
||||
int lineHeight = debugTxt.GetFontSize() + 4;
|
||||
UInt32 scrnWidth, scrnHeight;
|
||||
uint32_t scrnWidth, scrnHeight;
|
||||
|
||||
debugTxt.GetScreenSize( &scrnWidth, &scrnHeight );
|
||||
int y = 10;
|
||||
|
@ -127,7 +127,7 @@ public:
|
||||
virtual bool IsKinematic();
|
||||
virtual void GetKinematicPosition(hsPoint3& pos);
|
||||
|
||||
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo);
|
||||
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo);
|
||||
|
||||
virtual const hsMatrix44& GetPrevSubworldW2L() { return fPrevSubworldW2L; }
|
||||
|
||||
|
@ -99,7 +99,7 @@ public:
|
||||
plPXPhysicalControllerCore* ac = plPXPhysicalControllerCore::FindController(hit.controller);
|
||||
NxActor& actor = hit.shape->getActor();
|
||||
plPXPhysical* phys = (plPXPhysical*)actor.userData;
|
||||
static hsScalar SlopeLimit = kSLOPELIMIT;
|
||||
static float SlopeLimit = kSLOPELIMIT;
|
||||
hsVector3 normal = plPXConvert::Vector(hit.worldNormal);
|
||||
ac->fMovementInterface->IAddContactNormals(normal);
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
@ -127,9 +127,9 @@ public:
|
||||
// If the avatar hit a movable physical, apply some force to it.
|
||||
hsVector3 dir = plPXConvert::Vector(hit.dir);
|
||||
float dirdotup=dir.fZ;
|
||||
hsPoint3 pos((hsScalar)hit.worldPos.x, (hsScalar)hit.worldPos.y, (hsScalar)hit.worldPos.z);
|
||||
hsPoint3 pos((float)hit.worldPos.x, (float)hit.worldPos.y, (float)hit.worldPos.z);
|
||||
NxExtendedVec3 controllerPos=hit.controller->getPosition();
|
||||
hsVector3 bottomOfTheCapsule((hsScalar)controllerPos.x,(hsScalar)controllerPos.y,(hsScalar)controllerPos.z);
|
||||
hsVector3 bottomOfTheCapsule((float)controllerPos.x,(float)controllerPos.y,(float)controllerPos.z);
|
||||
bottomOfTheCapsule.fZ=bottomOfTheCapsule.fZ-(ac->fHeight/2.0f + ac->fRadius);
|
||||
if (actor.isDynamic() )
|
||||
{
|
||||
@ -154,7 +154,7 @@ public:
|
||||
plSynchedObject* obj = plSynchedObject::ConvertNoRef(phys->GetObjectKey()->ObjectIsLoaded());
|
||||
obj->SetNetGroupConstant(plNetGroup::kNetGroupLocalPhysicals);
|
||||
// Tell all the other clients that we own this physical
|
||||
plSetNetGroupIDMsg* setNetGroupID = TRACKED_NEW plSetNetGroupIDMsg;
|
||||
plSetNetGroupIDMsg* setNetGroupID = new plSetNetGroupIDMsg;
|
||||
setNetGroupID->fId = plNetGroup::kNetGroupRemotePhysicals;
|
||||
setNetGroupID->SetBCastFlag(plMessage::kNetPropagate | plMessage::kNetForce);
|
||||
setNetGroupID->SetBCastFlag(plMessage::kLocalPropagate, false);
|
||||
@ -167,10 +167,10 @@ public:
|
||||
hsVector3 vel=ac->GetLinearVelocity()- plPXConvert::Vector( actor.getLinearVelocity());
|
||||
if(dirdotup>=0)vel.fZ=0.001f;
|
||||
else vel.fZ=0.0f;
|
||||
static hsScalar kAvieMass = 140.f/32.f;
|
||||
static float kAvieMass = 140.f/32.f;
|
||||
if (!vel.IsEmpty())
|
||||
{
|
||||
static hsScalar kForceScale = 140.0f;
|
||||
static float kForceScale = 140.0f;
|
||||
NxF32 coeff;
|
||||
NxExtendedVec3 norm2=hit.controller->getPosition();
|
||||
norm2.x=hit.worldPos.x-bottomOfTheCapsule.fX;
|
||||
@ -195,9 +195,9 @@ public:
|
||||
|
||||
float proj=(float)(norm2.x*dir.fX+dir.fY*norm2.y+dir.fZ*norm2.z);
|
||||
coeff =abs(proj*kForceScale*vel.Magnitude());
|
||||
vel.fZ=(hsScalar)norm2.z;
|
||||
vel.fY=(hsScalar)norm2.y;
|
||||
vel.fX=(hsScalar)norm2.x;
|
||||
vel.fZ=(float)norm2.z;
|
||||
vel.fY=(float)norm2.y;
|
||||
vel.fX=(float)norm2.x;
|
||||
phys->SetHitForce(vel*coeff, pos);
|
||||
}
|
||||
}
|
||||
@ -223,14 +223,14 @@ public:
|
||||
} gMyReport;
|
||||
|
||||
|
||||
plPhysicalControllerCore* plPhysicalControllerCore::Create(plKey ownerSO, hsScalar height, hsScalar width)
|
||||
plPhysicalControllerCore* plPhysicalControllerCore::Create(plKey ownerSO, float height, float width)
|
||||
{
|
||||
// Test to see how many controller there already is
|
||||
if ( !plPXPhysicalControllerCore::fPXControllersMax || plPXPhysicalControllerCore::NumControllers() < plPXPhysicalControllerCore::fPXControllersMax )
|
||||
{
|
||||
hsScalar radius = width / 2.f;
|
||||
hsScalar realHeight = height - width + kPhysicalHeightFudge;
|
||||
return TRACKED_NEW plPXPhysicalControllerCore(ownerSO, realHeight,radius);
|
||||
float radius = width / 2.f;
|
||||
float realHeight = height - width + kPhysicalHeightFudge;
|
||||
return new plPXPhysicalControllerCore(ownerSO, realHeight,radius);
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
@ -326,7 +326,7 @@ int plPXPhysicalControllerCore::GetNumberOfControllersInThisSubWorld(plKey world
|
||||
return i;
|
||||
}
|
||||
//
|
||||
plPXPhysicalControllerCore::plPXPhysicalControllerCore(plKey ownerSO, hsScalar height, hsScalar radius)
|
||||
plPXPhysicalControllerCore::plPXPhysicalControllerCore(plKey ownerSO, float height, float radius)
|
||||
: plPhysicalControllerCore(ownerSO,height,radius)
|
||||
, fController(nil)
|
||||
, fProxyGen(nil)
|
||||
@ -499,12 +499,12 @@ void plPXPhysicalControllerCore::IGetPositionSim(hsPoint3& pos) const
|
||||
if(this->fBehavingLikeAnimatedPhys)
|
||||
{
|
||||
const NxExtendedVec3& nxPos = fController->getPosition();
|
||||
pos.Set(hsScalar(nxPos.x), hsScalar(nxPos.y), hsScalar(nxPos.z) - kPhysZOffset);
|
||||
pos.Set(float(nxPos.x), float(nxPos.y), float(nxPos.z) - kPhysZOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
NxVec3 Pos = fKinematicActor->getGlobalPosition();
|
||||
pos.Set(hsScalar(Pos.x), hsScalar(Pos.y), hsScalar(Pos.z) - kPhysZOffset);
|
||||
pos.Set(float(Pos.x), float(Pos.y), float(Pos.z) - kPhysZOffset);
|
||||
}
|
||||
}
|
||||
void plPXPhysicalControllerCore::ICreateController()
|
||||
@ -568,7 +568,7 @@ NxScene* scene = plSimulationMgr::GetInstance()->GetScene(fWorldKey);
|
||||
//hsAssert(!fProxyGen, "Already have proxy gen, double read?");
|
||||
|
||||
hsColorRGBA physColor;
|
||||
hsScalar opac = 1.0f;
|
||||
float opac = 1.0f;
|
||||
|
||||
// local avatar is light purple and transparent
|
||||
physColor.Set(.2f, .1f, .2f, 1.f);
|
||||
@ -576,7 +576,7 @@ NxScene* scene = plSimulationMgr::GetInstance()->GetScene(fWorldKey);
|
||||
|
||||
/*
|
||||
// the avatar proxy doesn't seem to work... not sure why?
|
||||
fProxyGen = TRACKED_NEW plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac);
|
||||
fProxyGen = new plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac);
|
||||
fProxyGen->Init(this);
|
||||
*/
|
||||
}
|
||||
@ -638,7 +638,7 @@ void plPXPhysicalControllerCore::ICreateController(const hsPoint3& pos)
|
||||
//hsAssert(!fProxyGen, "Already have proxy gen, double read?");
|
||||
|
||||
hsColorRGBA physColor;
|
||||
hsScalar opac = 1.0f;
|
||||
float opac = 1.0f;
|
||||
|
||||
// local avatar is light purple and transparent
|
||||
physColor.Set(.2f, .1f, .2f, 1.f);
|
||||
@ -646,7 +646,7 @@ void plPXPhysicalControllerCore::ICreateController(const hsPoint3& pos)
|
||||
|
||||
/*
|
||||
// the avatar proxy doesn't seem to work... not sure why?
|
||||
fProxyGen = TRACKED_NEW plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac);
|
||||
fProxyGen = new plPhysicalProxy(hsColorRGBA().Set(0,0,0,1.f), physColor, opac);
|
||||
fProxyGen->Init(this);
|
||||
*/
|
||||
|
||||
@ -694,7 +694,7 @@ void plPXPhysicalControllerCore::IInformDetectors(bool entering,bool deferUntilN
|
||||
bool doReport = physical->DoReportOn(plSimDefs::kGroupAvatar);
|
||||
if(doReport)
|
||||
{
|
||||
plCollideMsg* msg = TRACKED_NEW plCollideMsg;
|
||||
plCollideMsg* msg = new plCollideMsg;
|
||||
msg->fOtherKey = fOwner;
|
||||
msg->fEntering = entering;
|
||||
msg->AddReceiver(physical->GetObjectKey());
|
||||
@ -809,7 +809,7 @@ void plPXPhysicalControllerCore::GetState(hsPoint3& pos, float& zRot)
|
||||
fLocalRotation.GetAngleAxis(&zRot, (hsVector3*)&pos);
|
||||
|
||||
if (pos.fZ < 0)
|
||||
zRot = (2 * hsScalarPI) - zRot; // axis is backwards, so reverse the angle too
|
||||
zRot = (2 * M_PI) - zRot; // axis is backwards, so reverse the angle too
|
||||
|
||||
pos = fLocalPosition;
|
||||
|
||||
@ -870,13 +870,13 @@ void plPXPhysicalControllerCore::GetKinematicPosition(hsPoint3& pos)
|
||||
if ( fKinematicActor )
|
||||
{
|
||||
NxVec3 klPos = fKinematicActor->getGlobalPosition();
|
||||
pos.Set(hsScalar(klPos.x), hsScalar(klPos.y), hsScalar(klPos.z) - kPhysZOffset);
|
||||
pos.Set(float(klPos.x), float(klPos.y), float(klPos.z) - kPhysZOffset);
|
||||
}
|
||||
}
|
||||
void plPXPhysicalControllerCore::UpdatePoststep( hsScalar delSecs)
|
||||
void plPXPhysicalControllerCore::UpdatePoststep( float delSecs)
|
||||
{
|
||||
// Apparently the user data field of the controllers is broken
|
||||
// UInt32 count = gControllerMgr.getNbControllers();
|
||||
// uint32_t count = gControllerMgr.getNbControllers();
|
||||
// NxController* controllers = (NxController*)gControllerMgr.getControllers();
|
||||
//
|
||||
// for (int i = 0; i < count; i++)
|
||||
@ -901,7 +901,7 @@ void plPXPhysicalControllerCore::UpdatePoststep( hsScalar delSecs)
|
||||
}
|
||||
}
|
||||
}
|
||||
void plPXPhysicalControllerCore::UpdatePrestep(hsScalar delSecs)
|
||||
void plPXPhysicalControllerCore::UpdatePrestep(float delSecs)
|
||||
{
|
||||
for (int i = 0; i < gControllers.size(); i++)
|
||||
{
|
||||
@ -928,7 +928,7 @@ void plPXPhysicalControllerCore::UpdatePrestep(hsScalar delSecs)
|
||||
}
|
||||
gRebuildCache = false;
|
||||
}
|
||||
void plPXPhysicalControllerCore::UpdatePostSimStep(hsScalar delSecs)
|
||||
void plPXPhysicalControllerCore::UpdatePostSimStep(float delSecs)
|
||||
{
|
||||
for (int i = 0; i < gControllers.size(); i++)
|
||||
{
|
||||
@ -981,7 +981,7 @@ void plPXPhysicalControllerCore::HandleKinematicEnableNextUpdate()
|
||||
void plPXPhysicalControllerCore::IHandleResize()
|
||||
{
|
||||
|
||||
UInt32 collideFlags =
|
||||
uint32_t collideFlags =
|
||||
1<<plSimDefs::kGroupStatic |
|
||||
1<<plSimDefs::kGroupAvatarBlocker |
|
||||
1<<plSimDefs::kGroupDynamic;
|
||||
@ -990,7 +990,7 @@ void plPXPhysicalControllerCore::IHandleResize()
|
||||
collideFlags|=(1<<plSimDefs::kGroupExcludeRegion);
|
||||
}
|
||||
NxScene* myscene = plSimulationMgr::GetInstance()->GetScene(this->fWorldKey);
|
||||
// NxShape** response=TRACKED_NEW NxShape*[2];
|
||||
// NxShape** response=new NxShape*[2];
|
||||
|
||||
NxVec3 center(fLocalPosition.fX,fLocalPosition.fY,fLocalPosition.fZ+fPreferedRadius);
|
||||
NxSegment Seg(center,center);
|
||||
@ -1011,7 +1011,7 @@ void plPXPhysicalControllerCore::IHandleResize()
|
||||
|
||||
// delete[] response;
|
||||
}
|
||||
void plPXPhysicalControllerCore::SetControllerDimensions(hsScalar radius, hsScalar height)
|
||||
void plPXPhysicalControllerCore::SetControllerDimensions(float radius, float height)
|
||||
{
|
||||
fNeedsResize=false;
|
||||
if(fRadius!=radius)
|
||||
@ -1033,7 +1033,7 @@ void plPXPhysicalControllerCore::LeaveAge()
|
||||
this->fMovementInterface->LeaveAge();
|
||||
}
|
||||
int plPXPhysicalControllerCore::SweepControllerPath(const hsPoint3& startPos, const hsPoint3& endPos, hsBool vsDynamics, hsBool vsStatics,
|
||||
UInt32& vsSimGroups, std::multiset< plControllerSweepRecord >& WhatWasHitOut)
|
||||
uint32_t& vsSimGroups, std::multiset< plControllerSweepRecord >& WhatWasHitOut)
|
||||
{
|
||||
NxCapsule tempCap;
|
||||
tempCap.p0 =plPXConvert::Point( startPos);
|
||||
@ -1129,7 +1129,7 @@ void plPXPhysicalControllerCore::SetLinearVelocity(const hsVector3& linearVel)
|
||||
fKinematicActor->setLinearVelocity(vel);
|
||||
}
|
||||
}
|
||||
void plPXPhysicalControllerCore::SetAngularVelocity(const hsScalar angvel)
|
||||
void plPXPhysicalControllerCore::SetAngularVelocity(const float angvel)
|
||||
{
|
||||
plPhysicalControllerCore::SetAngularVelocity(angvel);
|
||||
if(fKinematicActor && !fBehavingLikeAnimatedPhys)
|
||||
@ -1138,7 +1138,7 @@ void plPXPhysicalControllerCore::SetAngularVelocity(const hsScalar angvel)
|
||||
fKinematicActor->setAngularVelocity(vel);
|
||||
}
|
||||
}
|
||||
void plPXPhysicalControllerCore::SetVelocities(const hsVector3& linearVel, hsScalar angVel)
|
||||
void plPXPhysicalControllerCore::SetVelocities(const hsVector3& linearVel, float angVel)
|
||||
{
|
||||
SetLinearVelocity(linearVel);
|
||||
SetAngularVelocity(angVel);
|
||||
@ -1165,7 +1165,7 @@ const hsVector3& plPXPhysicalControllerCore::GetLinearVelocity()
|
||||
}
|
||||
|
||||
// Make a visible object that can be viewed by users for debugging purposes.
|
||||
plDrawableSpans* plPXPhysicalControllerCore::CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo)
|
||||
plDrawableSpans* plPXPhysicalControllerCore::CreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo)
|
||||
{
|
||||
plDrawableSpans* myDraw = addTo;
|
||||
hsBool blended = ((mat->GetLayer(0)->GetBlendFlags() & hsGMatState::kBlendMask));
|
||||
@ -1194,7 +1194,7 @@ void plPXPhysicalControllerCore::IDrawDebugDisplay()
|
||||
plDebugText &debugTxt = plDebugText::Instance();
|
||||
char strBuf[ 2048 ];
|
||||
int lineHeight = debugTxt.GetFontSize() + 4;
|
||||
UInt32 scrnWidth, scrnHeight;
|
||||
uint32_t scrnWidth, scrnHeight;
|
||||
|
||||
debugTxt.GetScreenSize( &scrnWidth, &scrnHeight );
|
||||
int y = 10;
|
||||
@ -1212,7 +1212,7 @@ void plPXPhysicalControllerCore::IDrawDebugDisplay()
|
||||
{
|
||||
hsVector3 normal = fDbgCollisionInfo[i].fNormal;
|
||||
char *overlapStr = fDbgCollisionInfo[i].fOverlap ? "yes" : "no";
|
||||
hsScalar angle = hsScalarRadToDeg(hsACosine(normal * hsVector3(0, 0, 1)));
|
||||
float angle = hsRadiansToDegrees(acos(normal * hsVector3(0, 0, 1)));
|
||||
sprintf(strBuf, " Obj: %s, Normal: (%.2f, %.2f, %.2f), Angle(%.1f), Overlap(%3s)",
|
||||
fDbgCollisionInfo[i].fSO->GetKeyName(),
|
||||
normal.fX, normal.fY, normal.fZ, angle, overlapStr);
|
||||
|
@ -68,7 +68,7 @@ class plPXPhysicalControllerCore: public plPhysicalControllerCore
|
||||
{
|
||||
friend class PXControllerHitReportWalk;
|
||||
public:
|
||||
plPXPhysicalControllerCore(plKey ownerSO, hsScalar height, hsScalar radius);
|
||||
plPXPhysicalControllerCore(plKey ownerSO, float height, float radius);
|
||||
~plPXPhysicalControllerCore();
|
||||
//should actually be a 3 vector but everywhere else it is assumed to be just around Z
|
||||
|
||||
@ -98,7 +98,7 @@ public:
|
||||
virtual void GetPositionSim(hsPoint3& pos){IGetPositionSim(pos);}
|
||||
virtual void MoveKinematicToController(hsPoint3& pos);
|
||||
virtual const hsPoint3& GetLocalPosition(){return fLocalPosition;}
|
||||
virtual void SetControllerDimensions(hsScalar radius, hsScalar height);
|
||||
virtual void SetControllerDimensions(float radius, float height);
|
||||
virtual void LeaveAge();
|
||||
virtual void UpdateControllerAndPhysicalRep();
|
||||
|
||||
@ -113,24 +113,24 @@ public:
|
||||
static int GetControllersInThisSubWorld(plKey world, int maxToReturn,
|
||||
plPXPhysicalControllerCore** bufferout);
|
||||
static int GetNumberOfControllersInThisSubWorld(plKey world);
|
||||
static void UpdatePrestep(hsScalar delSecs);
|
||||
static void UpdatePoststep(hsScalar delSecs);
|
||||
static void UpdatePostSimStep(hsScalar delSecs);
|
||||
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo);
|
||||
static void UpdatePrestep(float delSecs);
|
||||
static void UpdatePoststep(float delSecs);
|
||||
static void UpdatePostSimStep(float delSecs);
|
||||
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<uint32_t>& idx, plDrawableSpans* addTo);
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
static hsBool fDebugDisplay;
|
||||
#endif // PLASMA_EXTERNAL_RELEASE
|
||||
static void SetMaxNumberOfControllers(int max) { fPXControllersMax = max; }
|
||||
static int fPXControllersMax;
|
||||
virtual int SweepControllerPath(const hsPoint3& startPos, const hsPoint3& endPos, hsBool vsDynamics, hsBool vsStatics, UInt32& vsSimGroups, std::multiset< plControllerSweepRecord >& WhatWasHitOut);
|
||||
virtual int SweepControllerPath(const hsPoint3& startPos, const hsPoint3& endPos, hsBool vsDynamics, hsBool vsStatics, uint32_t& vsSimGroups, std::multiset< plControllerSweepRecord >& WhatWasHitOut);
|
||||
virtual void BehaveLikeAnimatedPhysical(hsBool actLikeAnAnimatedPhys);
|
||||
virtual hsBool BehavingLikeAnAnimatedPhysical();
|
||||
virtual const hsVector3& GetLinearVelocity();
|
||||
|
||||
virtual void SetLinearVelocity(const hsVector3& linearVel);
|
||||
//should actually be a 3 vector but everywhere else it is assumed to be just around Z
|
||||
virtual void SetAngularVelocity(const hsScalar angvel);
|
||||
virtual void SetVelocities(const hsVector3& linearVel, hsScalar angVel);
|
||||
virtual void SetAngularVelocity(const float angvel);
|
||||
virtual void SetVelocities(const hsVector3& linearVel, float angVel);
|
||||
|
||||
protected:
|
||||
friend class PXControllerHitReport;
|
||||
@ -151,8 +151,8 @@ protected:
|
||||
void IDrawDebugDisplay();
|
||||
#endif
|
||||
void IHandleResize();
|
||||
hsScalar fPreferedRadius;
|
||||
hsScalar fPreferedHeight;
|
||||
float fPreferedRadius;
|
||||
float fPreferedHeight;
|
||||
// The global position and rotation of the avatar last time we set it (so we
|
||||
// can detect if someone else moves him)
|
||||
plPhysicalProxy* fProxyGen;
|
||||
|
@ -209,7 +209,7 @@ class SensorReport : public NxUserTriggerReport
|
||||
{
|
||||
DetectorLogYellow("Collision: %s was triggered by %s. Sending an %s msg", receiver->GetName(),
|
||||
hitter ? hitter->GetName().c_str() : "(nil)" , entering ? "'enter'" : "'exit'");
|
||||
plCollideMsg* msg = TRACKED_NEW plCollideMsg;
|
||||
plCollideMsg* msg = new plCollideMsg;
|
||||
msg->fOtherKey = hitter;
|
||||
msg->fEntering = entering;
|
||||
msg->AddReceiver(receiver);
|
||||
@ -293,23 +293,6 @@ class ErrorStream : public NxUserOutputStream
|
||||
}
|
||||
} gErrorStream;
|
||||
|
||||
// This class allows PhysX to use our heap manager
|
||||
static class HeapAllocator : public NxUserAllocator {
|
||||
public:
|
||||
void * malloc (NxU32 size) {
|
||||
return ALLOC(size);
|
||||
}
|
||||
void * mallocDEBUG (NxU32 size, const char * fileName, int line) {
|
||||
return MemAlloc(size, 0, fileName, line);
|
||||
}
|
||||
void * realloc (void * memory, NxU32 size) {
|
||||
return REALLOC(memory, size);
|
||||
}
|
||||
void free (void * memory) {
|
||||
FREE(memory);
|
||||
}
|
||||
} gHeapAllocator;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -370,7 +353,7 @@ bool plSimulationMgr::fDoClampingOnStep=true;
|
||||
void plSimulationMgr::Init()
|
||||
{
|
||||
hsAssert(!gTheInstance, "Initializing the sim when it's already been done");
|
||||
gTheInstance = TRACKED_NEW plSimulationMgr();
|
||||
gTheInstance = new plSimulationMgr();
|
||||
if (gTheInstance->InitSimulation())
|
||||
{
|
||||
gTheInstance->RegisterAs(kSimulationMgr_KEY);
|
||||
@ -380,7 +363,7 @@ void plSimulationMgr::Init()
|
||||
{
|
||||
// There was an error when creating the PhysX simulation
|
||||
// ...then get rid of the simulation instance
|
||||
DEL(gTheInstance); // clean up the memory we allocated
|
||||
delete gTheInstance; // clean up the memory we allocated
|
||||
gTheInstance = nil;
|
||||
}
|
||||
}
|
||||
@ -410,7 +393,7 @@ plSimulationMgr::plSimulationMgr()
|
||||
: fSuspended(true)
|
||||
, fMaxDelta(kDefaultMaxDelta)
|
||||
, fStepSize(kDefaultStepSize)
|
||||
, fLOSDispatch(TRACKED_NEW plLOSDispatch())
|
||||
, fLOSDispatch(new plLOSDispatch())
|
||||
, fSoundMgr(new plPhysicsSoundMgr)
|
||||
, fLog(nil)
|
||||
{
|
||||
@ -419,7 +402,7 @@ plSimulationMgr::plSimulationMgr()
|
||||
|
||||
bool plSimulationMgr::InitSimulation()
|
||||
{
|
||||
fSDK = NxCreatePhysicsSDK(NX_PHYSICS_SDK_VERSION, &gHeapAllocator, &gErrorStream);
|
||||
fSDK = NxCreatePhysicsSDK(NX_PHYSICS_SDK_VERSION, NULL, &gErrorStream);
|
||||
if (!fSDK)
|
||||
return false; // client will handle this and ask user to install
|
||||
|
||||
@ -468,7 +451,7 @@ NxScene* plSimulationMgr::GetScene(plKey world)
|
||||
|
||||
if (!scene)
|
||||
{
|
||||
UInt32 maxSteps = (UInt32)hsCeil(fMaxDelta / fStepSize);
|
||||
uint32_t maxSteps = (uint32_t)ceil(fMaxDelta / fStepSize);
|
||||
|
||||
NxSceneDesc sceneDesc;
|
||||
sceneDesc.gravity.set(0, 0, -32.174049f);
|
||||
@ -539,7 +522,7 @@ void plSimulationMgr::ISendCollisionMsg(plKey receiver, plKey hitter, hsBool ent
|
||||
{
|
||||
DetectorLogYellow("Collision: %s is inside %s. Sending an %s msg", hitter ? hitter->GetName().c_str() : "(nil)",
|
||||
receiver->GetName().c_str(), entering ? "'enter'" : "'exit'");
|
||||
plCollideMsg* msg = TRACKED_NEW plCollideMsg;
|
||||
plCollideMsg* msg = new plCollideMsg;
|
||||
msg->fOtherKey = hitter;
|
||||
msg->fEntering = entering;
|
||||
msg->AddReceiver(receiver);
|
||||
@ -556,7 +539,7 @@ void plSimulationMgr::UpdateDetectorsInScene(plKey world, plKey avatar, hsPoint3
|
||||
hsPoint3 soPos = ci->GetWorldPos();
|
||||
if (scene)
|
||||
{
|
||||
UInt32 numActors = scene->getNbActors();
|
||||
uint32_t numActors = scene->getNbActors();
|
||||
NxActor** actors = scene->getActors();
|
||||
|
||||
for (int i = 0; i < numActors; i++)
|
||||
@ -584,7 +567,7 @@ void plSimulationMgr::UpdateAvatarInDetector(plKey world, plPXPhysical* detector
|
||||
NxScene* scene = GetScene(world);
|
||||
if (scene)
|
||||
{
|
||||
UInt32 numActors = scene->getNbActors();
|
||||
uint32_t numActors = scene->getNbActors();
|
||||
NxActor** actors = scene->getActors();
|
||||
|
||||
for (int i = 0; i < numActors; i++)
|
||||
@ -629,7 +612,7 @@ void plSimulationMgr::Advance(float delSecs)
|
||||
plProfile_IncCount(StepLen, (int)(delSecs*1000));
|
||||
|
||||
#ifndef PLASMA_EXTERNAL_RELASE
|
||||
UInt32 stepTime = hsTimer::GetPrecTickCount();
|
||||
uint32_t stepTime = hsTimer::GetPrecTickCount();
|
||||
#endif
|
||||
plProfile_BeginTiming(Step);
|
||||
plPXPhysicalControllerCore::UpdatePrestep(delSecs);
|
||||
@ -719,7 +702,7 @@ void plSimulationMgr::ISendUpdates()
|
||||
for (; it != fScenes.end(); it++)
|
||||
{
|
||||
NxScene* scene = it->second;
|
||||
UInt32 numActors = scene->getNbActors();
|
||||
uint32_t numActors = scene->getNbActors();
|
||||
NxActor** actors = scene->getActors();
|
||||
|
||||
for (int i = 0; i < numActors; i++)
|
||||
@ -802,7 +785,7 @@ int plSimulationMgr::GetStepsPerSecond()
|
||||
return (int)((1.0 / fStepSize) + 0.5f); // round to nearest int
|
||||
}
|
||||
|
||||
int plSimulationMgr::GetMaterialIdx(NxScene* scene, hsScalar friction, hsScalar restitution)
|
||||
int plSimulationMgr::GetMaterialIdx(NxScene* scene, float friction, float restitution)
|
||||
{
|
||||
if (friction == 0.5f && restitution == 0.5f)
|
||||
return 0;
|
||||
@ -984,7 +967,7 @@ void plSimulationMgr::IDrawActiveActorList()
|
||||
plDebugText &debugTxt = plDebugText::Instance();
|
||||
char strBuf[ 2048 ];
|
||||
int lineHeight = debugTxt.GetFontSize() + 4;
|
||||
UInt32 scrnWidth, scrnHeight;
|
||||
uint32_t scrnWidth, scrnHeight;
|
||||
|
||||
debugTxt.GetScreenSize( &scrnWidth, &scrnHeight );
|
||||
int y = 10;
|
||||
@ -1000,9 +983,9 @@ void plSimulationMgr::IDrawActiveActorList()
|
||||
sprintf(strBuf, "Scene: %s",it->first->GetName());
|
||||
debugTxt.DrawString(x, y, strBuf);
|
||||
y += lineHeight;
|
||||
UInt32 numActors =it->second->getNbActors();
|
||||
uint32_t numActors =it->second->getNbActors();
|
||||
NxActor** actors =it->second->getActors();
|
||||
for(UInt32 i=0;i<numActors;i++)
|
||||
for(uint32_t i=0;i<numActors;i++)
|
||||
{
|
||||
if(!actors[i]->isSleeping())
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ public:
|
||||
// the scene
|
||||
void ReleaseScene(plKey world);
|
||||
|
||||
int GetMaterialIdx(NxScene* scene, hsScalar friction, hsScalar restitution);
|
||||
int GetMaterialIdx(NxScene* scene, float friction, float restitution);
|
||||
|
||||
// PHYSX FIXME - walk thru all the convex hull detector regions to see if we are in any... we're either coming or going
|
||||
void UpdateDetectorsInScene(plKey world, plKey avatar, hsPoint3& pos, bool entering);
|
||||
|
Reference in New Issue
Block a user