1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-19 19:59:09 +00:00

Change all CRLF-text files to LF-text files

to match H'uru for patching
This commit is contained in:
rarified
2021-01-28 12:08:00 -07:00
parent 6ae3df25f5
commit a553708b5b
3385 changed files with 1112046 additions and 1112046 deletions

View File

@ -1,311 +1,311 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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 "plLOSDispatch.h"
#include "plSimulationMgr.h"
#include "plgDispatch.h"
#include "../plMessage/plLOSRequestMsg.h"
#include "../plMessage/plLOSHitMsg.h"
#include "../pnKeyedObject/plFixedKey.h"
#include "../pnSceneObject/plSceneObject.h"
#include "../plModifier/plLogicModifier.h"
#include "plPXPhysical.h"
#include "plPXPhysicalControllerCore.h"
#include "plPXConvert.h"
#include "../plAvatar/plAvatarMgr.h"
#include "../plAvatar/plArmatureMod.h"
#include "NxPhysics.h"
#include "plProfile.h"
plProfile_Extern(LineOfSight);
class myRaycastReport : public NxUserRaycastReport
{
public:
void InitCast(plSimDefs::plLOSDB db, plLOSRequestMsg::TestType type)
{
fDB = db;
fType = type;
fHitObj = nil;
fNormal.Set(0, 0, 0);
fPoint.Set(0, 0, 0);
fDist = FLT_MAX;
}
bool GotHit() { return fDist != FLT_MAX; }
plKey GetObj() { return fHitObj; }
hsScalar GetDistance() { return fDist; }
const hsVector3& GetNormal() { return fNormal; }
const hsPoint3& GetPoint() { return fPoint; }
void ResetHitObj(){fHitObj=nil;}
private:
virtual bool onHit(const NxRaycastHit& hit)
{
NxActor& hitActor = hit.shape->getActor();
plPXPhysical* phys = (plPXPhysical*)hitActor.userData;
plKey objKey = nil;
UInt16 objDB = plSimDefs::kLOSDBNone;
if (phys)
{
objKey = phys->GetObjectKey();
objDB = phys->GetAllLOSDBs();
}
else
{
plPXPhysicalControllerCore* controller = plPXPhysicalControllerCore::GetController(hitActor);
if (controller)
{
objKey = controller->GetOwner();
objDB = controller->GetLOSDB();
}
}
// is the object's physic enabled and is it in the database that we are looking for?
if ( !phys || !phys->GetProperty(plSimulationInterface::kDisable) )
{
if ( (fDB & objDB) != 0)
{
if (fType == plLOSRequestMsg::kTestAny || hit.distance < fDist)
{
// need one more test... if it is a clickable need to see if it is enabled
bool disabled = false;
if ( objKey )
{
plSceneObject* so = plSceneObject::ConvertNoRef( objKey->GetObjectPtr() );
if (so)
{
int i;
for ( i=0; i < so->GetNumModifiers(); i++)
{
plLogicModifier* lo = (plLogicModifier*)plLogicModifier::ConvertNoRef(so->GetModifier(i) );
if (lo)
{
disabled = lo->Disabled();
break;
}
}
}
}
if (!disabled)
{
fHitObj = objKey;
fNormal.Set(hit.worldNormal.x, hit.worldNormal.y, hit.worldNormal.z);
fPoint.Set(hit.worldImpact.x, hit.worldImpact.y, hit.worldImpact.z);
fDist = hit.distance;
if (fType == plLOSRequestMsg::kTestAny)
return false;
}
}
}
}
return true;
}
plSimDefs::plLOSDB fDB;
plLOSRequestMsg::TestType fType;
plKey fHitObj;
hsVector3 fNormal;
hsPoint3 fPoint;
hsScalar fDist;
} gMyReport;
plLOSDispatch::plLOSDispatch()
{
RegisterAs(kLOSObject_KEY);
plgDispatch::Dispatch()->RegisterForExactType(plLOSRequestMsg::Index(), GetKey());
}
plLOSDispatch::~plLOSDispatch()
{
plgDispatch::Dispatch()->UnRegisterForExactType(plLOSRequestMsg::Index(), GetKey());
}
hsBool plLOSDispatch::MsgReceive(plMessage* msg)
{
plLOSRequestMsg* requestMsg = plLOSRequestMsg::ConvertNoRef(msg);
if (requestMsg)
{
plProfile_BeginTiming(LineOfSight);
plSimulationMgr* sim = plSimulationMgr::GetInstance();
plKey worldKey = requestMsg->fWorldKey;
if (!worldKey)
{
plArmatureMod* av = plAvatarMgr::GetInstance()->GetLocalAvatar();
if ( av && av->GetController() )
worldKey = av->GetController()->GetSubworld();
}
hsPoint3 from = requestMsg->fFrom;
hsPoint3 at = requestMsg->fTo;
// requests are always sent in world space, but they might
// need to be converted to subworld space
hsMatrix44 l2w, w2l;
if (worldKey)
{
plSceneObject* so = plSceneObject::ConvertNoRef(worldKey->ObjectIsLoaded());
if (so)
{
l2w = so->GetLocalToWorld();
w2l = so->GetWorldToLocal();
from = w2l * from;
at = w2l * at;
}
}
else
{
l2w.Reset();
w2l.Reset();
}
NxScene* scene = sim->GetScene(worldKey);
gMyReport.InitCast(requestMsg->GetRequestType(), requestMsg->GetTestType());
hsVector3 norm = hsVector3(at - from);
hsScalar dist = norm.Magnitude();
norm.Normalize();
NxRay worldRay;
worldRay.dir = plPXConvert::Vector(norm);
worldRay.orig = plPXConvert::Point(from);
//PhysX will complain to log if ray distance is less than or equal to Zero, besides shouldn't bother throwing
// a point, and if we have negative we have some serious problems
if(dist>0.0f)
{
scene->raycastAllShapes(worldRay, gMyReport, NX_ALL_SHAPES, 0xffffffff, dist, NX_RAYCAST_DISTANCE | NX_RAYCAST_IMPACT | NX_RAYCAST_NORMAL);
}
else{
SimLog("%s sent out a LOS request with a ray length of %d.", requestMsg->GetSender()->GetName(), dist);
}
if (gMyReport.GotHit())
{
// We got a hit, save off the info
plMessage* hitMsg = ICreateHitMsg(requestMsg, l2w);
if (requestMsg->GetCullDB() != plSimDefs::kLOSDBNone)
{
// 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();
if(dist!=0.0)
{
gMyReport.InitCast(requestMsg->GetCullDB(), plLOSRequestMsg::kTestAny);
scene->raycastAllShapes(worldRay, gMyReport, NX_ALL_SHAPES, 0xffffffff, dist, NX_RAYCAST_DISTANCE | NX_RAYCAST_IMPACT | NX_RAYCAST_NORMAL);
if (gMyReport.GotHit())
{
delete hitMsg;
hitMsg = nil;
if (requestMsg->GetReportType() == plLOSRequestMsg::kReportMiss ||
requestMsg->GetReportType() == plLOSRequestMsg::kReportHitOrMiss)
{
ICreateMissMsg(requestMsg)->Send();
}
}
}
else// we are right on top of the object I assume that means we hit it
{// since PhysX would have complained we will log it anyways. Just so we have a better idea, where this
//was happening previously
SimLog("%s sent out a LOS request. The second cast for culling was of length 0. ABORTING and assuming hit.", requestMsg->GetSender()->GetName());
}
}
if (hitMsg &&
(requestMsg->GetReportType() == plLOSRequestMsg::kReportHit ||
requestMsg->GetReportType() == plLOSRequestMsg::kReportHitOrMiss))
hitMsg->Send();
}
else
{
if (requestMsg->GetReportType() == plLOSRequestMsg::kReportMiss ||
requestMsg->GetReportType() == plLOSRequestMsg::kReportHitOrMiss)
{
ICreateMissMsg(requestMsg)->Send();
}
}
plProfile_EndTiming(LineOfSight);
gMyReport.ResetHitObj();
return true;
}
return hsKeyedObject::MsgReceive(msg);
}
plMessage* plLOSDispatch::ICreateHitMsg(plLOSRequestMsg* requestMsg, hsMatrix44& l2w)
{
plKey ourKey = GetKey();
plKey rcvKey = requestMsg->GetSender();
plLOSHitMsg* hitMsg = TRACKED_NEW plLOSHitMsg(ourKey, rcvKey, nil);
hitMsg->fNoHit = false;
hitMsg->fObj = gMyReport.GetObj();
hitMsg->fDistance = gMyReport.GetDistance();
hitMsg->fNormal = l2w * gMyReport.GetNormal();
hitMsg->fHitPoint = l2w * gMyReport.GetPoint();
hitMsg->fRequestID = requestMsg->GetRequestID();
return hitMsg;
}
plMessage* plLOSDispatch::ICreateMissMsg(plLOSRequestMsg* requestMsg)
{
plKey ourKey = GetKey();
plKey rcvKey = requestMsg->GetSender();
plLOSHitMsg* missMsg = TRACKED_NEW plLOSHitMsg(ourKey, rcvKey, nil);
missMsg->fNoHit = true;
missMsg->fObj = nil;
missMsg->fRequestID = requestMsg->GetRequestID();
return missMsg;
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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 "plLOSDispatch.h"
#include "plSimulationMgr.h"
#include "plgDispatch.h"
#include "../plMessage/plLOSRequestMsg.h"
#include "../plMessage/plLOSHitMsg.h"
#include "../pnKeyedObject/plFixedKey.h"
#include "../pnSceneObject/plSceneObject.h"
#include "../plModifier/plLogicModifier.h"
#include "plPXPhysical.h"
#include "plPXPhysicalControllerCore.h"
#include "plPXConvert.h"
#include "../plAvatar/plAvatarMgr.h"
#include "../plAvatar/plArmatureMod.h"
#include "NxPhysics.h"
#include "plProfile.h"
plProfile_Extern(LineOfSight);
class myRaycastReport : public NxUserRaycastReport
{
public:
void InitCast(plSimDefs::plLOSDB db, plLOSRequestMsg::TestType type)
{
fDB = db;
fType = type;
fHitObj = nil;
fNormal.Set(0, 0, 0);
fPoint.Set(0, 0, 0);
fDist = FLT_MAX;
}
bool GotHit() { return fDist != FLT_MAX; }
plKey GetObj() { return fHitObj; }
hsScalar GetDistance() { return fDist; }
const hsVector3& GetNormal() { return fNormal; }
const hsPoint3& GetPoint() { return fPoint; }
void ResetHitObj(){fHitObj=nil;}
private:
virtual bool onHit(const NxRaycastHit& hit)
{
NxActor& hitActor = hit.shape->getActor();
plPXPhysical* phys = (plPXPhysical*)hitActor.userData;
plKey objKey = nil;
UInt16 objDB = plSimDefs::kLOSDBNone;
if (phys)
{
objKey = phys->GetObjectKey();
objDB = phys->GetAllLOSDBs();
}
else
{
plPXPhysicalControllerCore* controller = plPXPhysicalControllerCore::GetController(hitActor);
if (controller)
{
objKey = controller->GetOwner();
objDB = controller->GetLOSDB();
}
}
// is the object's physic enabled and is it in the database that we are looking for?
if ( !phys || !phys->GetProperty(plSimulationInterface::kDisable) )
{
if ( (fDB & objDB) != 0)
{
if (fType == plLOSRequestMsg::kTestAny || hit.distance < fDist)
{
// need one more test... if it is a clickable need to see if it is enabled
bool disabled = false;
if ( objKey )
{
plSceneObject* so = plSceneObject::ConvertNoRef( objKey->GetObjectPtr() );
if (so)
{
int i;
for ( i=0; i < so->GetNumModifiers(); i++)
{
plLogicModifier* lo = (plLogicModifier*)plLogicModifier::ConvertNoRef(so->GetModifier(i) );
if (lo)
{
disabled = lo->Disabled();
break;
}
}
}
}
if (!disabled)
{
fHitObj = objKey;
fNormal.Set(hit.worldNormal.x, hit.worldNormal.y, hit.worldNormal.z);
fPoint.Set(hit.worldImpact.x, hit.worldImpact.y, hit.worldImpact.z);
fDist = hit.distance;
if (fType == plLOSRequestMsg::kTestAny)
return false;
}
}
}
}
return true;
}
plSimDefs::plLOSDB fDB;
plLOSRequestMsg::TestType fType;
plKey fHitObj;
hsVector3 fNormal;
hsPoint3 fPoint;
hsScalar fDist;
} gMyReport;
plLOSDispatch::plLOSDispatch()
{
RegisterAs(kLOSObject_KEY);
plgDispatch::Dispatch()->RegisterForExactType(plLOSRequestMsg::Index(), GetKey());
}
plLOSDispatch::~plLOSDispatch()
{
plgDispatch::Dispatch()->UnRegisterForExactType(plLOSRequestMsg::Index(), GetKey());
}
hsBool plLOSDispatch::MsgReceive(plMessage* msg)
{
plLOSRequestMsg* requestMsg = plLOSRequestMsg::ConvertNoRef(msg);
if (requestMsg)
{
plProfile_BeginTiming(LineOfSight);
plSimulationMgr* sim = plSimulationMgr::GetInstance();
plKey worldKey = requestMsg->fWorldKey;
if (!worldKey)
{
plArmatureMod* av = plAvatarMgr::GetInstance()->GetLocalAvatar();
if ( av && av->GetController() )
worldKey = av->GetController()->GetSubworld();
}
hsPoint3 from = requestMsg->fFrom;
hsPoint3 at = requestMsg->fTo;
// requests are always sent in world space, but they might
// need to be converted to subworld space
hsMatrix44 l2w, w2l;
if (worldKey)
{
plSceneObject* so = plSceneObject::ConvertNoRef(worldKey->ObjectIsLoaded());
if (so)
{
l2w = so->GetLocalToWorld();
w2l = so->GetWorldToLocal();
from = w2l * from;
at = w2l * at;
}
}
else
{
l2w.Reset();
w2l.Reset();
}
NxScene* scene = sim->GetScene(worldKey);
gMyReport.InitCast(requestMsg->GetRequestType(), requestMsg->GetTestType());
hsVector3 norm = hsVector3(at - from);
hsScalar dist = norm.Magnitude();
norm.Normalize();
NxRay worldRay;
worldRay.dir = plPXConvert::Vector(norm);
worldRay.orig = plPXConvert::Point(from);
//PhysX will complain to log if ray distance is less than or equal to Zero, besides shouldn't bother throwing
// a point, and if we have negative we have some serious problems
if(dist>0.0f)
{
scene->raycastAllShapes(worldRay, gMyReport, NX_ALL_SHAPES, 0xffffffff, dist, NX_RAYCAST_DISTANCE | NX_RAYCAST_IMPACT | NX_RAYCAST_NORMAL);
}
else{
SimLog("%s sent out a LOS request with a ray length of %d.", requestMsg->GetSender()->GetName(), dist);
}
if (gMyReport.GotHit())
{
// We got a hit, save off the info
plMessage* hitMsg = ICreateHitMsg(requestMsg, l2w);
if (requestMsg->GetCullDB() != plSimDefs::kLOSDBNone)
{
// 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();
if(dist!=0.0)
{
gMyReport.InitCast(requestMsg->GetCullDB(), plLOSRequestMsg::kTestAny);
scene->raycastAllShapes(worldRay, gMyReport, NX_ALL_SHAPES, 0xffffffff, dist, NX_RAYCAST_DISTANCE | NX_RAYCAST_IMPACT | NX_RAYCAST_NORMAL);
if (gMyReport.GotHit())
{
delete hitMsg;
hitMsg = nil;
if (requestMsg->GetReportType() == plLOSRequestMsg::kReportMiss ||
requestMsg->GetReportType() == plLOSRequestMsg::kReportHitOrMiss)
{
ICreateMissMsg(requestMsg)->Send();
}
}
}
else// we are right on top of the object I assume that means we hit it
{// since PhysX would have complained we will log it anyways. Just so we have a better idea, where this
//was happening previously
SimLog("%s sent out a LOS request. The second cast for culling was of length 0. ABORTING and assuming hit.", requestMsg->GetSender()->GetName());
}
}
if (hitMsg &&
(requestMsg->GetReportType() == plLOSRequestMsg::kReportHit ||
requestMsg->GetReportType() == plLOSRequestMsg::kReportHitOrMiss))
hitMsg->Send();
}
else
{
if (requestMsg->GetReportType() == plLOSRequestMsg::kReportMiss ||
requestMsg->GetReportType() == plLOSRequestMsg::kReportHitOrMiss)
{
ICreateMissMsg(requestMsg)->Send();
}
}
plProfile_EndTiming(LineOfSight);
gMyReport.ResetHitObj();
return true;
}
return hsKeyedObject::MsgReceive(msg);
}
plMessage* plLOSDispatch::ICreateHitMsg(plLOSRequestMsg* requestMsg, hsMatrix44& l2w)
{
plKey ourKey = GetKey();
plKey rcvKey = requestMsg->GetSender();
plLOSHitMsg* hitMsg = TRACKED_NEW plLOSHitMsg(ourKey, rcvKey, nil);
hitMsg->fNoHit = false;
hitMsg->fObj = gMyReport.GetObj();
hitMsg->fDistance = gMyReport.GetDistance();
hitMsg->fNormal = l2w * gMyReport.GetNormal();
hitMsg->fHitPoint = l2w * gMyReport.GetPoint();
hitMsg->fRequestID = requestMsg->GetRequestID();
return hitMsg;
}
plMessage* plLOSDispatch::ICreateMissMsg(plLOSRequestMsg* requestMsg)
{
plKey ourKey = GetKey();
plKey rcvKey = requestMsg->GetSender();
plLOSHitMsg* missMsg = TRACKED_NEW plLOSHitMsg(ourKey, rcvKey, nil);
missMsg->fNoHit = true;
missMsg->fObj = nil;
missMsg->fRequestID = requestMsg->GetRequestID();
return missMsg;
}

View File

@ -1,67 +1,67 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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 "../pnKeyedObject/hsKeyedObject.h"
class plLOSRequestMsg;
struct hsMatrix44;
/** \class plLOSDispatch
Line-of-sight requests are sent to this guy, who then hands them
to the appropriate solvers, which can vary depending on such
criteria as which subworld the player is currently in.
Eventually we will have more variants of requests, such as
"search all subworlds," etc. */
class plLOSDispatch : public hsKeyedObject
{
public:
plLOSDispatch();
~plLOSDispatch();
CLASSNAME_REGISTER(plLOSDispatch);
GETINTERFACE_ANY(plLOSDispatch, hsKeyedObject);
virtual hsBool MsgReceive(plMessage* msg);
protected:
plMessage* ICreateHitMsg(plLOSRequestMsg* requestMsg, hsMatrix44& l2w);
plMessage* ICreateMissMsg(plLOSRequestMsg* requestMsg);
};
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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 "../pnKeyedObject/hsKeyedObject.h"
class plLOSRequestMsg;
struct hsMatrix44;
/** \class plLOSDispatch
Line-of-sight requests are sent to this guy, who then hands them
to the appropriate solvers, which can vary depending on such
criteria as which subworld the player is currently in.
Eventually we will have more variants of requests, such as
"search all subworlds," etc. */
class plLOSDispatch : public hsKeyedObject
{
public:
plLOSDispatch();
~plLOSDispatch();
CLASSNAME_REGISTER(plLOSDispatch);
GETINTERFACE_ANY(plLOSDispatch, hsKeyedObject);
virtual hsBool MsgReceive(plMessage* msg);
protected:
plMessage* ICreateHitMsg(plLOSRequestMsg* requestMsg, hsMatrix44& l2w);
plMessage* ICreateMissMsg(plLOSRequestMsg* requestMsg);
};

View File

@ -1,82 +1,82 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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 "plPXConvert.h"
bool plPXConvert::Validate()
{
NxVec3 nxVec;
hsVector3 plVec;
int nxVecXOffset = ((char*)&nxVec.x) - ((char*)&nxVec);
int nxVecYOffset = ((char*)&nxVec.y) - ((char*)&nxVec);
int nxVecZOffset = ((char*)&nxVec.z) - ((char*)&nxVec);
int plVecXOffset = ((char*)&plVec.fX) - ((char*)&plVec);
int plVecYOffset = ((char*)&plVec.fY) - ((char*)&plVec);
int plVecZOffset = ((char*)&plVec.fZ) - ((char*)&plVec);
NxQuat nxQuat;
hsQuat plQuat;
int nxQuatXOffset = ((char*)&nxQuat.x) - ((char*)&nxQuat);
int nxQuatYOffset = ((char*)&nxQuat.y) - ((char*)&nxQuat);
int nxQuatZOffset = ((char*)&nxQuat.z) - ((char*)&nxQuat);
int nxQuatWOffset = ((char*)&nxQuat.w) - ((char*)&nxQuat);
int plQuatXOffset = ((char*)&plQuat.fX) - ((char*)&plQuat);
int plQuatYOffset = ((char*)&plQuat.fY) - ((char*)&plQuat);
int plQuatZOffset = ((char*)&plQuat.fZ) - ((char*)&plQuat);
int plQuatWOffset = ((char*)&plQuat.fW) - ((char*)&plQuat);
bool offsetsOK =
nxVecXOffset == plVecXOffset &&
nxVecYOffset == plVecYOffset &&
nxVecZOffset == plVecZOffset &&
nxQuatXOffset == plQuatXOffset &&
nxQuatYOffset == plQuatYOffset &&
nxQuatZOffset == plQuatZOffset &&
nxQuatWOffset == plQuatWOffset;
hsAssert(offsetsOK, "PhysX or Plasma offsets have changed, need to rewrite conversion code");
return offsetsOK;
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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 "plPXConvert.h"
bool plPXConvert::Validate()
{
NxVec3 nxVec;
hsVector3 plVec;
int nxVecXOffset = ((char*)&nxVec.x) - ((char*)&nxVec);
int nxVecYOffset = ((char*)&nxVec.y) - ((char*)&nxVec);
int nxVecZOffset = ((char*)&nxVec.z) - ((char*)&nxVec);
int plVecXOffset = ((char*)&plVec.fX) - ((char*)&plVec);
int plVecYOffset = ((char*)&plVec.fY) - ((char*)&plVec);
int plVecZOffset = ((char*)&plVec.fZ) - ((char*)&plVec);
NxQuat nxQuat;
hsQuat plQuat;
int nxQuatXOffset = ((char*)&nxQuat.x) - ((char*)&nxQuat);
int nxQuatYOffset = ((char*)&nxQuat.y) - ((char*)&nxQuat);
int nxQuatZOffset = ((char*)&nxQuat.z) - ((char*)&nxQuat);
int nxQuatWOffset = ((char*)&nxQuat.w) - ((char*)&nxQuat);
int plQuatXOffset = ((char*)&plQuat.fX) - ((char*)&plQuat);
int plQuatYOffset = ((char*)&plQuat.fY) - ((char*)&plQuat);
int plQuatZOffset = ((char*)&plQuat.fZ) - ((char*)&plQuat);
int plQuatWOffset = ((char*)&plQuat.fW) - ((char*)&plQuat);
bool offsetsOK =
nxVecXOffset == plVecXOffset &&
nxVecYOffset == plVecYOffset &&
nxVecZOffset == plVecZOffset &&
nxQuatXOffset == plQuatXOffset &&
nxQuatYOffset == plQuatYOffset &&
nxQuatZOffset == plQuatZOffset &&
nxQuatWOffset == plQuatWOffset;
hsAssert(offsetsOK, "PhysX or Plasma offsets have changed, need to rewrite conversion code");
return offsetsOK;
}

View File

@ -1,79 +1,79 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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==*/
#ifndef plPXConvert_h_inc
#define plPXConvert_h_inc
#include "hsGeometry3.h"
#include "hsQuat.h"
#include "hsMatrix44.h"
#include "NxVec3.h"
#include "NxQuat.h"
#include "NxMat34.h"
// Converts to and from the PhysX types
namespace plPXConvert
{
// The following conversions are just casts, due to the fact that the Plasma
// and PhysX vector and quat classes don't have any virtual fuctions and have
// all their data in the same offsets.
inline NxVec3& Point(hsPoint3& vec) { return *((NxVec3*)&vec); }
inline const NxVec3& Point(const hsPoint3& vec) { return *((NxVec3*)&vec); }
inline hsPoint3& Point(NxVec3& vec) { return *((hsPoint3*)&vec); }
inline const hsPoint3& Point(const NxVec3& vec) { return *((hsPoint3*)&vec); }
inline NxVec3& Vector(hsVector3& vel) { return *((NxVec3*)&vel); }
inline const NxVec3& Vector(const hsVector3& vel){ return *((NxVec3*)&vel); }
inline hsVector3& Vector(NxVec3& vec) { return *((hsVector3*)&vec); }
inline const hsVector3& Vector(const NxVec3& vec) { return *((hsVector3*)&vec); }
inline const NxQuat& Quat(const hsQuat& quat) { return *((NxQuat*)&quat); }
inline const hsQuat& Quat(const NxQuat& quat) { return *((hsQuat*)&quat); }
// The matrix data doesn't match up, so we have to convert it
inline void Matrix(const hsMatrix44& fromMat, NxMat34& toMat) { toMat.setRowMajor44(&fromMat.fMap[0][0]); }
inline void Matrix(const NxMat34& fromMat, hsMatrix44& toMat) { toMat.NotIdentity(); fromMat.getRowMajor44(&toMat.fMap[0][0]); }
bool Validate();
};
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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==*/
#ifndef plPXConvert_h_inc
#define plPXConvert_h_inc
#include "hsGeometry3.h"
#include "hsQuat.h"
#include "hsMatrix44.h"
#include "NxVec3.h"
#include "NxQuat.h"
#include "NxMat34.h"
// Converts to and from the PhysX types
namespace plPXConvert
{
// The following conversions are just casts, due to the fact that the Plasma
// and PhysX vector and quat classes don't have any virtual fuctions and have
// all their data in the same offsets.
inline NxVec3& Point(hsPoint3& vec) { return *((NxVec3*)&vec); }
inline const NxVec3& Point(const hsPoint3& vec) { return *((NxVec3*)&vec); }
inline hsPoint3& Point(NxVec3& vec) { return *((hsPoint3*)&vec); }
inline const hsPoint3& Point(const NxVec3& vec) { return *((hsPoint3*)&vec); }
inline NxVec3& Vector(hsVector3& vel) { return *((NxVec3*)&vel); }
inline const NxVec3& Vector(const hsVector3& vel){ return *((NxVec3*)&vel); }
inline hsVector3& Vector(NxVec3& vec) { return *((hsVector3*)&vec); }
inline const hsVector3& Vector(const NxVec3& vec) { return *((hsVector3*)&vec); }
inline const NxQuat& Quat(const hsQuat& quat) { return *((NxQuat*)&quat); }
inline const hsQuat& Quat(const NxQuat& quat) { return *((hsQuat*)&quat); }
// The matrix data doesn't match up, so we have to convert it
inline void Matrix(const hsMatrix44& fromMat, NxMat34& toMat) { toMat.setRowMajor44(&fromMat.fMap[0][0]); }
inline void Matrix(const NxMat34& fromMat, hsMatrix44& toMat) { toMat.NotIdentity(); fromMat.getRowMajor44(&toMat.fMap[0][0]); }
bool Validate();
};
#endif // plPXConvert_h_inc

File diff suppressed because it is too large Load Diff

View File

@ -1,296 +1,296 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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==*/
#ifndef plPXPhysical_h_inc
#define plPXPhysical_h_inc
#include "plPhysical.h"
#include "hsMatrix44.h"
#include "../plPhysical/plSimDefs.h"
#include "hsBitVector.h"
#include "hsUtils.h"
class NxActor;
class NxConvexMesh;
class NxTriangleMesh;
struct hsPoint3;
class hsQuat;
class plPhysicalProxy;
class plDrawableSpans;
class hsGMaterial;
struct hsPlane3;
class plMessage;
class plLOSHit;
class plSimulationMsg;
class plSDLModifier;
class plPhysicalSndGroup;
class plGenRefMsg;
class plSceneObject;
class hsVectorStream;
class NxCapsule;
class PhysRecipe
{
public:
PhysRecipe();
hsScalar mass;
hsScalar friction;
hsScalar restitution;
plSimDefs::Bounds bounds;
plSimDefs::Group group;
UInt32 reportsOn;
plKey objectKey;
plKey sceneNode;
plKey worldKey;
// The local to subworld matrix (or local to world if worldKey is nil)
hsMatrix44 l2s;
NxConvexMesh* convexMesh;
NxTriangleMesh* triMesh;
// For spheres only
hsScalar radius;
hsPoint3 offset;
// For Boxes
hsPoint3 bDimensions;
hsPoint3 bOffset;
// For export time only. The original data used to create the mesh
hsVectorStream* meshStream;
};
class plPXPhysical : public plPhysical
{
public:
friend class plSimulationMgr;
enum PhysRefType
{
kPhysRefWorld,
kPhysRefSndGroup
};
plPXPhysical();
virtual ~plPXPhysical();
CLASSNAME_REGISTER(plPXPhysical);
GETINTERFACE_ANY(plPXPhysical, plPhysical);
// Export time and internal use only
hsBool Init(PhysRecipe& recipe);
virtual void Read(hsStream* s, hsResMgr* mgr);
virtual void Write(hsStream* s, hsResMgr* mgr);
virtual hsBool MsgReceive(plMessage* msg);
//
// From plPhysical
//
virtual plPhysical& SetProperty(int prop, hsBool b);
virtual hsBool GetProperty(int prop) const { return fProps.IsBitSet(prop) != 0; }
virtual void SetObjectKey(plKey key) { fObjectKey = key; }
virtual plKey GetObjectKey() const { return fObjectKey; }
virtual void SetSceneNode(plKey node);
virtual plKey GetSceneNode() const;
virtual hsBool GetLinearVelocitySim(hsVector3& vel) const;
virtual void SetLinearVelocitySim(const hsVector3& vel);
virtual void ClearLinearVelocity();
virtual hsBool GetAngularVelocitySim(hsVector3& vel) const;
virtual void SetAngularVelocitySim(const hsVector3& vel);
virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l, hsBool force=false);
virtual void GetTransform(hsMatrix44& l2w, hsMatrix44& w2l);
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 hsBool DoDetectorHullWorkaround() { return fSaveTriangles ? true : false; }
virtual hsBool Should_I_Trigger(hsBool enter, hsPoint3& pos);
virtual hsBool IsObjectInsideHull(const hsPoint3& pos);
virtual void SetInsideConvexHull(hsBool inside) { fInsideConvexHull = inside; }
virtual plKey GetWorldKey() const { return fWorldKey; }
virtual plPhysicalSndGroup* GetSoundGroup() const { return fSndGroup; }
virtual void GetPositionSim(hsPoint3& pos) const { IGetPositionSim(pos); }
virtual void SendNewLocation(hsBool synchTransform = false, hsBool isSynchUpdate = false);
virtual void SetHitForce(const hsVector3& force, const hsPoint3& pos) { fWeWereHit=true; fHitForce = force; fHitPos = pos; }
virtual void ApplyHitForce();
virtual void ResetHitForce() { fWeWereHit=false; fHitForce.Set(0,0,0); fHitPos.Set(0,0,0); }
virtual void GetSyncState(hsPoint3& pos, hsQuat& rot, hsVector3& linV, hsVector3& angV);
virtual void SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsVector3* angV);
virtual void ExcludeRegionHack(hsBool cleared);
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo);
hsBool DoReportOn(plSimDefs::Group group) const { return hsCheckBits(fReportsOn, 1<<group); }
// Returns true if this object is *really* dynamic. We can have physicals
// that are in the dynamic group but are actually animated or something.
// This weeds those out.
hsBool IsDynamic() const;
//Hack to check if there is an overlap with the capsule
//this partially for exclude regions vs avatar capsule
virtual hsBool OverlapWithCapsule(NxCapsule& cap);
virtual hsScalar GetMass() {return fMass;}
protected:
class NxConvexMesh* IReadHull(hsStream* s);
class NxTriangleMesh* IReadTriMesh(hsStream* s);
void IGetPositionSim(hsPoint3& pos) const;
void IGetRotationSim(hsQuat& rot) const;
void ISetPositionSim(const hsPoint3& pos);
void ISetRotationSim(const hsQuat& rot);
/** Handle messages about our references. */
hsBool HandleRefMsg(plGenRefMsg * refM);
/////////////////////////////////////////////////////////////
//
// WORLDS, SUBWORLDS && CONTEXTS
//
/////////////////////////////////////////////////////////////
void IConvertGroups(UInt32 memberOf, UInt32 reportsOn, UInt32 collideWith);
/** See if the object is in a valid, non-overlapping position.
A valid overlap is one which is approved by the collision
masking code, i.e. my memberOf has no intersection with your
bounceOff and vice-versa
*/
// Set overlapText to get a string naming all the overlapping physicals (that you must delete)
hsBool CheckValidPosition(char** overlapText=nil);
/////////////////////////////////////////////////////////////
//
// NETWORK SYNCHRONIZATION
//
/////////////////////////////////////////////////////////////
/** Remember that we need to do a synch soon. */
hsBool DirtySynchState(const char* SDLStateName, UInt32 synchFlags );
double GetLastSyncTime() { return fLastSyncTime; }
/** Get the simulation transform of the physical, in world
coordinates (factoring in the subworld if necessary */
void IGetTransformGlobal(hsMatrix44 &l2w) const;
void ISetTransformGlobal(const hsMatrix44& l2w);
// Enable/disable collisions and dynamic movement
void IEnable(hsBool enable);
void IMakeHull(NxConvexMesh* convexMesh, hsMatrix44 l2w);
NxActor* fActor;
plKey fWorldKey; // either a subworld or nil
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
hsBitVector fProps; // plSimulationInterface::plSimulationProperties kept here
float fMass;
plKey fObjectKey; // the key to our scene object
plKey fSceneNode; // the room we're in
// PHYSX FIXME - need to create a plasma hull so that we can determine if inside
hsPlane3* fWorldHull;
UInt32 fHullNumberPlanes;
hsPoint3* fSaveTriangles;
hsBool fInsideConvexHull;
void ISetHullToWorldWTriangles();
inline hsBool ITestPlane(const hsPoint3 &pos, const hsPlane3 &plane)
{
hsScalar dis = plane.fN.InnerProduct(pos);
dis += plane.fD;
if (dis == 0.f)
return false;
if( dis >= 0.f )
return false;
return true;
}
// we need to remember the last matrices we sent to the coordinate interface
// so that we can recognize them when we send them back and not reapply them,
// which would reactivate our body. inelegant but effective
hsMatrix44 fCachedLocal2World;
// Syncronization
double fLastSyncTime;
plSDLModifier* fSDLMod;
plPhysicalSndGroup* fSndGroup;
hsBool fWeWereHit;
hsVector3 fHitForce;
hsPoint3 fHitPos;
plPhysicalProxy* fProxyGen; // visual proxy for debugging
static int fNumberAnimatedPhysicals;
static int fNumberAnimatedActivators;
};
#endif
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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==*/
#ifndef plPXPhysical_h_inc
#define plPXPhysical_h_inc
#include "plPhysical.h"
#include "hsMatrix44.h"
#include "../plPhysical/plSimDefs.h"
#include "hsBitVector.h"
#include "hsUtils.h"
class NxActor;
class NxConvexMesh;
class NxTriangleMesh;
struct hsPoint3;
class hsQuat;
class plPhysicalProxy;
class plDrawableSpans;
class hsGMaterial;
struct hsPlane3;
class plMessage;
class plLOSHit;
class plSimulationMsg;
class plSDLModifier;
class plPhysicalSndGroup;
class plGenRefMsg;
class plSceneObject;
class hsVectorStream;
class NxCapsule;
class PhysRecipe
{
public:
PhysRecipe();
hsScalar mass;
hsScalar friction;
hsScalar restitution;
plSimDefs::Bounds bounds;
plSimDefs::Group group;
UInt32 reportsOn;
plKey objectKey;
plKey sceneNode;
plKey worldKey;
// The local to subworld matrix (or local to world if worldKey is nil)
hsMatrix44 l2s;
NxConvexMesh* convexMesh;
NxTriangleMesh* triMesh;
// For spheres only
hsScalar radius;
hsPoint3 offset;
// For Boxes
hsPoint3 bDimensions;
hsPoint3 bOffset;
// For export time only. The original data used to create the mesh
hsVectorStream* meshStream;
};
class plPXPhysical : public plPhysical
{
public:
friend class plSimulationMgr;
enum PhysRefType
{
kPhysRefWorld,
kPhysRefSndGroup
};
plPXPhysical();
virtual ~plPXPhysical();
CLASSNAME_REGISTER(plPXPhysical);
GETINTERFACE_ANY(plPXPhysical, plPhysical);
// Export time and internal use only
hsBool Init(PhysRecipe& recipe);
virtual void Read(hsStream* s, hsResMgr* mgr);
virtual void Write(hsStream* s, hsResMgr* mgr);
virtual hsBool MsgReceive(plMessage* msg);
//
// From plPhysical
//
virtual plPhysical& SetProperty(int prop, hsBool b);
virtual hsBool GetProperty(int prop) const { return fProps.IsBitSet(prop) != 0; }
virtual void SetObjectKey(plKey key) { fObjectKey = key; }
virtual plKey GetObjectKey() const { return fObjectKey; }
virtual void SetSceneNode(plKey node);
virtual plKey GetSceneNode() const;
virtual hsBool GetLinearVelocitySim(hsVector3& vel) const;
virtual void SetLinearVelocitySim(const hsVector3& vel);
virtual void ClearLinearVelocity();
virtual hsBool GetAngularVelocitySim(hsVector3& vel) const;
virtual void SetAngularVelocitySim(const hsVector3& vel);
virtual void SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l, hsBool force=false);
virtual void GetTransform(hsMatrix44& l2w, hsMatrix44& w2l);
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 hsBool DoDetectorHullWorkaround() { return fSaveTriangles ? true : false; }
virtual hsBool Should_I_Trigger(hsBool enter, hsPoint3& pos);
virtual hsBool IsObjectInsideHull(const hsPoint3& pos);
virtual void SetInsideConvexHull(hsBool inside) { fInsideConvexHull = inside; }
virtual plKey GetWorldKey() const { return fWorldKey; }
virtual plPhysicalSndGroup* GetSoundGroup() const { return fSndGroup; }
virtual void GetPositionSim(hsPoint3& pos) const { IGetPositionSim(pos); }
virtual void SendNewLocation(hsBool synchTransform = false, hsBool isSynchUpdate = false);
virtual void SetHitForce(const hsVector3& force, const hsPoint3& pos) { fWeWereHit=true; fHitForce = force; fHitPos = pos; }
virtual void ApplyHitForce();
virtual void ResetHitForce() { fWeWereHit=false; fHitForce.Set(0,0,0); fHitPos.Set(0,0,0); }
virtual void GetSyncState(hsPoint3& pos, hsQuat& rot, hsVector3& linV, hsVector3& angV);
virtual void SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsVector3* angV);
virtual void ExcludeRegionHack(hsBool cleared);
virtual plDrawableSpans* CreateProxy(hsGMaterial* mat, hsTArray<UInt32>& idx, plDrawableSpans* addTo);
hsBool DoReportOn(plSimDefs::Group group) const { return hsCheckBits(fReportsOn, 1<<group); }
// Returns true if this object is *really* dynamic. We can have physicals
// that are in the dynamic group but are actually animated or something.
// This weeds those out.
hsBool IsDynamic() const;
//Hack to check if there is an overlap with the capsule
//this partially for exclude regions vs avatar capsule
virtual hsBool OverlapWithCapsule(NxCapsule& cap);
virtual hsScalar GetMass() {return fMass;}
protected:
class NxConvexMesh* IReadHull(hsStream* s);
class NxTriangleMesh* IReadTriMesh(hsStream* s);
void IGetPositionSim(hsPoint3& pos) const;
void IGetRotationSim(hsQuat& rot) const;
void ISetPositionSim(const hsPoint3& pos);
void ISetRotationSim(const hsQuat& rot);
/** Handle messages about our references. */
hsBool HandleRefMsg(plGenRefMsg * refM);
/////////////////////////////////////////////////////////////
//
// WORLDS, SUBWORLDS && CONTEXTS
//
/////////////////////////////////////////////////////////////
void IConvertGroups(UInt32 memberOf, UInt32 reportsOn, UInt32 collideWith);
/** See if the object is in a valid, non-overlapping position.
A valid overlap is one which is approved by the collision
masking code, i.e. my memberOf has no intersection with your
bounceOff and vice-versa
*/
// Set overlapText to get a string naming all the overlapping physicals (that you must delete)
hsBool CheckValidPosition(char** overlapText=nil);
/////////////////////////////////////////////////////////////
//
// NETWORK SYNCHRONIZATION
//
/////////////////////////////////////////////////////////////
/** Remember that we need to do a synch soon. */
hsBool DirtySynchState(const char* SDLStateName, UInt32 synchFlags );
double GetLastSyncTime() { return fLastSyncTime; }
/** Get the simulation transform of the physical, in world
coordinates (factoring in the subworld if necessary */
void IGetTransformGlobal(hsMatrix44 &l2w) const;
void ISetTransformGlobal(const hsMatrix44& l2w);
// Enable/disable collisions and dynamic movement
void IEnable(hsBool enable);
void IMakeHull(NxConvexMesh* convexMesh, hsMatrix44 l2w);
NxActor* fActor;
plKey fWorldKey; // either a subworld or nil
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
hsBitVector fProps; // plSimulationInterface::plSimulationProperties kept here
float fMass;
plKey fObjectKey; // the key to our scene object
plKey fSceneNode; // the room we're in
// PHYSX FIXME - need to create a plasma hull so that we can determine if inside
hsPlane3* fWorldHull;
UInt32 fHullNumberPlanes;
hsPoint3* fSaveTriangles;
hsBool fInsideConvexHull;
void ISetHullToWorldWTriangles();
inline hsBool ITestPlane(const hsPoint3 &pos, const hsPlane3 &plane)
{
hsScalar dis = plane.fN.InnerProduct(pos);
dis += plane.fD;
if (dis == 0.f)
return false;
if( dis >= 0.f )
return false;
return true;
}
// we need to remember the last matrices we sent to the coordinate interface
// so that we can recognize them when we send them back and not reapply them,
// which would reactivate our body. inelegant but effective
hsMatrix44 fCachedLocal2World;
// Syncronization
double fLastSyncTime;
plSDLModifier* fSDLMod;
plPhysicalSndGroup* fSndGroup;
hsBool fWeWereHit;
hsVector3 fHitForce;
hsPoint3 fHitPos;
plPhysicalProxy* fProxyGen; // visual proxy for debugging
static int fNumberAnimatedPhysicals;
static int fNumberAnimatedActivators;
};
#endif

View File

@ -1,173 +1,173 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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;
class NxCapsule;
class PXControllerHitReport;
class plPhysicalProxy;
class plDrawableSpans;
class hsGMaterial;
class plSceneObject;
class plPXPhysical;
class plCollideMsg;
#ifndef PLASMA_EXTERNAL_RELEASE
class plDbgCollisionInfo
{
public:
plSceneObject *fSO;
hsVector3 fNormal;
hsBool fOverlap;
};
#endif // PLASMA_EXTERNAL_RELEASE
class plPXPhysicalControllerCore: public plPhysicalControllerCore
{
public:
plPXPhysicalControllerCore(plKey ownerSO, hsScalar height, hsScalar radius, bool human);
~plPXPhysicalControllerCore();
// An ArmatureMod has its own idea about when physics should be enabled/disabled.
// Use plArmatureModBase::EnablePhysics() instead.
virtual void Enable(bool enable);
// Subworld
virtual void SetSubworld(plKey world);
// For the avatar SDL only
virtual void GetState(hsPoint3& pos, float& zRot);
virtual void SetState(const hsPoint3& pos, float zRot);
// 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
virtual void LeaveAge();
// 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);
//////////////////////////////////////////
//Static Helper Functions
////////////////////////////////////////
// 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
static bool AnyControllersInThisWorld(plKey world);
static int GetNumberOfControllersInThisSubWorld(plKey world);
static int GetControllersInThisSubWorld(plKey world, int maxToReturn, plPXPhysicalControllerCore** bufferout);
// Controller count
static int NumControllers();
static void SetMaxNumberOfControllers(int max) { fPXControllersMax = max; }
static int fPXControllersMax;
#ifndef PLASMA_EXTERNAL_RELEASE
static hsBool fDebugDisplay;
#endif
protected:
friend class PXControllerHitReport;
virtual void IHandleEnableChanged();
void IInformDetectors(bool entering);
void ICreateController(const hsPoint3& pos);
void IDeleteController();
void IDispatchQueuedMsgs();
void IProcessDynamicHits();
#ifndef PLASMA_EXTERNAL_RELEASE
void IDrawDebugDisplay();
hsTArray<plDbgCollisionInfo> fDbgCollisionInfo;
#endif
std::vector<plCollideMsg*> fQueuedCollideMsgs;
std::vector<plPXPhysical*> fDynamicHits;
NxCapsuleController* fController;
NxActor* fActor;
plPhysicalProxy* fProxyGen;
bool fKinematicCCT;
bool fHuman;
};
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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;
class NxCapsule;
class PXControllerHitReport;
class plPhysicalProxy;
class plDrawableSpans;
class hsGMaterial;
class plSceneObject;
class plPXPhysical;
class plCollideMsg;
#ifndef PLASMA_EXTERNAL_RELEASE
class plDbgCollisionInfo
{
public:
plSceneObject *fSO;
hsVector3 fNormal;
hsBool fOverlap;
};
#endif // PLASMA_EXTERNAL_RELEASE
class plPXPhysicalControllerCore: public plPhysicalControllerCore
{
public:
plPXPhysicalControllerCore(plKey ownerSO, hsScalar height, hsScalar radius, bool human);
~plPXPhysicalControllerCore();
// An ArmatureMod has its own idea about when physics should be enabled/disabled.
// Use plArmatureModBase::EnablePhysics() instead.
virtual void Enable(bool enable);
// Subworld
virtual void SetSubworld(plKey world);
// For the avatar SDL only
virtual void GetState(hsPoint3& pos, float& zRot);
virtual void SetState(const hsPoint3& pos, float zRot);
// 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
virtual void LeaveAge();
// 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);
//////////////////////////////////////////
//Static Helper Functions
////////////////////////////////////////
// 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
static bool AnyControllersInThisWorld(plKey world);
static int GetNumberOfControllersInThisSubWorld(plKey world);
static int GetControllersInThisSubWorld(plKey world, int maxToReturn, plPXPhysicalControllerCore** bufferout);
// Controller count
static int NumControllers();
static void SetMaxNumberOfControllers(int max) { fPXControllersMax = max; }
static int fPXControllersMax;
#ifndef PLASMA_EXTERNAL_RELEASE
static hsBool fDebugDisplay;
#endif
protected:
friend class PXControllerHitReport;
virtual void IHandleEnableChanged();
void IInformDetectors(bool entering);
void ICreateController(const hsPoint3& pos);
void IDeleteController();
void IDispatchQueuedMsgs();
void IProcessDynamicHits();
#ifndef PLASMA_EXTERNAL_RELEASE
void IDrawDebugDisplay();
hsTArray<plDbgCollisionInfo> fDbgCollisionInfo;
#endif
std::vector<plCollideMsg*> fQueuedCollideMsgs;
std::vector<plPXPhysical*> fDynamicHits;
NxCapsuleController* fController;
NxActor* fActor;
plPhysicalProxy* fProxyGen;
bool fKinematicCCT;
bool fHuman;
};

