Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"test:cypress": "cypress run",
"test:benchmark": "PERFORMANCE_TEST=true cypress run",
"test:cypress:open": "cypress open",
"test-unit": "vitest",
"test-unit": "vitest run",
"test:e2e": "start-test http-get://localhost:8080 test:cypress",
"prod-start": "node server.js --prod",
"test-mc-server": "tsx cypress/minecraft-server.mjs",
Expand Down
5 changes: 5 additions & 0 deletions src/defaultOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const defaultOptions = {
debugLogNotFrequentPackets: false,
unimplementedContainers: false,
...RENDERER_DEFAULT_OPTIONS,
rendererSmartCull: false as boolean,
enabledResourcepack: null as string | null,
useVersionsTextures: 'latest',
serverResourcePacks: 'prompt' as 'prompt' | 'always' | 'never',
Expand Down Expand Up @@ -204,6 +205,10 @@ export type OptionMeta = {

export const optionsMeta: Partial<Record<keyof typeof defaultOptions, OptionMeta>> = {
...RENDERER_OPTIONS_META,
rendererSmartCull: {
text: 'Smart cull',
tooltip: 'Occlusion-based section culling for better performance in caves and enclosed spaces',
},
activeRenderer: {
possibleValues: [
['threejs', 'Three.js (stable)'],
Expand Down
4 changes: 4 additions & 0 deletions src/optionsGuiScheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ export const guiOptionsScheme: {
rendererPerfDebugOverlay: {
text: 'Performance Debug',
},
rendererSmartCull: {
text: 'Smart cull',
tooltip: 'Occlusion-based section culling for better performance in caves and enclosed spaces',
},
},
{
custom () {
Expand Down
10 changes: 5 additions & 5 deletions src/react/RendererDebugMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export default () => {

const RendererDebugMenu = ({ worldRenderer }: { worldRenderer: WorldRendererCommon }) => {
const { reactiveDebugParams } = worldRenderer
const { chunksRenderAboveEnabled, chunksRenderBelowEnabled, chunksRenderDistanceEnabled, chunksRenderAboveOverride, chunksRenderBelowOverride, chunksRenderDistanceOverride, stopRendering, disableEntities, caveCullingDebug, smartCull } = useSnapshot(reactiveDebugParams)
const { chunksRenderAboveEnabled, chunksRenderBelowEnabled, chunksRenderDistanceEnabled, chunksRenderAboveOverride, chunksRenderBelowOverride, chunksRenderDistanceOverride, stopRendering, disableEntities, caveCullingDebug } = useSnapshot(reactiveDebugParams)

const { rendererPerfDebugOverlay } = useSnapshot(options)
const { rendererPerfDebugOverlay, rendererSmartCull } = useSnapshot(options)

// Helper to round values to nearest step
const roundToStep = (value: number, step: number) => Math.round(value / step) * step
Expand All @@ -37,9 +37,9 @@ const RendererDebugMenu = ({ worldRenderer }: { worldRenderer: WorldRendererComm
overlayColor={disableEntities ? 'red' : undefined}
/>
<Button
label={smartCull ? 'Disable Smart Cull' : 'Enable Smart Cull'}
onClick={() => { reactiveDebugParams.smartCull = !smartCull }}
overlayColor={smartCull ? undefined : 'orange'}
label={rendererSmartCull ? 'Disable Smart Cull' : 'Enable Smart Cull'}
onClick={() => { options.rendererSmartCull = !rendererSmartCull }}
overlayColor={rendererSmartCull ? undefined : 'orange'}
/>
<Button
label={caveCullingDebug ? 'Hide Cave Cull Debug' : 'Show Cave Cull Debug'}
Expand Down
8 changes: 8 additions & 0 deletions src/watchOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ export const watchOptionsAfterViewerInit = () => {
appViewer.inWorldRenderingConfig.volume = Math.max(o.volume / 100, 0)
})

watchValue(options, o => {
appViewer.inWorldRenderingConfig.smartCull = o.rendererSmartCull
const worldRenderer = window.world
if (worldRenderer) {
worldRenderer.reactiveDebugParams.smartCull = true
}
})
Comment on lines +49 to +55

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 8 \
  'watchOptionsAfterViewerInit|window\.world|reactiveDebugParams\.smartCull|inWorldRenderingConfig\.smartCull|resetBackend|worldRenderer' \
  src

Repository: zardoy/minecraft-web-client

Length of output: 18532


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '== watchOptions.ts relevant section ==\n'
cat -n src/watchOptions.ts | sed -n '1,120p'

printf '\n== optionsStorage.ts watchValue definition ==\n'
cat -n src/optionsStorage.ts | sed -n '1,200p'

printf '\n== worldRenderer assignment/usages in src/index.ts ==\n'
rg -n -C 6 'window\.world\s*=|worldRender|resetBackend|startWithBot|loadBackend' src/index.ts src/appViewer.ts src/appViewerLoad.ts

printf '\n== Smart Cull consumers in source files ==\n'
rg -n 'rendererSmartCull|smartCull|reactiveDebugParams\.smartCull|inWorldRenderingConfig\.smartCull' src

Repository: zardoy/minecraft-web-client

Length of output: 15877


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '== renderer debug menu body ==\n'
cat -n src/react/RendererDebugMenu.tsx | sed -n '1,120p'

printf '\n== rendererOptionsSync and worldRenderer files mentioning smartCull/watchers ==\n'
rg -n -C 10 'smartCull|inWorldRenderingConfig|reactiveDebugParams|worldRenderer|WorldRendererCommon' node_modules minecraft-renderer 2>/dev/null || true

Repository: zardoy/minecraft-web-client

Length of output: 6459


🏁 Script executed:

#!/bin/bash
set -euo pipefail

if [ -d node_modules/minecraft-renderer ]; then
  printf '== node_modules smartCull occurrences ==\n'
  rg -n -C 8 'smartCull|reactiveDebugParams|inWorldRenderingConfig' node_modules/minecraft-renderer || true
else
  printf 'node_modules/minecraft-renderer directory not present\n'
fi

printf '\n== repository references with global/window objects ==\n'
rg -n -C 5 'customEvents\.(emit|on)\(|gameLoaded|worldRenderer|new World|WorldRenderer|loadBackend\s*\(' src/index.ts src/appViewer.ts src/appViewerLoad.ts

Repository: zardoy/minecraft-web-client

Length of output: 6259


🌐 Web query:

minecraft-renderer smartCull reactiveDebugParams inWorldRenderingConfig documentation

💡 Result:

The terms you are inquiring about appear in two distinct contexts: the official Minecraft Java Edition engine and the third-party JavaScript library 'minecraft-renderer'. In the official Minecraft Java Edition, 'smartCull' refers to a rendering optimization feature (often identified as chunk culling) that can be toggled via debug hotkeys, such as F3 + L [1][2]. It is exposed in the game's client-side code as a boolean property, 'smartCull', within the Minecraft class [3][4]. In the context of the 'minecraft-renderer' library (a JavaScript/TypeScript renderer for Minecraft data), 'inWorldRenderingConfig' is a configuration object used to manage rendering settings [5][6]. Based on the library's official documentation, the 'WorldRendererConfig' interface includes settings for performance (e.g., 'mesherWorkers'), rendering (e.g., 'enableLighting', 'fov'), and debugging (e.g., 'showChunkBorders', 'enableDebugOverlay') [5][7]. There is no standard or widely documented single configuration string or object combining 'smartCull', 'reactiveDebugParams', and 'inWorldRenderingConfig'. It is highly likely that 'reactiveDebugParams' is either a custom implementation specific to a particular project's codebase, a typo, or a misidentification of a reactive state management pattern (such as 'valtio', which the 'minecraft-renderer' library explicitly uses to synchronize 'inWorldRenderingConfig' [5][8]). If you are working with a specific codebase, you should search for 'reactiveDebugParams' directly within your project's files, as it is not part of the standard Minecraft API or the public 'minecraft-renderer' documentation.

Citations:


🌐 Web query:

site:github.com/zardoy/minecraft-renderer smartCull reactiveDebugParams inWorldRenderingConfig

💡 Result:

The terms smartCull, reactiveDebugParams, and inWorldRenderingConfig are associated with the zardoy/minecraft-renderer project, which is a library for rendering Minecraft-style worlds in the browser [1][2]. inWorldRenderingConfig This is a configuration object used within the renderer to control various aspects of world rendering, performance, and debugging [1]. It is part of the system managed by the library's main thread and is synchronized with off-thread backends (such as mesher workers) using valtio's syncToWorker functionality [1]. Its schema includes: - Performance settings (e.g., mesherWorkers, addChunksBatchWaitTime) [1]. - Rendering options (e.g., enableLighting, smoothLighting, fov) [1]. - Debug options (e.g., showChunkBorders, enableDebugOverlay) [1]. smartCull and reactiveDebugParams While inWorldRenderingConfig is a documented interface in the project, smartCull and reactiveDebugParams appear to be specific internal implementation details, parameters, or debug/performance flags likely found within the source code or related feature branches of this repository [3][4][5]. In the context of this renderer: - smartCull likely refers to the project's frustum and section occlusion culling systems (e.g., the section occlusion culling feature) which optimize rendering by excluding hidden or off-screen sections [3][4][5]. - reactiveDebugParams likely refers to reactive configuration parameters used to toggle debug overlays, chunk borders, or other instrumentation dynamically during runtime, often utilizing the same reactive state management (valtio) as inWorldRenderingConfig [1][6]. For authoritative details, these identifiers are best investigated directly within the source files of the zardoy/minecraft-renderer repository, specifically under src/three/ or src/graphicsBackend/ [7][3][4].

Citations:


🌐 Web query:

github zardoy minecraft-renderer smartCull reactiveDebugParams assignment

💡 Result:

I couldn’t find any occurrences (in the sources surfaced by this search) of the exact identifiers “smartCull” or “reactiveDebugParams” in the zardoy/minecraft-renderer GitHub code/PRs/commits that were returned. What I did find (relevant adjacent behavior) 1) Frustum culling + “draw spans” - The project has a pass that frustum-culls sections and builds visible “(start,count) draw spans” for rendering (PR “feat: frustum-culled draw spans + sorted global transparent buffer”). It also excludes sections with visible=false from the span builder. [1] - There’s also a related PR focused on legacy draw spans and cap/merge behavior. [2] 2) “Cull registry” + avoiding redundant work - Another PR explicitly mentions a “cull registry” and that it now tracks only sections with legacy geometry; plus it computes a fingerprint of the visible set to skip redundant span rebuilds. [3] 3) Debug overlay option surface (not the identifiers you asked about) - The README documents general debug/perf options such as enableDebugOverlay and showChunkBorders (but not “reactiveDebugParams”). [4] Interpretation relative to your query - It’s likely that “smartCull” and “reactiveDebugParams” either (a) exist in files not returned by this search result set, (b) were renamed, (c) live on a different branch/repo/tag, or (d) are referenced by generated/compiled artifacts not indexed by the search results we pulled. If you want, paste the exact file path(s) or commit hash(es) where you saw “smartCull” / “reactiveDebugParams” (even a screenshot/snippet). With that, I can do a targeted follow-up search to locate the assignment(s) and explain what they do. Top evidence from the current search set - Frustum-culling into draw spans and excluding visible=false sections: [1] - Culling only legacy sections + skipping redundant span rebuilds via a visible-set fingerprint: [3] - General debug options in README (no “reactiveDebugParams” here): [4]

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

git ls-files | rg '(^|/)package.json$' | while read -r f; do
  echo "== $f =="
  sed -n '1,220p' "$f"
done

printf '\n== lockfile references to minecraft-renderer (if present) ==\n'
for f in package-lock.json npm-shrinkwrap.json pnpm-lock.yaml yarn.lock bun.lockb; do
  if [ -f "$f" ]; then
    echo "== $f =="
    rg -n 'minecraft-renderer|zardoy/minecraft-renderer' "$f" || true
  fi
done

Repository: zardoy/minecraft-web-client

Length of output: 8098


🌐 Web query:

github zardoy minecraft-renderer src/graphicsBackend/rendererOptionsSync inWorldRenderingConfig

💡 Result:

In the zardoy/minecraft-renderer project, inWorldRenderingConfig is an internal state object updated during runtime synchronization of renderer options [1][2]. It is managed via the subscribeRendererOptions function located within src/graphicsBackend/rendererOptionsSync.ts (or related modules in the graphicsBackend directory) [3][4][5]. When this function is called after the initialization of the AppViewer and backend, it synchronizes renderer settings from the application's options store to the renderer's internal configuration [1][5]. Key details regarding inWorldRenderingConfig include: - Function: It acts as the configuration source for in-world rendering behavior, updating dynamically based on changes to application settings [1][5]. - Implementation: Sync operations must be performed on the main thread only [1][2]. - Worker Compatibility: For off-thread backends, it utilizes an existing Valtio syncToWorker mechanism to propagate changes to workers; developers are explicitly instructed not to call subscribeRendererOptions directly from mesher workers [1][5]. - Context: It is part of a broader system where renderer-owned options are defined in RENDERER_DEFAULT_OPTIONS and RENDERER_OPTIONS_META in src/graphicsBackend/rendererDefaultOptions.ts [1][5].

Citations:


Reapply Smart Cull when the world renderer is created.

src/watchOptions.ts:49-55 applies rendererSmartCull during appViewer initialization, but window.world is bound later in src/index.ts. watchValue only re-runs when options.rendererSmartCull changes, so an already-disabled option leaves the world renderer without applying Smart Cull. Move the world-renderer reapplication to the renderer creation path, or add a separate creation-time trigger for the current option value.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/watchOptions.ts` around lines 49 - 55, Ensure Smart Cull is applied when
the world renderer is created, not only when watchValue observes an options
change. Update the renderer creation path in index.ts, or add an equivalent
creation-time trigger, to assign the current options.rendererSmartCull value to
window.world.reactiveDebugParams.smartCull even when the option is already
disabled.


subscribeKey(options, 'newVersionsLighting', () => {
applyRendererEnableLighting(
appViewer,
Expand Down
Loading