|
@@ -74,6 +74,7 @@ export class RendererInspector extends InspectorBase {
|
|
|
this.currentFrame = null;
|
|
this.currentFrame = null;
|
|
|
this.currentRender = null;
|
|
this.currentRender = null;
|
|
|
this.currentNodes = null;
|
|
this.currentNodes = null;
|
|
|
|
|
+ this.lastFrame = null;
|
|
|
|
|
|
|
|
this.frames = [];
|
|
this.frames = [];
|
|
|
this.framesLib = {};
|
|
this.framesLib = {};
|
|
@@ -104,6 +105,8 @@ export class RendererInspector extends InspectorBase {
|
|
|
|
|
|
|
|
this.addFrame( frame );
|
|
this.addFrame( frame );
|
|
|
|
|
|
|
|
|
|
+ this.lastFrame = frame;
|
|
|
|
|
+
|
|
|
this.currentFrame = null;
|
|
this.currentFrame = null;
|
|
|
this.currentRender = null;
|
|
this.currentRender = null;
|
|
|
this.currentNodes = null;
|
|
this.currentNodes = null;
|
|
@@ -131,7 +134,7 @@ export class RendererInspector extends InspectorBase {
|
|
|
|
|
|
|
|
getFrame() {
|
|
getFrame() {
|
|
|
|
|
|
|
|
- return this.currentFrame;
|
|
|
|
|
|
|
+ return this.currentFrame || this.lastFrame;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -327,6 +330,8 @@ export class RendererInspector extends InspectorBase {
|
|
|
|
|
|
|
|
const frame = this.getFrame();
|
|
const frame = this.getFrame();
|
|
|
|
|
|
|
|
|
|
+ if ( ! frame ) return;
|
|
|
|
|
+
|
|
|
const currentRender = new RenderStats( uid, scene, camera, renderTarget );
|
|
const currentRender = new RenderStats( uid, scene, camera, renderTarget );
|
|
|
currentRender.timestamp = performance.now();
|
|
currentRender.timestamp = performance.now();
|
|
|
currentRender.parent = this.currentRender;
|
|
currentRender.parent = this.currentRender;
|
|
@@ -349,6 +354,10 @@ export class RendererInspector extends InspectorBase {
|
|
|
|
|
|
|
|
finishRender() {
|
|
finishRender() {
|
|
|
|
|
|
|
|
|
|
+ const frame = this.getFrame();
|
|
|
|
|
+
|
|
|
|
|
+ if ( ! frame ) return;
|
|
|
|
|
+
|
|
|
const currentRender = this.currentRender;
|
|
const currentRender = this.currentRender;
|
|
|
currentRender.cpu = performance.now() - currentRender.timestamp;
|
|
currentRender.cpu = performance.now() - currentRender.timestamp;
|
|
|
|
|
|