This commit is contained in:
Vitaly Turovsky 2025-07-20 10:02:21 +03:00
commit be0993a00b
4 changed files with 16 additions and 14 deletions

View file

@ -674,7 +674,7 @@ export function getSectionGeometry (sx: number, sy: number, sz: number, world: W
}
if (block.name !== 'water' && block.name !== 'lava' && !INVISIBLE_BLOCKS.has(block.name)) {
// Check if this block can use instanced rendering
if ((enableInstancedRendering && isBlockInstanceable(world, block)) || forceInstancedOnly) {
if ((enableInstancedRendering && isBlockInstanceable(world, block))/* || forceInstancedOnly */) {
// Check if block should be culled (all faces hidden by neighbors)
// TODO validate this
if (shouldCullInstancedBlock(world, cursor, block)) {

View file

@ -61,7 +61,7 @@ export class ChunkMeshManager {
constructor (
public worldRenderer: WorldRendererThree,
public scene: THREE.Scene,
public scene: THREE.Group,
public material: THREE.Material,
public worldHeight: number,
viewDistance = 3,
@ -674,7 +674,7 @@ class SignHeadsRenderer {
}
renderSign (position: Vec3, rotation: number, isWall: boolean, isHanging: boolean, blockEntity) {
const tex = this.getSignTexture(position, blockEntity)
const tex = this.getSignTexture(position, blockEntity, isHanging)
if (!tex) return
@ -715,7 +715,7 @@ class SignHeadsRenderer {
return group
}
getSignTexture (position: Vec3, blockEntity, backSide = false) {
getSignTexture (position: Vec3, blockEntity, isHanging, backSide = false) {
const chunk = chunkPos(position)
let textures = this.chunkTextures.get(`${chunk[0]},${chunk[1]}`)
if (!textures) {
@ -727,7 +727,7 @@ class SignHeadsRenderer {
if (textures[texturekey]) return textures[texturekey]
const PrismarineChat = PrismarineChatLoader(this.worldRendererThree.version)
const canvas = renderSign(blockEntity, PrismarineChat)
const canvas = renderSign(blockEntity, isHanging, PrismarineChat)
if (!canvas) return
const tex = new THREE.Texture(canvas)
tex.magFilter = THREE.NearestFilter

View file

@ -102,7 +102,7 @@ export class WorldRendererThree extends WorldRendererCommon {
this.cameraShake = new CameraShake(this, this.onRender)
this.media = new ThreeJsMedia(this)
this.instancedRenderer = new InstancedRenderer(this)
this.chunkMeshManager = new ChunkMeshManager(this, this.realScene, this.material, this.worldSizeParams.worldHeight, this.viewDistance)
this.chunkMeshManager = new ChunkMeshManager(this, this.scene, this.material, this.worldSizeParams.worldHeight, this.viewDistance)
// Enable bypass pooling for debugging if URL param is present
if (new URLSearchParams(location.search).get('bypassMeshPooling') === 'true') {

View file

@ -6,7 +6,7 @@ import { versionToNumber } from 'mc-assets/dist/utils'
import { gameAdditionalState, miscUiState, openOptionsMenu, showModal } from './globalState'
import { AppOptions, getChangedSettings, options, resetOptions } from './optionsStorage'
import Button from './react/Button'
import { OptionMeta, OptionSlider } from './react/OptionsItems'
import { OptionButton, OptionMeta, OptionSlider } from './react/OptionsItems'
import Slider from './react/Slider'
import { getScreenRefreshRate } from './utils'
import { setLoadingScreenStatus } from './appStatus'
@ -127,7 +127,14 @@ export const guiOptionsScheme: {
}
}
return <Button
return <OptionButton
item={{
type: 'toggle',
text: 'Instacing',
requiresChunksReload: true,
}}
cacheKey='instacing'
valueText={status}
onClick={() => {
// cycle
if (useInstancedRendering) {
@ -149,13 +156,8 @@ export const guiOptionsScheme: {
options.enableSingleColorMode = false
options.forceInstancedOnly = false
}
}}
inScreen
>
<span>Instacing</span>:{' '}
<span>{status}</span>
</Button>
/>
},
},
{