mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-23 06:04:44 +00:00
This makes some tweaks to the engine to support this, specifically, it tweaks the hardcoded shaderpaths to defer to a pref variable, so none of the shader paths are hardcoded. Also tweaks how post effects read in texture files, removing a bizzare filepath interpretation choice, where if the file path didn't start with "/" it forcefully appended the script's file path. This made it impossible to have images not in the same dir as the script file defining the post effect. This was changed and the existing template's post effects tweaked for now to just add "./" to those few paths impacted, as well as the perf vars to support the non-hardcoded shader paths in the engine.
114 lines
2.6 KiB
C#
114 lines
2.6 KiB
C#
$ProfilerGraph::refreshRate = 32;
|
|
// Profiles
|
|
new GuiControlProfile (ProfilerGraphProfile)
|
|
{
|
|
modal = false;
|
|
opaque = false;
|
|
canKeyFocus = false;
|
|
};
|
|
|
|
new GuiControlProfile (ProfilerGraphKeyContainerProfile)
|
|
{
|
|
border = true;
|
|
opaque = true;
|
|
fillColor = "100 100 100 200";
|
|
};
|
|
new GuiControlProfile (ProfilerGraphGraphFrameRateProfile)
|
|
{
|
|
border = false;
|
|
fontColor = "255 255 255";
|
|
};
|
|
new GuiControlProfile (ProfilerGraphPolyCountProfile)
|
|
{
|
|
border = false;
|
|
fontColor = "255 0 0";
|
|
};
|
|
new GuiControlProfile (ProfilerGraphDrawCountProfile)
|
|
{
|
|
border = false;
|
|
fontColor = "0 255 0";
|
|
};
|
|
new GuiControlProfile (ProfilerGraphRTChangesProfile)
|
|
{
|
|
border = false;
|
|
fontColor = "0 0 255";
|
|
};
|
|
new GuiControlProfile (ProfilerGraphLatencyProfile)
|
|
{
|
|
border = false;
|
|
fontColor = "0 255 255";
|
|
};
|
|
new GuiControlProfile (ProfilerGraphPacketLossProfile)
|
|
{
|
|
border = false;
|
|
fontColor = "0 0 0";
|
|
};
|
|
|
|
function toggleProfilerGraph()
|
|
{
|
|
if(!$ProfilerGraph::isInitialized)
|
|
{
|
|
ProfilerGraph::updateStats();
|
|
$ProfilerGraph::isInitialized = true;
|
|
}
|
|
|
|
if(!Canvas.isMember(ProfilerGraphGui))
|
|
{
|
|
Canvas.add(ProfilerGraphGui);
|
|
}
|
|
else
|
|
Canvas.remove(ProfilerGraphGui);
|
|
}
|
|
|
|
function ProfilerGraph::updateStats()
|
|
{
|
|
$ProfilerGraphThread = ProfilerGraph.schedule($ProfilerGraph::refreshRate, "updateStats");
|
|
|
|
if(!$Stats::netGhostUpdates)
|
|
return;
|
|
|
|
if(isobject(ProfilerGraph))
|
|
{
|
|
GhostsActive.setText("Frame Rate: " @ $fps::real);
|
|
ProfilerGraph.addDatum(1,$fps::real);
|
|
|
|
GhostUpdates.setText("Poly Count: " @ $GFXDeviceStatistics::polyCount);
|
|
ProfilerGraph.addDatum(2,$GFXDeviceStatistics::polyCount);
|
|
|
|
BitsSent.setText("Draw Calls: " @ $GFXDeviceStatistics::drawCalls);
|
|
ProfilerGraph.addDatum(3,$GFXDeviceStatistics::drawCalls);
|
|
|
|
BitsReceived.setText("Render Target Changes: " @ $GFXDeviceStatistics::renderTargetChanges);
|
|
ProfilerGraph.addDatum(4,$GFXDeviceStatistics::renderTargetChanges);
|
|
|
|
ProfilerGraph.matchScale(2,3);
|
|
|
|
//Latency.setText("Latency: " @ ServerConnection.getPing());
|
|
//ProfilerGraph.addDatum(5,ServerConnection.getPacketLoss());
|
|
|
|
//PacketLoss.setText("Packet Loss: " @ ServerConnection.getPacketLoss());
|
|
}
|
|
}
|
|
|
|
function ProfilerGraph::toggleKey()
|
|
{
|
|
if(!GhostsActive.visible)
|
|
{
|
|
GhostsActive.visible = 1;
|
|
GhostUpdates.visible = 1;
|
|
BitsSent.visible = 1;
|
|
BitsReceived.visible = 1;
|
|
Latency.visible = 1;
|
|
PacketLoss.visible = 1;
|
|
}
|
|
else
|
|
{
|
|
GhostsActive.visible = 0;
|
|
GhostUpdates.visible = 0;
|
|
BitsSent.visible = 0;
|
|
BitsReceived.visible = 0;
|
|
Latency.visible = 0;
|
|
PacketLoss.visible = 0;
|
|
}
|
|
}
|