diff --git a/changelog.md b/changelog.md index dbd58e6..d261168 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,9 @@ +------------------------------------------------------ +Version 1.6.1 +------------------------------------------------------ +**Fixes** +- Fixed uniforms for core shaders still being reset after resource reloading + ------------------------------------------------------ Version 1.6.0 ------------------------------------------------------ diff --git a/gradle.properties b/gradle.properties index 81d8323..9591657 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,7 +11,7 @@ loader_version=0.11.6 fabric_version=0.36.0+1.17 # Mod Properties -mod_version = 1.6.0 +mod_version = 1.6.1 owners = Ladysnake maven_group = io.github.ladysnake archives_base_name = satin diff --git a/src/main/java/ladysnake/satin/impl/ManagedUniform.java b/src/main/java/ladysnake/satin/impl/ManagedUniform.java index 203a027..cc34826 100644 --- a/src/main/java/ladysnake/satin/impl/ManagedUniform.java +++ b/src/main/java/ladysnake/satin/impl/ManagedUniform.java @@ -55,33 +55,34 @@ public boolean findUniformTargets(List shaders) { .map(s -> s.getUniformByName(this.name)) .filter(Objects::nonNull) .toArray(GlUniform[]::new); - if (!this.firstUpload) { - this.uploadCurrentValues(); - } + this.syncCurrentValues(); return this.targets.length > 0; } - private void uploadCurrentValues() { - for (GlUniform target : this.targets) { - if (target.getIntData() != null) { - target.setForDataType(i0, i1, i2, i3); - } else { - assert target.getFloatData() != null; - target.setForDataType(f0, f1, f2, f3); - } - } - } - @Override public boolean findUniformTarget(Shader shader) { GlUniform uniform = shader.getUniform(this.name); if (uniform != null) { this.targets = new GlUniform[] {uniform}; + this.syncCurrentValues(); return true; } return false; } + private void syncCurrentValues() { + if (!this.firstUpload) { + for (GlUniform target : this.targets) { + if (target.getIntData() != null) { + target.setForDataType(i0, i1, i2, i3); + } else { + assert target.getFloatData() != null; + target.setForDataType(f0, f1, f2, f3); + } + } + } + } + @Override public void set(int value) { GlUniform[] targets = this.targets;