mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 10:55:01 -04:00
rename section preparer to mesher
This commit is contained in:
parent
3fbc54acc8
commit
9068f249c6
@ -15,17 +15,17 @@ package de.bixilon.minosoft.gui.rendering.chunk
|
|||||||
|
|
||||||
import de.bixilon.kutil.concurrent.pool.runnable.InterruptableRunnable
|
import de.bixilon.kutil.concurrent.pool.runnable.InterruptableRunnable
|
||||||
import de.bixilon.minosoft.gui.rendering.chunk.mesh.ChunkMesh
|
import de.bixilon.minosoft.gui.rendering.chunk.mesh.ChunkMesh
|
||||||
|
import de.bixilon.minosoft.gui.rendering.chunk.preparer.FluidSectionMesher
|
||||||
|
import de.bixilon.minosoft.gui.rendering.chunk.preparer.SolidSectionMesher
|
||||||
import de.bixilon.minosoft.gui.rendering.chunk.queue.meshing.tasks.MeshPrepareTask
|
import de.bixilon.minosoft.gui.rendering.chunk.queue.meshing.tasks.MeshPrepareTask
|
||||||
import de.bixilon.minosoft.gui.rendering.chunk.util.ChunkRendererUtil.smallMesh
|
import de.bixilon.minosoft.gui.rendering.chunk.util.ChunkRendererUtil.smallMesh
|
||||||
import de.bixilon.minosoft.gui.rendering.world.preparer.FluidSectionPreparer
|
|
||||||
import de.bixilon.minosoft.gui.rendering.world.preparer.SolidSectionPreparer
|
|
||||||
import de.bixilon.minosoft.util.chunk.ChunkUtil
|
import de.bixilon.minosoft.util.chunk.ChunkUtil
|
||||||
|
|
||||||
class ChunkMesher(
|
class ChunkMesher(
|
||||||
private val renderer: ChunkRenderer,
|
private val renderer: ChunkRenderer,
|
||||||
) {
|
) {
|
||||||
private val solidSectionPreparer = SolidSectionPreparer(renderer.context)
|
private val solid = SolidSectionMesher(renderer.context)
|
||||||
private val fluidSectionPreparer = FluidSectionPreparer(renderer.context)
|
private val fluid = FluidSectionMesher(renderer.context)
|
||||||
|
|
||||||
private fun mesh(item: WorldQueueItem): ChunkMesh? {
|
private fun mesh(item: WorldQueueItem): ChunkMesh? {
|
||||||
if (item.section.blocks.isEmpty) {
|
if (item.section.blocks.isEmpty) {
|
||||||
@ -39,10 +39,10 @@ class ChunkMesher(
|
|||||||
}
|
}
|
||||||
val sectionNeighbours = ChunkUtil.getDirectNeighbours(neighbours, item.chunk, item.section.sectionHeight)
|
val sectionNeighbours = ChunkUtil.getDirectNeighbours(neighbours, item.chunk, item.section.sectionHeight)
|
||||||
val mesh = ChunkMesh(renderer.context, item.chunkPosition, item.sectionHeight, item.section.smallMesh)
|
val mesh = ChunkMesh(renderer.context, item.chunkPosition, item.sectionHeight, item.section.smallMesh)
|
||||||
solidSectionPreparer.prepareSolid(item.chunkPosition, item.sectionHeight, item.chunk, item.section, neighbours, sectionNeighbours, mesh)
|
solid.mesh(item.chunkPosition, item.sectionHeight, item.chunk, item.section, neighbours, sectionNeighbours, mesh)
|
||||||
|
|
||||||
if (item.section.blocks.fluidCount > 0) {
|
if (item.section.blocks.fluidCount > 0) {
|
||||||
fluidSectionPreparer.prepareFluid(item.chunkPosition, item.sectionHeight, item.chunk, item.section, neighbours, sectionNeighbours, mesh)
|
fluid.mesh(item.chunkPosition, item.sectionHeight, item.chunk, item.section, neighbours, sectionNeighbours, mesh)
|
||||||
}
|
}
|
||||||
|
|
||||||
return mesh
|
return mesh
|
||||||
|
@ -33,12 +33,12 @@ import de.bixilon.minosoft.gui.rendering.RenderContext
|
|||||||
import de.bixilon.minosoft.gui.rendering.chunk.entities.MeshedEntityRenderer
|
import de.bixilon.minosoft.gui.rendering.chunk.entities.MeshedEntityRenderer
|
||||||
import de.bixilon.minosoft.gui.rendering.chunk.mesh.ChunkMesh
|
import de.bixilon.minosoft.gui.rendering.chunk.mesh.ChunkMesh
|
||||||
import de.bixilon.minosoft.gui.rendering.chunk.mesh.SingleChunkMesh
|
import de.bixilon.minosoft.gui.rendering.chunk.mesh.SingleChunkMesh
|
||||||
|
import de.bixilon.minosoft.gui.rendering.chunk.preparer.SolidSectionMesher.Companion.SELF_LIGHT_INDEX
|
||||||
import de.bixilon.minosoft.gui.rendering.font.renderer.component.ChatComponentRenderer
|
import de.bixilon.minosoft.gui.rendering.font.renderer.component.ChatComponentRenderer
|
||||||
import de.bixilon.minosoft.gui.rendering.font.renderer.element.TextRenderProperties
|
import de.bixilon.minosoft.gui.rendering.font.renderer.element.TextRenderProperties
|
||||||
import de.bixilon.minosoft.gui.rendering.models.block.element.ModelElement.Companion.BLOCK_SIZE
|
import de.bixilon.minosoft.gui.rendering.models.block.element.ModelElement.Companion.BLOCK_SIZE
|
||||||
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3Util.rotateAssign
|
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3Util.rotateAssign
|
||||||
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3Util.toVec3
|
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3Util.toVec3
|
||||||
import de.bixilon.minosoft.gui.rendering.world.preparer.SolidSectionPreparer.Companion.SELF_LIGHT_INDEX
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class SignBlockEntityRenderer(
|
class SignBlockEntityRenderer(
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.bixilon.minosoft.gui.rendering.world.preparer
|
package de.bixilon.minosoft.gui.rendering.chunk.preparer
|
||||||
|
|
||||||
import de.bixilon.kotlinglm.func.cos
|
import de.bixilon.kotlinglm.func.cos
|
||||||
import de.bixilon.kotlinglm.func.sin
|
import de.bixilon.kotlinglm.func.sin
|
||||||
@ -33,7 +33,6 @@ import de.bixilon.minosoft.data.world.chunk.ChunkSection
|
|||||||
import de.bixilon.minosoft.data.world.chunk.chunk.Chunk
|
import de.bixilon.minosoft.data.world.chunk.chunk.Chunk
|
||||||
import de.bixilon.minosoft.data.world.positions.BlockPositionUtil.positionHash
|
import de.bixilon.minosoft.data.world.positions.BlockPositionUtil.positionHash
|
||||||
import de.bixilon.minosoft.gui.rendering.RenderContext
|
import de.bixilon.minosoft.gui.rendering.RenderContext
|
||||||
import de.bixilon.minosoft.gui.rendering.chunk.ChunkMesher
|
|
||||||
import de.bixilon.minosoft.gui.rendering.chunk.mesh.ChunkMesh
|
import de.bixilon.minosoft.gui.rendering.chunk.mesh.ChunkMesh
|
||||||
import de.bixilon.minosoft.gui.rendering.chunk.mesh.SingleChunkMesh
|
import de.bixilon.minosoft.gui.rendering.chunk.mesh.SingleChunkMesh
|
||||||
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.Texture
|
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.Texture
|
||||||
@ -48,7 +47,7 @@ import de.bixilon.minosoft.util.KUtil.isTrue
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.atan2
|
import kotlin.math.atan2
|
||||||
|
|
||||||
class FluidSectionPreparer(
|
class FluidSectionMesher(
|
||||||
val context: RenderContext,
|
val context: RenderContext,
|
||||||
) {
|
) {
|
||||||
private val water = context.connection.registries.fluid[WaterFluid]
|
private val water = context.connection.registries.fluid[WaterFluid]
|
||||||
@ -56,7 +55,7 @@ class FluidSectionPreparer(
|
|||||||
|
|
||||||
|
|
||||||
// ToDo: Should this be combined with the solid renderer (but we'd need to render faces twice, because of cullface)
|
// ToDo: Should this be combined with the solid renderer (but we'd need to render faces twice, because of cullface)
|
||||||
fun prepareFluid(chunkPosition: Vec2i, sectionHeight: Int, chunk: Chunk, section: ChunkSection, neighbourChunks: Array<Chunk>, neighbours: Array<ChunkSection?>, mesh: ChunkMesh) {
|
fun mesh(chunkPosition: Vec2i, sectionHeight: Int, chunk: Chunk, section: ChunkSection, neighbourChunks: Array<Chunk>, neighbours: Array<ChunkSection?>, mesh: ChunkMesh) {
|
||||||
val blocks = section.blocks
|
val blocks = section.blocks
|
||||||
|
|
||||||
val random = Random(0L)
|
val random = Random(0L)
|
@ -11,7 +11,7 @@
|
|||||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.bixilon.minosoft.gui.rendering.world.preparer
|
package de.bixilon.minosoft.gui.rendering.chunk.preparer
|
||||||
|
|
||||||
import de.bixilon.kotlinglm.vec2.Vec2i
|
import de.bixilon.kotlinglm.vec2.Vec2i
|
||||||
import de.bixilon.kotlinglm.vec3.Vec3i
|
import de.bixilon.kotlinglm.vec3.Vec3i
|
||||||
@ -39,7 +39,7 @@ import de.bixilon.minosoft.gui.rendering.models.block.state.render.BlockRender
|
|||||||
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
|
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class SolidSectionPreparer(
|
class SolidSectionMesher(
|
||||||
val context: RenderContext,
|
val context: RenderContext,
|
||||||
) {
|
) {
|
||||||
private val profile = context.connection.profiles.block.rendering
|
private val profile = context.connection.profiles.block.rendering
|
||||||
@ -52,7 +52,7 @@ class SolidSectionPreparer(
|
|||||||
profile.performance::fastBedrock.observe(this, true) { this.fastBedrock = it }
|
profile.performance::fastBedrock.observe(this, true) { this.fastBedrock = it }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun prepareSolid(chunkPosition: Vec2i, sectionHeight: Int, chunk: Chunk, section: ChunkSection, neighbourChunks: Array<Chunk>, neighbours: Array<ChunkSection?>, mesh: ChunkMesh) {
|
fun mesh(chunkPosition: Vec2i, sectionHeight: Int, chunk: Chunk, section: ChunkSection, neighbourChunks: Array<Chunk>, neighbours: Array<ChunkSection?>, mesh: ChunkMesh) {
|
||||||
val random = if (profile.antiMoirePattern) Random(0L) else null
|
val random = if (profile.antiMoirePattern) Random(0L) else null
|
||||||
|
|
||||||
|
|
@ -18,12 +18,12 @@ import de.bixilon.minosoft.data.direction.Directions
|
|||||||
import de.bixilon.minosoft.data.text.formatting.color.RGBColor
|
import de.bixilon.minosoft.data.text.formatting.color.RGBColor
|
||||||
import de.bixilon.minosoft.gui.rendering.chunk.mesh.ChunkMesh
|
import de.bixilon.minosoft.gui.rendering.chunk.mesh.ChunkMesh
|
||||||
import de.bixilon.minosoft.gui.rendering.chunk.mesh.SingleChunkMesh
|
import de.bixilon.minosoft.gui.rendering.chunk.mesh.SingleChunkMesh
|
||||||
|
import de.bixilon.minosoft.gui.rendering.chunk.preparer.SolidSectionMesher.Companion.SELF_LIGHT_INDEX
|
||||||
import de.bixilon.minosoft.gui.rendering.models.block.state.baked.cull.side.FaceProperties
|
import de.bixilon.minosoft.gui.rendering.models.block.state.baked.cull.side.FaceProperties
|
||||||
import de.bixilon.minosoft.gui.rendering.system.base.MeshUtil.buffer
|
import de.bixilon.minosoft.gui.rendering.system.base.MeshUtil.buffer
|
||||||
import de.bixilon.minosoft.gui.rendering.system.base.texture.TextureTransparencies
|
import de.bixilon.minosoft.gui.rendering.system.base.texture.TextureTransparencies
|
||||||
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.Texture
|
import de.bixilon.minosoft.gui.rendering.system.base.texture.texture.Texture
|
||||||
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3Util.rgb
|
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3Util.rgb
|
||||||
import de.bixilon.minosoft.gui.rendering.world.preparer.SolidSectionPreparer.Companion.SELF_LIGHT_INDEX
|
|
||||||
|
|
||||||
class BakedFace(
|
class BakedFace(
|
||||||
val positions: FloatArray,
|
val positions: FloatArray,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user