minor render tweaks

This commit is contained in:
Vitaly Turovsky 2024-04-06 23:55:45 +03:00
commit 9fe0e340f8
2 changed files with 6 additions and 5 deletions

View file

@ -84,7 +84,7 @@ export const initWebglRenderer = async (canvas: HTMLCanvasElement, imageBlob: Im
-0.5, 0.5, -0.5, 0.0, 1.0, 5.0// top-let
])
let NumberOfCube = isPlayground ? 1_500_000 : 5_000_000
let NumberOfCube = isPlayground ? 1_000_000 : 5_000_000
cubePositions = new Float32Array(NumberOfCube * 3)
let cubeTextureIndices = new Float32Array(NumberOfCube * 6);
@ -172,7 +172,7 @@ export const initWebglRenderer = async (canvas: HTMLCanvasElement, imageBlob: Im
// [camera.position.x, camera.position.y, camera.position.z - 2, 'dirt'],
// ]
const blocks = allBlocks.slice(startIndex, lastNotUpdatedArrSize ? startIndex + lastNotUpdatedArrSize : undefined)
globalThis.allBlocksSize = allBlocks.length / 3
globalThis.allBlocksSize = allBlocks.length
cubePositions = new Float32Array(blocks.length * 3)
cubeTextureIndices = new Float32Array(blocks.length * 6);
for (let i = 0; i < blocks.length * 3; i += 3) {

View file

@ -419,7 +419,7 @@ export function getSectionGeometry (sx, sy, sz, world: World) {
block.variant = getModelVariants(block)
}
if (/* block.name !== 'water' && block.name !== 'lava' *//* && block.isCube */block.name !== 'air') {
if (block.name !== 'water' && /* && block.name !== 'lava' *//* && block.isCube */block.name !== 'air') {
let globalMatrix = null as any
let globalShift = null as any
@ -503,10 +503,11 @@ export function getSectionGeometry (sx, sy, sz, world: World) {
getResult('south'),
getResult('west'),
getResult('east'),
getResult('up'),
getResult('down')
getResult('down'),
getResult('up')
]
if (textures.every(t => t === 0)) continue
if (pos.y <= 1) continue // TODO!!
attr.blocks[`${pos.x},${pos.y},${pos.z}`] = {
textureIndex: textures,
textureName