mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-20 20:32:14 +00:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8898a6f252 | ||
|
|
37f638ac34 | ||
|
|
f73c698a5a | ||
|
|
029da0e7fa | ||
|
|
e40ee19ac8 | ||
|
|
33832fe547 | ||
|
|
671a776952 | ||
|
|
445b6a3e68 |
No files matched your search
@@ -8,7 +8,7 @@
|
||||
|
||||
# Required Dependencies
|
||||
* [UniMixins](https://github.com/LegacyModdingMC/UniMixins/releases) >= 0.1.14
|
||||
* [GTNHLib](https://github.com/GTNewHorizons/GTNHLib/releases) >= 0.2.1
|
||||
* [GTNHLib](https://github.com/GTNewHorizons/GTNHLib/releases) >= 0.2.4
|
||||
* NOTE: Some mods are not required, but a specific version is required if present - see: `Permanent Incompatibilities` below.
|
||||
|
||||
# Known (temporary) Incompatibilities
|
||||
|
||||
+1
-2
@@ -56,8 +56,7 @@ dependencies {
|
||||
|
||||
// Iris Shaders
|
||||
compileOnly('org.jetbrains:annotations:24.0.1')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.2.1:dev")
|
||||
shadowImplementation("org.joml:joml:1.10.5") // MIT
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.2.4:dev")
|
||||
shadowImplementation("org.anarres:jcpp:1.4.14") // Apache 2.0
|
||||
implementation("io.github.douira:glsl-transformer:1.0.0")
|
||||
shadowImplementation("io.github.douira:glsl-transformer:1.0.0") { // glsl-transformer Noncommercial License 1.0.0
|
||||
|
||||
@@ -15,7 +15,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
name = "Angelica",
|
||||
version = Tags.VERSION,
|
||||
dependencies = " before:lwjgl3ify@[1.5.3,);" + " after:hodgepodge@[2.4.4,);" + " after:CodeChickenCore@[1.2.0,);"
|
||||
+ " after:archaicfix@[0.7.0,);" + " required-after:gtnhlib@[0.2.1,);",
|
||||
+ " after:archaicfix@[0.7.0,);" + " required-after:gtnhlib@[0.2.4,);",
|
||||
acceptedMinecraftVersions = "[1.7.10]",
|
||||
acceptableRemoteVersions = "*",
|
||||
guiFactory = "com.gtnewhorizons.angelica.config.AngelicaGuiConfigFactory")
|
||||
|
||||
@@ -847,7 +847,9 @@ public class GLStateManager {
|
||||
|
||||
public static void glDrawArrays(int mode, int first, int count) {
|
||||
// Iris -- TODO: This doesn't seem to work and is related to matchPass()
|
||||
Iris.getPipelineManager().getPipeline().ifPresent(WorldRenderingPipeline::syncProgram);
|
||||
if(AngelicaConfig.enableIris) {
|
||||
Iris.getPipelineManager().getPipeline().ifPresent(WorldRenderingPipeline::syncProgram);
|
||||
}
|
||||
GL11.glDrawArrays(mode, first, count);
|
||||
}
|
||||
|
||||
@@ -1106,6 +1108,13 @@ public class GLStateManager {
|
||||
|
||||
public static void glLoadMatrix(FloatBuffer m) {
|
||||
getMatrixStack().set(m);
|
||||
GL11.glLoadMatrix(m);
|
||||
}
|
||||
|
||||
public static void glLoadMatrix(DoubleBuffer m) {
|
||||
conersionMatrix4d.set(m);
|
||||
getMatrixStack().set(conersionMatrix4d);
|
||||
GL11.glLoadMatrix(m);
|
||||
}
|
||||
|
||||
public static Matrix4fStack getMatrixStack() {
|
||||
|
||||
@@ -136,6 +136,7 @@ public enum Mixins {
|
||||
,"shaders.MixinOpenGlHelper"
|
||||
,"shaders.MixinRender"
|
||||
,"shaders.MixinRenderGlobal"
|
||||
,"shaders.MixinRenderManager"
|
||||
)
|
||||
),
|
||||
|
||||
@@ -214,8 +215,8 @@ public enum Mixins {
|
||||
//,"notfine.clouds.MixinGameSettings"
|
||||
//,"notfine.clouds.MixinRenderGlobal"
|
||||
//,"notfine.clouds.MixinWorldType"
|
||||
"notfine.glint.MixinRenderBiped"
|
||||
,"notfine.glint.MixinRenderItem"
|
||||
"notfine.fix.MixinRenderItem"
|
||||
,"notfine.glint.MixinRenderBiped"
|
||||
,"notfine.glint.MixinRenderPlayer"
|
||||
,"notfine.gui.MixinGuiSlot"
|
||||
,"notfine.leaves.MixinBlockLeaves"
|
||||
@@ -225,7 +226,6 @@ public enum Mixins {
|
||||
//,"notfine.particles.MixinWorldClient"
|
||||
//,"notfine.particles.MixinWorldProvider"
|
||||
,"notfine.renderer.MixinRenderGlobal"
|
||||
,"notfine.settings.MixinGameSettings"
|
||||
//,"notfine.toggle.MixinGuiIngame"
|
||||
//,"notfine.toggle.MixinEntityRenderer"
|
||||
//,"notfine.toggle.MixinRender" --> No Sodium below
|
||||
@@ -241,8 +241,8 @@ public enum Mixins {
|
||||
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableNotFineFeatures &&
|
||||
!(AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.instance().customItemTexturesEnabled)
|
||||
).addMixinClasses(
|
||||
"notfine.glint.MixinItemRenderer",
|
||||
"notfine.glint.MixinRenderItemGlint"
|
||||
"notfine.glint.MixinItemRenderer"
|
||||
,"notfine.glint.MixinRenderItem"
|
||||
)),
|
||||
|
||||
NOTFINE_LATE_TWILIGHT_FOREST_LEAVES(new Builder("NotFine Mod Leaves").addTargetedMod(TargetedMod.TWILIGHT_FOREST).setSide(Side.CLIENT)
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ public abstract class MixinGameSettings {
|
||||
|
||||
/**
|
||||
* @author jss2a98aj
|
||||
* @reason Make clouds drawScreen at any drawScreen distance.
|
||||
* @reason Make clouds render at any render distance.
|
||||
*/
|
||||
@Overwrite
|
||||
public boolean shouldRenderClouds() {
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ public abstract class MixinRenderGlobal {
|
||||
|
||||
/**
|
||||
* @author jss2a98aj
|
||||
* @reason Adjust how cloud drawScreen mode is selected.
|
||||
* @reason Adjust how cloud render mode is selected.
|
||||
*/
|
||||
@Overwrite
|
||||
public void renderClouds(float partialTicks) {
|
||||
@@ -45,7 +45,7 @@ public abstract class MixinRenderGlobal {
|
||||
|
||||
/**
|
||||
* @author jss2a98aj
|
||||
* @reason Adjust fancy cloud drawScreen.
|
||||
* @reason Adjust fancy cloud render.
|
||||
*/
|
||||
@Overwrite
|
||||
public void renderCloudsFancy(float partialTicks) {
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.notfine.fix;
|
||||
|
||||
import jss.notfine.core.Settings;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(value = RenderItem.class)
|
||||
public abstract class MixinRenderItem {
|
||||
|
||||
/**
|
||||
* @author jss2a98aj
|
||||
* @reason Makes renderGlint faster and fixes glBlendFunc being left with the wrong values.
|
||||
*/
|
||||
@Overwrite
|
||||
private void renderGlint(int unused, int posX, int posY, int width, int height) {
|
||||
if(!(boolean)Settings.MODE_GLINT_INV.option.getStore()) {
|
||||
return;
|
||||
}
|
||||
final float timeUVSpeed = 0.00390625F;
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
final long time = Minecraft.getSystemTime();
|
||||
|
||||
float layerUVNoise = 4.0F;
|
||||
|
||||
OpenGlHelper.glBlendFunc(772, 1, 0, 1);
|
||||
|
||||
//for(int layer = 0; layer < 2; ++layer) {
|
||||
final int timeUVDenominator = 3000 /*+ layer * 1873*/;
|
||||
final float timeUVNoise = (float)(time % (long)timeUVDenominator) / (float)timeUVDenominator * 256F;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(
|
||||
posX, (posY + height), zLevel,
|
||||
((timeUVNoise + (float)height * layerUVNoise) * timeUVSpeed), ((float)height * timeUVSpeed)
|
||||
);
|
||||
tessellator.addVertexWithUV(
|
||||
(posX + width), (posY + height), zLevel,
|
||||
((timeUVNoise + (float)width + (float)height * layerUVNoise) * timeUVSpeed), ((float)height * timeUVSpeed)
|
||||
);
|
||||
tessellator.addVertexWithUV(
|
||||
(posX + width), posY, zLevel,
|
||||
((timeUVNoise + (float)width) * timeUVSpeed), 0D
|
||||
);
|
||||
tessellator.addVertexWithUV(
|
||||
posX, posY, zLevel,
|
||||
(timeUVNoise * timeUVSpeed), 0D
|
||||
);
|
||||
tessellator.draw();
|
||||
|
||||
//layerUVNoise = -1.0F;
|
||||
//}
|
||||
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
}
|
||||
|
||||
@Shadow public float zLevel;
|
||||
|
||||
}
|
||||
+13
-51
@@ -1,63 +1,25 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.notfine.glint;
|
||||
|
||||
import jss.notfine.core.Settings;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(value = RenderItem.class)
|
||||
public abstract class MixinRenderItem {
|
||||
|
||||
/**
|
||||
* @author jss2a98aj
|
||||
* @reason Makes renderGlint faster and fixes glBlendFunc being left with the wrong values.
|
||||
*/
|
||||
@Overwrite
|
||||
private void renderGlint(int unused, int posX, int posY, int width, int height) {
|
||||
if(!(boolean)Settings.MODE_GLINT_INV.option.getStore()) {
|
||||
return;
|
||||
}
|
||||
final float timeUVSpeed = 0.00390625F;
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
final long time = Minecraft.getSystemTime();
|
||||
|
||||
float layerUVNoise = 4.0F;
|
||||
|
||||
OpenGlHelper.glBlendFunc(772, 1, 0, 1);
|
||||
|
||||
//for(int layer = 0; layer < 2; ++layer) {
|
||||
final int timeUVDenominator = 3000 /*+ layer * 1873*/;
|
||||
final float timeUVNoise = (float)(time % (long)timeUVDenominator) / (float)timeUVDenominator * 256F;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(
|
||||
posX, (posY + height), zLevel,
|
||||
((timeUVNoise + (float)height * layerUVNoise) * timeUVSpeed), ((float)height * timeUVSpeed)
|
||||
);
|
||||
tessellator.addVertexWithUV(
|
||||
(posX + width), (posY + height), zLevel,
|
||||
((timeUVNoise + (float)width + (float)height * layerUVNoise) * timeUVSpeed), ((float)height * timeUVSpeed)
|
||||
);
|
||||
tessellator.addVertexWithUV(
|
||||
(posX + width), posY, zLevel,
|
||||
((timeUVNoise + (float)width) * timeUVSpeed), 0D
|
||||
);
|
||||
tessellator.addVertexWithUV(
|
||||
posX, posY, zLevel,
|
||||
(timeUVNoise * timeUVSpeed), 0D
|
||||
);
|
||||
tessellator.draw();
|
||||
|
||||
//layerUVNoise = -1.0F;
|
||||
//}
|
||||
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
@Redirect(
|
||||
method = "renderDroppedItem(Lnet/minecraft/entity/item/EntityItem;Lnet/minecraft/util/IIcon;IFFFFI)V",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/item/ItemStack;hasEffect(I)Z"
|
||||
),
|
||||
remap = false
|
||||
)
|
||||
private boolean notFine$toggleGlint(ItemStack stack, int pass) {
|
||||
return stack.hasEffect(pass) && (boolean)Settings.MODE_GLINT_WORLD.option.getStore();
|
||||
}
|
||||
|
||||
@Shadow public float zLevel;
|
||||
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.notfine.glint;
|
||||
|
||||
import jss.notfine.core.Settings;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
// Separated for compat with MCPF
|
||||
@Mixin(RenderItem.class)
|
||||
public class MixinRenderItemGlint {
|
||||
|
||||
@Redirect(
|
||||
method = "renderDroppedItem(Lnet/minecraft/entity/item/EntityItem;Lnet/minecraft/util/IIcon;IFFFFI)V",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/item/ItemStack;hasEffect(I)Z"
|
||||
),
|
||||
remap = false
|
||||
)
|
||||
private boolean notFine$toggleGlint(ItemStack stack, int pass) {
|
||||
return stack.hasEffect(pass) && (boolean) Settings.MODE_GLINT_WORLD.option.getStore();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -10,7 +10,7 @@ public abstract class MixinEffectRenderer {
|
||||
|
||||
/**
|
||||
* @author jss2a98aj
|
||||
* @reason Makes most particles drawScreen with the expected depth.
|
||||
* @reason Makes most particles render with the expected depth.
|
||||
*/
|
||||
@Redirect(
|
||||
method = "renderParticles",
|
||||
|
||||
+8
-10
@@ -19,11 +19,9 @@ import com.llamalad7.mixinextras.injector.WrapWithCondition;
|
||||
|
||||
@Mixin(value = RenderGlobal.class)
|
||||
public abstract class MixinRenderGlobal {
|
||||
|
||||
@Shadow private int glSkyList;
|
||||
|
||||
@Shadow private int starGLCallList;
|
||||
@Shadow private int glSkyList2;
|
||||
|
||||
|
||||
@WrapWithCondition(
|
||||
method = "renderSky(F)V",
|
||||
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glCallList(I)V", remap = false))
|
||||
@@ -34,42 +32,42 @@ public abstract class MixinRenderGlobal {
|
||||
return (boolean)Settings.MODE_SKY.option.getStore();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@WrapWithCondition(
|
||||
method = "renderSky(F)V",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraftforge/client/IRenderHandler;render(FLnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/Minecraft;)V", remap = false))
|
||||
private boolean conditionalRenderHandlerRender(IRenderHandler irh, float f, WorldClient wc, Minecraft mc) {
|
||||
return (boolean)Settings.MODE_SKY.option.getStore();
|
||||
}
|
||||
|
||||
|
||||
@Inject(method="renderSky(F)V", at=@At(value="INVOKE", target="Lnet/minecraft/client/renderer/Tessellator;draw()I", ordinal = 0))
|
||||
private void conditionalTessellatorDrawEndSkybox(CallbackInfo ci) {
|
||||
if(!(boolean)Settings.MODE_SKY.option.getStore()) {
|
||||
Tessellator.instance.vertexCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method="renderSky(F)V", at=@At(value="INVOKE", target="Lnet/minecraft/client/renderer/Tessellator;draw()I", ordinal = 1))
|
||||
private void conditionalTessellatorDrawSunsetSunrise(CallbackInfo ci) {
|
||||
if(!(boolean)Settings.MODE_SKY.option.getStore()) {
|
||||
Tessellator.instance.vertexCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method="renderSky(F)V", at=@At(value="INVOKE", target="Lnet/minecraft/client/renderer/Tessellator;draw()I", ordinal = 2))
|
||||
private void conditionalTessellatorDrawSun(CallbackInfo ci) {
|
||||
if(!(boolean)Settings.MODE_SUN_MOON.option.getStore()) {
|
||||
Tessellator.instance.vertexCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method="renderSky(F)V", at=@At(value="INVOKE", target="Lnet/minecraft/client/renderer/Tessellator;draw()I", ordinal = 3))
|
||||
private void conditionalTessellatorDrawMoon(CallbackInfo ci) {
|
||||
if(!(boolean)Settings.MODE_SUN_MOON.option.getStore()) {
|
||||
Tessellator.instance.vertexCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method="renderSky(F)V", at=@At(value="INVOKE", target="Lnet/minecraft/client/renderer/Tessellator;draw()I", ordinal = 4))
|
||||
private void conditionalTessellatorDrawHorizon(CallbackInfo ci) {
|
||||
if(!(boolean)Settings.MODE_SKY.option.getStore()) {
|
||||
|
||||
-235
@@ -1,235 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.notfine.settings;
|
||||
|
||||
import jss.notfine.core.SettingsManager;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import org.lwjgl.opengl.Display;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(value = GameSettings.class, priority = 990)
|
||||
public abstract class MixinGameSettings {
|
||||
|
||||
@Final
|
||||
private static String[] GUISCALES = new String[] {
|
||||
"options.guiScale.auto",
|
||||
"options.guiScale.small",
|
||||
"options.guiScale.normal",
|
||||
"options.guiScale.large",
|
||||
"options.guiScale.massive"
|
||||
};
|
||||
|
||||
/**
|
||||
* @author jss2a98aj
|
||||
* @reason Makes this function not unreasonably slow.
|
||||
*/
|
||||
@Overwrite
|
||||
public void setOptionFloatValue(GameSettings.Options option, float value) {
|
||||
switch (option) {
|
||||
case SENSITIVITY -> mouseSensitivity = value;
|
||||
case FOV -> fovSetting = value;
|
||||
case GAMMA -> gammaSetting = value;
|
||||
case FRAMERATE_LIMIT -> limitFramerate = (int) value;
|
||||
case CHAT_OPACITY -> {
|
||||
chatOpacity = value;
|
||||
mc.ingameGUI.getChatGUI().refreshChat();
|
||||
}
|
||||
case CHAT_HEIGHT_FOCUSED -> {
|
||||
chatHeightFocused = value;
|
||||
mc.ingameGUI.getChatGUI().refreshChat();
|
||||
}
|
||||
case CHAT_HEIGHT_UNFOCUSED -> {
|
||||
chatHeightUnfocused = value;
|
||||
mc.ingameGUI.getChatGUI().refreshChat();
|
||||
}
|
||||
case CHAT_WIDTH -> {
|
||||
chatWidth = value;
|
||||
mc.ingameGUI.getChatGUI().refreshChat();
|
||||
}
|
||||
case CHAT_SCALE -> {
|
||||
chatScale = value;
|
||||
mc.ingameGUI.getChatGUI().refreshChat();
|
||||
}
|
||||
case ANISOTROPIC_FILTERING -> {
|
||||
if (anisotropicFiltering != (int) value) {
|
||||
anisotropicFiltering = (int) value;
|
||||
mc.getTextureMapBlocks().setAnisotropicFiltering(this.anisotropicFiltering);
|
||||
mc.scheduleResourcesRefresh();
|
||||
}
|
||||
}
|
||||
case MIPMAP_LEVELS -> {
|
||||
if (mipmapLevels != (int) value) {
|
||||
mipmapLevels = (int) value;
|
||||
mc.getTextureMapBlocks().setMipmapLevels(this.mipmapLevels);
|
||||
mc.scheduleResourcesRefresh();
|
||||
}
|
||||
}
|
||||
case RENDER_DISTANCE -> renderDistanceChunks = (int) value;
|
||||
case STREAM_BYTES_PER_PIXEL -> field_152400_J = value;
|
||||
case STREAM_VOLUME_MIC -> {
|
||||
field_152401_K = value;
|
||||
mc.func_152346_Z().func_152915_s();
|
||||
}
|
||||
case STREAM_VOLUME_SYSTEM -> {
|
||||
field_152402_L = value;
|
||||
mc.func_152346_Z().func_152915_s();
|
||||
}
|
||||
case STREAM_KBPS -> field_152403_M = value;
|
||||
case STREAM_FPS -> field_152404_N = value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @author jss2a98aj
|
||||
* @reason Makes this function not unreasonably slow.
|
||||
*/
|
||||
@Overwrite
|
||||
public void setOptionValue(GameSettings.Options option, int value) {
|
||||
switch(option) {
|
||||
case INVERT_MOUSE:
|
||||
invertMouse = !invertMouse;
|
||||
break;
|
||||
case GUI_SCALE:
|
||||
guiScale = (guiScale + value) % 5;
|
||||
break;
|
||||
case PARTICLES:
|
||||
particleSetting = (particleSetting + value) % 3;
|
||||
break;
|
||||
case VIEW_BOBBING:
|
||||
viewBobbing = !viewBobbing;
|
||||
break;
|
||||
case RENDER_CLOUDS:
|
||||
clouds = !clouds;
|
||||
break;
|
||||
case FORCE_UNICODE_FONT:
|
||||
forceUnicodeFont = !forceUnicodeFont;
|
||||
mc.fontRenderer.setUnicodeFlag(mc.getLanguageManager().isCurrentLocaleUnicode() || forceUnicodeFont);
|
||||
break;
|
||||
case ADVANCED_OPENGL:
|
||||
advancedOpengl = !advancedOpengl;
|
||||
mc.renderGlobal.loadRenderers();
|
||||
case FBO_ENABLE:
|
||||
fboEnable = !fboEnable;
|
||||
break;
|
||||
case ANAGLYPH:
|
||||
anaglyph = !anaglyph;
|
||||
//refreshResources was overkill.
|
||||
mc.renderGlobal.loadRenderers();
|
||||
break;
|
||||
case DIFFICULTY:
|
||||
difficulty = EnumDifficulty.getDifficultyEnum(difficulty.getDifficultyId() + value & 3);
|
||||
break;
|
||||
case GRAPHICS:
|
||||
fancyGraphics = !fancyGraphics;
|
||||
SettingsManager.graphicsUpdated();
|
||||
mc.renderGlobal.loadRenderers();
|
||||
break;
|
||||
case AMBIENT_OCCLUSION:
|
||||
ambientOcclusion = (ambientOcclusion + value) % 3;
|
||||
mc.renderGlobal.loadRenderers();
|
||||
break;
|
||||
case CHAT_VISIBILITY:
|
||||
chatVisibility = EntityPlayer.EnumChatVisibility.getEnumChatVisibility((chatVisibility.getChatVisibility() + value) % 3);
|
||||
break;
|
||||
case STREAM_COMPRESSION:
|
||||
field_152405_O = (field_152405_O + value) % 3;
|
||||
break;
|
||||
case STREAM_SEND_METADATA:
|
||||
field_152406_P = !field_152406_P;
|
||||
break;
|
||||
case STREAM_CHAT_ENABLED:
|
||||
field_152408_R = (field_152408_R + value) % 3;
|
||||
break;
|
||||
case STREAM_CHAT_USER_FILTER:
|
||||
field_152409_S = (field_152409_S + value) % 3;
|
||||
break;
|
||||
case STREAM_MIC_TOGGLE_BEHAVIOR:
|
||||
field_152410_T = (field_152410_T + value) % 2;
|
||||
break;
|
||||
case CHAT_COLOR:
|
||||
chatColours = !chatColours;
|
||||
break;
|
||||
case CHAT_LINKS:
|
||||
chatLinks = !chatLinks;
|
||||
break;
|
||||
case CHAT_LINKS_PROMPT:
|
||||
chatLinksPrompt = !chatLinksPrompt;
|
||||
break;
|
||||
case SNOOPER_ENABLED:
|
||||
snooperEnabled = !snooperEnabled;
|
||||
break;
|
||||
case SHOW_CAPE:
|
||||
showCape = !showCape;
|
||||
break;
|
||||
case TOUCHSCREEN:
|
||||
touchscreen = !touchscreen;
|
||||
break;
|
||||
case USE_FULLSCREEN:
|
||||
fullScreen = !fullScreen;
|
||||
if (mc.isFullScreen() != fullScreen) {
|
||||
mc.toggleFullscreen();
|
||||
}
|
||||
break;
|
||||
case ENABLE_VSYNC:
|
||||
enableVsync = !enableVsync;
|
||||
Display.setVSyncEnabled(enableVsync);
|
||||
break;
|
||||
}
|
||||
saveOptions();
|
||||
}
|
||||
|
||||
@Shadow
|
||||
public void saveOptions() {
|
||||
}
|
||||
|
||||
@Shadow protected Minecraft mc;
|
||||
|
||||
@Shadow public float mouseSensitivity;
|
||||
@Shadow public boolean invertMouse;
|
||||
@Shadow public float fovSetting;
|
||||
@Shadow public float gammaSetting;
|
||||
@Shadow public int renderDistanceChunks;
|
||||
@Shadow public int guiScale;
|
||||
@Shadow public int particleSetting;
|
||||
@Shadow public boolean viewBobbing;
|
||||
@Shadow public boolean anaglyph;
|
||||
@Shadow public boolean advancedOpengl;
|
||||
@Shadow public int limitFramerate;
|
||||
@Shadow public boolean fboEnable;
|
||||
@Shadow public EnumDifficulty difficulty;
|
||||
@Shadow public boolean fancyGraphics;
|
||||
@Shadow public int ambientOcclusion;
|
||||
@Shadow public boolean clouds;
|
||||
@Shadow public EntityPlayer.EnumChatVisibility chatVisibility;
|
||||
@Shadow public boolean chatColours;
|
||||
@Shadow public boolean chatLinks;
|
||||
@Shadow public boolean chatLinksPrompt;
|
||||
@Shadow public float chatOpacity;
|
||||
@Shadow public boolean snooperEnabled;
|
||||
@Shadow public boolean fullScreen;
|
||||
@Shadow public boolean enableVsync;
|
||||
@Shadow public boolean showCape;
|
||||
@Shadow public boolean touchscreen;
|
||||
@Shadow public float chatHeightFocused;
|
||||
@Shadow public float chatHeightUnfocused;
|
||||
@Shadow public float chatScale;
|
||||
@Shadow public float chatWidth;
|
||||
@Shadow public int mipmapLevels;
|
||||
@Shadow public int anisotropicFiltering;
|
||||
@Shadow public float field_152400_J;
|
||||
@Shadow public float field_152401_K;
|
||||
@Shadow public float field_152402_L;
|
||||
@Shadow public float field_152403_M;
|
||||
@Shadow public float field_152404_N;
|
||||
@Shadow public int field_152405_O;
|
||||
@Shadow public boolean field_152406_P;
|
||||
@Shadow public int field_152408_R;
|
||||
@Shadow public int field_152409_S;
|
||||
@Shadow public int field_152410_T;
|
||||
@Shadow public boolean forceUnicodeFont;
|
||||
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(RenderItem.class)
|
||||
@Mixin(value = RenderItem.class, priority = 1100)
|
||||
abstract public class MixinRenderItem {
|
||||
|
||||
@Redirect(
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.shaders;
|
||||
|
||||
import net.coderbot.iris.layer.GbufferPrograms;
|
||||
import net.coderbot.iris.uniforms.CapturedRenderingState;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(RenderManager.class)
|
||||
public class MixinRenderManager {
|
||||
|
||||
@Unique
|
||||
private static final String DO_RENDER = "Lnet/minecraft/client/renderer/entity/Render;doRender(Lnet/minecraft/entity/Entity;DDDFF)V";
|
||||
|
||||
@Inject(method = "func_147939_a", at = @At(value = "INVOKE", target = DO_RENDER))
|
||||
private void iris$onRenderEntityPre(Entity entity, double x, double y, double z, float yaw, float partialTicks, boolean rebuild, CallbackInfoReturnable<Boolean> cir) {
|
||||
CapturedRenderingState.INSTANCE.setCurrentEntity(entity.getEntityId());
|
||||
GbufferPrograms.beginEntities();
|
||||
}
|
||||
|
||||
@Inject(method = "func_147939_a", at = @At(value = "INVOKE", target = DO_RENDER, shift = At.Shift.AFTER))
|
||||
private void iris$onRenderEntityPost(Entity entity, double x, double y, double z, float yaw, float partialTicks, boolean rebuild, CallbackInfoReturnable<Boolean> cir) {
|
||||
CapturedRenderingState.INSTANCE.setCurrentEntity(-1);
|
||||
GbufferPrograms.endEntities();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -45,7 +45,7 @@ public class MixinRenderingRegistry implements IRenderingRegistryExt {
|
||||
throw new RuntimeException(e.getCause());
|
||||
}
|
||||
});
|
||||
} else if (mainThreadHandler.getClass().isInstance(ThreadSafeISBRHFactory.class)) {
|
||||
} else if (ThreadSafeISBRHFactory.class.isAssignableFrom(mainThreadHandler.getClass())) {
|
||||
return THREAD_LOCAL_MAP.get().computeIfAbsent(mainThreadHandler.getClass(), k -> ((ThreadSafeISBRHFactory) mainThreadHandler).newInstance());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ public class NotFine {
|
||||
@SidedProxy(clientSide = "jss.notfine.proxy.ClientProxy", serverSide = "jss.notfine.proxy.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
proxy.preInit(event);
|
||||
|
||||
@@ -20,7 +20,7 @@ public class NotFineConfig {
|
||||
}
|
||||
|
||||
public void loadSettings() {
|
||||
allowAdvancedOpenGL = notFineConfig.getBoolean("allowAdvancedOpenGL", CATEGORY_CLIENT, true, "Allow or always remove the Advanced OpenGL button");
|
||||
allowAdvancedOpenGL = notFineConfig.getBoolean("allowAdvancedOpenGL", CATEGORY_CLIENT, true, "Allow or always disable the Advanced OpenGL button");
|
||||
|
||||
if(notFineConfig.hasChanged()) {
|
||||
notFineConfig.save();
|
||||
|
||||
@@ -107,7 +107,7 @@ public enum Settings {
|
||||
SettingsManager.cloudsUpdated();
|
||||
}
|
||||
},
|
||||
TOTAL_STARS(new NotFineOptionSlider(1500, 0, 32000, 500, OptionImpact.LOW)) {
|
||||
TOTAL_STARS(new NotFineOptionSlider(1500, 500, 32000, 500, OptionImpact.LOW)) {
|
||||
@Override
|
||||
public void applyChanges() {
|
||||
RenderStars.reloadStarRenderList(Minecraft.getMinecraft().renderGlobal);
|
||||
@@ -197,7 +197,6 @@ public enum Settings {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static abstract class NotFineOption<T> implements Option<T> {
|
||||
private static final NotFineMinecraftOptionsStorage optionStorage = new NotFineMinecraftOptionsStorage();
|
||||
private final OptionImpact impact;
|
||||
|
||||
@@ -82,8 +82,6 @@ public class SettingsManager {
|
||||
}
|
||||
|
||||
public static void leavesUpdated() {
|
||||
//Do not re-enable, see MixinBlockLeaves workaround for Angelica/Sodium style menus.
|
||||
//mc.renderGlobal.loadRenderers();
|
||||
LeavesQuality value = (LeavesQuality)Settings.MODE_LEAVES.option.getStore();
|
||||
leavesOpaque = value == LeavesQuality.FAST || (value == LeavesQuality.DEFAULT && !mc.gameSettings.fancyGraphics);
|
||||
Blocks.leaves.setGraphicsLevel(!leavesOpaque);
|
||||
|
||||
@@ -19,7 +19,6 @@ public class GuiCustomMenu extends GuiScreen {
|
||||
private final OptionPage[] subPages;
|
||||
protected String screenTitle;
|
||||
|
||||
|
||||
private GuiListExtended optionsRowList;
|
||||
|
||||
public GuiCustomMenu(GuiScreen parentGuiScreen, OptionPage optionPage, OptionPage... subPages) {
|
||||
@@ -27,7 +26,6 @@ public class GuiCustomMenu extends GuiScreen {
|
||||
this.screenTitle = optionPage.getName();
|
||||
this.optionPage = optionPage;
|
||||
this.subPages = subPages;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,6 +3,7 @@ package jss.notfine.gui;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import jss.notfine.config.NotFineConfig;
|
||||
import jss.notfine.core.Settings;
|
||||
import jss.notfine.core.SettingsManager;
|
||||
import jss.notfine.gui.options.control.NotFineControlValueFormatter;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.OptionFlag;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.OptionGroup;
|
||||
@@ -36,9 +37,10 @@ public class NotFineGameOptionPages {
|
||||
.setName(I18n.format("options.graphics"))
|
||||
.setTooltip(I18n.format("sodium.options.graphics_quality.tooltip"))
|
||||
.setControl(option -> new CyclingControl<>(option, GraphicsMode.class))
|
||||
.setBinding(
|
||||
(opts, value) -> opts.fancyGraphics = value.isFancy(),
|
||||
opts -> GraphicsMode.fromBoolean(opts.fancyGraphics))
|
||||
.setBinding((opts, value) -> {
|
||||
opts.fancyGraphics = value.isFancy();
|
||||
SettingsManager.graphicsUpdated();
|
||||
}, opts -> GraphicsMode.fromBoolean(opts.fancyGraphics))
|
||||
.setImpact(OptionImpact.HIGH)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.build())
|
||||
@@ -113,6 +115,7 @@ public class NotFineGameOptionPages {
|
||||
.setName(I18n.format("options.mipmapLevels"))
|
||||
.setTooltip(I18n.format("sodium.options.mipmap_levels.tooltip"))
|
||||
.setControl(option -> new SliderControl(option, 0, 4, 1, ControlValueFormatter.multiplier()))
|
||||
//mc.getTextureMapBlocks().setMipmapLevels(this.mipmapLevels); ?
|
||||
.setBinding((opts, value) -> opts.mipmapLevels = value, opts -> opts.mipmapLevels)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setFlags(OptionFlag.REQUIRES_ASSET_RELOAD)
|
||||
@@ -122,6 +125,7 @@ public class NotFineGameOptionPages {
|
||||
.setTooltip(I18n.format("sodium.options.anisotropic_filtering.tooltip"))
|
||||
.setControl(option -> new SliderControl(option, 0, 4, 1, NotFineControlValueFormatter.powerOfTwo()))
|
||||
.setBinding(
|
||||
//mc.getTextureMapBlocks().setAnisotropicFiltering(this.anisotropicFiltering); ?
|
||||
(opts, value) -> opts.anisotropicFiltering = value == 0 ? 1 : (int)Math.pow(2, value),
|
||||
(opts) -> opts.anisotropicFiltering == 1 ? 0 : (int)(Math.log(opts.anisotropicFiltering) / Math.log(2)))
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
@@ -131,7 +135,6 @@ public class NotFineGameOptionPages {
|
||||
return new OptionPage(I18n.format("options.video"), ImmutableList.copyOf(groups));
|
||||
}
|
||||
|
||||
|
||||
public static OptionPage detail() {
|
||||
List<OptionGroup> groups = new ArrayList<>();
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
@@ -151,6 +154,7 @@ public class NotFineGameOptionPages {
|
||||
List<OptionGroup> groups = new ArrayList<>();
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
.add(Settings.MODE_SKY.option)
|
||||
.add(Settings.MODE_SUN_MOON.option)
|
||||
.add(Settings.MODE_CLOUDS.option)
|
||||
.add(Settings.RENDER_DISTANCE_CLOUDS.option)
|
||||
.add(Settings.CLOUD_HEIGHT.option)
|
||||
|
||||
@@ -14,9 +14,6 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
if(event.getSide() == Side.CLIENT) {
|
||||
GameSettings.Options.FRAMERATE_LIMIT.valueStep = 1f;
|
||||
}
|
||||
NotFineConfig config = new NotFineConfig();
|
||||
config.loadSettings();
|
||||
|
||||
@@ -30,15 +27,11 @@ public class ClientProxy extends CommonProxy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
// Nothing to do here (yet)
|
||||
}
|
||||
public void init(FMLInitializationEvent event) { }
|
||||
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
if(event.getSide() == Side.CLIENT) {
|
||||
SettingsManager.settingsFile.loadSettings();
|
||||
}
|
||||
SettingsManager.settingsFile.loadSettings();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,11 +6,10 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
public class CommonProxy {
|
||||
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
|
||||
}
|
||||
public void preInit(FMLPreInitializationEvent event) {}
|
||||
|
||||
public void init(FMLInitializationEvent event) {}
|
||||
|
||||
public void postInit(FMLPostInitializationEvent event) {}
|
||||
|
||||
}
|
||||
@@ -81,6 +81,7 @@ public class SodiumGameOptionPages {
|
||||
firstGroupBuilder.add(Settings.MODE_SKY.option);
|
||||
firstGroupBuilder.add(Settings.MODE_SUN_MOON.option);
|
||||
firstGroupBuilder.add(Settings.MODE_STARS.option);
|
||||
firstGroupBuilder.add(Settings.TOTAL_STARS.option);
|
||||
firstGroupBuilder.add(OptionImpl.createBuilder(boolean.class, vanillaOpts)
|
||||
.setName(I18n.format("sodium.options.clouds.name"))
|
||||
.setTooltip(I18n.format("sodium.options.clouds.tooltip"))
|
||||
@@ -249,7 +250,6 @@ public class SodiumGameOptionPages {
|
||||
.setBinding((opts, value) -> opts.quality.enableVignette = value, opts -> opts.quality.enableVignette)
|
||||
.setImpact(OptionImpact.LOW)
|
||||
.build())
|
||||
.add(Settings.TOTAL_STARS.option)
|
||||
.build());
|
||||
|
||||
|
||||
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
package me.jellysquid.mods.sodium.client.gui.options.named;
|
||||
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public enum LightingQuality implements NamedState {
|
||||
OFF("options.ao.off"),
|
||||
LOW("options.ao.min"),
|
||||
@@ -26,6 +28,6 @@ public enum LightingQuality implements NamedState {
|
||||
}
|
||||
|
||||
public static LightingQuality fromOrdinal(int ordinal) {
|
||||
return VALUES[ordinal];
|
||||
return VALUES[MathHelper.clamp_int(ordinal, 0, VALUES.length - 1)];
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package me.jellysquid.mods.sodium.client.gui.options.named;
|
||||
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public enum ParticleMode implements NamedState {
|
||||
ALL("options.particles.all"),
|
||||
DECREASED("options.particles.decreased"),
|
||||
@@ -19,6 +21,6 @@ public enum ParticleMode implements NamedState {
|
||||
}
|
||||
|
||||
public static ParticleMode fromOrdinal(int ordinal) {
|
||||
return VALUES[ordinal];
|
||||
return VALUES[MathHelper.clamp_int(ordinal, 0, VALUES.length - 1)];
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.gtnewhorizons.angelica.compat.mojang.Camera;
|
||||
import com.gtnewhorizons.angelica.compat.mojang.ChunkPos;
|
||||
import com.gtnewhorizons.angelica.compat.toremove.MatrixStack;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.rendering.AngelicaRenderQueue;
|
||||
import it.unimi.dsi.fastutil.ints.IntIterator;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||
@@ -45,6 +46,7 @@ import java.util.ArrayDeque;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class ChunkRenderManager<T extends ChunkGraphicsState> implements ChunkStatusListener {
|
||||
/**
|
||||
@@ -639,9 +641,7 @@ public class ChunkRenderManager<T extends ChunkGraphicsState> implements ChunkSt
|
||||
}
|
||||
|
||||
private void scheduleRebuildOffThread(int x, int y, int z, boolean important) {
|
||||
// TODO: Sodium Threads
|
||||
throw new RuntimeException("scheduleRebuildOffThread");
|
||||
// Minecraft.getMinecraft().submit(() -> this.scheduleRebuild(x, y, z, important));
|
||||
AngelicaRenderQueue.executor().execute(() -> this.scheduleRebuild(x, y, z, important));
|
||||
}
|
||||
|
||||
public void scheduleRebuild(int x, int y, int z, boolean important) {
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.gtnewhorizons.angelica.glsm;
|
||||
|
||||
import com.gtnewhorizons.angelica.AngelicaExtension;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Matrix4fStack;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.EnumSource;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertAll;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@ExtendWith(AngelicaExtension.class)
|
||||
public class GLMS_MatrixStack_UnitTest {
|
||||
|
||||
final static FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
|
||||
Matrix4f getMatrix(int matrix, boolean cached) {
|
||||
buffer.clear();
|
||||
if(cached) {
|
||||
GLStateManager.glGetFloat(matrix, buffer);
|
||||
} else {
|
||||
GL11.glGetFloat(matrix, buffer);
|
||||
}
|
||||
return new Matrix4f(buffer);
|
||||
}
|
||||
boolean matrixEquals(Matrix4f expected, Matrix4f actual) {
|
||||
if(expected.equals(actual, 0.0001f)) {
|
||||
return true;
|
||||
} else {
|
||||
System.out.println("Expected: " + expected);
|
||||
System.out.println("Actual: " + actual);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
void assertMatrixEquals(Matrix4f expected, Matrix4f actual, String message) {
|
||||
assertTrue(matrixEquals(expected, actual), message);
|
||||
}
|
||||
void validateMatrix(Matrix4f expected, int matrix, String message) {
|
||||
// Be careful of precision here
|
||||
assertAll(message,
|
||||
() -> assertMatrixEquals(expected, getMatrix(matrix, false), "GL State Mismatch"),
|
||||
() -> assertMatrixEquals(expected, getMatrix(matrix, true), "GLSM State Mismatch")
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
enum MatrixMode {
|
||||
MODELVIEW(GL11.GL_MODELVIEW, GL11.GL_MODELVIEW_MATRIX, "Model"),
|
||||
PROJECTION(GL11.GL_PROJECTION, GL11.GL_PROJECTION_MATRIX, "Projection"),
|
||||
TEXTURE(GL11.GL_TEXTURE, GL11.GL_TEXTURE_MATRIX, "Texture");
|
||||
|
||||
protected final int mode;
|
||||
protected final int getEnum;
|
||||
protected final String name;
|
||||
|
||||
MatrixMode(int mode, int getEnum, String name) {
|
||||
this.mode = mode;
|
||||
this.getEnum = getEnum;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@EnumSource(MatrixMode.class)
|
||||
void validateMatrixOperations(MatrixMode matrix) {
|
||||
GLStateManager.glMatrixMode(matrix.mode);
|
||||
GLStateManager.glLoadIdentity();
|
||||
|
||||
GLStateManager.glPushMatrix();
|
||||
|
||||
Matrix4fStack testMatrix = new Matrix4fStack(2);
|
||||
|
||||
validateMatrix(testMatrix, matrix.getEnum, "Identity " + matrix.name + " Matrix");
|
||||
|
||||
GLStateManager.glScalef(2.0f, 2.0f, 2.0f);
|
||||
testMatrix.scale(2.0f);
|
||||
validateMatrix(testMatrix, matrix.getEnum, "Scaled " + matrix.name + " Matrix");
|
||||
|
||||
GLStateManager.glTranslatef(2.0f, 2.0f, 2.0f);
|
||||
testMatrix.translate(2.0f, 2.0f, 2.0f);
|
||||
validateMatrix(testMatrix, matrix.getEnum, "Translated " + matrix.name + " Matrix");
|
||||
|
||||
GLStateManager.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
|
||||
testMatrix.rotate((float) Math.toRadians(180.0f), 0.0f, 0.0f, 1.0f);
|
||||
validateMatrix(testMatrix, matrix.getEnum, "Rotated " + matrix.name + " Matrix");
|
||||
|
||||
GLStateManager.glOrtho(0, 800, 0, 600, -1, 1);
|
||||
testMatrix.ortho(0, 800, 0, 600, -1, 1);
|
||||
validateMatrix(testMatrix, matrix.getEnum, "Ortho " + matrix.name + " Matrix");
|
||||
|
||||
Matrix4f testLoad = new Matrix4f();
|
||||
testLoad.m02(5f);
|
||||
testLoad.m12(12f);
|
||||
testLoad.get(buffer);
|
||||
|
||||
GLStateManager.glLoadMatrix(buffer);
|
||||
validateMatrix(testLoad, matrix.getEnum, "Loaded " + matrix.name + " Matrix");
|
||||
|
||||
GLStateManager.glPopMatrix();
|
||||
testMatrix.identity();
|
||||
validateMatrix(testMatrix, matrix.getEnum, "Popped " + matrix.name + " Matrix");
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
static void cleanup() {
|
||||
GLStateManager.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GLStateManager.glLoadIdentity();
|
||||
GLStateManager.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GLStateManager.glLoadIdentity();
|
||||
GLStateManager.glMatrixMode(GL11.GL_TEXTURE);
|
||||
GLStateManager.glLoadIdentity();
|
||||
|
||||
GLStateManager.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user