View File

@ -1,73 +1,73 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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==*/
#ifndef plPXStream_h_inc
#define plPXStream_h_inc
#include "hsStream.h"
#include "NxPhysics.h"
#include "NxStream.h"
// A super simple wrapper to convert a Plasma stream into a PhysX one
class plPXStream : public NxStream
{
public:
plPXStream(hsStream* s) : fStream(s) {}
virtual NxU8 readByte() const { return fStream->ReadByte(); }
virtual NxU16 readWord() const { return fStream->ReadSwap16(); }
virtual NxU32 readDword() const { return fStream->ReadSwap32(); }
virtual float readFloat() const { return fStream->ReadSwapScalar(); }
virtual double readDouble() const { return fStream->ReadSwapDouble(); }
virtual void readBuffer(void* buffer, NxU32 size) const { fStream->Read(size, buffer); }
virtual NxStream& storeByte(NxU8 b) { fStream->WriteByte(b); return *this; }
virtual NxStream& storeWord(NxU16 w) { fStream->WriteSwap16(w); return *this; }
virtual NxStream& storeDword(NxU32 d) { fStream->WriteSwap32(d); return *this; }
virtual NxStream& storeFloat(NxReal f) { fStream->WriteSwapScalar(f); return *this; }
virtual NxStream& storeDouble(NxF64 f) { fStream->WriteSwapDouble(f); return *this; }
virtual NxStream& storeBuffer(const void* buffer, NxU32 size) { fStream->Write(size, buffer); return *this; }
protected:
hsStream* fStream;
};
#endif // plPXStream_h_inc
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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==*/
#ifndef plPXStream_h_inc
#define plPXStream_h_inc
#include "hsStream.h"
#include "NxPhysics.h"
#include "NxStream.h"
// A super simple wrapper to convert a Plasma stream into a PhysX one
class plPXStream : public NxStream
{
public:
plPXStream(hsStream* s) : fStream(s) {}
virtual NxU8 readByte() const { return fStream->ReadByte(); }
virtual NxU16 readWord() const { return fStream->ReadSwap16(); }
virtual NxU32 readDword() const { return fStream->ReadSwap32(); }
virtual float readFloat() const { return fStream->ReadSwapScalar(); }
virtual double readDouble() const { return fStream->ReadSwapDouble(); }
virtual void readBuffer(void* buffer, NxU32 size) const { fStream->Read(size, buffer); }
virtual NxStream& storeByte(NxU8 b) { fStream->WriteByte(b); return *this; }
virtual NxStream& storeWord(NxU16 w) { fStream->WriteSwap16(w); return *this; }
virtual NxStream& storeDword(NxU32 d) { fStream->WriteSwap32(d); return *this; }
virtual NxStream& storeFloat(NxReal f) { fStream->WriteSwapScalar(f); return *this; }
virtual NxStream& storeDouble(NxF64 f) { fStream->WriteSwapDouble(f); return *this; }
virtual NxStream& storeBuffer(const void* buffer, NxU32 size) { fStream->Write(size, buffer); return *this; }
protected:
hsStream* fStream;
};
#endif // plPXStream_h_inc

