mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-19 20:09:39 +00:00
Fix PBR (#252)
This commit is contained in:
1 parent
4d39c90ba6
commit
05158317e8
3 files changed
+42
-1
No files matched your search
@@ -79,6 +79,7 @@ public enum Mixins {
|
||||
,"shaders.startup.MixinInitRenderer"
|
||||
,"shaders.startup.MixinAbstractTexture"
|
||||
,"shaders.startup.MixinTextureAtlasSprite"
|
||||
,"shaders.startup.MixinTextureMap"
|
||||
)
|
||||
),
|
||||
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.shaders.startup;
|
||||
|
||||
import net.coderbot.iris.texture.pbr.PBRAtlasHolder;
|
||||
import net.coderbot.iris.texture.pbr.TextureAtlasExtension;
|
||||
import net.minecraft.client.renderer.texture.AbstractTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(TextureMap.class)
|
||||
public abstract class MixinTextureMap extends AbstractTexture implements TextureAtlasExtension {
|
||||
@Unique
|
||||
private PBRAtlasHolder iris$pbrHolder;
|
||||
|
||||
@Inject(method = "updateAnimations()V", at = @At("TAIL"))
|
||||
private void iris$onTailUpdateAnimations(CallbackInfo ci) {
|
||||
if (iris$pbrHolder != null) {
|
||||
iris$pbrHolder.cycleAnimationFrames();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PBRAtlasHolder getPBRHolder() {
|
||||
return iris$pbrHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PBRAtlasHolder getOrCreatePBRHolder() {
|
||||
if (iris$pbrHolder == null) {
|
||||
iris$pbrHolder = new PBRAtlasHolder();
|
||||
}
|
||||
return iris$pbrHolder;
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,10 @@ public class AtlasPBRLoader implements PBRTextureLoader<TextureMap> {
|
||||
}
|
||||
|
||||
if (normalAtlas != null) {
|
||||
if (normalAtlas.tryUpload(atlasWidth, atlasHeight, mipLevel, ((TextureMapAccessor) texMap).getAnisotropicFiltering())) {
|
||||
if (normalAtlas.tryUpload(atlasWidth,
|
||||
atlasHeight,
|
||||
mipLevel,
|
||||
((TextureMapAccessor) texMap).getAnisotropicFiltering())) {
|
||||
pbrTextureConsumer.acceptNormalTexture(normalAtlas);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user