How to enables cesium inspector mixin performance display by default?

471 views
Skip to first unread message

Alexey Romanov

unread,
Mar 22, 2016, 9:07:36 AM3/22/16
to cesium-dev

Hi all!

I am playing with the cesium sandbox and would like to have the performance display (FPS & time in ms per frame) from cesium inspector mixin enabled by default. By now I found a solution that seems to be kind of bulky to me:

CesiumViewer.js
    viewer.extend(viewerCesiumInspectorMixin);

    viewer
.cesiumInspector.viewModel.performance = true;
    viewer
.cesiumInspector.viewModel._showPerformance();
    viewer
.cesiumInspector.viewModel.update();
    knockout
.getObservable(viewer.cesiumInspector.viewModel, 'performance')(true);


for the above code to work I also had to force knockout to track the performance variable inside cesium.

CesiumInspectorViewModel,js
knockout.track(this, ['filterTile', 'suspendUpdates', 'dropDownVisible', 'shaderCacheText', 'frustums',
                     'frustumStatisticText', 'pickTileActive', 'pickPrimitiveActive', 'hasPickedPrimitive',
                     'hasPickedTile', 'tileText', 'performance', 'generalVisible', 'generalSwitchText',
                     'primitivesVisible', 'primitivesSwitchText', 'terrainVisible', 'terrainSwitchText', 'depthFrustumText']);



Is there a proper way of enabling performance display in cesium inspector mixin?


With best regards,
Alexey

Hannah Pinkos

unread,
Mar 22, 2016, 11:12:58 AM3/22/16
to cesium-dev
Hello,

If you just care about seeing the FPS and ms/frame, you can add this line to your code:
scene.debugShowFramesPerSecond = true;


When I wrote the inspector widget years ago, I was really new to using knockout and it looks like I made some bad decisions.  Currently, I think the method you're using is the best way to override values.
I wrote an issue to clean up the code here: https://github.com/AnalyticalGraphicsInc/cesium/issues/3747

Thanks!

Hannah

austin...@gmail.com

unread,
Jan 13, 2017, 8:12:12 AM1/13/17
to cesium-dev
On Tuesday, March 22, 2016 at 9:07:36 AM UTC-4, Alexey Romanov wrote:
Hey, this problem has been fixed, and the updates to the inspector will be included in the next release. Showing performance now works with just the following:

```javascript
viewer.extend(viewerCesiumInspectorMixin);
viewer.cesiumInspector.viewModel.performance = true;
```

Thank you for reporting this!
Austin
Reply all
Reply to author
Forward
0 new messages