rendering: fix loading of newer versions

This commit is contained in:
Bixilon 2021-03-20 14:13:15 +01:00
parent 6414ba4462
commit 8b2705a1f5
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
5 changed files with 16 additions and 13 deletions

View File

@ -169,7 +169,6 @@ class MinecraftAssetsManager(
return ret.toMap()
}
override fun getAssetSize(hash: String): Long {
val file = File(FileAssetsManager.getAssetDiskPath(hash))
return if (file.exists()) {
@ -179,7 +178,6 @@ class MinecraftAssetsManager(
}
}
override fun getAssetSize(resourceLocation: ResourceLocation): Long {
return getAssetSize(getAssetHash(resourceLocation))
}

View File

@ -24,20 +24,17 @@ data class HUDAtlasElement(
val binding: Vec2Binding,
val slots: Map<Int, Vec2Binding> = mapOf(),
) : TextureLike {
private var _uvStart = Vec2()
private var _uvEnd = Vec2()
override val uvStart: Vec2
get() = _uvStart
override val uvEnd: Vec2
get() = _uvEnd
override var uvStart: Vec2 = Vec2()
private set
override var uvEnd: Vec2 = Vec2()
private set
override val size: Vec2i
get() = binding.size
fun postInit() {
_uvStart = Vec2(binding.start) * texture.arraySinglePixelSize
_uvEnd = (Vec2(binding.end) - Vec2(0, 1)) * texture.arraySinglePixelSize
uvStart = Vec2(binding.start) * texture.arraySinglePixelSize
uvEnd = (Vec2(binding.end) - Vec2(0, 1)) * texture.arraySinglePixelSize
}
companion object {

View File

@ -90,7 +90,15 @@ class Texture(
companion object {
fun getResourceTextureIdentifier(namespace: String = ProtocolDefinition.DEFAULT_NAMESPACE, textureName: String): ResourceLocation {
var namespace = namespace
var texturePath = textureName
if (texturePath.contains(":")) {
val split = texturePath.split(":")
namespace = split[0]
texturePath = split[1]
}
texturePath = texturePath.removePrefix("/")
if (!texturePath.startsWith("textures/")) {

View File

@ -161,7 +161,7 @@ class TextureArray(val allTextures: MutableList<Texture>) {
private set
fun initBuffer() {
animatedData = IntArray(32 * INTS_PER_ANIMATED_TEXTURE) // 4 data ints per entry
animatedData = IntArray(128 * INTS_PER_ANIMATED_TEXTURE) // 4 data ints per entry
animatedBufferDataId = glGenBuffers()

View File

@ -33,7 +33,7 @@ uniform mat4 viewProjectionMatrix;
layout(std140) uniform AnimatedDataBuffer
{
uvec4 globalAnimationData[32];// ToDo: WTF. Why 4 values??
uvec4 globalAnimationData[128];// ToDo: WTF. Why 4 values??
};