Skip to content

Commit

Permalink
add stats
Browse files Browse the repository at this point in the history
  • Loading branch information
Crauzer committed Mar 3, 2023
1 parent fa73e00 commit f34ecc1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
5 changes: 0 additions & 5 deletions Obsidian/Shared/WadFileViewport.razor
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@
<div class="@(_isEnabled ? "wad-file-preview-viewport" : "wad-file-preview-viewport-hidden")">
<div class="wad-file-render-canvas-content-wrapper">
<div class="wad-file-render-canvas-content">
<MudText id="@($"{WadTab.Id}_renderCanvas_fps")"
Class="unselectable-text mt-2 ml-2"
Style="pointer-events: auto;">
FPS: n/a
</MudText>
<MudButton Class="mt-auto mb-2 ml-2" Style="pointer-events: auto;"
Color="Color.Primary" Variant="Variant.Filled"
StartIcon="@CustomIcons.Material.ContentSave"
Expand Down
15 changes: 12 additions & 3 deletions Obsidian/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
}
}
</script>
<script src="http://mrdoob.github.io/stats.js/build/stats.min.js"></script>
<script type="module">
import * as THREE from 'three';
import { DoubleSide } from 'three';
Expand Down Expand Up @@ -88,6 +89,13 @@

scene.add(new THREE.HemisphereLight(0x443333, 0x222233, 4));

const stats = Stats();
stats.dom.style.position = "absolute";
stats.dom.style.top = "0px";
stats.dom.style.left = "0px";

viewport.appendChild(stats.dom);

// Resize handler
const resizeViewport = () => {
const viewportRect = viewport.getBoundingClientRect();
Expand All @@ -114,6 +122,7 @@
controls.update();

renderer.render(scene, camera);
stats.update();
}

animate();
Expand All @@ -131,7 +140,7 @@
if (viewport.gui) {
viewport.gui.destroy();
}

viewports.delete(viewportId);
}
}
Expand All @@ -148,11 +157,11 @@
window.renderSkinnedMesh = (viewportId, joints, primitives, indices, positions, normals, uvs, weightIds, weights, textures) => {
const viewport = viewports.get(viewportId);
const geometry = new THREE.BufferGeometry();

// GUI
const gui = new GUI({ container: document.getElementById(viewportId) });
viewport.gui = gui;

// Set vertex data
geometry.setIndex(indices);

Expand Down

0 comments on commit f34ecc1

Please sign in to comment.