mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 03:15:35 -04:00
model builder: wip baking, serialize or condition
This commit is contained in:
parent
4a469a9394
commit
34857d0878
@ -14,6 +14,7 @@
|
|||||||
package de.bixilon.minosoft.gui.rendering.models.block.state.builder
|
package de.bixilon.minosoft.gui.rendering.models.block.state.builder
|
||||||
|
|
||||||
import de.bixilon.minosoft.gui.rendering.models.block.state.apply.BlockStateApply
|
import de.bixilon.minosoft.gui.rendering.models.block.state.apply.BlockStateApply
|
||||||
|
import de.bixilon.minosoft.gui.rendering.models.block.state.baked.BakedModel
|
||||||
import de.bixilon.minosoft.gui.rendering.models.block.state.render.BlockRender
|
import de.bixilon.minosoft.gui.rendering.models.block.state.render.BlockRender
|
||||||
import de.bixilon.minosoft.gui.rendering.system.base.texture.TextureManager
|
import de.bixilon.minosoft.gui.rendering.system.base.texture.TextureManager
|
||||||
|
|
||||||
@ -22,6 +23,20 @@ class BuilderApply(
|
|||||||
) : BlockStateApply {
|
) : BlockStateApply {
|
||||||
|
|
||||||
override fun bake(textures: TextureManager): BlockRender? {
|
override fun bake(textures: TextureManager): BlockRender? {
|
||||||
TODO("Not yet implemented")
|
val static: MutableList<BakedModel> = mutableListOf()
|
||||||
|
val dynamic: MutableList<BlockRender> = mutableListOf()
|
||||||
|
|
||||||
|
for (apply in this.applies) {
|
||||||
|
val baked = apply.bake(textures) ?: continue
|
||||||
|
if (baked is BakedModel) {
|
||||||
|
static += baked
|
||||||
|
} else {
|
||||||
|
dynamic += baked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (static.isEmpty() && dynamic.isEmpty()) return null
|
||||||
|
|
||||||
|
TODO("Can not combine them yet")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,15 @@ class OrCondition(
|
|||||||
const val KEY = "OR"
|
const val KEY = "OR"
|
||||||
|
|
||||||
fun deserialize(data: List<JsonObject>): OrCondition? {
|
fun deserialize(data: List<JsonObject>): OrCondition? {
|
||||||
TODO()
|
val conditions: MutableSet<BuilderCondition> = mutableSetOf()
|
||||||
|
|
||||||
|
for (entry in data) {
|
||||||
|
conditions += AndCondition.deserialize(entry) ?: continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (conditions.isEmpty()) return null
|
||||||
|
|
||||||
|
return OrCondition(conditions)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user