mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-18 19:39:09 +00:00
Custom images, textures, SSBO, and ShaderPack/ShaderProperties backports
This commit is contained in:
1 parent
6d60477b93
commit
bb52476d27
54 files changed
+2210
-494
No files matched your search
@@ -1,64 +1,69 @@
|
||||
package net.coderbot.iris.shaderpack;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2BooleanMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2BooleanMaps;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import lombok.Getter;
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.gl.buffer.ShaderStorageInfo;
|
||||
import net.coderbot.iris.gl.texture.TextureScaleOverride;
|
||||
import net.coderbot.iris.gl.texture.TextureType;
|
||||
import net.coderbot.iris.helpers.Tri;
|
||||
import net.coderbot.iris.shaderpack.texture.TextureStage;
|
||||
import org.joml.Vector2i;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
public class PackDirectives {
|
||||
@Getter
|
||||
private int noiseTextureResolution;
|
||||
@Getter
|
||||
private float sunPathRotation;
|
||||
@Getter
|
||||
private float ambientOcclusionLevel;
|
||||
@Getter
|
||||
private float wetnessHalfLife;
|
||||
@Getter
|
||||
private float drynessHalfLife;
|
||||
@Getter
|
||||
private float eyeBrightnessHalfLife;
|
||||
@Getter
|
||||
private float centerDepthHalfLife;
|
||||
@Getter
|
||||
private CloudSetting cloudSetting;
|
||||
@Getter private int noiseTextureResolution;
|
||||
@Getter private float sunPathRotation;
|
||||
@Getter private float ambientOcclusionLevel;
|
||||
@Getter private float wetnessHalfLife;
|
||||
@Getter private float drynessHalfLife;
|
||||
@Getter private float eyeBrightnessHalfLife;
|
||||
@Getter private float centerDepthHalfLife;
|
||||
@Getter private CloudSetting cloudSetting;
|
||||
@Getter private CloudSetting dhCloudSetting;
|
||||
private boolean underwaterOverlay;
|
||||
private boolean vignette;
|
||||
private boolean sun;
|
||||
private boolean moon;
|
||||
private boolean rainDepth;
|
||||
private boolean separateAo;
|
||||
@Getter
|
||||
private boolean oldLighting;
|
||||
private boolean voxelizeLightBlocks;
|
||||
private boolean separateEntityDraws;
|
||||
private boolean frustumCulling;
|
||||
private boolean occlusionCulling;
|
||||
@Getter private boolean oldLighting;
|
||||
private boolean concurrentCompute;
|
||||
@Getter
|
||||
private boolean oldHandLight;
|
||||
private boolean particlesBeforeDeferred;
|
||||
@Getter
|
||||
private boolean prepareBeforeShadow;
|
||||
@Getter private boolean oldHandLight;
|
||||
@Getter private boolean prepareBeforeShadow;
|
||||
@Getter private boolean supportsColorCorrection;
|
||||
@Getter private int fallbackTex;
|
||||
private Object2ObjectMap<String, Object2BooleanMap<String>> explicitFlips = new Object2ObjectOpenHashMap<>();
|
||||
private Object2ObjectMap<String, TextureScaleOverride> scaleOverrides = new Object2ObjectOpenHashMap<>();
|
||||
@Getter private Object2ObjectMap<Tri<String, TextureType, TextureStage>, String> textureMap;
|
||||
@Getter private Int2ObjectMap<ShaderStorageInfo> bufferObjects;
|
||||
@Getter private Optional<ParticleRenderingSettings> particleRenderingSettings;
|
||||
|
||||
@Getter
|
||||
private final PackRenderTargetDirectives renderTargetDirectives;
|
||||
@Getter
|
||||
private final PackShadowDirectives shadowDirectives;
|
||||
@Getter private final PackRenderTargetDirectives renderTargetDirectives;
|
||||
@Getter private final PackShadowDirectives shadowDirectives;
|
||||
|
||||
private PackDirectives(Set<Integer> supportedRenderTargets, PackShadowDirectives packShadowDirectives) {
|
||||
noiseTextureResolution = 256;
|
||||
sunPathRotation = 0.0F;
|
||||
supportsColorCorrection = false;
|
||||
ambientOcclusionLevel = 1.0F;
|
||||
wetnessHalfLife = 600.0f;
|
||||
drynessHalfLife = 200.0f;
|
||||
eyeBrightnessHalfLife = 10.0f;
|
||||
centerDepthHalfLife = 1.0F;
|
||||
bufferObjects = new Int2ObjectOpenHashMap<>();
|
||||
renderTargetDirectives = new PackRenderTargetDirectives(supportedRenderTargets);
|
||||
shadowDirectives = packShadowDirectives;
|
||||
}
|
||||
@@ -66,31 +71,46 @@ public class PackDirectives {
|
||||
PackDirectives(Set<Integer> supportedRenderTargets, ShaderProperties properties) {
|
||||
this(supportedRenderTargets, new PackShadowDirectives(properties));
|
||||
cloudSetting = properties.getCloudSetting();
|
||||
dhCloudSetting = properties.getDhCloudSetting();
|
||||
underwaterOverlay = properties.getUnderwaterOverlay().orElse(false);
|
||||
vignette = properties.getVignette().orElse(false);
|
||||
sun = properties.getSun().orElse(true);
|
||||
moon = properties.getMoon().orElse(true);
|
||||
rainDepth = properties.getRainDepth().orElse(false);
|
||||
separateAo = false; //properties.getSeparateAo().orElse(false);
|
||||
voxelizeLightBlocks = properties.getVoxelizeLightBlocks().orElse(false);
|
||||
separateEntityDraws = properties.getSeparateEntityDraws().orElse(false);
|
||||
frustumCulling = properties.getFrustumCulling().orElse(true);
|
||||
occlusionCulling = properties.getOcclusionCulling().orElse(true);
|
||||
oldLighting = properties.getOldLighting().orElse(false);
|
||||
fallbackTex = properties.getFallbackTex();
|
||||
supportsColorCorrection = properties.getSupportsColorCorrection().orElse(false);
|
||||
concurrentCompute = properties.getConcurrentCompute().orElse(false);
|
||||
oldHandLight = properties.getOldHandLight().orElse(true);
|
||||
explicitFlips = properties.getExplicitFlips();
|
||||
scaleOverrides = properties.getTextureScaleOverrides();
|
||||
particlesBeforeDeferred = properties.getParticlesBeforeDeferred().orElse(false);
|
||||
prepareBeforeShadow = properties.getPrepareBeforeShadow().orElse(false);
|
||||
particleRenderingSettings = properties.getParticleRenderingSettings();
|
||||
textureMap = properties.getCustomTexturePatching();
|
||||
bufferObjects = properties.getBufferObjects();
|
||||
}
|
||||
|
||||
PackDirectives(Set<Integer> supportedRenderTargets, PackDirectives directives) {
|
||||
this(supportedRenderTargets, new PackShadowDirectives(directives.getShadowDirectives()));
|
||||
cloudSetting = directives.cloudSetting;
|
||||
separateAo = directives.separateAo;
|
||||
voxelizeLightBlocks = directives.voxelizeLightBlocks;
|
||||
separateEntityDraws = directives.separateEntityDraws;
|
||||
frustumCulling = directives.frustumCulling;
|
||||
occlusionCulling = directives.occlusionCulling;
|
||||
oldLighting = directives.oldLighting;
|
||||
concurrentCompute = directives.concurrentCompute;
|
||||
explicitFlips = directives.explicitFlips;
|
||||
scaleOverrides = directives.scaleOverrides;
|
||||
particlesBeforeDeferred = directives.particlesBeforeDeferred;
|
||||
prepareBeforeShadow = directives.prepareBeforeShadow;
|
||||
particleRenderingSettings = directives.particleRenderingSettings;
|
||||
textureMap = directives.textureMap;
|
||||
bufferObjects = directives.bufferObjects;
|
||||
}
|
||||
|
||||
public boolean underwaterOverlay() {
|
||||
@@ -117,8 +137,20 @@ public class PackDirectives {
|
||||
return separateAo;
|
||||
}
|
||||
|
||||
public boolean areParticlesBeforeDeferred() {
|
||||
return particlesBeforeDeferred;
|
||||
public boolean shouldVoxelizeLightBlocks() {
|
||||
return voxelizeLightBlocks;
|
||||
}
|
||||
|
||||
public boolean shouldUseSeparateEntityDraws() {
|
||||
return separateEntityDraws;
|
||||
}
|
||||
|
||||
public boolean shouldUseFrustumCulling() {
|
||||
return frustumCulling;
|
||||
}
|
||||
|
||||
public boolean shouldUseOcclusionCulling() {
|
||||
return occlusionCulling;
|
||||
}
|
||||
|
||||
public boolean getConcurrentCompute() {
|
||||
@@ -133,30 +165,17 @@ public class PackDirectives {
|
||||
renderTargetDirectives.acceptDirectives(directives);
|
||||
shadowDirectives.acceptDirectives(directives);
|
||||
|
||||
directives.acceptConstIntDirective("noiseTextureResolution",
|
||||
noiseTextureResolution -> this.noiseTextureResolution = noiseTextureResolution);
|
||||
|
||||
directives.acceptConstFloatDirective("sunPathRotation",
|
||||
sunPathRotation -> this.sunPathRotation = sunPathRotation);
|
||||
|
||||
directives.acceptConstFloatDirective("ambientOcclusionLevel",
|
||||
ambientOcclusionLevel -> this.ambientOcclusionLevel = clamp(ambientOcclusionLevel, 0.0f, 1.0f));
|
||||
|
||||
directives.acceptConstFloatDirective("wetnessHalflife",
|
||||
wetnessHalfLife -> this.wetnessHalfLife = wetnessHalfLife);
|
||||
|
||||
directives.acceptConstFloatDirective("drynessHalflife",
|
||||
wetnessHalfLife -> this.wetnessHalfLife = wetnessHalfLife);
|
||||
|
||||
directives.acceptConstFloatDirective("eyeBrightnessHalflife",
|
||||
eyeBrightnessHalfLife -> this.eyeBrightnessHalfLife = eyeBrightnessHalfLife);
|
||||
|
||||
directives.acceptConstFloatDirective("centerDepthHalflife",
|
||||
centerDepthHalfLife -> this.centerDepthHalfLife = centerDepthHalfLife);
|
||||
directives.acceptConstIntDirective("noiseTextureResolution", noiseTextureResolution -> this.noiseTextureResolution = noiseTextureResolution);
|
||||
directives.acceptConstFloatDirective("sunPathRotation", sunPathRotation -> this.sunPathRotation = sunPathRotation);
|
||||
directives.acceptConstFloatDirective("ambientOcclusionLevel", ambientOcclusionLevel -> this.ambientOcclusionLevel = clamp(ambientOcclusionLevel, 0.0f, 1.0f));
|
||||
directives.acceptConstFloatDirective("wetnessHalflife", wetnessHalfLife -> this.wetnessHalfLife = wetnessHalfLife);
|
||||
directives.acceptConstFloatDirective("drynessHalflife", wetnessHalfLife -> this.wetnessHalfLife = wetnessHalfLife);
|
||||
directives.acceptConstFloatDirective("eyeBrightnessHalflife", eyeBrightnessHalfLife -> this.eyeBrightnessHalfLife = eyeBrightnessHalfLife);
|
||||
directives.acceptConstFloatDirective("centerDepthHalflife", centerDepthHalfLife -> this.centerDepthHalfLife = centerDepthHalfLife);
|
||||
}
|
||||
|
||||
public ImmutableMap<Integer, Boolean> getExplicitFlips(String pass) {
|
||||
ImmutableMap.Builder<Integer, Boolean> explicitFlips = ImmutableMap.builder();
|
||||
final ImmutableMap.Builder<Integer, Boolean> explicitFlips = ImmutableMap.builder();
|
||||
|
||||
Object2BooleanMap<String> explicitFlipsStr = this.explicitFlips.get(pass);
|
||||
|
||||
@@ -180,8 +199,7 @@ public class PackDirectives {
|
||||
if (index != -1) {
|
||||
explicitFlips.put(index, shouldFlip);
|
||||
} else {
|
||||
Iris.logger.warn("Unknown buffer with ID " + buffer + " specified in flip directive for pass "
|
||||
+ pass);
|
||||
Iris.logger.warn("Unknown buffer with ID " + buffer + " specified in flip directive for pass " + pass);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user