minecraft-renderer 0.1.56 → 0.1.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/minecraft-renderer.js +13 -13
- package/dist/minecraft-renderer.js.meta.json +1 -1
- package/dist/threeWorker.js +2 -2
- package/package.json +1 -1
- package/src/graphicsBackend/config.ts +2 -1
- package/src/graphicsBackend/rendererDefaultOptions.ts +1 -1
- package/src/graphicsBackend/types.ts +1 -0
- package/src/lib/worldrendererCommon.ts +1 -0
- package/src/three/graphicsBackendBase.ts +12 -0
- package/src/three/graphicsBackendOffThread.ts +12 -1
package/package.json
CHANGED
|
@@ -690,6 +690,7 @@ export abstract class WorldRendererCommon<WorkerSend = any, WorkerReceive = any>
|
|
|
690
690
|
|
|
691
691
|
const text = `Q: ${this.messageQueue.length} ${Object.keys(this.loadedChunks).length}/${Object.keys(this.finishedChunks).length}/${this.chunksLength} chunks (${this.workers.length}:${this.workersProcessAverageTime.toFixed(0)}ms/${this.geometryReceiveCountPerSec}ss/${this.allLoadedIn?.toFixed(1) ?? '-'}s)`
|
|
692
692
|
this.chunksFullInfo = text
|
|
693
|
+
this.displayOptions.nonReactiveState.world.chunksFullInfo = text
|
|
693
694
|
updateStatText('downloaded-chunks', text)
|
|
694
695
|
}
|
|
695
696
|
|
|
@@ -94,6 +94,18 @@ export const getBackendMethods = (worldRenderer: WorldRendererThree): any => {
|
|
|
94
94
|
for (const worker of worldRenderer.workers) {
|
|
95
95
|
worker.postMessage(message)
|
|
96
96
|
}
|
|
97
|
+
},
|
|
98
|
+
getChunksDebugState() {
|
|
99
|
+
const loadedSectionsChunks: Record<string, true> = {}
|
|
100
|
+
for (const sectionPos of Object.keys(worldRenderer.sectionObjects)) {
|
|
101
|
+
const [x, , z] = sectionPos.split(',').map(Number)
|
|
102
|
+
loadedSectionsChunks[`${x},${z}`] = true
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
loadedSectionsChunks,
|
|
106
|
+
loadedChunks: { ...worldRenderer.loadedChunks },
|
|
107
|
+
finishedChunks: { ...worldRenderer.finishedChunks },
|
|
108
|
+
}
|
|
97
109
|
}
|
|
98
110
|
}
|
|
99
111
|
}
|
|
@@ -4,7 +4,7 @@ import { GraphicsBackend, GraphicsBackendLoader } from '../graphicsBackend'
|
|
|
4
4
|
import { useWorkerProxy, deepPrepareForTransfer, findProblemTransfer } from '../lib/workerProxy'
|
|
5
5
|
import { meshersSendMcDataAwait } from '../lib/worldrendererCommon'
|
|
6
6
|
import { dynamicMcDataFiles } from '../lib/buildSharedConfig.mjs'
|
|
7
|
-
import { addNewStat } from '../lib/ui/newStats'
|
|
7
|
+
import { addNewStat, MC_RENDERER_DEBUG_OVERLAY_CLASS } from '../lib/ui/newStats'
|
|
8
8
|
import type { MenuBackgroundOptions } from './menuBackground/types'
|
|
9
9
|
import { MENU_BACKGROUND_MC_VERSION } from './menuBackground/shared'
|
|
10
10
|
import { createGraphicsBackendBase, type ThreeJsBackendMethods } from './graphicsBackendBase'
|
|
@@ -122,6 +122,17 @@ export const createGraphicsBackendOffThread: GraphicsBackendLoader = async (init
|
|
|
122
122
|
fpsStat.updateText(`FPS: ${fps.toFixed(0)} (${avgRenderTime.toFixed(0)}ms/${worstRenderTime.toFixed(0)}ms)`)
|
|
123
123
|
options.nonReactiveState.fps = 0
|
|
124
124
|
}, 1000)
|
|
125
|
+
|
|
126
|
+
const chunksStat = addNewStat('downloaded-chunks', 100, 140, 20, {
|
|
127
|
+
className: MC_RENDERER_DEBUG_OVERLAY_CLASS,
|
|
128
|
+
})
|
|
129
|
+
setInterval(() => {
|
|
130
|
+
const advanced = (initOptions.config.statsVisible ?? 0) > 1
|
|
131
|
+
chunksStat.setVisibility(advanced)
|
|
132
|
+
if (advanced) {
|
|
133
|
+
chunksStat.updateText(options.nonReactiveState.world.chunksFullInfo)
|
|
134
|
+
}
|
|
135
|
+
}, 200)
|
|
125
136
|
},
|
|
126
137
|
disconnect() {
|
|
127
138
|
canvas.destroy()
|