View File

@ -1,71 +1,71 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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==*/
#ifndef plPhysXCreatable_inc
#define plPhysXCreatable_inc
#include "../pnFactory/plCreator.h"
#include "plPXPhysical.h"
REGISTER_CREATABLE(plPXPhysical);
//#include "plHKSimulationSynchMsg.h"
//REGISTER_CREATABLE(plHKSimulationSynchMsg);
//#include "plHavokConstraintTools.h"
//REGISTER_NONCREATABLE(plHavokConstraintsMod);
//REGISTER_CREATABLE(plHingeConstraintMod);
//REGISTER_CREATABLE(plStrongSpringConstraintMod);
//REGISTER_CREATABLE(plWheelConstraintMod);
#include "plLOSDispatch.h"
REGISTER_CREATABLE( plLOSDispatch );
#include "plSimulationMgr.h"
REGISTER_CREATABLE( plSimulationMgr );
//#include "plVehicleModifier.h"
//REGISTER_CREATABLE(plVehicleModifier);
#endif // plPhysXCreatable_inc
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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==*/
#ifndef plPhysXCreatable_inc
#define plPhysXCreatable_inc
#include "../pnFactory/plCreator.h"
#include "plPXPhysical.h"
REGISTER_CREATABLE(plPXPhysical);
//#include "plHKSimulationSynchMsg.h"
//REGISTER_CREATABLE(plHKSimulationSynchMsg);
//#include "plHavokConstraintTools.h"
//REGISTER_NONCREATABLE(plHavokConstraintsMod);
//REGISTER_CREATABLE(plHingeConstraintMod);
//REGISTER_CREATABLE(plStrongSpringConstraintMod);
//REGISTER_CREATABLE(plWheelConstraintMod);
#include "plLOSDispatch.h"
REGISTER_CREATABLE( plLOSDispatch );
#include "plSimulationMgr.h"
REGISTER_CREATABLE( plSimulationMgr );
//#include "plVehicleModifier.h"
//REGISTER_CREATABLE(plVehicleModifier);
#endif // plPhysXCreatable_inc

