Commit f13fd861c4b046d8f80775aeb3a8fe55e3cb78ee
1 parent
11bcac00
some additions to GL convenience class, cleaning up some warnings and redundant code
Showing
5 changed files
with
89 additions
and
19 deletions
java/client/com/mumfrey/liteloader/gl/GL.java
| 1 | package com.mumfrey.liteloader.gl; | 1 | package com.mumfrey.liteloader.gl; |
| 2 | 2 | ||
| 3 | +import java.nio.ByteBuffer; | ||
| 4 | +import java.nio.DoubleBuffer; | ||
| 3 | import java.nio.FloatBuffer; | 5 | import java.nio.FloatBuffer; |
| 4 | - | ||
| 5 | -import org.lwjgl.opengl.GL11; | 6 | +import java.nio.IntBuffer; |
| 6 | 7 | ||
| 7 | import net.minecraft.client.renderer.GlStateManager; | 8 | import net.minecraft.client.renderer.GlStateManager; |
| 8 | import net.minecraft.client.renderer.GlStateManager.TexGen; | 9 | import net.minecraft.client.renderer.GlStateManager.TexGen; |
| 9 | 10 | ||
| 11 | +import org.lwjgl.opengl.GL11; | ||
| 12 | +import org.lwjgl.util.glu.GLU; | ||
| 13 | + | ||
| 10 | /** | 14 | /** |
| 11 | * Convenience class for working with Mojang's GLStateManager: | 15 | * Convenience class for working with Mojang's GLStateManager: |
| 12 | * | 16 | * |
| @@ -854,6 +858,21 @@ public class GL | @@ -854,6 +858,21 @@ public class GL | ||
| 854 | GlStateManager.disableLight(light); // TODO OBF MCPTEST disableBooleanStateAt - disableLight | 858 | GlStateManager.disableLight(light); // TODO OBF MCPTEST disableBooleanStateAt - disableLight |
| 855 | } | 859 | } |
| 856 | 860 | ||
| 861 | + public static void glLight(int light, int pname, FloatBuffer params) | ||
| 862 | + { | ||
| 863 | + GL11.glLight(light, pname, params); | ||
| 864 | + } | ||
| 865 | + | ||
| 866 | + public static void glLightModel(int pname, FloatBuffer params) | ||
| 867 | + { | ||
| 868 | + GL11.glLightModel(pname, params); | ||
| 869 | + } | ||
| 870 | + | ||
| 871 | + public static void glLightModeli(int pname, int param) | ||
| 872 | + { | ||
| 873 | + GL11.glLightModeli(pname, param); | ||
| 874 | + } | ||
| 875 | + | ||
| 857 | public static void glEnableColorMaterial() | 876 | public static void glEnableColorMaterial() |
| 858 | { | 877 | { |
| 859 | GlStateManager.enableColorMaterial(); | 878 | GlStateManager.enableColorMaterial(); |
| @@ -939,6 +958,21 @@ public class GL | @@ -939,6 +958,21 @@ public class GL | ||
| 939 | GlStateManager.setFogEnd(end); | 958 | GlStateManager.setFogEnd(end); |
| 940 | } | 959 | } |
| 941 | 960 | ||
| 961 | + public static void glSetFogColour(FloatBuffer colour) | ||
| 962 | + { | ||
| 963 | + GL11.glFog(GL_FOG_COLOR, colour); | ||
| 964 | + } | ||
| 965 | + | ||
| 966 | + public static void glFogi(int pname, int param) | ||
| 967 | + { | ||
| 968 | + GL11.glFogi(pname, param); | ||
| 969 | + } | ||
| 970 | + | ||
| 971 | + public static void glFogf(int pname, float param) | ||
| 972 | + { | ||
| 973 | + GL11.glFogf(pname, param); | ||
| 974 | + } | ||
| 975 | + | ||
| 942 | public static void glEnableCulling() | 976 | public static void glEnableCulling() |
| 943 | { | 977 | { |
| 944 | GlStateManager.enableCull(); | 978 | GlStateManager.enableCull(); |
| @@ -1024,7 +1058,7 @@ public class GL | @@ -1024,7 +1058,7 @@ public class GL | ||
| 1024 | return GlStateManager.generateTexture(); // TODO OBF MCPTEST func_179146_y - generateTexture | 1058 | return GlStateManager.generateTexture(); // TODO OBF MCPTEST func_179146_y - generateTexture |
| 1025 | } | 1059 | } |
| 1026 | 1060 | ||
| 1027 | - public static void glDeleteTexture(int textureName) | 1061 | + public static void glDeleteTextures(int textureName) |
| 1028 | { | 1062 | { |
| 1029 | GlStateManager.deleteTexture(textureName); // TODO OBF MCPTEST func_179150_h - deleteTexture | 1063 | GlStateManager.deleteTexture(textureName); // TODO OBF MCPTEST func_179150_h - deleteTexture |
| 1030 | } | 1064 | } |
| @@ -1109,6 +1143,51 @@ public class GL | @@ -1109,6 +1143,51 @@ public class GL | ||
| 1109 | GlStateManager.getFloat(pname, params); | 1143 | GlStateManager.getFloat(pname, params); |
| 1110 | } | 1144 | } |
| 1111 | 1145 | ||
| 1146 | + public static float glGetFloat(int pname) | ||
| 1147 | + { | ||
| 1148 | + return GL11.glGetFloat(pname); | ||
| 1149 | + } | ||
| 1150 | + | ||
| 1151 | + public static void glGetDouble(int pname, DoubleBuffer params) | ||
| 1152 | + { | ||
| 1153 | + GL11.glGetDouble(pname, params); | ||
| 1154 | + } | ||
| 1155 | + | ||
| 1156 | + public static double glGetDouble(int pname) | ||
| 1157 | + { | ||
| 1158 | + return GL11.glGetDouble(pname); | ||
| 1159 | + } | ||
| 1160 | + | ||
| 1161 | + public static void glGetInteger(int pname, IntBuffer params) | ||
| 1162 | + { | ||
| 1163 | + GL11.glGetInteger(pname, params); | ||
| 1164 | + } | ||
| 1165 | + | ||
| 1166 | + public static int glGetInteger(int pname) | ||
| 1167 | + { | ||
| 1168 | + return GL11.glGetInteger(pname); | ||
| 1169 | + } | ||
| 1170 | + | ||
| 1171 | + public static void glGetBoolean(int pname, ByteBuffer params) | ||
| 1172 | + { | ||
| 1173 | + GL11.glGetBoolean(pname, params); | ||
| 1174 | + } | ||
| 1175 | + | ||
| 1176 | + public static boolean glGetBoolean(int pname) | ||
| 1177 | + { | ||
| 1178 | + return GL11.glGetBoolean(pname); | ||
| 1179 | + } | ||
| 1180 | + | ||
| 1181 | + public static void gluProject(float objx, float objy, float objz, FloatBuffer modelMatrix, FloatBuffer projMatrix, IntBuffer viewport, FloatBuffer win_pos) | ||
| 1182 | + { | ||
| 1183 | + GLU.gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, win_pos); | ||
| 1184 | + } | ||
| 1185 | + | ||
| 1186 | + public static void gluPerspective(float fovy, float aspect, float zNear, float zFar) | ||
| 1187 | + { | ||
| 1188 | + GLU.gluPerspective(fovy, aspect, zNear, zFar); | ||
| 1189 | + } | ||
| 1190 | + | ||
| 1112 | public static void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar) | 1191 | public static void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar) |
| 1113 | { | 1192 | { |
| 1114 | GlStateManager.ortho(left, right, bottom, top, zNear, zFar); | 1193 | GlStateManager.ortho(left, right, bottom, top, zNear, zFar); |
| @@ -1119,6 +1198,11 @@ public class GL | @@ -1119,6 +1198,11 @@ public class GL | ||
| 1119 | GlStateManager.rotate(angle, x, y, z); | 1198 | GlStateManager.rotate(angle, x, y, z); |
| 1120 | } | 1199 | } |
| 1121 | 1200 | ||
| 1201 | + public static void glRotated(double angle, double x, double y, double z) | ||
| 1202 | + { | ||
| 1203 | + GL11.glRotated(angle, x, y, z); | ||
| 1204 | + } | ||
| 1205 | + | ||
| 1122 | public static void glScalef(float x, float y, float z) | 1206 | public static void glScalef(float x, float y, float z) |
| 1123 | { | 1207 | { |
| 1124 | GlStateManager.scale(x, y, z); | 1208 | GlStateManager.scale(x, y, z); |
java/common/com/mumfrey/liteloader/core/LiteLoader.java
| @@ -595,7 +595,7 @@ public final class LiteLoader | @@ -595,7 +595,7 @@ public final class LiteLoader | ||
| 595 | * @throws InvalidActivityException Thrown by getMod if init is not complete | 595 | * @throws InvalidActivityException Thrown by getMod if init is not complete |
| 596 | * @throws IllegalArgumentException Thrown by getMod if argument is null | 596 | * @throws IllegalArgumentException Thrown by getMod if argument is null |
| 597 | */ | 597 | */ |
| 598 | - public String getModMetaData(String modNameOrId, String metaDataKey, String defaultValue) throws InvalidActivityException, IllegalArgumentException | 598 | + public String getModMetaData(String modNameOrId, String metaDataKey, String defaultValue) throws IllegalArgumentException |
| 599 | { | 599 | { |
| 600 | return this.mods.getModMetaData(modNameOrId, metaDataKey, defaultValue); | 600 | return this.mods.getModMetaData(modNameOrId, metaDataKey, defaultValue); |
| 601 | } | 601 | } |
java/common/com/mumfrey/liteloader/core/LiteLoaderBootstrap.java
| @@ -4,7 +4,6 @@ import java.io.File; | @@ -4,7 +4,6 @@ import java.io.File; | ||
| 4 | import java.io.FileInputStream; | 4 | import java.io.FileInputStream; |
| 5 | import java.io.FileNotFoundException; | 5 | import java.io.FileNotFoundException; |
| 6 | import java.io.FileWriter; | 6 | import java.io.FileWriter; |
| 7 | -import java.io.IOException; | ||
| 8 | import java.io.InputStream; | 7 | import java.io.InputStream; |
| 9 | import java.io.Serializable; | 8 | import java.io.Serializable; |
| 10 | import java.lang.reflect.Field; | 9 | import java.lang.reflect.Field; |
| @@ -373,7 +372,7 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | @@ -373,7 +372,7 @@ class LiteLoaderBootstrap implements LoaderBootstrap, LoaderEnvironment, LoaderP | ||
| 373 | * @throws SecurityException | 372 | * @throws SecurityException |
| 374 | * @throws IOException | 373 | * @throws IOException |
| 375 | */ | 374 | */ |
| 376 | - private void prepareLogger() throws SecurityException, IOException | 375 | + private void prepareLogger() throws SecurityException |
| 377 | { | 376 | { |
| 378 | LiteLoaderLogger.info("Setting up logger..."); | 377 | LiteLoaderLogger.info("Setting up logger..."); |
| 379 | 378 |
java/common/com/mumfrey/liteloader/core/LiteLoaderUpdateSite.java
| @@ -41,7 +41,6 @@ public class LiteLoaderUpdateSite extends UpdateSite | @@ -41,7 +41,6 @@ public class LiteLoaderUpdateSite extends UpdateSite | ||
| 41 | return false; | 41 | return false; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | - // TODO Enable force update | ||
| 45 | if (this.hasJarFile()) return true; | 44 | if (this.hasJarFile()) return true; |
| 46 | return this.findJarFile(); | 45 | return this.findJarFile(); |
| 47 | } | 46 | } |
| @@ -107,7 +106,6 @@ public class LiteLoaderUpdateSite extends UpdateSite | @@ -107,7 +106,6 @@ public class LiteLoaderUpdateSite extends UpdateSite | ||
| 107 | { | 106 | { |
| 108 | LiteLoaderLogger.info("Attempting to force update, extracting jar assassin..."); | 107 | LiteLoaderLogger.info("Attempting to force update, extracting jar assassin..."); |
| 109 | 108 | ||
| 110 | - // TODO Enable force update | ||
| 111 | File jarAssassinOutput = new File(this.jarFile.getParentFile(), "liteloader-update-agent.jar"); | 109 | File jarAssassinOutput = new File(this.jarFile.getParentFile(), "liteloader-update-agent.jar"); |
| 112 | 110 | ||
| 113 | if (!LiteLoaderUpdateSite.extractFile("/update/liteloader-update-agent.jar", jarAssassinOutput) || !jarAssassinOutput.isFile()) | 111 | if (!LiteLoaderUpdateSite.extractFile("/update/liteloader-update-agent.jar", jarAssassinOutput) || !jarAssassinOutput.isFile()) |