some shader improvements

This commit is contained in:
Moritz Zwerger 2025-03-10 00:34:00 +01:00
parent fd0974055d
commit 14a3257092
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
3 changed files with 5 additions and 3 deletions

View File

@ -117,7 +117,7 @@ void animation_animated(uint animationId) {
animationArray2 = animation_extractArray(texture2);
animationLayer2 = animation_extractLayer(texture2);
animationInterpolation = data.z / 100.0f;
animationInterpolation = data.z * (1.0f / 100.0f);
}
void setTexture(uint animation) {

View File

@ -37,6 +37,7 @@ vec4 getTexture(uint textureId, vec3 uv, uint mipmapLevel) {
case 7u: return textureLod(uTextures[7], uv, lod);
case 8u: return textureLod(uTextures[8], uv, lod);
case 9u: return textureLod(uTextures[9], uv, lod);
default: return textureLod(uTextures[0], uv, lod);
}
return textureLod(uTextures[0], uv, lod);
#endif
@ -63,6 +64,7 @@ vec4 getTexture(uint textureId, vec3 uv) {
case 7u: return texture(uTextures[7], uv);
case 8u: return texture(uTextures[8], uv);
case 9u: return texture(uTextures[9], uv);
default: return texture(uTextures[0], uv);
}
return texture(uTextures[0], uv);
#endif

View File

@ -19,8 +19,8 @@
#define UV_UNPACK_MASK ((1u << UV_UNPACK_BITS) - 1u)
vec2 uv_unpack(uint raw) {
float x = float((raw >> (1u * UV_UNPACK_BITS)) & UV_UNPACK_MASK) / float(UV_UNPACK_MASK);
float y = float((raw >> (0u * UV_UNPACK_BITS)) & UV_UNPACK_MASK) / float(UV_UNPACK_MASK);
float x = float((raw >> (1u * UV_UNPACK_BITS)) & UV_UNPACK_MASK) * (1.0f / float(UV_UNPACK_MASK));
float y = float((raw >> (0u * UV_UNPACK_BITS)) & UV_UNPACK_MASK) * (1.0f / float(UV_UNPACK_MASK));
return vec2(x, y);
}