File diff suppressed because it is too large Load Diff

View File

@ -1,212 +1,212 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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==*/
#ifndef plSimulationMgr_H
#define plSimulationMgr_H
#include "hsStlUtils.h"
#include "../pnKeyedObject/hsKeyedObject.h"
#include "hsTemplates.h"
class plPXPhysical;
class plLOSDispatch;
class plStatusLog;
class plPhysicsSoundMgr;
class NxPhysicsSDK;
class NxScene;
class plCollideMsg;
struct hsPoint3;
class plSimulationMgr : public hsKeyedObject
{
public:
CLASSNAME_REGISTER(plSimulationMgr);
GETINTERFACE_ANY(plSimulationMgr, hsKeyedObject);
static plSimulationMgr* GetInstance();
static void Init();
static void Shutdown();
static bool fExtraProfile;
static bool fSubworldOptimization;
static bool fDoClampingOnStep;
// initialiation of the PhysX simulation
virtual bool InitSimulation();
// Advance the simulation by the given number of seconds
void Advance(float delSecs);
// The simulation won't run at all if it is suspended
void Suspend() { fSuspended = true; }
void Resume() { fSuspended = false; }
bool IsSuspended() { return fSuspended; }
// Output the given debug text to the simulation log.
static void Log(const char* formatStr, ...);
static void LogV(const char* formatStr, va_list args);
static void ClearLog();
// We've detected a collision, which may be grounds for synchronizing the involved
// physicals over the network.
void ConsiderSynch(plPXPhysical *physical, plPXPhysical *other);
NxPhysicsSDK* GetSDK() const { return fSDK; }
NxScene* GetScene(plKey world);
// Called when an actor is removed from a scene, checks if it's time to delete
// the scene
void ReleaseScene(plKey world);
int GetMaterialIdx(NxScene* scene, hsScalar friction, hsScalar restitution);
UInt32 GetStepCount() { return fStepCount; }
// 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);
void UpdateAvatarInDetector(plKey world, plPXPhysical* detector);
//Fix to Move collision messages and their handling out of the simulation step
void AddCollisionMsg(plCollideMsg* msg);
#ifndef PLASMA_EXTERNAL_RELEASE
static bool fDisplayAwakeActors;
#endif //PLASMA_EXTERNAL_RELEASE
protected:
friend class ContactReport;
void ISendUpdates();
plSimulationMgr();
virtual ~plSimulationMgr();
// Set the maximum amount of time (in seconds) that the physics will advance
// between frames. If a frame-to-frame delta is bigger than this, we'll
// clamp it to this value.
// WARNING: animation doesn't do this, so if we clamp the time animated
// physicals and the avatar may move at a faster rate than usual.
void SetMaxDelta(float maxDelta);
float GetMaxDelta() const;
// Set the number of steps per second that physics will advance.
// The more steps per second, the less fallthough and more accurate
// simulation response.
void SetStepsPerSecond(int stepsPerSecond);
int GetStepsPerSecond();
// Walk through the synchronization requests and send them as appropriate.
void IProcessSynchs();
// PHYSX FIXME send a collision message - should only be used with UpdateDetectorsInScene
void ISendCollisionMsg(plKey receiver, plKey hitter, hsBool entering);
NxPhysicsSDK* fSDK;
plPhysicsSoundMgr* fSoundMgr;
//a list of collision messages generated by the simulation steps. Added to by AddCollisionMsg(plCollideMsg* msg)
//cleared by IDispatchCollisionMessages when done
hsTArray<plCollideMsg*> fCollisionMessages;
void IDispatchCollisionMessages();
// A mapping from a key to a PhysX scene. The key is either the
// SimulationMgr key, for the main world, or a SceneObject key if it's a
// subworld.
typedef std::map<plKey, NxScene*> SceneMap;
SceneMap fScenes;
plLOSDispatch* fLOSDispatch;
// Is the entire physics world suspended? If so, the clock can still advance
// but nothing will move.
bool fSuspended;
float fMaxDelta;
float fStepSize;
float fAccumulator;
UInt32 fStepCount;
// A utility class to keep track of a request for a physical synchronization.
// These requests must pass a certain criteria (see the code for the latest)
// before they are actually either sent over the network or rejected.
class SynchRequest
{
public:
double fTime; // when to synch
plKey fKey; // key of the object to be synched, so we can make sure it still lives
static const double kDefaultTime;
SynchRequest() : fTime(kDefaultTime) {};
};
// All currently pending synch requests. Keyed by the physical in question
// so we can quickly eliminate redundant requests, which are very common.
typedef std::map<plPXPhysical*, SynchRequest> PhysSynchMap;
PhysSynchMap fPendingSynchs;
plStatusLog *fLog;
#ifndef PLASMA_EXTERNAL_RELEASE
void IDrawActiveActorList();
#endif //PLASMA_EXTERNAL_RELEASE
};
#define SIM_VERBOSE
#ifdef SIM_VERBOSE
#include <stdarg.h> // only include when we need to call plSimulationMgr::Log
inline void SimLog(const char *str, ...)
{
va_list args;
va_start(args, str);
plSimulationMgr::LogV(str, args);
va_end(args);
}
#else
inline void SimLog(const char *str, ...)
{
// will get stripped out
}
#endif
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
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.
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==*/
#ifndef plSimulationMgr_H
#define plSimulationMgr_H
#include "hsStlUtils.h"
#include "../pnKeyedObject/hsKeyedObject.h"
#include "hsTemplates.h"
class plPXPhysical;
class plLOSDispatch;
class plStatusLog;
class plPhysicsSoundMgr;
class NxPhysicsSDK;
class NxScene;
class plCollideMsg;
struct hsPoint3;
class plSimulationMgr : public hsKeyedObject
{
public:
CLASSNAME_REGISTER(plSimulationMgr);
GETINTERFACE_ANY(plSimulationMgr, hsKeyedObject);
static plSimulationMgr* GetInstance();
static void Init();
static void Shutdown();
static bool fExtraProfile;
static bool fSubworldOptimization;
static bool fDoClampingOnStep;
// initialiation of the PhysX simulation
virtual bool InitSimulation();
// Advance the simulation by the given number of seconds
void Advance(float delSecs);
// The simulation won't run at all if it is suspended
void Suspend() { fSuspended = true; }
void Resume() { fSuspended = false; }
bool IsSuspended() { return fSuspended; }
// Output the given debug text to the simulation log.
static void Log(const char* formatStr, ...);
static void LogV(const char* formatStr, va_list args);
static void ClearLog();
// We've detected a collision, which may be grounds for synchronizing the involved
// physicals over the network.
void ConsiderSynch(plPXPhysical *physical, plPXPhysical *other);
NxPhysicsSDK* GetSDK() const { return fSDK; }
NxScene* GetScene(plKey world);
// Called when an actor is removed from a scene, checks if it's time to delete
// the scene
void ReleaseScene(plKey world);
int GetMaterialIdx(NxScene* scene, hsScalar friction, hsScalar restitution);
UInt32 GetStepCount() { return fStepCount; }
// 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);
void UpdateAvatarInDetector(plKey world, plPXPhysical* detector);
//Fix to Move collision messages and their handling out of the simulation step
void AddCollisionMsg(plCollideMsg* msg);
#ifndef PLASMA_EXTERNAL_RELEASE
static bool fDisplayAwakeActors;
#endif //PLASMA_EXTERNAL_RELEASE
protected:
friend class ContactReport;
void ISendUpdates();
plSimulationMgr();
virtual ~plSimulationMgr();
// Set the maximum amount of time (in seconds) that the physics will advance
// between frames. If a frame-to-frame delta is bigger than this, we'll
// clamp it to this value.
// WARNING: animation doesn't do this, so if we clamp the time animated
// physicals and the avatar may move at a faster rate than usual.
void SetMaxDelta(float maxDelta);
float GetMaxDelta() const;
// Set the number of steps per second that physics will advance.
// The more steps per second, the less fallthough and more accurate
// simulation response.
void SetStepsPerSecond(int stepsPerSecond);
int GetStepsPerSecond();
// Walk through the synchronization requests and send them as appropriate.
void IProcessSynchs();
// PHYSX FIXME send a collision message - should only be used with UpdateDetectorsInScene
void ISendCollisionMsg(plKey receiver, plKey hitter, hsBool entering);
NxPhysicsSDK* fSDK;
plPhysicsSoundMgr* fSoundMgr;
//a list of collision messages generated by the simulation steps. Added to by AddCollisionMsg(plCollideMsg* msg)
//cleared by IDispatchCollisionMessages when done
hsTArray<plCollideMsg*> fCollisionMessages;
void IDispatchCollisionMessages();
// A mapping from a key to a PhysX scene. The key is either the
// SimulationMgr key, for the main world, or a SceneObject key if it's a
// subworld.
typedef std::map<plKey, NxScene*> SceneMap;
SceneMap fScenes;
plLOSDispatch* fLOSDispatch;
// Is the entire physics world suspended? If so, the clock can still advance
// but nothing will move.
bool fSuspended;
float fMaxDelta;
float fStepSize;
float fAccumulator;
UInt32 fStepCount;
// A utility class to keep track of a request for a physical synchronization.
// These requests must pass a certain criteria (see the code for the latest)
// before they are actually either sent over the network or rejected.
class SynchRequest
{
public:
double fTime; // when to synch
plKey fKey; // key of the object to be synched, so we can make sure it still lives
static const double kDefaultTime;
SynchRequest() : fTime(kDefaultTime) {};
};
// All currently pending synch requests. Keyed by the physical in question
// so we can quickly eliminate redundant requests, which are very common.
typedef std::map<plPXPhysical*, SynchRequest> PhysSynchMap;
PhysSynchMap fPendingSynchs;
plStatusLog *fLog;
#ifndef PLASMA_EXTERNAL_RELEASE
void IDrawActiveActorList();
#endif //PLASMA_EXTERNAL_RELEASE
};
#define SIM_VERBOSE
#ifdef SIM_VERBOSE
#include <stdarg.h> // only include when we need to call plSimulationMgr::Log
inline void SimLog(const char *str, ...)
{
va_list args;
va_start(args, str);
plSimulationMgr::LogV(str, args);
va_end(args);
}
#else
inline void SimLog(const char *str, ...)
{
// will get stripped out
}
#endif
#endif