Skip to content

Commit

Permalink
fix: highlighted mesh counts on devtools stats #533
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosabu committed Jul 26, 2024
1 parent ac308d9 commit e0b0a3d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/devtools/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ export function registerTresDevtools(app: DevtoolsApp, tres: TresContext) {
payload.state = {
object: Object.entries(instance)
.map(([key, value]) => {
if (key === 'children') {
return { key, value: value.filter(child => child.type !== 'HightlightMesh') }
}
return { key, value, editable: true }
})
.filter(({ key }) => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/perf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function calculateMemoryUsage(object: TresObject | Scene) {
let totalMemory = 0

object.traverse((node: TresObject) => {
if (node.isMesh && node.geometry) {
if (node.isMesh && node.geometry && node.type !== 'HightlightMesh') {
const geometry = node.geometry
const verticesMemory = geometry.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT
const facesMemory = geometry.index ? geometry.index.count * Uint32Array.BYTES_PER_ELEMENT : 0
Expand Down

0 comments on commit e0b0a3d

Please sign in to comment.