Browse Source

plStringify ControllerDebugDisplay.

plStringification of plPXPhysicalControllerCore::IDrawDebugDisplay
and general clean-up.  Also changed to only display
avatar collisions heading if any exist to show.
Joseph Davies 12 years ago
parent
commit
e2a0041d31
  1. 30
      Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp

30
Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp

@ -850,33 +850,35 @@ void plPXPhysicalControllerCore::IProcessDynamicHits()
void plPXPhysicalControllerCore::IDrawDebugDisplay() void plPXPhysicalControllerCore::IDrawDebugDisplay()
{ {
plDebugText &debugTxt = plDebugText::Instance(); plDebugText &debugTxt = plDebugText::Instance();
char strBuf[ 2048 ]; plString debugString;
int lineHeight = debugTxt.GetFontSize() + 4; int y = 10; // Initial draw position
uint32_t scrnWidth, scrnHeight;
debugTxt.GetScreenSize( &scrnWidth, &scrnHeight );
int y = 10;
int x = 10; int x = 10;
int lineHeight = debugTxt.GetFontSize() + 4;
sprintf(strBuf, "Controller Count: %d", gControllers.size()); debugString = plString::Format("Controller Count: %d", gControllers.size());
debugTxt.DrawString(x, y, strBuf); debugTxt.DrawString(x, y, debugString.c_str());
y += lineHeight; y += lineHeight;
// Only display avatar collisions if any exist...
int collisionCount = fDbgCollisionInfo.GetCount();
if (collisionCount > 0)
{
debugTxt.DrawString(x, y, "Avatar Collisions:"); debugTxt.DrawString(x, y, "Avatar Collisions:");
y += lineHeight; y += lineHeight;
int i; for (int i = 0; i < collisionCount; i++)
for (i = 0; i < fDbgCollisionInfo.GetCount(); i++)
{ {
hsVector3 normal = fDbgCollisionInfo[i].fNormal; hsVector3 normal = fDbgCollisionInfo[i].fNormal;
char *overlapStr = fDbgCollisionInfo[i].fOverlap ? "yes" : "no"; const char* overlapStr = fDbgCollisionInfo[i].fOverlap ? "yes" : "no";
float angle = hsRadiansToDegrees(acos(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)", debugString = plString::Format("\tObj: %s, Normal: (%.2f, %.2f, %.2f), Angle(%.1f), Overlap(%s)",
fDbgCollisionInfo[i].fSO->GetKeyName().c_str(), fDbgCollisionInfo[i].fSO->GetKeyName().c_str(),
normal.fX, normal.fY, normal.fZ, angle, overlapStr); normal.fX, normal.fY, normal.fZ, angle,
debugTxt.DrawString(x, y, strBuf); overlapStr);
debugTxt.DrawString(x, y, debugString.c_str());
y += lineHeight; y += lineHeight;
} }
} }
}
#endif PLASMA_EXTERNAL_RELEASE #endif PLASMA_EXTERNAL_RELEASE

Loading…
Cancel
Save