some tracing

This commit is contained in:
Moritz Zwerger 2025-03-02 19:41:03 +01:00
parent 83c86d2129
commit f0db36c80b
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 4 additions and 14 deletions

View File

@ -225,7 +225,7 @@ class FluidSectionMesher(
) )
val meshToUse = mesh[model.flowing.transparency] val meshToUse = mesh[model.flowing.transparency]
val fluidLight = chunk.light[x, offsetY + y, z] val fluidLight = chunk.light[InChunkPosition(x, offsetY + y, z)]
addFluidVertices(meshToUse, positions, texturePositions, model.flowing, tint, fluidLight) addFluidVertices(meshToUse, positions, texturePositions, model.flowing, tint, fluidLight)
rendered = true rendered = true
} }

View File

@ -99,7 +99,7 @@ abstract class Particle(
if (chunk != null) { if (chunk != null) {
if (chunk.position == this.chunkPosition) return chunk if (chunk.position == this.chunkPosition) return chunk
chunk = chunk.neighbours.trace(chunkPosition - chunk.position) chunk = chunk.neighbours.traceChunk(chunkPosition - chunk.position)
} }
if (chunk == null && revision != this.chunkRevision) { if (chunk == null && revision != this.chunkRevision) {
chunk = session.world.chunks[chunkPosition] chunk = session.world.chunks[chunkPosition]

View File

@ -13,15 +13,12 @@
package de.bixilon.minosoft.gui.rendering.particle.types.render package de.bixilon.minosoft.gui.rendering.particle.types.render
import de.bixilon.kotlinglm.vec2.Vec2i
import de.bixilon.kotlinglm.vec3.Vec3d import de.bixilon.kotlinglm.vec3.Vec3d
import de.bixilon.kotlinglm.vec3.Vec3i
import de.bixilon.minosoft.data.registries.particle.data.ParticleData import de.bixilon.minosoft.data.registries.particle.data.ParticleData
import de.bixilon.minosoft.data.text.formatting.color.ChatColors import de.bixilon.minosoft.data.text.formatting.color.ChatColors
import de.bixilon.minosoft.data.text.formatting.color.RGBColor import de.bixilon.minosoft.data.text.formatting.color.RGBColor
import de.bixilon.minosoft.data.world.chunk.light.SectionLight import de.bixilon.minosoft.data.world.chunk.light.SectionLight
import de.bixilon.minosoft.gui.rendering.particle.types.Particle import de.bixilon.minosoft.gui.rendering.particle.types.Particle
import de.bixilon.minosoft.gui.rendering.util.vec.vec2.Vec2iUtil.EMPTY
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3dUtil.blockPosition import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3dUtil.blockPosition
import de.bixilon.minosoft.protocol.network.session.play.PlaySession import de.bixilon.minosoft.protocol.network.session.play.PlaySession
@ -45,17 +42,10 @@ abstract class RenderParticle(session: PlaySession, position: Vec3d, velocity: V
val chunkPosition = position.blockPosition.chunkPosition val chunkPosition = position.blockPosition.chunkPosition
val chunk = getChunk() ?: return maxBlockLight val chunk = getChunk() ?: return maxBlockLight
val offset = Vec2i.EMPTY
val inChunk = Vec3i()
for (position in aabb.positions()) { for (position in aabb.positions()) {
offset.x = (position.x shr 4) - chunkPosition.x val next = chunk.neighbours.traceChunk(position.chunkPosition - chunkPosition)
offset.y = (position.z shr 4) - chunkPosition.z
inChunk.x = position.x and 0x0F val light = next?.light?.get(position.inChunkPosition) ?: SectionLight.SKY_LIGHT_MASK
inChunk.y = position.y
inChunk.z = position.z and 0x0F
val light = chunk.neighbours.trace(offset)?.light?.get(inChunk) ?: SectionLight.SKY_LIGHT_MASK
if (light and SectionLight.BLOCK_LIGHT_MASK > maxBlockLight) { if (light and SectionLight.BLOCK_LIGHT_MASK > maxBlockLight) {
maxBlockLight = light and SectionLight.BLOCK_LIGHT_MASK maxBlockLight = light and SectionLight.BLOCK_LIGHT_MASK
} }