|
|
@@ -257,8 +257,6 @@ namespace oxygine
|
|
|
{
|
|
|
}
|
|
|
|
|
|
- extern IVideoDriver::Stats _videoStats;
|
|
|
-
|
|
|
std::string aligned(int v, int width)
|
|
|
{
|
|
|
char str[32];
|
|
|
@@ -274,16 +272,21 @@ namespace oxygine
|
|
|
|
|
|
void DebugActor::doUpdate(const UpdateState& us)
|
|
|
{
|
|
|
+ }
|
|
|
+
|
|
|
+ void DebugActor::render(RenderState const& parentRS)
|
|
|
+ {
|
|
|
+ timeMS tm = getTimeMS();
|
|
|
+
|
|
|
static int fps = 0;
|
|
|
++_frames;
|
|
|
if (_frames > 50)
|
|
|
{
|
|
|
- timeMS this_time = getTimeMS();
|
|
|
- if (this_time != _startTime)
|
|
|
+ if (tm != _startTime)
|
|
|
{
|
|
|
- fps = int(((float)_frames / (this_time - _startTime)) * 1000);
|
|
|
+ fps = int(((float)_frames / (tm - _startTime)) * 1000);
|
|
|
}
|
|
|
- _startTime = this_time;
|
|
|
+ _startTime = tm;
|
|
|
_frames = 0;
|
|
|
}
|
|
|
|
|
|
@@ -302,17 +305,21 @@ namespace oxygine
|
|
|
s << "mfree=" << mem_free << " mem=" << mem_used << std::endl;
|
|
|
#endif
|
|
|
|
|
|
-
|
|
|
+ const IVideoDriver::Stats& vstats = IVideoDriver::_stats;
|
|
|
|
|
|
#ifdef OXYGINE_DEBUG_TRACE_LEAKS
|
|
|
s << "objects=" << (int)ObjectBase::__getCreatedObjects().size() << std::endl;
|
|
|
#endif
|
|
|
-#ifdef OXYGINE_TRACE_VIDEO_STATS
|
|
|
- s << "batches=" << aligned(_videoStats.batches, 3) << " triangles=" << aligned(_videoStats.triangles, 3) << std::endl;
|
|
|
+
|
|
|
+#if OXYGINE_TRACE_VIDEO_STATS
|
|
|
+ int primitives = 0;
|
|
|
+ primitives += vstats.elements[IVideoDriver::PT_TRIANGLES] / 3;
|
|
|
+ primitives += vstats.elements[IVideoDriver::PT_TRIANGLE_STRIP] - 2;
|
|
|
+ s << "batches=" << aligned(vstats.batches, 3) << " primitives=" << aligned(primitives, 3) << std::endl;
|
|
|
#endif
|
|
|
|
|
|
s << "update=" << aligned(getStage()->_statUpdate, 2) << "ms ";
|
|
|
- s << "render=" << aligned(getStage()->_statRender, 2) << "ms ";
|
|
|
+ s << "render=" << aligned(vstats.duration, 2) << "ms ";
|
|
|
s << "textures=" << aligned(NativeTexture::created, 2) << " ";
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
@@ -320,7 +327,6 @@ namespace oxygine
|
|
|
iosGetMemoryUsage(mem);
|
|
|
s << "memory=" << mem / 1024 << "kb ";
|
|
|
#endif
|
|
|
- //s << "\nlisteners=" << getStage()->getListenersCount() << "";
|
|
|
|
|
|
if (!_debugText.empty())
|
|
|
{
|
|
|
@@ -371,19 +377,18 @@ namespace oxygine
|
|
|
|
|
|
setPosition(pos);
|
|
|
setScale(1.0f / getStage()->getScaleX());
|
|
|
- }
|
|
|
|
|
|
- void DebugActor::render(RenderState const& parentRS)
|
|
|
- {
|
|
|
+
|
|
|
RenderState rs = parentRS;
|
|
|
parentRS.material->finish();
|
|
|
|
|
|
STDRenderer renderer;
|
|
|
STDMaterial mat(&renderer);
|
|
|
mat.apply(0);
|
|
|
- //STDRenderer* renderer = mat.getRenderer();
|
|
|
+
|
|
|
+
|
|
|
IVideoDriver* driver = renderer.getDriver();
|
|
|
- driver->setDebugStats(false);
|
|
|
+
|
|
|
|
|
|
Rect vp(Point(0, 0), core::getDisplaySize());
|
|
|
driver->setViewport(vp);
|
|
|
@@ -392,10 +397,14 @@ namespace oxygine
|
|
|
rs.material = &mat;
|
|
|
Actor::render(rs);
|
|
|
renderer.drawBatch();
|
|
|
- driver->setDebugStats(true);
|
|
|
+
|
|
|
mat.finish();
|
|
|
|
|
|
Material::setCurrent(0);
|
|
|
+
|
|
|
+ timeMS dur = getTimeMS() - tm;
|
|
|
+
|
|
|
+ IVideoDriver::_stats.start += dur;
|
|
|
}
|
|
|
|
|
|
void DebugActor::showTexel2PixelErrors(bool show)
|