-
Notifications
You must be signed in to change notification settings - Fork 820
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust tex coord epsilon depending on atlas size
This fixes some texture precision issues with very large atlases, and with hardware that has limited sub-texel precision.
- Loading branch information
1 parent
d74e421
commit 3bc32ee
Showing
5 changed files
with
51 additions
and
12 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
...n/src/main/java/net/caffeinemc/mods/sodium/client/gl/shader/uniform/GlUniformFloat2v.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package net.caffeinemc.mods.sodium.client.gl.shader.uniform; | ||
|
||
import org.lwjgl.opengl.GL30C; | ||
|
||
public class GlUniformFloat2v extends GlUniform<float[]> { | ||
public GlUniformFloat2v(int index) { | ||
super(index); | ||
} | ||
|
||
@Override | ||
public void set(float[] value) { | ||
if (value.length != 2) { | ||
throw new IllegalArgumentException("value.length != 2"); | ||
} | ||
|
||
GL30C.glUniform2fv(this.index, value); | ||
} | ||
|
||
public void set(float x, float y) { | ||
GL30C.glUniform2f(this.index, x, y); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 4 additions & 5 deletions
9
.../main/java/net/caffeinemc/mods/sodium/mixin/core/render/texture/TextureAtlasAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
package net.caffeinemc.mods.sodium.mixin.core.render.texture; | ||
|
||
import net.minecraft.client.renderer.texture.TextureAtlas; | ||
import net.minecraft.client.renderer.texture.TextureAtlasSprite; | ||
import net.minecraft.resources.ResourceLocation; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
import java.util.Map; | ||
|
||
@Mixin(TextureAtlas.class) | ||
public interface TextureAtlasAccessor { | ||
@Accessor | ||
Map<ResourceLocation, TextureAtlasSprite> getTexturesByName(); | ||
int getWidth(); | ||
|
||
@Accessor | ||
int getHeight(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters