Common and version specific shader packages #10
No files matched your search
@@ -1,150 +0,0 @@
|
|||||||
package net.irisshaders.iris.api.v0;
|
|
||||||
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.util.ServiceLoader;
|
|
||||||
import java.util.function.IntFunction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The entry point to the Iris API, major version 0. This is currently the latest
|
|
||||||
* version of the API.
|
|
||||||
* <p>
|
|
||||||
* To access the API, use {@link #getInstance()}.
|
|
||||||
*/
|
|
||||||
public interface IrisApi {
|
|
||||||
IrisApi INSTANCE = ServiceLoader.load(IrisApi.class).findFirst().orElseThrow();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @since API v0.0
|
|
||||||
*/
|
|
||||||
static IrisApi getInstance() {
|
|
||||||
return INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the minor revision of this API. This is incremented when
|
|
||||||
* new methods are added without breaking API. Mods can check this
|
|
||||||
* if they wish to check whether given API calls are available on
|
|
||||||
* the currently installed Iris version.
|
|
||||||
*
|
|
||||||
* @return The current minor revision. Currently, revision 2.
|
|
||||||
*/
|
|
||||||
int getMinorApiRevision();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether a shader pack is currently in use and being used
|
|
||||||
* for rendering. If there is no shader pack enabled or a shader
|
|
||||||
* pack failed to compile and is therefore not in use, this will
|
|
||||||
* return false.
|
|
||||||
*
|
|
||||||
* <p>Mods that need to enable custom workarounds for shaders
|
|
||||||
* should use this method.
|
|
||||||
*
|
|
||||||
* @return Whether shaders are being used for rendering.
|
|
||||||
* @since {@link #getMinorApiRevision() API v0.0}
|
|
||||||
*/
|
|
||||||
boolean isShaderPackInUse();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether the shadow pass is currently being rendered.
|
|
||||||
*
|
|
||||||
* <p>Generally, mods won't need to call this function for much.
|
|
||||||
* Mods should be fine with things being rendered multiple times
|
|
||||||
* each frame from different camera perspectives. Often, there's
|
|
||||||
* a better approach to fixing bugs than calling this function.
|
|
||||||
*
|
|
||||||
* <p>Pretty much the main legitimate use for this function that
|
|
||||||
* I've seen is in a mod like Immersive Portals, where it has
|
|
||||||
* very custom culling that doesn't work when the Iris shadow
|
|
||||||
* pass is active.
|
|
||||||
*
|
|
||||||
* <p>Naturally, this function can only return true if
|
|
||||||
* {@link #isShaderPackInUse()} returns true.
|
|
||||||
*
|
|
||||||
* @return Whether Iris is currently rendering the shadow pass.
|
|
||||||
* @since API v0.0
|
|
||||||
*/
|
|
||||||
boolean isRenderingShadowPass();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the shadow distance that should be used for rendering shadows.
|
|
||||||
* This method is used to override the shadow distance set in the
|
|
||||||
* Minecraft options screen.
|
|
||||||
*
|
|
||||||
* @param base The shadow distance set in the Minecraft options screen.
|
|
||||||
* @return The shadow distance that should be used for rendering shadows.
|
|
||||||
* @since API v0.2
|
|
||||||
*/
|
|
||||||
int getOverriddenShadowDistance(int base);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether the shadow distance slider should be enabled in the
|
|
||||||
* Minecraft options screen. If this method returns false, the shadow
|
|
||||||
* distance slider should be disabled.
|
|
||||||
*
|
|
||||||
* @return Whether the shadow distance slider should be enabled.
|
|
||||||
* @since API v0.2
|
|
||||||
*/
|
|
||||||
boolean isShadowDistanceSliderEnabled();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether debug options are enabled. Debug options give much
|
|
||||||
* more detailed OpenGL error outputs at the cost of performance.
|
|
||||||
*
|
|
||||||
* @return Whether debug options are enabled.
|
|
||||||
* @since API v0.2
|
|
||||||
*/
|
|
||||||
boolean areDebugOptionsEnabled();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Opens the main Iris GUI screen. It's up to Iris to decide
|
|
||||||
* what this screen is, but generally this is the shader selection
|
|
||||||
* screen.
|
|
||||||
* <p>
|
|
||||||
* This method takes and returns Objects instead of any concrete
|
|
||||||
* Minecraft screen class to avoid referencing Minecraft classes.
|
|
||||||
* Nevertheless, the passed parent must either be null, or an
|
|
||||||
* object that is a subclass of the appropriate {@code Screen}
|
|
||||||
* class for the given Minecraft version.
|
|
||||||
*
|
|
||||||
* @param parent The parent screen, an instance of the appropriate
|
|
||||||
* {@code Screen} class.
|
|
||||||
* @return A {@code Screen} class for the main Iris GUI screen.
|
|
||||||
* @since API v0.0
|
|
||||||
*/
|
|
||||||
Object openMainIrisScreenObj(Object parent);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the language key of the main screen. Currently, this
|
|
||||||
* is "options.iris.shaderPackSelection".
|
|
||||||
*
|
|
||||||
* @return the language key, for use with {@code TranslatableText}
|
|
||||||
* / {@code TranslatableComponent}
|
|
||||||
* @since API v0.0
|
|
||||||
*/
|
|
||||||
String getMainScreenLanguageKey();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a config object that can edit the Iris configuration.
|
|
||||||
*
|
|
||||||
* @since API v0.0
|
|
||||||
*/
|
|
||||||
IrisApiConfig getConfig();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a text vertex sink to render into.
|
|
||||||
*
|
|
||||||
* @param maxQuadCount Maximum amount of quads that will be rendered with this sink
|
|
||||||
* @param bufferProvider An IntFunction that can provide a {@code ByteBuffer} with at minimum the bytes provided by the input parameter
|
|
||||||
* @since API 0.1
|
|
||||||
*/
|
|
||||||
IrisTextVertexSink createTextVertexSink(int maxQuadCount, IntFunction<ByteBuffer> bufferProvider);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the sun path rotation used by the current shader pack.
|
|
||||||
*
|
|
||||||
* @return The sun path rotation as specified by the shader pack, or 0 if no shader pack is in use.
|
|
||||||
* @since API v0.2
|
|
||||||
*/
|
|
||||||
float getSunPathRotation();
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package net.irisshaders.iris.gui.option;
|
package net.irisshaders.iris.gui.option;
|
||||||
|
|
||||||
import net.irisshaders.iris.api.v0.IrisApi;
|
|
||||||
import net.irisshaders.iris.pathways.colorspace.ColorSpace;
|
import net.irisshaders.iris.pathways.colorspace.ColorSpace;
|
||||||
|
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
||||||
|
|
||||||
|
|
||||||
public class IrisVideoSettings {
|
public class IrisVideoSettings {
|
||||||
@@ -9,10 +9,10 @@ public class IrisVideoSettings {
|
|||||||
public static ColorSpace colorSpace = ColorSpace.SRGB;
|
public static ColorSpace colorSpace = ColorSpace.SRGB;
|
||||||
|
|
||||||
public static int getOverriddenShadowDistance(int base) {
|
public static int getOverriddenShadowDistance(int base) {
|
||||||
return IrisApi.getInstance().getOverriddenShadowDistance(base);
|
return CeleritasShadersApi.getInstance().getOverriddenShadowDistance(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isShadowDistanceSliderEnabled() {
|
public static boolean isShadowDistanceSliderEnabled() {
|
||||||
return IrisApi.getInstance().isShadowDistanceSliderEnabled();
|
return CeleritasShadersApi.getInstance().isShadowDistanceSliderEnabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package net.irisshaders.iris.helpers;
|
package net.irisshaders.iris.helpers;
|
||||||
|
|
||||||
import static org.embeddedt.embeddium.compat.mc.ABGR32Service.ABGR32;
|
import org.embeddedt.embeddium.api.util.ColorABGR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a port of the fast-srgb8 library from thomcc on <a href="https://github.com/thomcc/fast-srgb8">GitHub</a>.
|
* This is a port of the fast-srgb8 library from thomcc on <a href="https://github.com/thomcc/fast-srgb8">GitHub</a>.
|
||||||
@@ -84,7 +84,7 @@ public class ColorSRGB {
|
|||||||
* @param a The alpha-component in linear RGB space (0 to 255)
|
* @param a The alpha-component in linear RGB space (0 to 255)
|
||||||
*/
|
*/
|
||||||
public static int linearToSrgb(float r, float g, float b, int a) {
|
public static int linearToSrgb(float r, float g, float b, int a) {
|
||||||
return ABGR32.color(a, linearToSrgb(b), linearToSrgb(g), linearToSrgb(r));
|
return ColorABGR.pack(linearToSrgb(r), linearToSrgb(g), linearToSrgb(b), a);
|
||||||
|
embeddedt marked this conversation as resolved
Outdated
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
package net.irisshaders.iris.pipeline.transform;
|
package net.irisshaders.iris.pipeline.transform;
|
||||||
|
|
||||||
import net.irisshaders.iris.api.v0.IrisApi;
|
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@@ -57,7 +57,7 @@ public class ShaderPrinter {
|
|||||||
public static class ProgramPrintBuilder {
|
public static class ProgramPrintBuilder {
|
||||||
// copy the debug flag if for some reason the debug flag changes during the
|
// copy the debug flag if for some reason the debug flag changes during the
|
||||||
// lifetime of this builder object
|
// lifetime of this builder object
|
||||||
private final boolean isActive = IrisApi.getInstance().areDebugOptionsEnabled();
|
private final boolean isActive = CeleritasShadersApi.getInstance().areDebugOptionsEnabled();
|
||||||
|
|
||||||
// the prefix is created at instantiation time so that all sources attached to
|
// the prefix is created at instantiation time so that all sources attached to
|
||||||
// this builder use the same counter prefix
|
// this builder use the same counter prefix
|
||||||
|
|||||||
+2
-2
@@ -6,7 +6,6 @@ import it.unimi.dsi.fastutil.objects.Object2BooleanMap;
|
|||||||
import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||||
import net.irisshaders.iris.api.v0.IrisApi;
|
|
||||||
import net.irisshaders.iris.gl.IrisRenderSystem;
|
import net.irisshaders.iris.gl.IrisRenderSystem;
|
||||||
import net.irisshaders.iris.gl.blending.AlphaTest;
|
import net.irisshaders.iris.gl.blending.AlphaTest;
|
||||||
import net.irisshaders.iris.gl.blending.AlphaTestFunction;
|
import net.irisshaders.iris.gl.blending.AlphaTestFunction;
|
||||||
@@ -31,6 +30,7 @@ import net.irisshaders.iris.shaderpack.option.ShaderPackOptions;
|
|||||||
import net.irisshaders.iris.shaderpack.preprocessor.PropertiesPreprocessor;
|
import net.irisshaders.iris.shaderpack.preprocessor.PropertiesPreprocessor;
|
||||||
import net.irisshaders.iris.shaderpack.texture.TextureStage;
|
import net.irisshaders.iris.shaderpack.texture.TextureStage;
|
||||||
import net.irisshaders.iris.uniforms.custom.CustomUniforms;
|
import net.irisshaders.iris.uniforms.custom.CustomUniforms;
|
||||||
|
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
@@ -126,7 +126,7 @@ public class ShaderProperties {
|
|||||||
public ShaderProperties(String contents, ShaderPackOptions shaderPackOptions, Iterable<StringPair> environmentDefines) {
|
public ShaderProperties(String contents, ShaderPackOptions shaderPackOptions, Iterable<StringPair> environmentDefines) {
|
||||||
String preprocessedContents = PropertiesPreprocessor.preprocessSource(contents, shaderPackOptions, environmentDefines);
|
String preprocessedContents = PropertiesPreprocessor.preprocessSource(contents, shaderPackOptions, environmentDefines);
|
||||||
|
|
||||||
if (IrisApi.getInstance().areDebugOptionsEnabled()) {
|
if (CeleritasShadersApi.getInstance().areDebugOptionsEnabled()) {
|
||||||
try {
|
try {
|
||||||
Files.writeString(PLATFORM_UTIL.getGameDir().resolve("preprocessed.properties"), preprocessedContents);
|
Files.writeString(PLATFORM_UTIL.getGameDir().resolve("preprocessed.properties"), preprocessedContents);
|
||||||
Files.writeString(PLATFORM_UTIL.getGameDir().resolve("original.properties"), contents);
|
Files.writeString(PLATFORM_UTIL.getGameDir().resolve("original.properties"), contents);
|
||||||
|
|||||||
+24
-24
@@ -1,6 +1,6 @@
|
|||||||
package net.irisshaders.iris.texture.mipmap;
|
package net.irisshaders.iris.texture.mipmap;
|
||||||
|
|
||||||
import static org.embeddedt.embeddium.compat.mc.ABGR32Service.ABGR32;
|
import org.embeddedt.embeddium.api.util.ColorABGR;
|
||||||
|
|
||||||
public class ChannelMipmapGenerator extends AbstractMipmapGenerator {
|
public class ChannelMipmapGenerator extends AbstractMipmapGenerator {
|
||||||
protected final BlendFunction redFunc;
|
protected final BlendFunction redFunc;
|
||||||
@@ -17,31 +17,31 @@ public class ChannelMipmapGenerator extends AbstractMipmapGenerator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int blend(int c0, int c1, int c2, int c3) {
|
public int blend(int c0, int c1, int c2, int c3) {
|
||||||
return ABGR32.color(
|
return ColorABGR.pack(
|
||||||
alphaFunc.blend(
|
redFunc.blend(
|
||||||
ABGR32.alpha(c0),
|
ColorABGR.unpackRed(c0),
|
||||||
ABGR32.alpha(c1),
|
ColorABGR.unpackRed(c1),
|
||||||
ABGR32.alpha(c2),
|
ColorABGR.unpackRed(c2),
|
||||||
ABGR32.alpha(c3)
|
ColorABGR.unpackRed(c3)
|
||||||
),
|
),
|
||||||
|
greenFunc.blend(
|
||||||
|
ColorABGR.unpackGreen(c0),
|
||||||
|
ColorABGR.unpackGreen(c1),
|
||||||
|
ColorABGR.unpackGreen(c2),
|
||||||
|
ColorABGR.unpackGreen(c3)
|
||||||
|
),
|
||||||
blueFunc.blend(
|
blueFunc.blend(
|
||||||
ABGR32.blue(c0),
|
ColorABGR.unpackBlue(c0),
|
||||||
ABGR32.blue(c1),
|
ColorABGR.unpackBlue(c1),
|
||||||
ABGR32.blue(c2),
|
ColorABGR.unpackBlue(c2),
|
||||||
ABGR32.blue(c3)
|
ColorABGR.unpackBlue(c3)
|
||||||
),
|
),
|
||||||
greenFunc.blend(
|
alphaFunc.blend(
|
||||||
ABGR32.green(c0),
|
ColorABGR.unpackAlpha(c0),
|
||||||
ABGR32.green(c1),
|
ColorABGR.unpackAlpha(c1),
|
||||||
ABGR32.green(c2),
|
ColorABGR.unpackAlpha(c2),
|
||||||
ABGR32.green(c3)
|
ColorABGR.unpackAlpha(c3)
|
||||||
),
|
)
|
||||||
redFunc.blend(
|
|
||||||
ABGR32.red(c0),
|
|
||||||
ABGR32.red(c1),
|
|
||||||
ABGR32.red(c2),
|
|
||||||
ABGR32.red(c3)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
package org.embeddedt.embeddium.compat.mc;
|
|
||||||
|
|
||||||
import java.util.ServiceLoader;
|
|
||||||
|
|
||||||
public interface ABGR32Service {
|
|
||||||
ABGR32Service ABGR32 = ServiceLoader.load(ABGR32Service.class).findFirst().orElseThrow();
|
|
||||||
|
|
||||||
int alpha(int packedColor);
|
|
||||||
int red(int packedColor);
|
|
||||||
int green(int packedColor);
|
|
||||||
int blue(int packedColor);
|
|
||||||
int transparent(int packedColor);
|
|
||||||
int opaque(int packedColor);
|
|
||||||
int color(int alpha, int red, int green, int blue);
|
|
||||||
int color(int alpha, int packedColor);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package org.taumc.celeritas.api.v0;
|
||||||
|
|
||||||
|
import net.irisshaders.iris.api.v0.IrisApiConfig;
|
||||||
|
|
||||||
|
import java.util.ServiceLoader;
|
||||||
|
|
||||||
|
public interface CeleritasShadersApi {
|
||||||
|
CeleritasShadersApi INSTANCE = ServiceLoader.load(CeleritasShadersApi.class).findFirst().orElseThrow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since API v0.0
|
||||||
|
*/
|
||||||
|
static CeleritasShadersApi getInstance() {
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether a shader pack is currently in use and being used
|
||||||
|
* for rendering. If there is no shader pack enabled or a shader
|
||||||
|
* pack failed to compile and is therefore not in use, this will
|
||||||
|
* return false.
|
||||||
|
*
|
||||||
|
* <p>Mods that need to enable custom workarounds for shaders
|
||||||
|
* should use this method.
|
||||||
|
*
|
||||||
|
* @return Whether shaders are being used for rendering.
|
||||||
|
* @since {@link #getMinorApiRevision() API v0.0}
|
||||||
|
*/
|
||||||
|
boolean isShaderPackInUse();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the shadow pass is currently being rendered.
|
||||||
|
*
|
||||||
|
* <p>Generally, mods won't need to call this function for much.
|
||||||
|
* Mods should be fine with things being rendered multiple times
|
||||||
|
* each frame from different camera perspectives. Often, there's
|
||||||
|
* a better approach to fixing bugs than calling this function.
|
||||||
|
*
|
||||||
|
* <p>Pretty much the main legitimate use for this function that
|
||||||
|
* I've seen is in a mod like Immersive Portals, where it has
|
||||||
|
* very custom culling that doesn't work when the Iris shadow
|
||||||
|
* pass is active.
|
||||||
|
*
|
||||||
|
* <p>Naturally, this function can only return true if
|
||||||
|
* {@link #isShaderPackInUse()} returns true.
|
||||||
|
*
|
||||||
|
* @return Whether Iris is currently rendering the shadow pass.
|
||||||
|
* @since API v0.0
|
||||||
|
*/
|
||||||
|
boolean isRenderingShadowPass();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the shadow distance that should be used for rendering shadows.
|
||||||
|
* This method is used to override the shadow distance set in the
|
||||||
|
* Minecraft options screen.
|
||||||
|
*
|
||||||
|
* @param base The shadow distance set in the Minecraft options screen.
|
||||||
|
* @return The shadow distance that should be used for rendering shadows.
|
||||||
|
* @since API v0.2
|
||||||
|
*/
|
||||||
|
int getOverriddenShadowDistance(int base);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the shadow distance slider should be enabled in the
|
||||||
|
* Minecraft options screen. If this method returns false, the shadow
|
||||||
|
* distance slider should be disabled.
|
||||||
|
*
|
||||||
|
* @return Whether the shadow distance slider should be enabled.
|
||||||
|
* @since API v0.2
|
||||||
|
*/
|
||||||
|
boolean isShadowDistanceSliderEnabled();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether debug options are enabled. Debug options give much
|
||||||
|
* more detailed OpenGL error outputs at the cost of performance.
|
||||||
|
*
|
||||||
|
* @return Whether debug options are enabled.
|
||||||
|
* @since API v0.2
|
||||||
|
*/
|
||||||
|
boolean areDebugOptionsEnabled();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens the main Iris GUI screen. It's up to Iris to decide
|
||||||
|
* what this screen is, but generally this is the shader selection
|
||||||
|
* screen.
|
||||||
|
* <p>
|
||||||
|
* This method takes and returns Objects instead of any concrete
|
||||||
|
* Minecraft screen class to avoid referencing Minecraft classes.
|
||||||
|
* Nevertheless, the passed parent must either be null, or an
|
||||||
|
* object that is a subclass of the appropriate {@code Screen}
|
||||||
|
* class for the given Minecraft version.
|
||||||
|
*
|
||||||
|
* @param parent The parent screen, an instance of the appropriate
|
||||||
|
* {@code Screen} class.
|
||||||
|
* @return A {@code Screen} class for the main Iris GUI screen.
|
||||||
|
* @since API v0.0
|
||||||
|
*/
|
||||||
|
Object openMainIrisScreenObj(Object parent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the language key of the main screen. Currently, this
|
||||||
|
* is "options.iris.shaderPackSelection".
|
||||||
|
*
|
||||||
|
* @return the language key, for use with {@code TranslatableText}
|
||||||
|
* / {@code TranslatableComponent}
|
||||||
|
* @since API v0.0
|
||||||
|
*/
|
||||||
|
String getMainScreenLanguageKey();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a config object that can edit the Iris configuration.
|
||||||
|
*
|
||||||
|
* @since API v0.0
|
||||||
|
*/
|
||||||
|
IrisApiConfig getConfig();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the sun path rotation used by the current shader pack.
|
||||||
|
*
|
||||||
|
* @return The sun path rotation as specified by the shader pack, or 0 if no shader pack is in use.
|
||||||
|
* @since API v0.2
|
||||||
|
*/
|
||||||
|
float getSunPathRotation();
|
||||||
|
}
|
||||||
@@ -15,8 +15,8 @@ public class ShaderModBridge {
|
|||||||
Class<?> irisApiClass = Class.forName("net.irisshaders.iris.api.v0.IrisApi");
|
Class<?> irisApiClass = Class.forName("net.irisshaders.iris.api.v0.IrisApi");
|
||||||
Method instanceGetter = irisApiClass.getDeclaredMethod("getInstance");
|
Method instanceGetter = irisApiClass.getDeclaredMethod("getInstance");
|
||||||
Object irisApiInstance = instanceGetter.invoke(null);
|
Object irisApiInstance = instanceGetter.invoke(null);
|
||||||
shadersEnabled = MethodHandles.lookup().unreflect(irisApiClass.getDeclaredMethod("isShaderPackInUse")).bindTo(irisApiInstance);
|
shadersEnabled = MethodHandles.lookup().unreflect(irisApiClass.getMethod("isShaderPackInUse")).bindTo(irisApiInstance);
|
||||||
shaderOpenScreen = MethodHandles.lookup().unreflect(irisApiClass.getDeclaredMethod("openMainIrisScreenObj", Object.class)).bindTo(irisApiInstance);
|
shaderOpenScreen = MethodHandles.lookup().unreflect(irisApiClass.getMethod("openMainIrisScreenObj", Object.class)).bindTo(irisApiInstance);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package net.irisshaders.iris.api.v0;
|
||||||
|
|
||||||
|
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.function.IntFunction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entry point to the Iris API, major version 0. This is currently the latest
|
||||||
|
* version of the API.
|
||||||
|
* <p>
|
||||||
|
* To access the API, use {@link #getInstance()}.
|
||||||
|
*/
|
||||||
|
public interface IrisApi extends CeleritasShadersApi {
|
||||||
|
/**
|
||||||
|
* @since API v0.0
|
||||||
|
*/
|
||||||
|
static IrisApi getInstance() {
|
||||||
|
return (IrisApi)CeleritasShadersApi.getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the minor revision of this API. This is incremented when
|
||||||
|
* new methods are added without breaking API. Mods can check this
|
||||||
|
* if they wish to check whether given API calls are available on
|
||||||
|
* the currently installed Iris version.
|
||||||
|
*
|
||||||
|
* @return The current minor revision. Currently, revision 2.
|
||||||
|
*/
|
||||||
|
int getMinorApiRevision();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a text vertex sink to render into.
|
||||||
|
*
|
||||||
|
* @param maxQuadCount Maximum amount of quads that will be rendered with this sink
|
||||||
|
* @param bufferProvider An IntFunction that can provide a {@code ByteBuffer} with at minimum the bytes provided by the input parameter
|
||||||
|
* @since API 0.1
|
||||||
|
*/
|
||||||
|
IrisTextVertexSink createTextVertexSink(int maxQuadCount, IntFunction<ByteBuffer> bufferProvider);
|
||||||
|
}
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
package org.embeddedt.embeddium.impl;
|
|
||||||
|
|
||||||
import net.minecraft.util.FastColor;
|
|
||||||
import org.embeddedt.embeddium.compat.mc.ABGR32Service;
|
|
||||||
|
|
||||||
public class ABGR32Impl implements ABGR32Service {
|
|
||||||
@Override
|
|
||||||
public int alpha(int packedColor) {
|
|
||||||
return FastColor.ABGR32.alpha(packedColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int red(int packedColor) {
|
|
||||||
return FastColor.ABGR32.red(packedColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int green(int packedColor) {
|
|
||||||
return FastColor.ABGR32.green(packedColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int blue(int packedColor) {
|
|
||||||
return FastColor.ABGR32.blue(packedColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int transparent(int packedColor) {
|
|
||||||
return FastColor.ABGR32.transparent(packedColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int opaque(int packedColor) {
|
|
||||||
return FastColor.ABGR32.opaque(packedColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int color(int alpha, int red, int green, int blue) {
|
|
||||||
return FastColor.ABGR32.color(alpha, red, green, blue);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int color(int alpha, int packedColor) {
|
|
||||||
return FastColor.ABGR32.color(alpha, packedColor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user
Use Celeritas'
ColorABGRorColorARGBinstead of making a service.