u35
This commit is contained in:
parent
7949400ca9
commit
579b61a8aa
|
@ -377,9 +377,10 @@
|
|||
~ logger.info("Caught error stitching, removing all assigned resourcepacks");
|
||||
~ logger.info(runtimeexception);
|
||||
|
||||
> INSERT 9 : 11 @ 9
|
||||
> INSERT 9 : 12 @ 9
|
||||
|
||||
+ ShaderSource.clearCache();
|
||||
+ GuiMainMenu.doResourceReloadHack();
|
||||
+
|
||||
|
||||
> CHANGE 7 : 10 @ 7 : 19
|
||||
|
@ -429,9 +430,20 @@
|
|||
|
||||
> DELETE 10 @ 10 : 11
|
||||
|
||||
> INSERT 9 : 10 @ 9
|
||||
> INSERT 9 : 21 @ 9
|
||||
|
||||
+ SingleplayerServerController.shutdownEaglercraftServer();
|
||||
+ if (SingleplayerServerController.isWorldRunning()) {
|
||||
+ SingleplayerServerController.shutdownEaglercraftServer();
|
||||
+ while (SingleplayerServerController.getStatusState() == IntegratedServerState.WORLD_UNLOADING) {
|
||||
+ EagUtils.sleep(50l);
|
||||
+ SingleplayerServerController.runTick();
|
||||
+ }
|
||||
+ }
|
||||
+ if (SingleplayerServerController.isIntegratedServerWorkerAlive()
|
||||
+ && SingleplayerServerController.canKillWorker()) {
|
||||
+ SingleplayerServerController.killWorker();
|
||||
+ EagUtils.sleep(50l);
|
||||
+ }
|
||||
|
||||
> CHANGE 1 : 2 @ 1 : 2
|
||||
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
|
||||
> DELETE 2 @ 2 : 3
|
||||
|
||||
> DELETE 3 @ 3 : 4
|
||||
> CHANGE 3 : 4 @ 3 : 4
|
||||
|
||||
~ import java.nio.charset.StandardCharsets;
|
||||
|
||||
> INSERT 1 : 2 @ 1
|
||||
|
||||
|
@ -19,6 +21,7 @@
|
|||
~ import net.eaglerforge.gui.GuiMods;
|
||||
~ import net.eaglerforge.gui.ModGUI;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.EagUtils;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.EaglerInputStream;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
|
||||
|
@ -27,7 +30,6 @@
|
|||
~ import com.google.common.base.Charsets;
|
||||
~ import com.google.common.collect.Lists;
|
||||
~
|
||||
~ import net.lax1dude.eaglercraft.v1_8.crypto.MD5Digest;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.crypto.SHA1Digest;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.internal.EnumCursorType;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
|
@ -63,12 +65,10 @@
|
|||
|
||||
~ private static final EaglercraftRandom RANDOM = new EaglercraftRandom();
|
||||
|
||||
> INSERT 1 : 7 @ 1
|
||||
> INSERT 1 : 5 @ 1
|
||||
|
||||
+ private boolean isDefault;
|
||||
+ private static final int lendef = 5987;
|
||||
+ private static final byte[] md5def = new byte[] { -61, -53, -36, 27, 24, 27, 103, -31, -58, -116, 113, -60, -67, -8,
|
||||
+ -77, 30 };
|
||||
+ private static final byte[] sha1def = new byte[] { -107, 77, 108, 49, 11, -100, -8, -119, -1, -100, -85, -55, 18,
|
||||
+ -69, -107, 113, -93, -101, -79, 32 };
|
||||
|
||||
|
@ -80,58 +80,105 @@
|
|||
|
||||
> DELETE 2 @ 2 : 3
|
||||
|
||||
> INSERT 3 : 4 @ 3
|
||||
> INSERT 3 : 6 @ 3
|
||||
|
||||
+ private static final ResourceLocation minecraftTitleBlurFlag = new ResourceLocation(
|
||||
+ "textures/gui/title/background/enable_blur.txt");
|
||||
+ private static final ResourceLocation eaglerGuiTextures = new ResourceLocation("eagler:gui/eagler_gui.png");
|
||||
|
||||
> DELETE 7 @ 7 : 9
|
||||
|
||||
> CHANGE 6 : 9 @ 6 : 8
|
||||
> CHANGE 6 : 11 @ 6 : 8
|
||||
|
||||
~ private static ResourceLocation backgroundTexture = null;
|
||||
~ private GuiUpdateCheckerOverlay updateCheckerOverlay;
|
||||
~ private GuiButton downloadOfflineButton;
|
||||
~ private boolean enableBlur = true;
|
||||
~ private boolean shouldReload = false;
|
||||
|
||||
> DELETE 2 @ 2 : 3
|
||||
> INSERT 1 : 3 @ 1
|
||||
|
||||
+ private static GuiMainMenu instance = null;
|
||||
+
|
||||
|
||||
> CHANGE 1 : 2 @ 1 : 2
|
||||
|
||||
~ instance = this;
|
||||
|
||||
> INSERT 1 : 2 @ 1
|
||||
|
||||
+ updateCheckerOverlay = new GuiUpdateCheckerOverlay(false, this);
|
||||
|
||||
> DELETE 38 @ 38 : 44
|
||||
> CHANGE 38 : 65 @ 38 : 43
|
||||
|
||||
> INSERT 1 : 25 @ 1
|
||||
~
|
||||
~ reloadResourceFlags();
|
||||
~ }
|
||||
~
|
||||
~ private void reloadResourceFlags() {
|
||||
~ if (Minecraft.getMinecraft().isDemo()) {
|
||||
~ this.isDefault = false;
|
||||
~ } else {
|
||||
~ if (!EagRuntime.getConfiguration().isEnableMinceraft()) {
|
||||
~ this.isDefault = false;
|
||||
~ } else {
|
||||
~ try {
|
||||
~ byte[] bytes = EaglerInputStream.inputStreamToBytesQuiet(Minecraft.getMinecraft()
|
||||
~ .getResourceManager().getResource(minecraftTitleTextures).getInputStream());
|
||||
~ if (bytes != null && bytes.length == lendef) {
|
||||
~ SHA1Digest sha1 = new SHA1Digest();
|
||||
~ byte[] sha1out = new byte[20];
|
||||
~ sha1.update(bytes, 0, bytes.length);
|
||||
~ sha1.doFinal(sha1out, 0);
|
||||
~ this.isDefault = Arrays.equals(sha1out, sha1def);
|
||||
~ } else {
|
||||
~ this.isDefault = false;
|
||||
~ }
|
||||
~ } catch (IOException e) {
|
||||
~ this.isDefault = false;
|
||||
~ }
|
||||
~ }
|
||||
|
||||
+ if (Minecraft.getMinecraft().isDemo()) {
|
||||
+ this.isDefault = false;
|
||||
+ } else {
|
||||
+ MD5Digest md5 = new MD5Digest();
|
||||
+ SHA1Digest sha1 = new SHA1Digest();
|
||||
+ byte[] md5out = new byte[16];
|
||||
+ byte[] sha1out = new byte[20];
|
||||
+ try {
|
||||
+ byte[] bytes = EaglerInputStream.inputStreamToBytesQuiet(Minecraft.getMinecraft().getResourceManager()
|
||||
+ .getResource(minecraftTitleTextures).getInputStream());
|
||||
+ if (bytes != null) {
|
||||
+ md5.update(bytes, 0, bytes.length);
|
||||
+ sha1.update(bytes, 0, bytes.length);
|
||||
+ md5.doFinal(md5out, 0);
|
||||
+ sha1.doFinal(sha1out, 0);
|
||||
+ this.isDefault = bytes.length == lendef && Arrays.equals(md5out, md5def)
|
||||
+ && Arrays.equals(sha1out, sha1def);
|
||||
+ } else {
|
||||
+ this.isDefault = false;
|
||||
> INSERT 2 : 21 @ 2
|
||||
|
||||
+ this.enableBlur = true;
|
||||
+
|
||||
+ try {
|
||||
+ byte[] bytes = EaglerInputStream.inputStreamToBytesQuiet(
|
||||
+ Minecraft.getMinecraft().getResourceManager().getResource(minecraftTitleBlurFlag).getInputStream());
|
||||
+ if (bytes != null) {
|
||||
+ String[] blurCfg = EagUtils.linesArray(new String(bytes, StandardCharsets.UTF_8));
|
||||
+ for (int i = 0; i < blurCfg.length; ++i) {
|
||||
+ String s = blurCfg[i];
|
||||
+ if (s.startsWith("enable_blur=")) {
|
||||
+ s = s.substring(12).trim();
|
||||
+ this.enableBlur = s.equals("1") || s.equals("true");
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ } catch (IOException e) {
|
||||
+ this.isDefault = false;
|
||||
+ }
|
||||
+ } catch (IOException e) {
|
||||
+ ;
|
||||
+ }
|
||||
|
||||
> INSERT 4 : 7 @ 4
|
||||
> INSERT 2 : 8 @ 2
|
||||
|
||||
+ public static void doResourceReloadHack() {
|
||||
+ if (instance != null) {
|
||||
+ instance.shouldReload = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
||||
> INSERT 2 : 9 @ 2
|
||||
|
||||
+ if (downloadOfflineButton != null) {
|
||||
+ downloadOfflineButton.enabled = !UpdateService.shouldDisableDownloadButton();
|
||||
+ }
|
||||
+ if (shouldReload) {
|
||||
+ reloadResourceFlags();
|
||||
+ shouldReload = false;
|
||||
+ }
|
||||
|
||||
> CHANGE 6 : 7 @ 6 : 7
|
||||
|
||||
|
@ -267,11 +314,25 @@
|
|||
|
||||
> DELETE 1 @ 1 : 2
|
||||
|
||||
> CHANGE 8 : 9 @ 8 : 9
|
||||
> CHANGE 8 : 13 @ 8 : 9
|
||||
|
||||
~ GlStateManager.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
|
||||
~ if (enableBlur) {
|
||||
~ GlStateManager.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
|
||||
~ } else {
|
||||
~ GlStateManager.gluPerspective(85.0F, (float) width / (float) height, 0.05F, 10.0F);
|
||||
~ }
|
||||
|
||||
> CHANGE 73 : 77 @ 73 : 77
|
||||
> CHANGE 5 : 8 @ 5 : 6
|
||||
|
||||
~ if (enableBlur) {
|
||||
~ GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
|
||||
~ }
|
||||
|
||||
> CHANGE 5 : 6 @ 5 : 6
|
||||
|
||||
~ byte b0 = enableBlur ? (byte) 8 : (byte) 1;
|
||||
|
||||
> CHANGE 61 : 65 @ 61 : 65
|
||||
|
||||
~ this.mc.getTextureManager().bindTexture(backgroundTexture);
|
||||
~ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
@ -282,11 +343,23 @@
|
|||
|
||||
> DELETE 9 @ 9 : 10
|
||||
|
||||
> DELETE 24 @ 24 : 26
|
||||
> CHANGE 22 : 27 @ 22 : 23
|
||||
|
||||
> CHANGE 7 : 8 @ 7 : 8
|
||||
~ if (enableBlur) {
|
||||
~ this.renderSkybox(i, j, f);
|
||||
~ } else {
|
||||
~ this.drawPanorama(i, j, f);
|
||||
~ }
|
||||
|
||||
~ if (this.isDefault || (double) this.updateCounter < 1.0E-4D) {
|
||||
> DELETE 1 @ 1 : 3
|
||||
|
||||
> CHANGE 7 : 12 @ 7 : 8
|
||||
|
||||
~ boolean minc = (double) this.updateCounter < 1.0E-4D;
|
||||
~ if (this.isDefault) {
|
||||
~ minc = !minc;
|
||||
~ }
|
||||
~ if (minc) {
|
||||
|
||||
> CHANGE 4 : 5 @ 4 : 5
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
+ import java.util.Locale;
|
||||
|
||||
> INSERT 1 : 13 @ 1
|
||||
> INSERT 1 : 14 @ 1
|
||||
|
||||
+ import java.util.TimeZone;
|
||||
+
|
||||
|
@ -31,6 +31,7 @@
|
|||
+ import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformType;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.sp.SingleplayerServerController;
|
||||
|
||||
> CHANGE 5 : 6 @ 5 : 10
|
||||
|
@ -316,7 +317,13 @@
|
|||
|
||||
~ HString.format("Facing: %s (%s) (%.1f / %.1f)",
|
||||
|
||||
> CHANGE 5 : 6 @ 5 : 6
|
||||
> INSERT 3 : 6 @ 3
|
||||
|
||||
+ if (DynamicLightsStateManager.isDynamicLightsRender()) {
|
||||
+ arraylist.add(6, DynamicLightsStateManager.getF3String());
|
||||
+ }
|
||||
|
||||
> CHANGE 2 : 3 @ 2 : 3
|
||||
|
||||
~ arraylist.add("Biome: " + chunk.getBiome(blockpos, null).biomeName);
|
||||
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
~ GameSettings.Options.VIEW_BOBBING, GameSettings.Options.GUI_SCALE, GameSettings.Options.GAMMA,
|
||||
~ GameSettings.Options.RENDER_CLOUDS, GameSettings.Options.PARTICLES, GameSettings.Options.FXAA,
|
||||
~ GameSettings.Options.MIPMAP_LEVELS, GameSettings.Options.BLOCK_ALTERNATIVES,
|
||||
~ GameSettings.Options.ENTITY_SHADOWS, GameSettings.Options.FOG, GameSettings.Options.FULLSCREEN,
|
||||
~ GameSettings.Options.FNAW_SKINS, GameSettings.Options.HUD_FPS, GameSettings.Options.HUD_COORDS,
|
||||
~ GameSettings.Options.HUD_PLAYER, GameSettings.Options.HUD_STATS, GameSettings.Options.HUD_WORLD,
|
||||
~ GameSettings.Options.HUD_24H, GameSettings.Options.CHUNK_FIX };
|
||||
~ GameSettings.Options.ENTITY_SHADOWS, GameSettings.Options.FOG, GameSettings.Options.EAGLER_DYNAMIC_LIGHTS,
|
||||
~ GameSettings.Options.FULLSCREEN, GameSettings.Options.FNAW_SKINS, GameSettings.Options.HUD_FPS,
|
||||
~ GameSettings.Options.HUD_COORDS, GameSettings.Options.HUD_PLAYER, GameSettings.Options.HUD_STATS,
|
||||
~ GameSettings.Options.HUD_WORLD, GameSettings.Options.HUD_24H, GameSettings.Options.CHUNK_FIX };
|
||||
|
||||
> CHANGE 11 : 13 @ 11 : 31
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
+ public static final ServerResourceMode[] _VALUES = values();
|
||||
+
|
||||
|
||||
> INSERT 10 : 76 @ 10
|
||||
> INSERT 10 : 81 @ 10
|
||||
|
||||
+
|
||||
+ public void setMOTDFromQuery(QueryResponse pkt) {
|
||||
|
@ -95,7 +95,12 @@
|
|||
+ this.serverMOTD = motd.length() > 0
|
||||
+ ? (motd.length() > 1 ? motd.getString(0) + "\n" + motd.getString(1) : motd.getString(0))
|
||||
+ : "";
|
||||
+ this.populationInfo = "" + motdData.getInt("online") + "/" + motdData.getInt("max");
|
||||
+ int max = motdData.getInt("max");
|
||||
+ if (max > 0) {
|
||||
+ this.populationInfo = "" + motdData.getInt("online") + "/" + max;
|
||||
+ } else {
|
||||
+ this.populationInfo = "" + motdData.getInt("online");
|
||||
+ }
|
||||
+ this.playerList = null;
|
||||
+ JSONArray players = motdData.optJSONArray("players");
|
||||
+ if (players.length() > 0) {
|
||||
|
|
|
@ -36,4 +36,11 @@
|
|||
|
||||
~ public void setParticleIcon(EaglerTextureAtlasSprite icon) {
|
||||
|
||||
> INSERT 30 : 34 @ 30
|
||||
|
||||
+
|
||||
+ protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
+ return 0.0f;
|
||||
+ }
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -5,12 +5,13 @@
|
|||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> INSERT 2 : 7 @ 2
|
||||
> INSERT 2 : 8 @ 2
|
||||
|
||||
+ import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.BlockVertexIDs;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
+ import net.minecraft.block.Block;
|
||||
|
||||
> DELETE 4 @ 4 : 6
|
||||
|
@ -20,10 +21,11 @@
|
|||
~ private EaglerTextureAtlasSprite[] atlasSpritesLava = new EaglerTextureAtlasSprite[2];
|
||||
~ private EaglerTextureAtlasSprite[] atlasSpritesWater = new EaglerTextureAtlasSprite[2];
|
||||
|
||||
> INSERT 15 : 17 @ 15
|
||||
> INSERT 15 : 18 @ 15
|
||||
|
||||
+ BlockPos tmp = new BlockPos(0, 0, 0);
|
||||
+ boolean deferred = DeferredStateManager.isDeferredRenderer();
|
||||
+ boolean isDynamicLights = deferred || DynamicLightsStateManager.isDynamicLightsRender();
|
||||
|
||||
> INSERT 1 : 3 @ 1
|
||||
|
||||
|
@ -78,7 +80,7 @@
|
|||
|
||||
> CHANGE 31 : 36 @ 31 : 32
|
||||
|
||||
~ if (deferred)
|
||||
~ if (isDynamicLights)
|
||||
~ worldRendererIn.genNormals(true, f12 <= -999.0F ? BlockVertexIDs.builtin_water_still_vertex_id
|
||||
~ : BlockVertexIDs.builtin_water_flow_vertex_id);
|
||||
~
|
||||
|
@ -86,7 +88,7 @@
|
|||
|
||||
> INSERT 8 : 11 @ 8
|
||||
|
||||
+ if (deferred)
|
||||
+ if (isDynamicLights)
|
||||
+ worldRendererIn.genNormals(true, f12 <= -999.0F ? BlockVertexIDs.builtin_water_still_vertex_id
|
||||
+ : BlockVertexIDs.builtin_water_flow_vertex_id);
|
||||
|
||||
|
@ -100,7 +102,7 @@
|
|||
|
||||
> INSERT 10 : 12 @ 10
|
||||
|
||||
+ if (deferred)
|
||||
+ if (isDynamicLights)
|
||||
+ worldRendererIn.putNormal(0.0f, -1.0f, 0.0f, BlockVertexIDs.builtin_water_still_vertex_id);
|
||||
|
||||
> CHANGE 23 : 24 @ 23 : 24
|
||||
|
@ -119,7 +121,7 @@
|
|||
|
||||
> CHANGE 15 : 29 @ 15 : 23
|
||||
|
||||
~ if (deferred)
|
||||
~ if (isDynamicLights)
|
||||
~ worldRendererIn.putNormal(j1, 0.0f, k1, BlockVertexIDs.builtin_water_flow_vertex_id);
|
||||
~ if (!realistic) {
|
||||
~ worldRendererIn.pos(d3, d1 + 0.0D, d4).color(f32, f33, f34, 1.0F)
|
||||
|
@ -130,7 +132,7 @@
|
|||
~ .tex((double) f27, (double) f29).lightmap(k, l).endVertex();
|
||||
~ worldRendererIn.pos(d3, d1 + (double) f39, d4).color(f32, f33, f34, 1.0F)
|
||||
~ .tex((double) f41, (double) f28).lightmap(k, l).endVertex();
|
||||
~ if (deferred)
|
||||
~ if (isDynamicLights)
|
||||
~ worldRendererIn.putNormal(-j1, 0.0f, -k1, BlockVertexIDs.builtin_water_flow_vertex_id);
|
||||
~ }
|
||||
|
||||
|
|
|
@ -5,13 +5,14 @@
|
|||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> INSERT 4 : 9 @ 4
|
||||
> INSERT 4 : 10 @ 4
|
||||
|
||||
+
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.VertexMarkerState;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
|
||||
> DELETE 3 @ 3 : 7
|
||||
|
||||
|
@ -52,20 +53,22 @@
|
|||
|
||||
~ worldRendererIn, list1, bitset, afloat);
|
||||
|
||||
> INSERT 9 : 10 @ 9
|
||||
> INSERT 9 : 11 @ 9
|
||||
|
||||
+ boolean isDeferred = DeferredStateManager.isDeferredRenderer();
|
||||
+ boolean isDynamicLights = isDeferred || DynamicLightsStateManager.isDynamicLightsRender();
|
||||
|
||||
> CHANGE 8 : 9 @ 8 : 9
|
||||
|
||||
~ if (!isDeferred && block$enumoffsettype == Block.EnumOffsetType.XYZ) {
|
||||
|
||||
> CHANGE 4 : 8 @ 4 : 6
|
||||
> CHANGE 4 : 9 @ 4 : 6
|
||||
|
||||
~ for (int i = 0, l = listQuadsIn.size(); i < l; ++i) {
|
||||
~ BakedQuad bakedquad = listQuadsIn.get(i);
|
||||
~ int[] vertData = isDeferred ? bakedquad.getVertexDataWithNormals() : bakedquad.getVertexData();
|
||||
~ this.fillQuadBounds(blockIn, vertData, bakedquad.getFace(), quadBounds, boundsFlags, isDeferred ? 8 : 7);
|
||||
~ int[] vertData = isDynamicLights ? bakedquad.getVertexDataWithNormals() : bakedquad.getVertexData();
|
||||
~ this.fillQuadBounds(blockIn, vertData, bakedquad.getFace(), quadBounds, boundsFlags,
|
||||
~ isDynamicLights ? 8 : 7);
|
||||
|
||||
> CHANGE 2 : 3 @ 2 : 3
|
||||
|
||||
|
@ -101,10 +104,11 @@
|
|||
+ private final BlockPos blockpos5 = new BlockPos(0, 0, 0);
|
||||
+
|
||||
|
||||
> CHANGE 2 : 4 @ 2 : 3
|
||||
> CHANGE 2 : 5 @ 2 : 3
|
||||
|
||||
~ List<BakedQuad> listQuadsIn, BitSet boundsFlags, float[] quadBounds) {
|
||||
~ boolean isDeferred = DeferredStateManager.isDeferredRenderer();
|
||||
~ boolean isDynamicLights = isDeferred || DynamicLightsStateManager.isDynamicLightsRender();
|
||||
|
||||
> CHANGE 11 : 12 @ 11 : 12
|
||||
|
||||
|
@ -115,9 +119,9 @@
|
|||
~ for (int m = 0, n = listQuadsIn.size(); m < n; ++m) {
|
||||
~ BakedQuad bakedquad = listQuadsIn.get(m);
|
||||
~ EnumFacing facingIn = bakedquad.getFace();
|
||||
~ int[] vertData = isDeferred ? bakedquad.getVertexDataWithNormals() : bakedquad.getVertexData();
|
||||
~ int[] vertData = isDynamicLights ? bakedquad.getVertexDataWithNormals() : bakedquad.getVertexData();
|
||||
~ blockPosIn.offsetEvenFaster(facingIn, blockpos0);
|
||||
~ this.fillQuadBounds(blockIn, vertData, facingIn, quadBounds, boundsFlags, isDeferred ? 8 : 7);
|
||||
~ this.fillQuadBounds(blockIn, vertData, facingIn, quadBounds, boundsFlags, isDynamicLights ? 8 : 7);
|
||||
~ boolean boundsFlags0 = boundsFlags.get(0);
|
||||
|
||||
> CHANGE 1 : 2 @ 1 : 5
|
||||
|
|
|
@ -7,13 +7,14 @@
|
|||
|
||||
> DELETE 2 @ 2 : 3
|
||||
|
||||
> CHANGE 1 : 6 @ 1 : 2
|
||||
> CHANGE 1 : 7 @ 1 : 2
|
||||
|
||||
~
|
||||
~ import com.google.common.collect.Lists;
|
||||
~
|
||||
~ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
|
||||
> INSERT 3 : 4 @ 3
|
||||
|
||||
|
@ -23,17 +24,22 @@
|
|||
|
||||
~ public void preRenderChunk(RenderChunk renderChunkIn, EnumWorldBlockLayer enumworldblocklayer) {
|
||||
|
||||
> CHANGE 1 : 11 @ 1 : 4
|
||||
> CHANGE 1 : 16 @ 1 : 4
|
||||
|
||||
~ float posX = (float) ((double) blockpos.getX() - this.viewEntityX);
|
||||
~ float posY = (float) ((double) blockpos.getY() - this.viewEntityY);
|
||||
~ float posZ = (float) ((double) blockpos.getZ() - this.viewEntityZ);
|
||||
~ GlStateManager.translate(posX, posY, posZ);
|
||||
~ if (DeferredStateManager.isInForwardPass()) {
|
||||
~ posX = (float) (blockpos.getX() - (MathHelper.floor_double(this.viewEntityX / 16.0) << 4)); // TODO
|
||||
~ posX = (float) (blockpos.getX() - (MathHelper.floor_double(this.viewEntityX / 16.0) << 4));
|
||||
~ posY = (float) (blockpos.getY() - (MathHelper.floor_double(this.viewEntityY / 16.0) << 4));
|
||||
~ posZ = (float) (blockpos.getZ() - (MathHelper.floor_double(this.viewEntityZ / 16.0) << 4));
|
||||
~ DeferredStateManager.reportForwardRenderObjectPosition((int) posX, (int) posY, (int) posZ);
|
||||
~ } else if (DynamicLightsStateManager.isInDynamicLightsPass()) {
|
||||
~ posX = (float) (blockpos.getX() - (MathHelper.floor_double(this.viewEntityX / 16.0) << 4));
|
||||
~ posY = (float) (blockpos.getY() - (MathHelper.floor_double(this.viewEntityY / 16.0) << 4));
|
||||
~ posZ = (float) (blockpos.getZ() - (MathHelper.floor_double(this.viewEntityZ / 16.0) << 4));
|
||||
~ DynamicLightsStateManager.reportForwardRenderObjectPosition((int) posX, (int) posY, (int) posZ);
|
||||
~ }
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
~ import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.HString;
|
||||
|
||||
> INSERT 1 : 31 @ 1
|
||||
> INSERT 1 : 32 @ 1
|
||||
|
||||
+
|
||||
+ import com.google.common.base.Predicate;
|
||||
|
@ -45,6 +45,7 @@
|
|||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ShadersRenderPassFuture;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.gui.GuiShaderConfig;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.texture.EmissiveItems;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.vector.Vector4f;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.voice.VoiceTagRenderer;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
|
||||
|
@ -158,7 +159,13 @@
|
|||
~ (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, farPlane);
|
||||
~ DeferredStateManager.setGBufferNearFarPlanes(0.05f, farPlane);
|
||||
|
||||
> CHANGE 57 : 58 @ 57 : 58
|
||||
> INSERT 50 : 53 @ 50
|
||||
|
||||
+ if (DynamicLightsStateManager.isInDynamicLightsPass()) {
|
||||
+ DynamicLightsStateManager.reportForwardRenderObjectPosition2(0.0f, 0.0f, 0.0f);
|
||||
+ }
|
||||
|
||||
> CHANGE 7 : 8 @ 7 : 8
|
||||
|
||||
~ GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, false),
|
||||
|
||||
|
@ -183,12 +190,13 @@
|
|||
|
||||
~ this.lightmapColors[i] = short1 << 24 | j | k << 8 | l << 16;
|
||||
|
||||
> INSERT 3 : 17 @ 3
|
||||
> INSERT 3 : 18 @ 3
|
||||
|
||||
+
|
||||
+ GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||
+ this.mc.getTextureManager().bindTexture(this.locationLightMap);
|
||||
+ if (mc.gameSettings.fancyGraphics || mc.gameSettings.ambientOcclusion > 0) {
|
||||
+ if (mc.gameSettings.fancyGraphics || mc.gameSettings.ambientOcclusion > 0
|
||||
+ || DynamicLightsStateManager.isDynamicLightsRender()) {
|
||||
+ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
+ EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
+ } else {
|
||||
|
@ -290,11 +298,31 @@
|
|||
+ VoiceTagRenderer.clearTagsDrawnSet();
|
||||
+
|
||||
|
||||
> CHANGE 4 : 5 @ 4 : 5
|
||||
> CHANGE 4 : 25 @ 4 : 12
|
||||
|
||||
~ boolean dlights = DynamicLightsStateManager.isDynamicLightsRender();
|
||||
~ if (dlights) {
|
||||
~ updateDynamicLightListEagler(partialTicks);
|
||||
~ }
|
||||
~ if (this.mc.gameSettings.anaglyph && !this.mc.gameSettings.shaders) {
|
||||
~ if (dlights) {
|
||||
~ GlStateManager.enableExtensionPipeline();
|
||||
~ }
|
||||
~ try {
|
||||
~ anaglyphField = 0;
|
||||
~ GlStateManager.colorMask(false, true, true, false);
|
||||
~ this.renderWorldPass(0, partialTicks, finishTimeNano);
|
||||
~ anaglyphField = 1;
|
||||
~ GlStateManager.colorMask(true, false, false, false);
|
||||
~ this.renderWorldPass(1, partialTicks, finishTimeNano);
|
||||
~ GlStateManager.colorMask(true, true, true, false);
|
||||
~ } finally {
|
||||
~ if (dlights) {
|
||||
~ GlStateManager.disableExtensionPipeline();
|
||||
~ }
|
||||
~ }
|
||||
|
||||
> CHANGE 8 : 24 @ 8 : 9
|
||||
> CHANGE 1 : 26 @ 1 : 2
|
||||
|
||||
~ if (this.mc.gameSettings.shaders) {
|
||||
~ try {
|
||||
|
@ -310,7 +338,16 @@
|
|||
~ mc.effectRenderer.acceleratedParticleRenderer = EffectRenderer.vanillaAcceleratedParticleRenderer;
|
||||
~ } else {
|
||||
~ mc.effectRenderer.acceleratedParticleRenderer = EffectRenderer.vanillaAcceleratedParticleRenderer;
|
||||
~ this.renderWorldPass(2, partialTicks, finishTimeNano);
|
||||
~ if (dlights) {
|
||||
~ GlStateManager.enableExtensionPipeline();
|
||||
~ }
|
||||
~ try {
|
||||
~ this.renderWorldPass(2, partialTicks, finishTimeNano);
|
||||
~ } finally {
|
||||
~ if (dlights) {
|
||||
~ GlStateManager.disableExtensionPipeline();
|
||||
~ }
|
||||
~ }
|
||||
~ }
|
||||
|
||||
> INSERT 2 : 6 @ 2
|
||||
|
@ -320,9 +357,22 @@
|
|||
+ }
|
||||
+
|
||||
|
||||
> DELETE 15 @ 15 : 17
|
||||
> INSERT 14 : 18 @ 14
|
||||
|
||||
> CHANGE 12 : 15 @ 12 : 14
|
||||
+ boolean isDynamicLights = DynamicLightsStateManager.isDynamicLightsRender();
|
||||
+ if (isDynamicLights) {
|
||||
+ DynamicLightsStateManager.setupInverseViewMatrix();
|
||||
+ }
|
||||
|
||||
> DELETE 1 @ 1 : 3
|
||||
|
||||
> INSERT 6 : 9 @ 6
|
||||
|
||||
+ TileEntityRendererDispatcher.staticPlayerX = d0; // hack, needed for some eagler stuff
|
||||
+ TileEntityRendererDispatcher.staticPlayerY = d1;
|
||||
+ TileEntityRendererDispatcher.staticPlayerZ = d2;
|
||||
|
||||
> CHANGE 6 : 9 @ 6 : 8
|
||||
|
||||
~ float vigg = this.getFOVModifier(partialTicks, true);
|
||||
~ GlStateManager.gluPerspective(vigg, (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F,
|
||||
|
@ -342,9 +392,40 @@
|
|||
|
||||
+ GlStateManager.shadeModel(7424);
|
||||
|
||||
> CHANGE 46 : 47 @ 46 : 47
|
||||
> INSERT 16 : 19 @ 16
|
||||
|
||||
+ if (isDynamicLights) {
|
||||
+ GlStateManager.disableExtensionPipeline();
|
||||
+ }
|
||||
|
||||
> INSERT 2 : 5 @ 2
|
||||
|
||||
+ if (isDynamicLights) {
|
||||
+ GlStateManager.enableExtensionPipeline();
|
||||
+ }
|
||||
|
||||
> INSERT 8 : 11 @ 8
|
||||
|
||||
+ if (isDynamicLights) {
|
||||
+ GlStateManager.disableExtensionPipeline();
|
||||
+ }
|
||||
|
||||
> INSERT 3 : 6 @ 3
|
||||
|
||||
+ if (isDynamicLights) {
|
||||
+ GlStateManager.enableExtensionPipeline();
|
||||
+ }
|
||||
|
||||
> CHANGE 17 : 25 @ 17 : 18
|
||||
|
||||
~ if (isDynamicLights) {
|
||||
~ DynamicLightsStateManager.bindAcceleratedEffectRenderer(effectrenderer);
|
||||
~ DynamicLightsStateManager.reportForwardRenderObjectPosition2(0.0f, 0.0f, 0.0f);
|
||||
~ }
|
||||
~ effectrenderer.renderParticles(entity, partialTicks, 2);
|
||||
~ if (isDynamicLights) {
|
||||
~ effectrenderer.acceleratedParticleRenderer = null;
|
||||
~ }
|
||||
|
||||
> INSERT 30 : 34 @ 30
|
||||
|
||||
|
@ -353,7 +434,24 @@
|
|||
+ ModAPI.callEvent("render", eventData);
|
||||
+
|
||||
|
||||
> CHANGE 14 : 15 @ 14 : 15
|
||||
> INSERT 9 : 23 @ 9
|
||||
|
||||
+ private void updateDynamicLightListEagler(float partialTicks) {
|
||||
+ DynamicLightsStateManager.clearRenderList();
|
||||
+ Entity entity = this.mc.getRenderViewEntity();
|
||||
+ double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks;
|
||||
+ double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks;
|
||||
+ double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks;
|
||||
+ AxisAlignedBB entityAABB = new AxisAlignedBB(d0 - 48.0, d1 - 32.0, d2 - 48.0, d0 + 48.0, d1 + 32.0, d2 + 48.0);
|
||||
+ List<Entity> entities = this.mc.theWorld.getEntitiesWithinAABB(Entity.class, entityAABB);
|
||||
+ for (int i = 0, l = entities.size(); i < l; ++i) {
|
||||
+ entities.get(i).renderDynamicLightsEaglerSimple(partialTicks);
|
||||
+ }
|
||||
+ DynamicLightsStateManager.commitLightSourceBuckets(d0, d1, d2);
|
||||
+ }
|
||||
+
|
||||
|
||||
> CHANGE 5 : 6 @ 5 : 6
|
||||
|
||||
~ GlStateManager.gluPerspective(this.getFOVModifier(partialTicks, true),
|
||||
|
||||
|
@ -373,12 +471,15 @@
|
|||
|
||||
+ boolean df = DeferredStateManager.isInDeferredPass();
|
||||
|
||||
> CHANGE 9 : 25 @ 9 : 13
|
||||
> CHANGE 9 : 28 @ 9 : 13
|
||||
|
||||
~ if (!df) {
|
||||
~ GlStateManager.enableBlend();
|
||||
~ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
~ GlStateManager.alphaFunc(516, 0.1F);
|
||||
~ if (DynamicLightsStateManager.isInDynamicLightsPass()) {
|
||||
~ DynamicLightsStateManager.reportForwardRenderObjectPosition2(0.0f, 0.0f, 0.0f);
|
||||
~ }
|
||||
~ } else {
|
||||
~ GlStateManager.enableAlpha();
|
||||
~ DeferredStateManager.setHDRTranslucentPassBlendFunc();
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
~ import net.lax1dude.eaglercraft.v1_8.Keyboard;
|
||||
~
|
||||
|
||||
> INSERT 2 : 22 @ 2
|
||||
> INSERT 2 : 23 @ 2
|
||||
|
||||
+
|
||||
+ import com.google.common.collect.Lists;
|
||||
|
@ -34,6 +34,7 @@
|
|||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.EaglerDeferredConfig;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.EaglerDeferredPipeline;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.SharedPipelineShaders;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.vector.Vector3f;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.vector.Vector4f;
|
||||
|
||||
|
@ -142,7 +143,7 @@
|
|||
+ this.renderDistanceChunks = this.mc.gameSettings.renderDistanceChunks;
|
||||
+
|
||||
|
||||
> INSERT 19 : 75 @ 19
|
||||
> INSERT 19 : 85 @ 19
|
||||
|
||||
+
|
||||
+ if (mc.gameSettings.shaders) {
|
||||
|
@ -200,6 +201,16 @@
|
|||
+ }
|
||||
+ SharedPipelineShaders.free();
|
||||
+ }
|
||||
+
|
||||
+ if (DeferredStateManager.isDeferredRenderer()) {
|
||||
+ DynamicLightsStateManager.disableDynamicLightsRender(false);
|
||||
+ } else {
|
||||
+ if (mc.gameSettings.enableDynamicLights) {
|
||||
+ DynamicLightsStateManager.enableDynamicLightsRender();
|
||||
+ } else {
|
||||
+ DynamicLightsStateManager.disableDynamicLightsRender(true);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
> DELETE 9 @ 9 : 13
|
||||
|
||||
|
@ -600,16 +611,25 @@
|
|||
|
||||
> DELETE 17 @ 17 : 18
|
||||
|
||||
> CHANGE 155 : 157 @ 155 : 156
|
||||
> CHANGE 155 : 159 @ 155 : 156
|
||||
|
||||
~ worldRendererIn.begin(7, DeferredStateManager.isDeferredRenderer() ? VertexFormat.BLOCK_SHADERS
|
||||
~ : DefaultVertexFormats.BLOCK);
|
||||
~ worldRendererIn.begin(7,
|
||||
~ (DeferredStateManager.isDeferredRenderer() || DynamicLightsStateManager.isDynamicLightsRender())
|
||||
~ ? VertexFormat.BLOCK_SHADERS
|
||||
~ : DefaultVertexFormats.BLOCK);
|
||||
|
||||
> CHANGE 19 : 20 @ 19 : 20
|
||||
|
||||
~ EaglerTextureAtlasSprite textureatlassprite = this.destroyBlockIcons[i];
|
||||
|
||||
> CHANGE 17 : 19 @ 17 : 18
|
||||
> INSERT 1 : 5 @ 1
|
||||
|
||||
+ if (DynamicLightsStateManager.isInDynamicLightsPass()) {
|
||||
+ DynamicLightsStateManager.reportForwardRenderObjectPosition2(blockpos.x, blockpos.y,
|
||||
+ blockpos.z);
|
||||
+ }
|
||||
|
||||
> CHANGE 16 : 18 @ 16 : 17
|
||||
|
||||
~ if (partialTicks == 0 && movingObjectPositionIn != null
|
||||
~ && movingObjectPositionIn.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
|
|
|
@ -5,13 +5,14 @@
|
|||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> INSERT 2 : 7 @ 2
|
||||
> INSERT 2 : 8 @ 2
|
||||
|
||||
+ import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.VertexMarkerState;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.vector.Vector3f;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.vector.Vector4f;
|
||||
+ import net.minecraft.client.Minecraft;
|
||||
|
||||
> DELETE 1 @ 1 : 6
|
||||
|
||||
|
@ -70,9 +71,11 @@
|
|||
~ float[] sprite, EaglerTextureAtlasSprite modelRotationIn, ModelRotation partRotation,
|
||||
~ BlockPartRotation uvLocked, boolean shade, boolean parFlag2, Vector3f calcNormal) {
|
||||
|
||||
> CHANGE 1 : 2 @ 1 : 2
|
||||
> CHANGE 1 : 4 @ 1 : 2
|
||||
|
||||
~ int i = (parFlag2 && stride != 8) ? this.getFaceShadeColor(enumfacing) : -1;
|
||||
~ int i = (parFlag2 && (stride != 8 || !Minecraft.getMinecraft().gameSettings.shaders))
|
||||
~ ? this.getFaceShadeColor(enumfacing)
|
||||
~ : -1;
|
||||
|
||||
> CHANGE 7 : 9 @ 7 : 8
|
||||
|
||||
|
@ -84,12 +87,18 @@
|
|||
~ EaglerTextureAtlasSprite sprite, BlockFaceUV faceUV, EnumFacing facing, Vector3f calcNormal) {
|
||||
~ int i = storeIndex * stride;
|
||||
|
||||
> INSERT 4 : 27 @ 4
|
||||
> INSERT 4 : 33 @ 4
|
||||
|
||||
+ if (stride == 8) {
|
||||
+ faceData[i] = Float.floatToRawIntBits(position.x * VertexMarkerState.localCoordDeriveHackX);
|
||||
+ faceData[i + 1] = Float.floatToRawIntBits(position.y * VertexMarkerState.localCoordDeriveHackY);
|
||||
+ faceData[i + 2] = Float.floatToRawIntBits(position.z * VertexMarkerState.localCoordDeriveHackZ);
|
||||
+ if (!Minecraft.getMinecraft().gameSettings.shaders) {
|
||||
+ faceData[i] = Float.floatToRawIntBits(position.x);
|
||||
+ faceData[i + 1] = Float.floatToRawIntBits(position.y);
|
||||
+ faceData[i + 2] = Float.floatToRawIntBits(position.z);
|
||||
+ } else {
|
||||
+ faceData[i] = Float.floatToRawIntBits(position.x * VertexMarkerState.localCoordDeriveHackX);
|
||||
+ faceData[i + 1] = Float.floatToRawIntBits(position.y * VertexMarkerState.localCoordDeriveHackY);
|
||||
+ faceData[i + 2] = Float.floatToRawIntBits(position.z * VertexMarkerState.localCoordDeriveHackZ);
|
||||
+ }
|
||||
+ if (calcNormal != null) {
|
||||
+ int x = (byte) ((int) (calcNormal.x * 127.0F)) & 255;
|
||||
+ int y = (byte) ((int) (calcNormal.y * 127.0F)) & 255;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
> DELETE 2 @ 2 : 5
|
||||
|
||||
> CHANGE 3 : 11 @ 3 : 4
|
||||
> CHANGE 3 : 12 @ 3 : 4
|
||||
|
||||
~
|
||||
~ import com.google.common.collect.Maps;
|
||||
|
@ -17,6 +17,7 @@
|
|||
~ import net.lax1dude.eaglercraft.v1_8.opengl.VertexFormat;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
|
||||
> DELETE 4 @ 4 : 7
|
||||
|
||||
|
@ -152,10 +153,12 @@
|
|||
~ this.compileTask.setCompiledChunk(this.compiledChunk);
|
||||
~ return this.compileTask;
|
||||
|
||||
> CHANGE 3 : 5 @ 3 : 4
|
||||
> CHANGE 3 : 7 @ 3 : 4
|
||||
|
||||
~ worldRendererIn.begin(7,
|
||||
~ DeferredStateManager.isDeferredRenderer() ? VertexFormat.BLOCK_SHADERS : DefaultVertexFormats.BLOCK);
|
||||
~ (DeferredStateManager.isDeferredRenderer() || DynamicLightsStateManager.isDynamicLightsRender())
|
||||
~ ? VertexFormat.BLOCK_SHADERS
|
||||
~ : DefaultVertexFormats.BLOCK);
|
||||
|
||||
> CHANGE 5 : 7 @ 5 : 6
|
||||
|
||||
|
|
|
@ -5,20 +5,23 @@
|
|||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> INSERT 2 : 6 @ 2
|
||||
> INSERT 2 : 7 @ 2
|
||||
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.VertexFormat;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
|
||||
> DELETE 4 @ 4 : 5
|
||||
|
||||
> DELETE 1 @ 1 : 4
|
||||
|
||||
> CHANGE 28 : 30 @ 28 : 29
|
||||
> CHANGE 28 : 32 @ 28 : 29
|
||||
|
||||
~ worldrenderer.begin(7, DeferredStateManager.isDeferredRenderer() ? VertexFormat.BLOCK_SHADERS
|
||||
~ : DefaultVertexFormats.BLOCK);
|
||||
~ worldrenderer.begin(7,
|
||||
~ (DeferredStateManager.isDeferredRenderer()
|
||||
~ || DynamicLightsStateManager.isDynamicLightsRender()) ? VertexFormat.BLOCK_SHADERS
|
||||
~ : DefaultVertexFormats.BLOCK);
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
> DELETE 2 @ 2 : 3
|
||||
|
||||
> INSERT 1 : 10 @ 1
|
||||
> INSERT 1 : 11 @ 1
|
||||
|
||||
+
|
||||
+ import com.google.common.collect.Maps;
|
||||
|
@ -17,6 +17,7 @@
|
|||
+ import net.lax1dude.eaglercraft.v1_8.opengl.OpenGlHelper;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.profile.RenderHighPoly;
|
||||
|
||||
> INSERT 3 : 4 @ 3
|
||||
|
@ -61,7 +62,14 @@
|
|||
|
||||
~ public <T extends Entity> Render getEntityRenderObject(Entity entityIn) {
|
||||
|
||||
> INSERT 85 : 86 @ 85
|
||||
> INSERT 82 : 86 @ 82
|
||||
|
||||
+ if (DynamicLightsStateManager.isInDynamicLightsPass()) {
|
||||
+ DynamicLightsStateManager.reportForwardRenderObjectPosition2((float) (d0 - viewerPosX),
|
||||
+ (float) (d1 - viewerPosY), (float) (d2 - viewerPosZ));
|
||||
+ }
|
||||
|
||||
> INSERT 3 : 4 @ 3
|
||||
|
||||
+ DeferredStateManager.setEmissionConstant(1.0f);
|
||||
|
||||
|
|
|
@ -67,4 +67,13 @@
|
|||
+ return;
|
||||
+ }
|
||||
|
||||
> INSERT 3 : 5 @ 3
|
||||
|
||||
+ GlStateManager.enablePolygonOffset();
|
||||
+ GlStateManager.doPolygonOffset(-0.025f, 1.0f);
|
||||
|
||||
> INSERT 20 : 21 @ 20
|
||||
|
||||
+ GlStateManager.disablePolygonOffset();
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -7,13 +7,14 @@
|
|||
|
||||
> DELETE 2 @ 2 : 3
|
||||
|
||||
> INSERT 1 : 6 @ 1
|
||||
> INSERT 1 : 7 @ 1
|
||||
|
||||
+
|
||||
+ import com.google.common.collect.Maps;
|
||||
+
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.OpenGlHelper;
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
|
||||
> DELETE 1 @ 1 : 3
|
||||
|
||||
|
@ -24,4 +25,10 @@
|
|||
~ tileentityspecialrenderer = this
|
||||
~ .getSpecialRendererByClass((Class<? extends TileEntity>) teClass.getSuperclass());
|
||||
|
||||
> INSERT 52 : 55 @ 52
|
||||
|
||||
+ if (DynamicLightsStateManager.isInDynamicLightsPass()) {
|
||||
+ DynamicLightsStateManager.reportForwardRenderObjectPosition2((float) x, (float) y, (float) z);
|
||||
+ }
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
|
||||
~ public int guiScale = 3;
|
||||
|
||||
> INSERT 3 : 17 @ 3
|
||||
> INSERT 3 : 18 @ 3
|
||||
|
||||
+ public boolean hudFps = true;
|
||||
+ public boolean hudCoords = true;
|
||||
|
@ -113,6 +113,7 @@
|
|||
+ public EaglerDeferredConfig deferredShaderConf = new EaglerDeferredConfig();
|
||||
+ public boolean enableUpdateSvc = true;
|
||||
+ public boolean enableFNAWSkins = true;
|
||||
+ public boolean enableDynamicLights = false;
|
||||
|
||||
> CHANGE 1 : 7 @ 1 : 2
|
||||
|
||||
|
@ -326,7 +327,7 @@
|
|||
|
||||
> DELETE 20 @ 20 : 37
|
||||
|
||||
> INSERT 13 : 62 @ 13
|
||||
> INSERT 13 : 67 @ 13
|
||||
|
||||
+ if (parOptions == GameSettings.Options.HUD_FPS) {
|
||||
+ this.hudFps = !this.hudFps;
|
||||
|
@ -377,6 +378,11 @@
|
|||
+ this.enableVsync = !this.enableVsync;
|
||||
+ }
|
||||
+
|
||||
+ if (parOptions == GameSettings.Options.EAGLER_DYNAMIC_LIGHTS) {
|
||||
+ this.enableDynamicLights = !this.enableDynamicLights;
|
||||
+ this.mc.renderGlobal.loadRenderers();
|
||||
+ }
|
||||
+
|
||||
|
||||
> CHANGE 23 : 24 @ 23 : 34
|
||||
|
||||
|
@ -386,7 +392,7 @@
|
|||
|
||||
> DELETE 2 @ 2 : 4
|
||||
|
||||
> INSERT 8 : 30 @ 8
|
||||
> INSERT 8 : 32 @ 8
|
||||
|
||||
+ case HUD_COORDS:
|
||||
+ return this.hudCoords;
|
||||
|
@ -410,6 +416,8 @@
|
|||
+ return this.enableFNAWSkins;
|
||||
+ case EAGLER_VSYNC:
|
||||
+ return this.enableVsync;
|
||||
+ case EAGLER_DYNAMIC_LIGHTS:
|
||||
+ return this.enableDynamicLights;
|
||||
|
||||
> CHANGE 43 : 46 @ 43 : 47
|
||||
|
||||
|
@ -620,13 +628,17 @@
|
|||
|
||||
~ for (EnumPlayerModelParts enumplayermodelparts : EnumPlayerModelParts._VALUES) {
|
||||
|
||||
> INSERT 4 : 10 @ 4
|
||||
> INSERT 4 : 14 @ 4
|
||||
|
||||
+
|
||||
+ if (astring[0].equals("enableFNAWSkins")) {
|
||||
+ this.enableFNAWSkins = astring[1].equals("true");
|
||||
+ }
|
||||
+
|
||||
+ if (astring[0].equals("enableDynamicLights")) {
|
||||
+ this.enableDynamicLights = astring[1].equals("true");
|
||||
+ }
|
||||
+
|
||||
+ deferredShaderConf.readOption(astring[0], astring[1]);
|
||||
|
||||
> CHANGE 6 : 13 @ 6 : 7
|
||||
|
@ -678,7 +690,7 @@
|
|||
|
||||
> DELETE 13 @ 13 : 24
|
||||
|
||||
> INSERT 5 : 21 @ 5
|
||||
> INSERT 5 : 22 @ 5
|
||||
|
||||
+ printwriter.println("hudFps:" + this.hudFps);
|
||||
+ printwriter.println("hudWorld:" + this.hudWorld);
|
||||
|
@ -696,6 +708,7 @@
|
|||
+ printwriter.println("voiceSpeakVolume:" + this.voiceSpeakVolume);
|
||||
+ printwriter.println("voicePTTKey:" + this.voicePTTKey);
|
||||
+ printwriter.println("enableFNAWSkins:" + this.enableFNAWSkins);
|
||||
+ printwriter.println("enableDynamicLights:" + this.enableDynamicLights);
|
||||
|
||||
> CHANGE 5 : 8 @ 5 : 6
|
||||
|
||||
|
@ -745,7 +758,7 @@
|
|||
|
||||
> CHANGE 4 : 5 @ 4 : 5
|
||||
|
||||
~ RENDER_DISTANCE("options.renderDistance", true, false, 1.0F, 16.0F, 1.0F),
|
||||
~ RENDER_DISTANCE("options.renderDistance", true, false, 1.0F, 18.0F, 1.0F),
|
||||
|
||||
> CHANGE 8 : 10 @ 8 : 12
|
||||
|
||||
|
@ -761,6 +774,6 @@
|
|||
~ FOG("options.fog", false, true), FXAA("options.fxaa", false, false),
|
||||
~ FULLSCREEN("options.fullscreen", false, true),
|
||||
~ FNAW_SKINS("options.skinCustomisation.enableFNAWSkins", false, true),
|
||||
~ EAGLER_VSYNC("options.vsync", false, true);
|
||||
~ EAGLER_VSYNC("options.vsync", false, true), EAGLER_DYNAMIC_LIGHTS("options.dynamicLights", false, true);
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> CHANGE 3 : 11 @ 3 : 5
|
||||
> CHANGE 3 : 12 @ 3 : 5
|
||||
|
||||
~
|
||||
~ import net.eaglerforge.api.BaseData;
|
||||
|
@ -14,6 +14,7 @@
|
|||
~ import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.HString;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DynamicLightManager;
|
||||
~ import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
~
|
||||
|
||||
> INSERT 1 : 2 @ 1
|
||||
|
@ -479,7 +480,24 @@
|
|||
+ }
|
||||
+
|
||||
|
||||
> CHANGE 418 : 420 @ 418 : 419
|
||||
> CHANGE 115 : 121 @ 115 : 116
|
||||
|
||||
~ int i = 0;
|
||||
~ if (DynamicLightsStateManager.isDynamicLightsRender()) {
|
||||
~ i += (int) (getEaglerDynamicLightsValueSimple(var1) * 15.0f);
|
||||
~ }
|
||||
~ return this.worldObj.isBlockLoaded(blockpos) ? this.worldObj.getCombinedLight(blockpos, -i)
|
||||
~ : (i > 15 ? 240 : (i << 4));
|
||||
|
||||
> CHANGE 4 : 9 @ 4 : 5
|
||||
|
||||
~ float f = this.worldObj.isBlockLoaded(blockpos) ? this.worldObj.getLightBrightness(blockpos) : 0.0F;
|
||||
~ if (DynamicLightsStateManager.isDynamicLightsRender()) {
|
||||
~ f = Math.min(f + getEaglerDynamicLightsValueSimple(var1), 1.0f);
|
||||
~ }
|
||||
~ return f;
|
||||
|
||||
> CHANGE 297 : 299 @ 297 : 298
|
||||
|
||||
~ this.entityUniqueID = new EaglercraftUUID(tagCompund.getLong("UUIDMost"),
|
||||
~ tagCompund.getLong("UUIDLeast"));
|
||||
|
@ -528,7 +546,7 @@
|
|||
|
||||
~ public EaglercraftUUID getUniqueID() {
|
||||
|
||||
> INSERT 151 : 177 @ 151
|
||||
> INSERT 151 : 205 @ 151
|
||||
|
||||
+
|
||||
+ public void renderDynamicLightsEagler(float partialTicks, boolean isInFrustum) {
|
||||
|
@ -538,7 +556,8 @@
|
|||
+ double entityX2 = entityX - TileEntityRendererDispatcher.staticPlayerX;
|
||||
+ double entityY2 = entityY - TileEntityRendererDispatcher.staticPlayerY;
|
||||
+ double entityZ2 = entityZ - TileEntityRendererDispatcher.staticPlayerZ;
|
||||
+ if (Math.sqrt(entityX2 * entityX2 + entityY2 * entityY2 + entityZ2 * entityZ2) < 48.0 * 48.0) {
|
||||
+ if (entityX2 * entityX2 + entityY2 * entityY2
|
||||
+ + entityZ2 * entityZ2 < (isInFrustum ? (64.0 * 64.0) : (24.0 * 24.0))) {
|
||||
+ renderDynamicLightsEaglerAt(entityX, entityY, entityZ, entityX2, entityY2, entityZ2, partialTicks,
|
||||
+ isInFrustum);
|
||||
+ }
|
||||
|
@ -546,15 +565,42 @@
|
|||
+
|
||||
+ protected void renderDynamicLightsEaglerAt(double entityX, double entityY, double entityZ, double renderX,
|
||||
+ double renderY, double renderZ, float partialTicks, boolean isInFrustum) {
|
||||
+ float size = Math.max(width, height);
|
||||
+ if (size < 1.0f && !isInFrustum) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (this.isBurning()) {
|
||||
+ float size = Math.max(width, height);
|
||||
+ if (size < 1.0f && !isInFrustum) {
|
||||
+ return;
|
||||
+ }
|
||||
+ float mag = 5.0f * size;
|
||||
+ DynamicLightManager.renderDynamicLight("entity_" + entityId + "_fire", entityX, entityY + height * 0.75,
|
||||
+ entityZ, mag, 0.487f * mag, 0.1411f * mag, false);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void renderDynamicLightsEaglerSimple(float partialTicks) {
|
||||
+ double entityX = prevPosX + (posX - prevPosX) * (double) partialTicks;
|
||||
+ double entityY = prevPosY + (posY - prevPosY) * (double) partialTicks;
|
||||
+ double entityZ = prevPosZ + (posZ - prevPosZ) * (double) partialTicks;
|
||||
+ renderDynamicLightsEaglerSimpleAt(entityX, entityY, entityZ, partialTicks);
|
||||
+ }
|
||||
+
|
||||
+ protected void renderDynamicLightsEaglerSimpleAt(double entityX, double entityY, double entityZ,
|
||||
+ float partialTicks) {
|
||||
+ float renderBrightness = this.getEaglerDynamicLightsValueSimple(partialTicks);
|
||||
+ if (renderBrightness > 0.1f) {
|
||||
+ DynamicLightsStateManager.renderDynamicLight("entity_" + entityId + "_lightmap", entityX,
|
||||
+ entityY + height * 0.85, entityZ, renderBrightness * 13.0f);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
+ float size = Math.max(width, height);
|
||||
+ if (size < 1.0f) {
|
||||
+ return 0.0f;
|
||||
+ }
|
||||
+ if (this.isBurning()) {
|
||||
+ return size / 2.0f;
|
||||
+ }
|
||||
+ return 0.0f;
|
||||
+ }
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -353,7 +353,7 @@
|
|||
~ for (int i = 0; i < inv.length; ++i) {
|
||||
~ ItemStack itemstack1 = inv[i];
|
||||
|
||||
> INSERT 1254 : 1265 @ 1254
|
||||
> INSERT 1254 : 1277 @ 1254
|
||||
|
||||
+
|
||||
+ protected void renderDynamicLightsEaglerAt(double entityX, double entityY, double entityZ, double renderX,
|
||||
|
@ -366,5 +366,17 @@
|
|||
+ }
|
||||
+ }
|
||||
+
|
||||
+ protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
+ float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
|
||||
+ ItemStack itm = this.getHeldItem();
|
||||
+ if (itm != null && itm.stackSize > 0) {
|
||||
+ Item item = itm.getItem();
|
||||
+ if (item != null) {
|
||||
+ float f2 = item.getHeldItemBrightnessEagler();
|
||||
+ f = Math.min(f + f2 * 0.5f, 1.0f) + f2 * 0.5f;
|
||||
+ }
|
||||
+ }
|
||||
+ return f;
|
||||
+ }
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -21,4 +21,11 @@
|
|||
~ for (int i = 0, l = lst.size(); i < l; ++i) {
|
||||
~ lst.get(i).triggerAchievement(AchievementList.killWither);
|
||||
|
||||
> INSERT 13 : 17 @ 13
|
||||
|
||||
+ protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
+ return 1.0f;
|
||||
+ }
|
||||
+
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -5,6 +5,28 @@
|
|||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> DELETE 3 @ 3 : 4
|
||||
> INSERT 2 : 3 @ 2
|
||||
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DynamicLightManager;
|
||||
|
||||
> DELETE 1 @ 1 : 2
|
||||
|
||||
> INSERT 168 : 183 @ 168
|
||||
|
||||
+ protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
+ return 0.5f;
|
||||
+ }
|
||||
+
|
||||
+ protected void renderDynamicLightsEaglerAt(double entityX, double entityY, double entityZ, double renderX,
|
||||
+ double renderY, double renderZ, float partialTicks, boolean isInFrustum) {
|
||||
+ super.renderDynamicLightsEaglerAt(entityX, entityY, entityZ, renderX, renderY, renderZ, partialTicks,
|
||||
+ isInFrustum);
|
||||
+ if (isInFrustum && renderX * renderX + renderY * renderY + renderZ * renderZ < 150.0) {
|
||||
+ float mag = 0.5f;
|
||||
+ DynamicLightManager.renderDynamicLight("entity_" + getEntityId() + "_endereye", entityX, entityY + 0.2,
|
||||
+ entityZ, mag * 0.1990f, mag * 0.7750f, mag * 0.4130f, false);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -5,4 +5,11 @@
|
|||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> INSERT 156 : 160 @ 156
|
||||
|
||||
+ protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
+ return 1.0f;
|
||||
+ }
|
||||
+
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
~ for (int i = 0, l = lst.size(); i < l; ++i) {
|
||||
~ this.combineItems(lst.get(i));
|
||||
|
||||
> INSERT 258 : 267 @ 258
|
||||
> INSERT 258 : 280 @ 258
|
||||
|
||||
+
|
||||
+ public boolean eaglerEmissiveFlag = false;
|
||||
|
@ -36,5 +36,18 @@
|
|||
+ isInFrustum);
|
||||
+ eaglerEmissiveFlag = Minecraft.getMinecraft().entityRenderer.renderItemEntityLight(this, 0.1f);
|
||||
+ }
|
||||
+
|
||||
+ protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
+ float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
|
||||
+ ItemStack itm = this.getEntityItem();
|
||||
+ if (itm != null && itm.stackSize > 0) {
|
||||
+ Item item = itm.getItem();
|
||||
+ if (item != null) {
|
||||
+ float f2 = item.getHeldItemBrightnessEagler() * 0.75f;
|
||||
+ f = Math.min(f + f2 * 0.5f, 1.0f) + f2 * 0.5f;
|
||||
+ }
|
||||
+ }
|
||||
+ return f;
|
||||
+ }
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -9,7 +9,11 @@
|
|||
|
||||
+ import net.minecraft.client.Minecraft;
|
||||
|
||||
> INSERT 189 : 198 @ 189
|
||||
> INSERT 5 : 6 @ 5
|
||||
|
||||
+ import net.minecraft.item.Item;
|
||||
|
||||
> INSERT 184 : 206 @ 184
|
||||
|
||||
+
|
||||
+ public boolean eaglerEmissiveFlag = false;
|
||||
|
@ -20,5 +24,18 @@
|
|||
+ isInFrustum);
|
||||
+ eaglerEmissiveFlag = Minecraft.getMinecraft().entityRenderer.renderItemEntityLight(this, 0.1f);
|
||||
+ }
|
||||
+
|
||||
+ protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
+ float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
|
||||
+ ItemStack itm = this.getDisplayedItem();
|
||||
+ if (itm != null && itm.stackSize > 0) {
|
||||
+ Item item = itm.getItem();
|
||||
+ if (item != null) {
|
||||
+ float f2 = item.getHeldItemBrightnessEagler() * 0.75f;
|
||||
+ f = Math.min(f + f2 * 0.5f, 1.0f) + f2 * 0.5f;
|
||||
+ }
|
||||
+ }
|
||||
+ return f;
|
||||
+ }
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
> DELETE 3 @ 3 : 4
|
||||
|
||||
> INSERT 159 : 170 @ 159
|
||||
> INSERT 159 : 178 @ 159
|
||||
|
||||
+
|
||||
+ protected void renderDynamicLightsEaglerAt(double entityX, double entityY, double entityZ, double renderX,
|
||||
|
@ -24,5 +24,13 @@
|
|||
+ entityZ, dynamicLightMag, dynamicLightMag * 0.7792f, dynamicLightMag * 0.618f, false);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
+ float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
|
||||
+ if (minecartTNTFuse > -1 && minecartTNTFuse / 5 % 2 == 0) {
|
||||
+ f = Math.min(f + 0.75f, 1.25f);
|
||||
+ }
|
||||
+ return f;
|
||||
+ }
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DynamicLightManager;
|
||||
|
||||
> INSERT 90 : 101 @ 90
|
||||
> INSERT 90 : 109 @ 90
|
||||
|
||||
+
|
||||
+ protected void renderDynamicLightsEaglerAt(double entityX, double entityY, double entityZ, double renderX,
|
||||
|
@ -22,5 +22,13 @@
|
|||
+ entityZ, dynamicLightMag, dynamicLightMag * 0.7792f, dynamicLightMag * 0.618f, false);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
+ float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
|
||||
+ if (fuse / 5 % 2 == 0) {
|
||||
+ f = Math.min(f + 0.75f, 1.25f);
|
||||
+ }
|
||||
+ return f;
|
||||
+ }
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -9,7 +9,14 @@
|
|||
|
||||
+ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DynamicLightManager;
|
||||
|
||||
> INSERT 205 : 216 @ 205
|
||||
> INSERT 55 : 59 @ 55
|
||||
|
||||
+ protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
+ return 0.25f;
|
||||
+ }
|
||||
+
|
||||
|
||||
> INSERT 150 : 161 @ 150
|
||||
|
||||
+
|
||||
+ protected void renderDynamicLightsEaglerAt(double entityX, double entityY, double entityZ, double renderX,
|
||||
|
|
|
@ -15,7 +15,14 @@
|
|||
|
||||
~ this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
|
||||
|
||||
> INSERT 185 : 192 @ 185
|
||||
> INSERT 22 : 26 @ 22
|
||||
|
||||
+ protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
+ return 1.0f;
|
||||
+ }
|
||||
+
|
||||
|
||||
> INSERT 163 : 170 @ 163
|
||||
|
||||
+
|
||||
+ protected void renderDynamicLightsEaglerAt(double entityX, double entityY, double entityZ, double renderX,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
> DELETE 12 @ 12 : 14
|
||||
|
||||
> INSERT 204 : 217 @ 204
|
||||
> INSERT 204 : 226 @ 204
|
||||
|
||||
+
|
||||
+ protected void renderDynamicLightsEaglerAt(double entityX, double entityY, double entityZ, double renderX,
|
||||
|
@ -27,5 +27,14 @@
|
|||
+ DeferredStateManager.setEmissionConstant(1.0f);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
+ float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
|
||||
+ float ff = getCreeperFlashIntensity(partialTicks);
|
||||
+ if ((int) (ff * 10.0F) % 2 != 0) {
|
||||
+ f = Math.min(f + 0.5f, 1.15f);
|
||||
+ }
|
||||
+ return f;
|
||||
+ }
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -7,4 +7,11 @@
|
|||
|
||||
> DELETE 3 @ 3 : 4
|
||||
|
||||
> INSERT 39 : 43 @ 39
|
||||
|
||||
+ protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
+ return 1.0f;
|
||||
+ }
|
||||
+
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -27,4 +27,11 @@
|
|||
|
||||
~ for (int i = 0, l = list.size(); i < l; ++i) {
|
||||
|
||||
> INSERT 156 : 160 @ 156
|
||||
|
||||
+ protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
|
||||
+ return 1.0f;
|
||||
+ }
|
||||
+
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -82,4 +82,11 @@
|
|||
+ }
|
||||
+
|
||||
|
||||
> INSERT 864 : 868 @ 864
|
||||
|
||||
+
|
||||
+ public float getHeldItemBrightnessEagler() {
|
||||
+ return 0.0f;
|
||||
+ }
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -7,4 +7,11 @@
|
|||
|
||||
> DELETE 9 @ 9 : 11
|
||||
|
||||
> INSERT 120 : 124 @ 120
|
||||
|
||||
+
|
||||
+ public float getHeldItemBrightnessEagler() {
|
||||
+ return this.block.getLightValue() * 0.06667f;
|
||||
+ }
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -120,7 +120,15 @@
|
|||
|
||||
> DELETE 1 @ 1 : 2
|
||||
|
||||
> DELETE 32 @ 32 : 35
|
||||
> INSERT 6 : 11 @ 6
|
||||
|
||||
+ if (worldinfo.isOldEaglercraftRandom()) {
|
||||
+ LogManager.getLogger("EaglerMinecraftServer")
|
||||
+ .info("Detected a pre-u34 world, using old EaglercraftRandom implementation for world generation");
|
||||
+ }
|
||||
+
|
||||
|
||||
> DELETE 26 @ 26 : 29
|
||||
|
||||
> CHANGE 3 : 11 @ 3 : 5
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -17,6 +17,6 @@
|
|||
|
||||
> CHANGE 5 : 6 @ 5 : 6
|
||||
|
||||
~ this.random = new EaglercraftRandom(worldIn.getSeed());
|
||||
~ this.random = new EaglercraftRandom(worldIn.getSeed(), !worldIn.getWorldInfo().isOldEaglercraftRandom());
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -64,7 +64,16 @@
|
|||
|
||||
~ return Chunk.getNoSkyLightValue();
|
||||
|
||||
> INSERT 94 : 98 @ 94
|
||||
> CHANGE 74 : 80 @ 74 : 75
|
||||
|
||||
~ if (lightValue < 0) {
|
||||
~ j += -lightValue;
|
||||
~ if (j > 15) {
|
||||
~ j = 15;
|
||||
~ }
|
||||
~ } else if (j < lightValue) {
|
||||
|
||||
> INSERT 19 : 23 @ 19
|
||||
|
||||
+ public Block getBlock(BlockPos pos) {
|
||||
+ return getBlockState(pos).getBlock();
|
||||
|
|
|
@ -7,7 +7,15 @@
|
|||
|
||||
> DELETE 6 @ 6 : 11
|
||||
|
||||
> CHANGE 99 : 100 @ 99 : 100
|
||||
> INSERT 83 : 84 @ 83
|
||||
|
||||
+ float f2 = f;
|
||||
|
||||
> CHANGE 1 : 2 @ 1 : 2
|
||||
|
||||
~ f = f2 + (f - f2) / 3.0F;
|
||||
|
||||
> CHANGE 14 : 15 @ 14 : 15
|
||||
|
||||
~ float f2 = 0.0F;
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -24,12 +24,21 @@
|
|||
~ public void genTerrainBlocks(World world, EaglercraftRandom random, ChunkPrimer chunkprimer, int i, int j,
|
||||
~ double d0) {
|
||||
|
||||
> CHANGE 5 : 6 @ 5 : 6
|
||||
> CHANGE 1 : 2 @ 1 : 2
|
||||
|
||||
~ EaglercraftRandom random1 = new EaglercraftRandom(this.field_150622_aD);
|
||||
~ this.func_150619_a(world.getSeed(), !world.getWorldInfo().isOldEaglercraftRandom());
|
||||
|
||||
> CHANGE 111 : 112 @ 111 : 112
|
||||
> CHANGE 3 : 5 @ 3 : 4
|
||||
|
||||
~ EaglercraftRandom random = new EaglercraftRandom(parLong1);
|
||||
~ EaglercraftRandom random1 = new EaglercraftRandom(this.field_150622_aD,
|
||||
~ !world.getWorldInfo().isOldEaglercraftRandom());
|
||||
|
||||
> CHANGE 108 : 109 @ 108 : 109
|
||||
|
||||
~ private void func_150619_a(long parLong1, boolean scrambleRNG) {
|
||||
|
||||
> CHANGE 2 : 3 @ 2 : 3
|
||||
|
||||
~ EaglercraftRandom random = new EaglercraftRandom(parLong1, scrambleRNG);
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -162,7 +162,11 @@
|
|||
~ public EaglercraftRandom getRandomWithSeed(long i) {
|
||||
~ return new EaglercraftRandom(this.worldObj.getSeed() + (long) (this.xPosition * this.xPosition * 4987142)
|
||||
|
||||
> CHANGE 92 : 93 @ 92 : 93
|
||||
> CHANGE 1 : 2 @ 1 : 2
|
||||
|
||||
~ + (long) (this.zPosition * 389711) ^ i, !this.worldObj.getWorldInfo().isOldEaglercraftRandom());
|
||||
|
||||
> CHANGE 90 : 91 @ 90 : 91
|
||||
|
||||
~ BlockPos blockpos = (BlockPos) this.tileEntityPosQueue.remove(0);
|
||||
|
||||
|
|
|
@ -16,9 +16,13 @@
|
|||
|
||||
> DELETE 8 @ 8 : 9
|
||||
|
||||
> CHANGE 90 : 92 @ 90 : 92
|
||||
> CHANGE 90 : 96 @ 90 : 94
|
||||
|
||||
~ public EaglercraftRandom getRandomWithSeed(long seed) {
|
||||
~ return new EaglercraftRandom(this.getWorld().getSeed() + (long) (this.xPosition * this.xPosition * 4987142)
|
||||
~ return new EaglercraftRandom(
|
||||
~ this.getWorld().getSeed() + (long) (this.xPosition * this.xPosition * 4987142)
|
||||
~ + (long) (this.xPosition * 5947611) + (long) (this.zPosition * this.zPosition) * 4392871L
|
||||
~ + (long) (this.zPosition * 389711) ^ seed,
|
||||
~ !this.getWorld().getWorldInfo().isOldEaglercraftRandom());
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -17,6 +17,6 @@
|
|||
|
||||
> CHANGE 16 : 17 @ 16 : 17
|
||||
|
||||
~ this.endRNG = new EaglercraftRandom(parLong1);
|
||||
~ this.endRNG = new EaglercraftRandom(parLong1, !worldIn.getWorldInfo().isOldEaglercraftRandom());
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -15,11 +15,32 @@
|
|||
|
||||
~ private EaglercraftRandom random;
|
||||
|
||||
> CHANGE 10 : 11 @ 10 : 11
|
||||
> CHANGE 10 : 12 @ 10 : 11
|
||||
|
||||
~ this.random = new EaglercraftRandom(seed);
|
||||
~ boolean scramble = !worldIn.getWorldInfo().isOldEaglercraftRandom();
|
||||
~ this.random = new EaglercraftRandom(seed, scramble);
|
||||
|
||||
> CHANGE 110 : 112 @ 110 : 111
|
||||
> CHANGE 9 : 10 @ 9 : 10
|
||||
|
||||
~ this.structureGenerators.add(new MapGenVillage(map1, scramble));
|
||||
|
||||
> CHANGE 3 : 4 @ 3 : 4
|
||||
|
||||
~ this.structureGenerators.add(new MapGenScatteredFeature((Map) map.get("biome_1"), scramble));
|
||||
|
||||
> CHANGE 3 : 4 @ 3 : 4
|
||||
|
||||
~ this.structureGenerators.add(new MapGenMineshaft((Map) map.get("mineshaft"), scramble));
|
||||
|
||||
> CHANGE 3 : 4 @ 3 : 4
|
||||
|
||||
~ this.structureGenerators.add(new MapGenStronghold((Map) map.get("stronghold"), scramble));
|
||||
|
||||
> CHANGE 3 : 4 @ 3 : 4
|
||||
|
||||
~ this.structureGenerators.add(new StructureOceanMonument((Map) map.get("oceanmonument"), scramble));
|
||||
|
||||
> CHANGE 84 : 86 @ 84 : 85
|
||||
|
||||
~ for (int m = 0, n = this.structureGenerators.size(); m < n; ++m) {
|
||||
~ MapGenStructure mapgenstructure = this.structureGenerators.get(m);
|
||||
|
|
|
@ -15,8 +15,26 @@
|
|||
|
||||
~ private EaglercraftRandom rand;
|
||||
|
||||
> CHANGE 32 : 33 @ 32 : 33
|
||||
> CHANGE 15 : 22 @ 15 : 22
|
||||
|
||||
~ this.rand = new EaglercraftRandom(parLong1);
|
||||
~ private MapGenBase caveGenerator;
|
||||
~ private MapGenStronghold strongholdGenerator;
|
||||
~ private MapGenVillage villageGenerator;
|
||||
~ private MapGenMineshaft mineshaftGenerator;
|
||||
~ private MapGenScatteredFeature scatteredFeatureGenerator;
|
||||
~ private MapGenBase ravineGenerator;
|
||||
~ private StructureOceanMonument oceanMonumentGenerator;
|
||||
|
||||
> CHANGE 10 : 19 @ 10 : 11
|
||||
|
||||
~ boolean scramble = !worldIn.getWorldInfo().isOldEaglercraftRandom();
|
||||
~ this.rand = new EaglercraftRandom(parLong1, scramble);
|
||||
~ this.caveGenerator = new MapGenCaves(scramble);
|
||||
~ this.strongholdGenerator = new MapGenStronghold(scramble);
|
||||
~ this.villageGenerator = new MapGenVillage(scramble);
|
||||
~ this.mineshaftGenerator = new MapGenMineshaft(scramble);
|
||||
~ this.scatteredFeatureGenerator = new MapGenScatteredFeature(scramble);
|
||||
~ this.ravineGenerator = new MapGenRavine(scramble);
|
||||
~ this.oceanMonumentGenerator = new StructureOceanMonument(scramble);
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -15,8 +15,16 @@
|
|||
|
||||
~ private final EaglercraftRandom hellRNG;
|
||||
|
||||
> CHANGE 31 : 32 @ 31 : 32
|
||||
> CHANGE 20 : 22 @ 20 : 22
|
||||
|
||||
~ this.hellRNG = new EaglercraftRandom(parLong1);
|
||||
~ private final MapGenNetherBridge genNetherBridge;
|
||||
~ private final MapGenBase netherCaveGenerator;
|
||||
|
||||
> CHANGE 9 : 13 @ 9 : 10
|
||||
|
||||
~ boolean scramble = !worldIn.getWorldInfo().isOldEaglercraftRandom();
|
||||
~ this.hellRNG = new EaglercraftRandom(parLong1, scramble);
|
||||
~ this.genNetherBridge = new MapGenNetherBridge(scramble);
|
||||
~ this.netherCaveGenerator = new MapGenCavesHell(scramble);
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -11,6 +11,17 @@
|
|||
|
||||
> CHANGE 6 : 7 @ 6 : 7
|
||||
|
||||
~ protected EaglercraftRandom rand = new EaglercraftRandom();
|
||||
~ protected EaglercraftRandom rand;
|
||||
|
||||
> INSERT 2 : 10 @ 2
|
||||
|
||||
+ public MapGenBase() {
|
||||
+ this(true);
|
||||
+ }
|
||||
+
|
||||
+ public MapGenBase(boolean scramble) {
|
||||
+ rand = new EaglercraftRandom(scramble);
|
||||
+ }
|
||||
+
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -11,8 +11,16 @@
|
|||
|
||||
> DELETE 8 @ 8 : 9
|
||||
|
||||
> CHANGE 15 : 16 @ 15 : 16
|
||||
> INSERT 2 : 7 @ 2
|
||||
|
||||
~ EaglercraftRandom random = new EaglercraftRandom(parLong1);
|
||||
+
|
||||
+ public MapGenCaves(boolean scramble) {
|
||||
+ super(scramble);
|
||||
+ }
|
||||
+
|
||||
|
||||
> CHANGE 13 : 14 @ 13 : 14
|
||||
|
||||
~ EaglercraftRandom random = new EaglercraftRandom(parLong1, this.rand.isScramble());
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -11,8 +11,16 @@
|
|||
|
||||
> DELETE 5 @ 5 : 6
|
||||
|
||||
> CHANGE 15 : 16 @ 15 : 16
|
||||
> INSERT 2 : 7 @ 2
|
||||
|
||||
~ EaglercraftRandom random = new EaglercraftRandom(parLong1);
|
||||
+
|
||||
+ public MapGenCavesHell(boolean scramble) {
|
||||
+ super(scramble);
|
||||
+ }
|
||||
+
|
||||
|
||||
> CHANGE 13 : 14 @ 13 : 14
|
||||
|
||||
~ EaglercraftRandom random = new EaglercraftRandom(parLong1, this.rand.isScramble());
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -11,8 +11,15 @@
|
|||
|
||||
> DELETE 6 @ 6 : 7
|
||||
|
||||
> CHANGE 7 : 8 @ 7 : 8
|
||||
> INSERT 4 : 8 @ 4
|
||||
|
||||
~ EaglercraftRandom random = new EaglercraftRandom(parLong1);
|
||||
+ public MapGenRavine(boolean scramble) {
|
||||
+ super(scramble);
|
||||
+ }
|
||||
+
|
||||
|
||||
> CHANGE 3 : 4 @ 3 : 4
|
||||
|
||||
~ EaglercraftRandom random = new EaglercraftRandom(parLong1, this.rand.isScramble());
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -36,6 +36,6 @@
|
|||
|
||||
> CHANGE 2 : 3 @ 2 : 3
|
||||
|
||||
~ this.rand = new EaglercraftRandom(rand.nextLong());
|
||||
~ this.rand = new EaglercraftRandom(rand.nextLong(), !worldIn.getWorldInfo().isOldEaglercraftRandom());
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -7,4 +7,14 @@
|
|||
|
||||
> DELETE 5 @ 5 : 8
|
||||
|
||||
> CHANGE 4 : 6 @ 4 : 5
|
||||
|
||||
~ public MapGenMineshaft(boolean scramble) {
|
||||
~ super(scramble);
|
||||
|
||||
> CHANGE 6 : 8 @ 6 : 7
|
||||
|
||||
~ public MapGenMineshaft(Map<String, String> parMap, boolean scramble) {
|
||||
~ super(scramble);
|
||||
|
||||
> EOF
|
||||
|
|
|
@ -11,7 +11,12 @@
|
|||
|
||||
> DELETE 6 @ 6 : 10
|
||||
|
||||
> CHANGE 36 : 37 @ 36 : 37
|
||||
> CHANGE 4 : 6 @ 4 : 5
|
||||
|
||||
~ public MapGenNetherBridge(boolean scramble) {
|
||||
~ super(scramble);
|
||||
|
||||
> CHANGE 31 : 32 @ 31 : 32
|
||||
|
||||
~ public Start(World worldIn, EaglercraftRandom parRandom, int parInt1, int parInt2) {
|
||||
|
||||
|
|
|
@ -11,7 +11,17 @@
|
|||
|
||||
> DELETE 6 @ 6 : 10
|
||||
|
||||
> CHANGE 45 : 46 @ 45 : 46
|
||||
> CHANGE 8 : 10 @ 8 : 9
|
||||
|
||||
~ public MapGenScatteredFeature(boolean scramble) {
|
||||
~ super(scramble);
|
||||
|
||||
> CHANGE 6 : 8 @ 6 : 8
|
||||
|
||||
~ public MapGenScatteredFeature(Map<String, String> parMap, boolean scramble) {
|
||||
~ this(scramble);
|
||||
|
||||
> CHANGE 28 : 29 @ 28 : 29
|
||||
|
||||
~ EaglercraftRandom random = this.worldObj.setRandomSeed(i1, j1, 14357617);
|
||||
|
||||
|
|
|
@ -11,15 +11,25 @@
|
|||
|
||||
> DELETE 6 @ 6 : 10
|
||||
|
||||
> CHANGE 14 : 17 @ 14 : 15
|
||||
> CHANGE 8 : 10 @ 8 : 9
|
||||
|
||||
~ public MapGenStronghold(boolean scramble) {
|
||||
~ super(scramble);
|
||||
|
||||
> CHANGE 5 : 8 @ 5 : 6
|
||||
|
||||
~ BiomeGenBase[] biomes = BiomeGenBase.getBiomeGenArray();
|
||||
~ for (int i = 0; i < biomes.length; ++i) {
|
||||
~ BiomeGenBase biomegenbase = biomes[i];
|
||||
|
||||
> CHANGE 31 : 32 @ 31 : 32
|
||||
> CHANGE 7 : 9 @ 7 : 9
|
||||
|
||||
~ EaglercraftRandom random = new EaglercraftRandom();
|
||||
~ public MapGenStronghold(Map<String, String> parMap, boolean scramble) {
|
||||
~ this(scramble);
|
||||
|
||||
> CHANGE 22 : 23 @ 22 : 23
|
||||
|
||||
~ EaglercraftRandom random = new EaglercraftRandom(!this.worldObj.getWorldInfo().isOldEaglercraftRandom());
|
||||
|
||||
> CHANGE 26 : 28 @ 26 : 27
|
||||
|
||||
|
|
|
@ -17,7 +17,18 @@
|
|||
|
||||
> DELETE 11 @ 11 : 16
|
||||
|
||||
> CHANGE 30 : 31 @ 30 : 31
|
||||
> INSERT 7 : 15 @ 7
|
||||
|
||||
+ public MapGenStructure() {
|
||||
+ super();
|
||||
+ }
|
||||
+
|
||||
+ public MapGenStructure(boolean scramble) {
|
||||
+ super(scramble);
|
||||
+ }
|
||||
+
|
||||
|
||||
> CHANGE 23 : 24 @ 23 : 24
|
||||
|
||||
~ HString.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j) }));
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -11,7 +11,17 @@
|
|||
|
||||
> DELETE 5 @ 5 : 9
|
||||
|
||||
> CHANGE 44 : 45 @ 44 : 45
|
||||
> CHANGE 8 : 10 @ 8 : 9
|
||||
|
||||
~ public MapGenVillage(boolean scramble) {
|
||||
~ super(scramble);
|
||||
|
||||
> CHANGE 4 : 6 @ 4 : 6
|
||||
|
||||
~ public MapGenVillage(Map<String, String> parMap, boolean scramble) {
|
||||
~ this(scramble);
|
||||
|
||||
> CHANGE 29 : 30 @ 29 : 30
|
||||
|
||||
~ EaglercraftRandom random = this.worldObj.setRandomSeed(i1, j1, 10387312);
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -11,7 +11,17 @@
|
|||
|
||||
> DELETE 11 @ 11 : 15
|
||||
|
||||
> CHANGE 45 : 46 @ 45 : 46
|
||||
> CHANGE 8 : 10 @ 8 : 9
|
||||
|
||||
~ public StructureOceanMonument(boolean scramble) {
|
||||
~ super(scramble);
|
||||
|
||||
> CHANGE 4 : 6 @ 4 : 6
|
||||
|
||||
~ public StructureOceanMonument(Map<String, String> parMap, boolean scramble) {
|
||||
~ this(scramble);
|
||||
|
||||
> CHANGE 30 : 31 @ 30 : 31
|
||||
|
||||
~ EaglercraftRandom random = this.worldObj.setRandomSeed(i1, j1, 10387313);
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
# Eagler Context Redacted Diff
|
||||
# Copyright (c) 2024 lax1dude. All rights reserved.
|
||||
|
||||
# Version: 1.0
|
||||
# Author: lax1dude
|
||||
|
||||
> EOF
|
|
@ -10,7 +10,38 @@
|
|||
+ import net.lax1dude.eaglercraft.v1_8.HString;
|
||||
+
|
||||
|
||||
> CHANGE 539 : 540 @ 539 : 540
|
||||
> INSERT 39 : 42 @ 39
|
||||
|
||||
+ public static final int eaglerVersionCurrent = 1;
|
||||
+ private int eaglerVersion = eaglerVersionCurrent;
|
||||
+
|
||||
|
||||
> INSERT 116 : 117 @ 116
|
||||
|
||||
+ this.eaglerVersion = nbt.getInteger("eaglerVersionSerial");
|
||||
|
||||
> INSERT 102 : 103 @ 102
|
||||
|
||||
+ nbt.setInteger("eaglerVersionSerial", this.eaglerVersion);
|
||||
|
||||
> INSERT 274 : 288 @ 274
|
||||
|
||||
+ public int getEaglerVersion() {
|
||||
+ return this.eaglerVersion;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isOldEaglercraftRandom() {
|
||||
+ return this.eaglerVersion == 0;
|
||||
+ }
|
||||
+
|
||||
+ public static void initEaglerVersion(NBTTagCompound compound) {
|
||||
+ if (!compound.hasKey("eaglerVersionSerial", 99)) {
|
||||
+ compound.setInteger("eaglerVersionSerial", eaglerVersionCurrent);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
||||
> CHANGE 8 : 9 @ 8 : 9
|
||||
|
||||
~ return HString.format("ID %02d - %s, ver %d. Features enabled: %b",
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
~ eaglercraft.recording.start=Record Screen...
|
||||
~ eaglercraft.soundCategory.voice=Recording Voice
|
||||
|
||||
> INSERT 1 : 246 @ 1
|
||||
> INSERT 1 : 247 @ 1
|
||||
|
||||
+ eaglercraft.resourcePack.prompt.title=What do you want to do with '%s'?
|
||||
+ eaglercraft.resourcePack.prompt.text=Tip: Hold Shift to skip this screen when selecting a resource pack!
|
||||
|
@ -123,6 +123,7 @@
|
|||
+ eaglercraft.options.fastMath.0=OFF
|
||||
+ eaglercraft.options.fastMath.1=Low
|
||||
+ eaglercraft.options.fastMath.2=High
|
||||
+ eaglercraft.options.dynamicLights=Dynamic Lights
|
||||
+
|
||||
+ eaglercraft.key.function=Function
|
||||
+ eaglercraft.key.zoomCamera=Zoom Camera
|
||||
|
@ -260,7 +261,7 @@
|
|||
+ eaglerforge.menu.mods.info=(Only .js files)
|
||||
+
|
||||
|
||||
> INSERT 163 : 404 @ 163
|
||||
> INSERT 163 : 409 @ 163
|
||||
|
||||
+ eaglercraft.singleplayer.busy.killTask=Cancel Task
|
||||
+ eaglercraft.singleplayer.busy.cancelWarning=Are you sure?
|
||||
|
@ -418,7 +419,12 @@
|
|||
+ eaglercraft.singleplayer.demo.create.join=Join Shared World
|
||||
+ eaglercraft.singleplayer.demo.create.join.tooltip=Join someone else's world and play multiplayer
|
||||
+
|
||||
+ eaglercraft.createWorld.seedNote=Note: Vanilla seeds do not work!
|
||||
+ eaglercraft.createWorld.seedNote=Note: Vanilla seeds now work!
|
||||
+
|
||||
+ eaglercraft.singleplayer.oldseedwarning.title=Old World Detected!
|
||||
+ eaglercraft.singleplayer.oldseedwarning.msg1=Please use EaglercraftX u32 or older to "Re-Create" this world
|
||||
+ eaglercraft.singleplayer.oldseedwarning.msg2=The world's seed will not be the same otherwise :(
|
||||
+ eaglercraft.singleplayer.oldseedwarning.ok=OK
|
||||
+
|
||||
+ eaglercraft.singleplayer.outdatedLANServerKick=This is a 1.5.2 LAN world!
|
||||
+
|
||||
|
|
|
@ -142,6 +142,11 @@ public class DesktopClientConfigAdapter implements IClientConfigAdapter {
|
|||
return EaglercraftVersion.localStorageNamespace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnableMinceraft() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClientConfigAdapterHooks getHooks() {
|
||||
return hooks;
|
||||
|
|
|
@ -121,20 +121,24 @@ public class EaglerInputStream extends InputStream {
|
|||
}
|
||||
|
||||
public static byte[] inputStreamToBytes(InputStream is) throws IOException {
|
||||
if (is instanceof EaglerInputStream) {
|
||||
return ((EaglerInputStream) is).getAsArray();
|
||||
} else if (is instanceof ByteArrayInputStream) {
|
||||
byte[] ret = new byte[is.available()];
|
||||
is.read(ret);
|
||||
return ret;
|
||||
} else {
|
||||
EaglerOutputStream os = new EaglerOutputStream(1024);
|
||||
byte[] buf = new byte[1024];
|
||||
int i;
|
||||
while ((i = is.read(buf)) != -1) {
|
||||
os.write(buf, 0, i);
|
||||
try {
|
||||
if (is instanceof EaglerInputStream) {
|
||||
return ((EaglerInputStream) is).getAsArray();
|
||||
} else if (is instanceof ByteArrayInputStream) {
|
||||
byte[] ret = new byte[is.available()];
|
||||
is.read(ret);
|
||||
return ret;
|
||||
} else {
|
||||
EaglerOutputStream os = new EaglerOutputStream(1024);
|
||||
byte[] buf = new byte[1024];
|
||||
int i;
|
||||
while ((i = is.read(buf)) != -1) {
|
||||
os.write(buf, 0, i);
|
||||
}
|
||||
return os.toByteArray();
|
||||
}
|
||||
return os.toByteArray();
|
||||
}finally {
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package net.lax1dude.eaglercraft.v1_8;
|
|||
import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2022 lax1dude. All Rights Reserved.
|
||||
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
|
@ -25,19 +25,46 @@ public class EaglercraftRandom {
|
|||
|
||||
private static final double DOUBLE_UNIT = 0x1.0p-53;
|
||||
private long seed = 69;
|
||||
|
||||
private static int yee = 0;
|
||||
private final boolean enableScramble;
|
||||
|
||||
public EaglercraftRandom() {
|
||||
this(PlatformRuntime.randomSeed());
|
||||
}
|
||||
|
||||
public EaglercraftRandom(long seed) {
|
||||
this(seed, true);
|
||||
}
|
||||
|
||||
public EaglercraftRandom(boolean scramble) {
|
||||
this(PlatformRuntime.randomSeed(), scramble);
|
||||
}
|
||||
|
||||
/**
|
||||
* Older versions of EaglercraftX (and Eaglercraft) are missing the
|
||||
* "initialScramble" function from their setSeed function, which was what caused
|
||||
* world generation to not match vanilla. The "enableScramble" boolean is used
|
||||
* when players play on an old world created before the bug was fixed.
|
||||
*/
|
||||
public EaglercraftRandom(long seed, boolean scramble) {
|
||||
enableScramble = scramble;
|
||||
setSeed(seed);
|
||||
}
|
||||
|
||||
private static long initialScramble(long seed) {
|
||||
return (seed ^ multiplier) & mask;
|
||||
}
|
||||
|
||||
public void setSeed(long yeed) {
|
||||
seed = yeed;
|
||||
if(enableScramble) {
|
||||
seed = initialScramble(yeed);
|
||||
}else {
|
||||
seed = yeed;
|
||||
}
|
||||
haveNextNextGaussian = true;
|
||||
}
|
||||
|
||||
public boolean isScramble() {
|
||||
return enableScramble;
|
||||
}
|
||||
|
||||
protected int next(int bits) {
|
||||
|
|
|
@ -23,7 +23,7 @@ public class EaglercraftVersion {
|
|||
public static final String projectOriginName = "EaglercraftX";
|
||||
public static final String projectOriginAuthor = "lax1dude";
|
||||
public static final String projectOriginRevision = "1.8";
|
||||
public static final String projectOriginVersion = "u32";
|
||||
public static final String projectOriginVersion = "u35";
|
||||
|
||||
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
|
||||
|
||||
|
|
|
@ -74,6 +74,8 @@ public interface IClientConfigAdapter {
|
|||
|
||||
String getLocalStorageNamespace();
|
||||
|
||||
boolean isEnableMinceraft();
|
||||
|
||||
IClientConfigAdapterHooks getHooks();
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
|
|||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.StreamBuffer.StreamBufferInstance;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
|
||||
import net.lax1dude.eaglercraft.v1_8.vector.Vector4f;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
@ -904,7 +905,9 @@ public class FixedFunctionPipeline {
|
|||
_wglUniform3f(stateLightingAmbientUniform3f, r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(stateEnableMCLighting || DynamicLightsStateManager.isInDynamicLightsPass()) {
|
||||
if(!stateHasAttribNormal) {
|
||||
serial = GlStateManager.stateNormalSerial;
|
||||
if(stateNormalSerial != serial) {
|
||||
|
|
|
@ -810,6 +810,22 @@ public class GlStateManager extends ModData {
|
|||
}
|
||||
}
|
||||
|
||||
public static final void getFloat(int pname, FloatBuffer params) {
|
||||
switch(pname) {
|
||||
case GL_MODELVIEW_MATRIX:
|
||||
modelMatrixStack[modelMatrixStackPointer].store(params);
|
||||
break;
|
||||
case GL_PROJECTION_MATRIX:
|
||||
projectionMatrixStack[projectionMatrixStackPointer].store(params);
|
||||
break;
|
||||
case GL_TEXTURE_MATRIX:
|
||||
textureMatrixStack[activeTexture][textureMatrixStackPointer[activeTexture]].store(params);
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException("glGetFloat can only be used to retrieve matricies!");
|
||||
}
|
||||
}
|
||||
|
||||
public static final void ortho(double left, double right, double bottom, double top, double zNear, double zFar) {
|
||||
Matrix4f matrix;
|
||||
switch(stateMatrixMode) {
|
||||
|
|
|
@ -49,8 +49,8 @@ public class InstancedParticleRenderer {
|
|||
private static IUniformGL u_matrixTransform = null;
|
||||
private static FloatBuffer matrixCopyBuffer = null;
|
||||
private static IUniformGL u_texCoordSize2f_particleSize1f = null;
|
||||
private static IUniformGL u_transformParam_1_2_3_4_f = null;
|
||||
private static IUniformGL u_transformParam_5_f = null;
|
||||
private static IUniformGL u_transformParam_1_2_5_f = null;
|
||||
private static IUniformGL u_transformParam_3_4_f = null;
|
||||
private static IUniformGL u_color4f = null;
|
||||
|
||||
private static IBufferArrayGL vertexArray = null;
|
||||
|
@ -154,8 +154,8 @@ public class InstancedParticleRenderer {
|
|||
|
||||
u_matrixTransform = _wglGetUniformLocation(shaderProgram, "u_matrixTransform");
|
||||
u_texCoordSize2f_particleSize1f = _wglGetUniformLocation(shaderProgram, "u_texCoordSize2f_particleSize1f");
|
||||
u_transformParam_1_2_3_4_f = _wglGetUniformLocation(shaderProgram, "u_transformParam_1_2_3_4_f");
|
||||
u_transformParam_5_f = _wglGetUniformLocation(shaderProgram, "u_transformParam_5_f");
|
||||
u_transformParam_1_2_5_f = _wglGetUniformLocation(shaderProgram, "u_transformParam_1_2_5_f");
|
||||
u_transformParam_3_4_f = _wglGetUniformLocation(shaderProgram, "u_transformParam_3_4_f");
|
||||
u_color4f = _wglGetUniformLocation(shaderProgram, "u_color4f");
|
||||
|
||||
_wglUniform1i(_wglGetUniformLocation(shaderProgram, "u_inputTexture"), 0);
|
||||
|
@ -260,17 +260,17 @@ public class InstancedParticleRenderer {
|
|||
}
|
||||
|
||||
if (transformParam1 != stateTransformParam1 || transformParam2 != stateTransformParam2
|
||||
|| transformParam3 != stateTransformParam3 || transformParam4 != stateTransformParam4) {
|
||||
_wglUniform4f(u_transformParam_1_2_3_4_f, transformParam1, transformParam2, transformParam3, transformParam4);
|
||||
|| transformParam5 != stateTransformParam5) {
|
||||
_wglUniform3f(u_transformParam_1_2_5_f, transformParam1, transformParam2, transformParam5);
|
||||
stateTransformParam1 = transformParam1;
|
||||
stateTransformParam2 = transformParam2;
|
||||
stateTransformParam3 = transformParam3;
|
||||
stateTransformParam4 = transformParam4;
|
||||
stateTransformParam5 = transformParam5;
|
||||
}
|
||||
|
||||
if (transformParam5 != stateTransformParam5) {
|
||||
_wglUniform1f(u_transformParam_5_f, transformParam5);
|
||||
stateTransformParam5 = transformParam5;
|
||||
if (transformParam3 != stateTransformParam3 || transformParam4 != stateTransformParam4) {
|
||||
_wglUniform2f(u_transformParam_3_4_f, transformParam3, transformParam4);
|
||||
stateTransformParam3 = transformParam3;
|
||||
stateTransformParam4 = transformParam4;
|
||||
}
|
||||
|
||||
int serial = GlStateManager.stateColorSerial;
|
||||
|
@ -319,4 +319,8 @@ public class InstancedParticleRenderer {
|
|||
_wglDrawArraysInstanced(GL_TRIANGLES, 0, 6, particleCount);
|
||||
}
|
||||
|
||||
public static void stupidColorSetHack(IUniformGL color4f) {
|
||||
_wglUniform4f(color4f, GlStateManager.stateColorR, GlStateManager.stateColorG, GlStateManager.stateColorB, GlStateManager.stateColorA);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public class DeferredStateManager {
|
|||
}
|
||||
|
||||
public static final boolean isInDeferredPass() {
|
||||
return GlStateManager.isExtensionPipeline();
|
||||
return EaglerDeferredPipeline.instance != null && GlStateManager.isExtensionPipeline();
|
||||
}
|
||||
|
||||
public static final boolean isInForwardPass() {
|
||||
|
@ -153,10 +153,17 @@ public class DeferredStateManager {
|
|||
}
|
||||
|
||||
public static final void reportForwardRenderObjectPosition2(float x, float y, float z) {
|
||||
float posX = (float)((x + TileEntityRendererDispatcher.staticPlayerX) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerX / 16.0) << 4));
|
||||
float posY = (float)((y + TileEntityRendererDispatcher.staticPlayerY) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerY / 16.0) << 4));
|
||||
float posZ = (float)((z + TileEntityRendererDispatcher.staticPlayerZ) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerZ / 16.0) << 4));
|
||||
reportForwardRenderObjectPosition((int)posX, (int)posY, (int)posZ);
|
||||
EaglerDeferredPipeline instance = EaglerDeferredPipeline.instance;
|
||||
if(instance != null && enableForwardRender) {
|
||||
EaglerDeferredConfig cfg = instance.config;
|
||||
if(!cfg.is_rendering_dynamicLights || !cfg.shaderPackInfo.DYNAMIC_LIGHTS) {
|
||||
return;
|
||||
}
|
||||
float posX = (float)((x + TileEntityRendererDispatcher.staticPlayerX) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerX / 16.0) << 4));
|
||||
float posY = (float)((y + TileEntityRendererDispatcher.staticPlayerY) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerY / 16.0) << 4));
|
||||
float posZ = (float)((z + TileEntityRendererDispatcher.staticPlayerZ) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerZ / 16.0) << 4));
|
||||
instance.loadLightSourceBucket((int)posX, (int)posY, (int)posZ);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void setHDRTranslucentPassBlendFunc() {
|
||||
|
|
|
@ -66,7 +66,6 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ExtGLEnums.*;
|
|||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -2049,6 +2048,8 @@ public class EaglerDeferredPipeline {
|
|||
}
|
||||
}
|
||||
|
||||
truncateOverflowingLightBuffers();
|
||||
|
||||
DeferredStateManager.checkGLError("combineGBuffersAndIlluminate(): RENDER DYNAMIC LIGHTS");
|
||||
}
|
||||
|
||||
|
@ -2305,6 +2306,19 @@ public class EaglerDeferredPipeline {
|
|||
return radius2 >= 0.0f;
|
||||
}
|
||||
|
||||
private void truncateOverflowingLightBuffers() {
|
||||
for(int i = 0; i < this.lightSourceBuckets.length; ++i) {
|
||||
List<DynamicLightInstance> lst = this.lightSourceBuckets[i];
|
||||
int k = lst.size();
|
||||
if(k > MAX_LIGHTS_PER_CHUNK) {
|
||||
lst.sort(comparatorLightRadius);
|
||||
for(int l = MAX_LIGHTS_PER_CHUNK - 1; l >= MAX_LIGHTS_PER_CHUNK; --l) {
|
||||
lst.remove(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateLightSourceUBO() {
|
||||
if(currentLightSourceBucket == null) {
|
||||
currentBoundLightSourceBucket = null;
|
||||
|
@ -2332,7 +2346,6 @@ public class EaglerDeferredPipeline {
|
|||
}
|
||||
}
|
||||
|
||||
private static final List<DynamicLightInstance> tmpListLights = new ArrayList(32);
|
||||
private static final Comparator<DynamicLightInstance> comparatorLightRadius = (l1, l2) -> {
|
||||
return l1.radius < l2.radius ? 1 : -1;
|
||||
};
|
||||
|
@ -2340,10 +2353,6 @@ public class EaglerDeferredPipeline {
|
|||
private void populateLightSourceUBOFromBucket(List<DynamicLightInstance> lights) {
|
||||
int max = lights.size();
|
||||
if(max > MAX_LIGHTS_PER_CHUNK) {
|
||||
tmpListLights.clear();
|
||||
tmpListLights.addAll(lights);
|
||||
lights = tmpListLights;
|
||||
lights.sort(comparatorLightRadius);
|
||||
max = MAX_LIGHTS_PER_CHUNK;
|
||||
}
|
||||
chunkLightingDataCopyBuffer.clear();
|
||||
|
|
|
@ -124,8 +124,13 @@ public class ForwardAcceleratedEffectRenderer extends AbstractAcceleratedEffectR
|
|||
shaderProgram.useProgram();
|
||||
|
||||
_wglUniform3f(shaderProgram.uniforms.u_texCoordSize2f_particleSize1f, texCoordWidth, texCoordHeight, 0.0625f);
|
||||
_wglUniform4f(shaderProgram.uniforms.u_transformParam_1_2_3_4_f, f1, f5, f2, f3);
|
||||
_wglUniform1f(shaderProgram.uniforms.u_transformParam_5_f, f4);
|
||||
if(shaderProgram.uniforms.u_transformParam_1_2_5_f != null) {
|
||||
_wglUniform3f(shaderProgram.uniforms.u_transformParam_1_2_5_f, f1, f5, f4);
|
||||
_wglUniform2f(shaderProgram.uniforms.u_transformParam_3_4_f, f2, f3);
|
||||
}else {
|
||||
_wglUniform4f(shaderProgram.uniforms.u_transformParam_1_2_3_4_f, f1, f5, f2, f3);
|
||||
_wglUniform1f(shaderProgram.uniforms.u_transformParam_5_f, f4);
|
||||
}
|
||||
if(isMaterialNormalTexture) {
|
||||
_wglUniform2f(shaderProgram.uniforms.u_textureYScale2f, 0.5f, 0.5f);
|
||||
}else {
|
||||
|
|
|
@ -124,8 +124,13 @@ public class GBufferAcceleratedEffectRenderer extends AbstractAcceleratedEffectR
|
|||
shaderProgram.useProgram();
|
||||
|
||||
_wglUniform3f(shaderProgram.uniforms.u_texCoordSize2f_particleSize1f, texCoordWidth, texCoordHeight, 0.0625f);
|
||||
_wglUniform4f(shaderProgram.uniforms.u_transformParam_1_2_3_4_f, f1, f5, f2, f3);
|
||||
_wglUniform1f(shaderProgram.uniforms.u_transformParam_5_f, f4);
|
||||
if(shaderProgram.uniforms.u_transformParam_1_2_5_f != null) {
|
||||
_wglUniform3f(shaderProgram.uniforms.u_transformParam_1_2_5_f, f1, f5, f4);
|
||||
_wglUniform2f(shaderProgram.uniforms.u_transformParam_3_4_f, f2, f3);
|
||||
}else {
|
||||
_wglUniform4f(shaderProgram.uniforms.u_transformParam_1_2_3_4_f, f1, f5, f2, f3);
|
||||
_wglUniform1f(shaderProgram.uniforms.u_transformParam_5_f, f4);
|
||||
}
|
||||
if(isMaterialNormalTexture) {
|
||||
_wglUniform2f(shaderProgram.uniforms.u_textureYScale2f, 0.5f, 0.5f);
|
||||
}else {
|
||||
|
|
|
@ -69,6 +69,8 @@ public class PipelineShaderAccelParticleForward extends ShaderProgram<PipelineSh
|
|||
public IUniformGL u_texCoordSize2f_particleSize1f = null;
|
||||
public IUniformGL u_transformParam_1_2_3_4_f = null;
|
||||
public IUniformGL u_transformParam_5_f = null;
|
||||
public IUniformGL u_transformParam_1_2_5_f = null;
|
||||
public IUniformGL u_transformParam_3_4_f = null;
|
||||
public IUniformGL u_textureYScale2f = null;
|
||||
|
||||
public int u_chunkLightingDataBlockBinding = -1;
|
||||
|
@ -85,6 +87,8 @@ public class PipelineShaderAccelParticleForward extends ShaderProgram<PipelineSh
|
|||
u_texCoordSize2f_particleSize1f = _wglGetUniformLocation(prog, "u_texCoordSize2f_particleSize1f");
|
||||
u_transformParam_1_2_3_4_f = _wglGetUniformLocation(prog, "u_transformParam_1_2_3_4_f");
|
||||
u_transformParam_5_f = _wglGetUniformLocation(prog, "u_transformParam_5_f");
|
||||
u_transformParam_1_2_5_f = _wglGetUniformLocation(prog, "u_transformParam_1_2_5_f");
|
||||
u_transformParam_3_4_f = _wglGetUniformLocation(prog, "u_transformParam_3_4_f");
|
||||
u_textureYScale2f = _wglGetUniformLocation(prog, "u_textureYScale2f");
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_diffuseTexture"), 0);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_samplerNormalMaterial"), 2);
|
||||
|
|
|
@ -53,6 +53,8 @@ public class PipelineShaderAccelParticleGBuffer extends ShaderProgram<PipelineSh
|
|||
public IUniformGL u_texCoordSize2f_particleSize1f = null;
|
||||
public IUniformGL u_transformParam_1_2_3_4_f = null;
|
||||
public IUniformGL u_transformParam_5_f = null;
|
||||
public IUniformGL u_transformParam_1_2_5_f = null;
|
||||
public IUniformGL u_transformParam_3_4_f = null;
|
||||
public IUniformGL u_textureYScale2f = null;
|
||||
|
||||
private Uniforms() {
|
||||
|
@ -64,6 +66,8 @@ public class PipelineShaderAccelParticleGBuffer extends ShaderProgram<PipelineSh
|
|||
u_texCoordSize2f_particleSize1f = _wglGetUniformLocation(prog, "u_texCoordSize2f_particleSize1f");
|
||||
u_transformParam_1_2_3_4_f = _wglGetUniformLocation(prog, "u_transformParam_1_2_3_4_f");
|
||||
u_transformParam_5_f = _wglGetUniformLocation(prog, "u_transformParam_5_f");
|
||||
u_transformParam_1_2_5_f = _wglGetUniformLocation(prog, "u_transformParam_1_2_5_f");
|
||||
u_transformParam_3_4_f = _wglGetUniformLocation(prog, "u_transformParam_3_4_f");
|
||||
u_textureYScale2f = _wglGetUniformLocation(prog, "u_textureYScale2f");
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_diffuseTexture"), 0);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_samplerNormalMaterial"), 2);
|
||||
|
|
|
@ -92,6 +92,11 @@ public class ShaderSource {
|
|||
public static final ResourceLocation post_fxaa_fsh = new ResourceLocation("eagler:glsl/deferred/post_fxaa.fsh");
|
||||
public static final ResourceLocation hand_depth_mask_fsh = new ResourceLocation("eagler:glsl/deferred/hand_depth_mask.fsh");
|
||||
|
||||
public static final ResourceLocation core_dynamiclights_vsh = new ResourceLocation("eagler:glsl/dynamiclights/core_dynamiclights.vsh");
|
||||
public static final ResourceLocation core_dynamiclights_fsh = new ResourceLocation("eagler:glsl/dynamiclights/core_dynamiclights.fsh");
|
||||
public static final ResourceLocation accel_particle_dynamiclights_vsh = new ResourceLocation("eagler:glsl/dynamiclights/accel_particle_dynamiclights.vsh");
|
||||
public static final ResourceLocation accel_particle_dynamiclights_fsh = new ResourceLocation("eagler:glsl/dynamiclights/accel_particle_dynamiclights.fsh");
|
||||
|
||||
private static final Map<ResourceLocation, String> sourceCache = new HashMap();
|
||||
|
||||
private static boolean isHighP = false;
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.texture;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.IOUtils;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ImageData;
|
||||
|
||||
/**
|
||||
|
@ -75,4 +76,15 @@ public class EaglerBitwisePackedTexture {
|
|||
return img;
|
||||
}
|
||||
|
||||
public static ImageData loadTextureSafe(InputStream is, int alpha) throws IOException {
|
||||
ImageData bufferedimage;
|
||||
try {
|
||||
bufferedimage = loadTexture(is, alpha);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(is);
|
||||
}
|
||||
|
||||
return bufferedimage;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class PBRTextureMapUtils {
|
|||
}catch(Throwable t) {
|
||||
}
|
||||
try {
|
||||
return EaglerBitwisePackedTexture.loadTexture(resMgr.getResource(new ResourceLocation("eagler:glsl/deferred/assets_pbr/" + fname + ".ebp")).getInputStream(), 255);
|
||||
return EaglerBitwisePackedTexture.loadTextureSafe(resMgr.getResource(new ResourceLocation("eagler:glsl/deferred/assets_pbr/" + fname + ".ebp")).getInputStream(), 255);
|
||||
}catch(Throwable t) {
|
||||
// dead code because teavm
|
||||
t.toString();
|
||||
|
|
|
@ -0,0 +1,286 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
|
||||
|
||||
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ExtGLEnums.*;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ArrayListSerial;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.EaglerDeferredPipeline;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ListSerial;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2023-2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class DynamicLightBucketLoader {
|
||||
|
||||
public IBufferGL buffer_chunkLightingData;
|
||||
private ByteBuffer chunkLightingDataCopyBuffer;
|
||||
private boolean isChunkLightingEnabled = false;
|
||||
public ListSerial<DynamicLightInstance> currentBoundLightSourceBucket;
|
||||
|
||||
public final ListSerial<DynamicLightInstance>[] lightSourceBuckets;
|
||||
public ListSerial<DynamicLightInstance> currentLightSourceBucket;
|
||||
|
||||
public static final int MAX_LIGHTS_PER_CHUNK = 12;
|
||||
|
||||
private final int lightSourceBucketsWidth;
|
||||
private final int lightSourceBucketsHeight;
|
||||
|
||||
private double currentRenderX = 0.0;
|
||||
private double currentRenderY = 0.0;
|
||||
private double currentRenderZ = 0.0;
|
||||
|
||||
public DynamicLightBucketLoader() {
|
||||
this.lightSourceBucketsWidth = 5;
|
||||
this.lightSourceBucketsHeight = 3;
|
||||
int cnt = 5 * 3 * 5;
|
||||
this.lightSourceBuckets = new ListSerial[cnt];
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
destroy();
|
||||
|
||||
buffer_chunkLightingData = _wglGenBuffers();
|
||||
EaglercraftGPU.bindGLUniformBuffer(buffer_chunkLightingData);
|
||||
int lightingDataLength = 4 * MAX_LIGHTS_PER_CHUNK + 4;
|
||||
chunkLightingDataCopyBuffer = EagRuntime.allocateByteBuffer(lightingDataLength << 2);
|
||||
for(int i = 0; i < lightingDataLength; ++i) {
|
||||
chunkLightingDataCopyBuffer.putInt(0);
|
||||
}
|
||||
chunkLightingDataCopyBuffer.flip();
|
||||
_wglBufferData(_GL_UNIFORM_BUFFER, chunkLightingDataCopyBuffer, GL_DYNAMIC_DRAW);
|
||||
|
||||
for(int i = 0; i < this.lightSourceBuckets.length; ++i) {
|
||||
this.lightSourceBuckets[i] = new ArrayListSerial(16);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearBuckets() {
|
||||
for(int i = 0; i < this.lightSourceBuckets.length; ++i) {
|
||||
this.lightSourceBuckets[i].clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void loadLightSourceBucket(int relativeBlockX, int relativeBlockY, int relativeBlockZ) {
|
||||
int hw = lightSourceBucketsWidth / 2;
|
||||
int hh = lightSourceBucketsHeight / 2;
|
||||
int bucketX = (relativeBlockX >> 4) + hw;
|
||||
int bucketY = (relativeBlockY >> 4) + hh;
|
||||
int bucketZ = (relativeBlockZ >> 4) + hw;
|
||||
if(bucketX >= 0 && bucketY >= 0 && bucketZ >= 0 && bucketX < lightSourceBucketsWidth
|
||||
&& bucketY < lightSourceBucketsHeight && bucketZ < lightSourceBucketsWidth) {
|
||||
currentLightSourceBucket = lightSourceBuckets[bucketY * lightSourceBucketsWidth * lightSourceBucketsWidth
|
||||
+ bucketZ * lightSourceBucketsWidth + bucketX];
|
||||
}else {
|
||||
currentLightSourceBucket = null;
|
||||
}
|
||||
updateLightSourceUBO();
|
||||
}
|
||||
|
||||
public ListSerial<DynamicLightInstance> getLightSourceBucketRelativeChunkCoords(int cx, int cy, int cz) {
|
||||
int hw = lightSourceBucketsWidth / 2;
|
||||
int hh = lightSourceBucketsHeight / 2;
|
||||
cx += hw;
|
||||
cy += hh;
|
||||
cz += hw;
|
||||
if(cx < 0 || cx >= lightSourceBucketsWidth || cy < 0 || cy >= lightSourceBucketsHeight || cz < 0
|
||||
|| cz >= lightSourceBucketsWidth) {
|
||||
return null;
|
||||
}else {
|
||||
return lightSourceBuckets[cy * lightSourceBucketsWidth * lightSourceBucketsWidth
|
||||
+ cz * lightSourceBucketsWidth + cx];
|
||||
}
|
||||
}
|
||||
|
||||
public void addLightSourceToBucket(int cx, int cy, int cz, DynamicLightInstance dl) {
|
||||
ListSerial<DynamicLightInstance> lst = getLightSourceBucketRelativeChunkCoords(cx, cy, cz);
|
||||
if(lst != null) {
|
||||
lst.add(dl);
|
||||
}
|
||||
}
|
||||
|
||||
public void bucketLightSource(float x, float y, float z, DynamicLightInstance dl) {
|
||||
int bucketX = MathHelper.floor_float(x / 16.0f);
|
||||
int bucketY = MathHelper.floor_float(y / 16.0f);
|
||||
int bucketZ = MathHelper.floor_float(z / 16.0f);
|
||||
addLightSourceToBucket(bucketX, bucketY, bucketZ, dl);
|
||||
int minX = bucketX, maxX = bucketX;
|
||||
int minY = bucketY, maxY = bucketY;
|
||||
int minZ = bucketZ, maxZ = bucketZ;
|
||||
float lightLocalX = x - (bucketX << 4);
|
||||
float lightLocalY = y - (bucketY << 4);
|
||||
float lightLocalZ = z - (bucketZ << 4);
|
||||
float radius = dl.radius;
|
||||
boolean outOfBounds = false;
|
||||
if(lightLocalX - radius < 0.0f) {
|
||||
minX -= 1;
|
||||
outOfBounds = true;
|
||||
addLightSourceToBucket(bucketX - 1, bucketY, bucketZ, dl);
|
||||
}
|
||||
if(lightLocalY - radius < 0.0f) {
|
||||
minY -= 1;
|
||||
outOfBounds = true;
|
||||
addLightSourceToBucket(bucketX, bucketY - 1, bucketZ, dl);
|
||||
}
|
||||
if(lightLocalZ - radius < 0.0f) {
|
||||
minZ -= 1;
|
||||
outOfBounds = true;
|
||||
addLightSourceToBucket(bucketX, bucketY, bucketZ - 1, dl);
|
||||
}
|
||||
if(lightLocalX + radius >= 16.0f) {
|
||||
maxX += 1;
|
||||
outOfBounds = true;
|
||||
addLightSourceToBucket(bucketX + 1, bucketY, bucketZ, dl);
|
||||
}
|
||||
if(lightLocalY + radius >= 16.0f) {
|
||||
maxY += 1;
|
||||
outOfBounds = true;
|
||||
addLightSourceToBucket(bucketX, bucketY + 1, bucketZ, dl);
|
||||
}
|
||||
if(lightLocalZ + radius >= 16.0f) {
|
||||
maxZ += 1;
|
||||
outOfBounds = true;
|
||||
addLightSourceToBucket(bucketX, bucketY, bucketZ + 1, dl);
|
||||
}
|
||||
if(!outOfBounds) {
|
||||
return;
|
||||
}
|
||||
radius *= radius;
|
||||
for(int yy = minY; yy <= maxY; ++yy) {
|
||||
for(int zz = minZ; zz <= maxZ; ++zz) {
|
||||
for(int xx = minX; xx <= maxX; ++xx) {
|
||||
if((xx == bucketX ? 1 : 0) + (yy == bucketY ? 1 : 0) + (zz == bucketZ ? 1 : 0) > 1) {
|
||||
continue;
|
||||
}
|
||||
List<DynamicLightInstance> lst = getLightSourceBucketRelativeChunkCoords(xx, yy, zz);
|
||||
if(lst != null) {
|
||||
int bucketBoundsX = xx << 4;
|
||||
int bucketBoundsY = yy << 4;
|
||||
int bucketBoundsZ = zz << 4;
|
||||
if (EaglerDeferredPipeline.testAabSphere(bucketBoundsX, bucketBoundsY, bucketBoundsZ,
|
||||
bucketBoundsX + 16, bucketBoundsY + 16, bucketBoundsZ + 16, x, y, z, radius)) {
|
||||
lst.add(dl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void truncateOverflowingBuffers() {
|
||||
for(int i = 0; i < this.lightSourceBuckets.length; ++i) {
|
||||
List<DynamicLightInstance> lst = this.lightSourceBuckets[i];
|
||||
int k = lst.size();
|
||||
if(k > MAX_LIGHTS_PER_CHUNK) {
|
||||
lst.sort(comparatorLightRadius);
|
||||
for(int l = MAX_LIGHTS_PER_CHUNK - 1; l >= MAX_LIGHTS_PER_CHUNK; --l) {
|
||||
lst.remove(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateLightSourceUBO() {
|
||||
if(currentLightSourceBucket == null) {
|
||||
currentBoundLightSourceBucket = null;
|
||||
if(isChunkLightingEnabled) {
|
||||
isChunkLightingEnabled = false;
|
||||
EaglercraftGPU.bindGLUniformBuffer(buffer_chunkLightingData);
|
||||
chunkLightingDataCopyBuffer.clear();
|
||||
chunkLightingDataCopyBuffer.putInt(0);
|
||||
chunkLightingDataCopyBuffer.flip();
|
||||
_wglBufferSubData(_GL_UNIFORM_BUFFER, 0, chunkLightingDataCopyBuffer);
|
||||
}
|
||||
}else {
|
||||
boolean isNew;
|
||||
if(!isChunkLightingEnabled) {
|
||||
isChunkLightingEnabled = true;
|
||||
isNew = true;
|
||||
}else {
|
||||
isNew = currentLightSourceBucket != currentBoundLightSourceBucket;
|
||||
}
|
||||
currentBoundLightSourceBucket = currentLightSourceBucket;
|
||||
if(isNew || currentBoundLightSourceBucket.eaglerCheck()) {
|
||||
populateLightSourceUBOFromBucket(currentBoundLightSourceBucket);
|
||||
currentBoundLightSourceBucket.eaglerResetCheck();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final Comparator<DynamicLightInstance> comparatorLightRadius = (l1, l2) -> {
|
||||
return l1.radius < l2.radius ? 1 : -1;
|
||||
};
|
||||
|
||||
private void populateLightSourceUBOFromBucket(List<DynamicLightInstance> lights) {
|
||||
int max = lights.size();
|
||||
if(max > MAX_LIGHTS_PER_CHUNK) {
|
||||
//tmpListLights.clear();
|
||||
//tmpListLights.addAll(lights);
|
||||
//lights = tmpListLights;
|
||||
//lights.sort(comparatorLightRadius);
|
||||
max = MAX_LIGHTS_PER_CHUNK;
|
||||
}
|
||||
chunkLightingDataCopyBuffer.clear();
|
||||
chunkLightingDataCopyBuffer.putInt(max);
|
||||
if(max > 0) {
|
||||
chunkLightingDataCopyBuffer.putInt(0); //padding
|
||||
chunkLightingDataCopyBuffer.putInt(0); //padding
|
||||
chunkLightingDataCopyBuffer.putInt(0); //padding
|
||||
for(int i = 0; i < max; ++i) {
|
||||
DynamicLightInstance dl = lights.get(i);
|
||||
chunkLightingDataCopyBuffer.putFloat((float)(dl.posX - currentRenderX));
|
||||
chunkLightingDataCopyBuffer.putFloat((float)(dl.posY - currentRenderY));
|
||||
chunkLightingDataCopyBuffer.putFloat((float)(dl.posZ - currentRenderZ));
|
||||
chunkLightingDataCopyBuffer.putFloat(dl.radius);
|
||||
}
|
||||
}
|
||||
chunkLightingDataCopyBuffer.flip();
|
||||
EaglercraftGPU.bindGLUniformBuffer(buffer_chunkLightingData);
|
||||
_wglBufferSubData(_GL_UNIFORM_BUFFER, 0, chunkLightingDataCopyBuffer);
|
||||
}
|
||||
|
||||
public void setRenderPos(double currentRenderX, double currentRenderY, double currentRenderZ) {
|
||||
this.currentRenderX = currentRenderX;
|
||||
this.currentRenderY = currentRenderY;
|
||||
this.currentRenderZ = currentRenderZ;
|
||||
}
|
||||
|
||||
public void bindUniformBuffer(int index) {
|
||||
EaglercraftGPU.bindGLUniformBuffer(buffer_chunkLightingData);
|
||||
EaglercraftGPU.bindUniformBufferRange(index, buffer_chunkLightingData, 0, chunkLightingDataCopyBuffer.capacity());
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
if(chunkLightingDataCopyBuffer != null) {
|
||||
EagRuntime.freeByteBuffer(chunkLightingDataCopyBuffer);
|
||||
chunkLightingDataCopyBuffer = null;
|
||||
}
|
||||
if(buffer_chunkLightingData != null) {
|
||||
_wglDeleteBuffers(buffer_chunkLightingData);
|
||||
buffer_chunkLightingData = null;
|
||||
}
|
||||
for(int i = 0; i < this.lightSourceBuckets.length; ++i) {
|
||||
this.lightSourceBuckets[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
class DynamicLightInstance {
|
||||
|
||||
double posX;
|
||||
double posY;
|
||||
double posZ;
|
||||
float radius;
|
||||
|
||||
public DynamicLightInstance() {
|
||||
}
|
||||
|
||||
public void updateLight(double posX, double posY, double posZ, float radius) {
|
||||
this.posX = posX;
|
||||
this.posY = posY;
|
||||
this.posZ = posZ;
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
public float getRadiusInWorld() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,230 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
|
||||
|
||||
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.FloatBuffer;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.InstancedParticleRenderer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.AbstractAcceleratedEffectRenderer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program.DynamicLightsAccelParticleShader;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class DynamicLightsAcceleratedEffectRenderer extends AbstractAcceleratedEffectRenderer {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger("DynamicLightsAcceleratedEffectRenderer");
|
||||
|
||||
private ByteBuffer particleBuffer = null;
|
||||
private int particleCount = 0;
|
||||
private boolean particlesHasOverflowed = false;
|
||||
|
||||
private static final int BYTES_PER_PARTICLE = 24;
|
||||
private static final int PARTICLE_LIMIT = 5461;
|
||||
|
||||
private DynamicLightsAccelParticleShader shaderProgram = null;
|
||||
|
||||
private IBufferArrayGL vertexArray = null;
|
||||
private IBufferGL vertexBuffer = null;
|
||||
|
||||
private IBufferGL instancesBuffer = null;
|
||||
|
||||
private float f1;
|
||||
private float f2;
|
||||
private float f3;
|
||||
private float f4;
|
||||
private float f5;
|
||||
|
||||
public static boolean isMaterialNormalTexture = false;
|
||||
|
||||
public void initialize() {
|
||||
destroy();
|
||||
|
||||
if(DynamicLightsPipelineCompiler.matrixCopyBuffer == null) {
|
||||
DynamicLightsPipelineCompiler.matrixCopyBuffer = GLAllocation.createDirectFloatBuffer(16);
|
||||
}
|
||||
|
||||
shaderProgram = DynamicLightsAccelParticleShader.compile();
|
||||
shaderProgram.loadUniforms();
|
||||
|
||||
particleBuffer = EagRuntime.allocateByteBuffer(PARTICLE_LIMIT * BYTES_PER_PARTICLE);
|
||||
|
||||
vertexArray = _wglGenVertexArrays();
|
||||
vertexBuffer = _wglGenBuffers();
|
||||
instancesBuffer = _wglGenBuffers();
|
||||
|
||||
FloatBuffer verts = EagRuntime.allocateFloatBuffer(12);
|
||||
verts.put(new float[] {
|
||||
-1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f,
|
||||
-1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f
|
||||
});
|
||||
verts.flip();
|
||||
|
||||
EaglercraftGPU.bindGLBufferArray(vertexArray);
|
||||
|
||||
EaglercraftGPU.bindGLArrayBuffer(vertexBuffer);
|
||||
_wglBufferData(GL_ARRAY_BUFFER, verts, GL_STATIC_DRAW);
|
||||
|
||||
EagRuntime.freeFloatBuffer(verts);
|
||||
|
||||
_wglEnableVertexAttribArray(0);
|
||||
_wglVertexAttribPointer(0, 2, GL_FLOAT, false, 8, 0);
|
||||
_wglVertexAttribDivisor(0, 0);
|
||||
|
||||
EaglercraftGPU.bindGLArrayBuffer(instancesBuffer);
|
||||
_wglBufferData(GL_ARRAY_BUFFER, particleBuffer.remaining(), GL_STREAM_DRAW);
|
||||
|
||||
_wglEnableVertexAttribArray(1);
|
||||
_wglVertexAttribPointer(1, 3, GL_FLOAT, false, 24, 0);
|
||||
_wglVertexAttribDivisor(1, 1);
|
||||
|
||||
_wglEnableVertexAttribArray(2);
|
||||
_wglVertexAttribPointer(2, 2, GL_UNSIGNED_SHORT, false, 24, 12);
|
||||
_wglVertexAttribDivisor(2, 1);
|
||||
|
||||
_wglEnableVertexAttribArray(3);
|
||||
_wglVertexAttribPointer(3, 2, GL_UNSIGNED_BYTE, true, 24, 16);
|
||||
_wglVertexAttribDivisor(3, 1);
|
||||
|
||||
_wglEnableVertexAttribArray(4);
|
||||
_wglVertexAttribPointer(4, 2, GL_UNSIGNED_BYTE, false, 24, 18);
|
||||
_wglVertexAttribDivisor(4, 1);
|
||||
|
||||
_wglEnableVertexAttribArray(5);
|
||||
_wglVertexAttribPointer(5, 4, GL_UNSIGNED_BYTE, true, 24, 20);
|
||||
_wglVertexAttribDivisor(5, 1);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(float texCoordWidth, float texCoordHeight) {
|
||||
if(particleCount == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
shaderProgram.useProgram();
|
||||
|
||||
_wglUniform3f(shaderProgram.uniforms.u_texCoordSize2f_particleSize1f, texCoordWidth, texCoordHeight, 0.0625f);
|
||||
_wglUniform3f(shaderProgram.uniforms.u_transformParam_1_2_5_f, f1, f5, f4);
|
||||
_wglUniform2f(shaderProgram.uniforms.u_transformParam_3_4_f, f2, f3);
|
||||
InstancedParticleRenderer.stupidColorSetHack(shaderProgram.uniforms.u_color4f);
|
||||
|
||||
FloatBuffer buf = DynamicLightsPipelineCompiler.matrixCopyBuffer;
|
||||
buf.clear();
|
||||
GlStateManager.getFloat(GL_MODELVIEW_MATRIX, buf);
|
||||
buf.flip();
|
||||
_wglUniformMatrix4fv(shaderProgram.uniforms.u_modelViewMatrix4f, false, buf);
|
||||
buf.clear();
|
||||
GlStateManager.getFloat(GL_PROJECTION_MATRIX, buf);
|
||||
buf.flip();
|
||||
_wglUniformMatrix4fv(shaderProgram.uniforms.u_projectionMatrix4f, false, buf);
|
||||
buf.clear();
|
||||
DynamicLightsStateManager.inverseViewMatrix.store(buf);
|
||||
buf.flip();
|
||||
_wglUniformMatrix4fv(shaderProgram.uniforms.u_inverseViewMatrix4f, false, buf);
|
||||
|
||||
EaglercraftGPU.bindGLArrayBuffer(instancesBuffer);
|
||||
EaglercraftGPU.bindGLBufferArray(vertexArray);
|
||||
|
||||
int p = particleBuffer.position();
|
||||
int l = particleBuffer.limit();
|
||||
|
||||
particleBuffer.flip();
|
||||
_wglBufferSubData(GL_ARRAY_BUFFER, 0, particleBuffer);
|
||||
|
||||
particleBuffer.position(p);
|
||||
particleBuffer.limit(l);
|
||||
|
||||
_wglDrawArraysInstanced(GL_TRIANGLES, 0, 6, particleCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void begin(float partialTicks) {
|
||||
this.partialTicks = partialTicks;
|
||||
|
||||
particleBuffer.clear();
|
||||
particleCount = 0;
|
||||
particlesHasOverflowed = false;
|
||||
|
||||
Entity et = Minecraft.getMinecraft().getRenderViewEntity();
|
||||
if(et != null) {
|
||||
f1 = MathHelper.cos(et.rotationYaw * 0.017453292F);
|
||||
f2 = MathHelper.sin(et.rotationYaw * 0.017453292F);
|
||||
f3 = -f2 * MathHelper.sin(et.rotationPitch * 0.017453292F);
|
||||
f4 = f1 * MathHelper.sin(et.rotationPitch * 0.017453292F);
|
||||
f5 = MathHelper.cos(et.rotationPitch * 0.017453292F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawParticle(float posX, float posY, float posZ, int particleIndexX, int particleIndexY,
|
||||
int lightMapData, int texSize, float particleSize, int rgba) {
|
||||
if(particlesHasOverflowed) {
|
||||
return;
|
||||
}
|
||||
if(particleCount >= PARTICLE_LIMIT) {
|
||||
particlesHasOverflowed = true;
|
||||
logger.error("Particle buffer has overflowed! Exceeded {} particles, no more particles will be rendered.", PARTICLE_LIMIT);
|
||||
return;
|
||||
}
|
||||
++particleCount;
|
||||
ByteBuffer buf = particleBuffer;
|
||||
buf.putFloat(posX);
|
||||
buf.putFloat(posY);
|
||||
buf.putFloat(posZ);
|
||||
buf.putShort((short)particleIndexX);
|
||||
buf.putShort((short)particleIndexY);
|
||||
buf.put((byte)(lightMapData & 0xFF));
|
||||
buf.put((byte)((lightMapData >> 16) & 0xFF));
|
||||
buf.put((byte)(particleSize * 16.0f));
|
||||
buf.put((byte)texSize);
|
||||
buf.putInt(rgba);
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
if(particleBuffer != null) {
|
||||
EagRuntime.freeByteBuffer(particleBuffer);
|
||||
particleBuffer = null;
|
||||
}
|
||||
if(shaderProgram != null) {
|
||||
shaderProgram.destroy();
|
||||
shaderProgram = null;
|
||||
}
|
||||
if(vertexArray != null) {
|
||||
_wglDeleteVertexArrays(vertexArray);
|
||||
vertexArray = null;
|
||||
}
|
||||
if(vertexBuffer != null) {
|
||||
_wglDeleteBuffers(vertexBuffer);
|
||||
vertexBuffer = null;
|
||||
}
|
||||
if(instancesBuffer != null) {
|
||||
_wglDeleteBuffers(instancesBuffer);
|
||||
instancesBuffer = null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
|
||||
|
||||
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.buffer.FloatBuffer;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.FixedFunctionShader.FixedFunctionState;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.IExtPipelineCompiler;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderSource;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program.DynamicLightsExtPipelineShader;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class DynamicLightsPipelineCompiler implements IExtPipelineCompiler {
|
||||
|
||||
static FloatBuffer matrixCopyBuffer = null;
|
||||
|
||||
private static class PipelineInstance {
|
||||
|
||||
private final int coreBits;
|
||||
private final int extBits;
|
||||
|
||||
private DynamicLightsExtPipelineShader shader;
|
||||
|
||||
public PipelineInstance(int coreBits, int extBits) {
|
||||
this.coreBits = coreBits;
|
||||
this.extBits = extBits;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getShaderSource(int stateCoreBits, int stateExtBits, Object[] userPointer) {
|
||||
if(matrixCopyBuffer == null) {
|
||||
matrixCopyBuffer = GLAllocation.createDirectFloatBuffer(16);
|
||||
}
|
||||
userPointer[0] = new PipelineInstance(stateCoreBits, stateExtBits);
|
||||
return new String[] {
|
||||
ShaderSource.getSourceFor(ShaderSource.core_dynamiclights_vsh),
|
||||
ShaderSource.getSourceFor(ShaderSource.core_dynamiclights_fsh)
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExtensionStatesCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentExtensionStateBits(int stateCoreBits) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCoreStateMask(int stateExtBits) {
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeNewShader(IProgramGL compiledProg, int stateCoreBits, int stateExtBits,
|
||||
Object[] userPointer) {
|
||||
DynamicLightsExtPipelineShader newShader = new DynamicLightsExtPipelineShader(compiledProg, stateCoreBits);
|
||||
((PipelineInstance)userPointer[0]).shader = newShader;
|
||||
newShader.loadUniforms();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePipeline(IProgramGL compiledProg, int stateCoreBits, int stateExtBits, Object[] userPointer) {
|
||||
if((stateCoreBits & FixedFunctionState.STATE_ENABLE_LIGHTMAP) != 0) {
|
||||
DynamicLightsExtPipelineShader.Uniforms uniforms = ((PipelineInstance)userPointer[0]).shader.uniforms;
|
||||
if(uniforms.u_inverseViewMatrix4f != null) {
|
||||
int serial = DynamicLightsStateManager.inverseViewMatrixSerial;
|
||||
if(uniforms.inverseViewMatrixSerial != serial) {
|
||||
uniforms.inverseViewMatrixSerial = serial;
|
||||
FloatBuffer buf = matrixCopyBuffer;
|
||||
buf.clear();
|
||||
DynamicLightsStateManager.inverseViewMatrix.store(buf);
|
||||
buf.flip();
|
||||
_wglUniformMatrix4fv(uniforms.u_inverseViewMatrix4f, false, buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyPipeline(IProgramGL shaderProgram, int stateCoreBits, int stateExtBits, Object[] userPointer) {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,177 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.FixedFunctionPipeline;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class DynamicLightsStateManager {
|
||||
|
||||
static final DynamicLightsPipelineCompiler deferredExtPipeline = new DynamicLightsPipelineCompiler();
|
||||
private static List<DynamicLightInstance> lightInstancePool = new ArrayList();
|
||||
private static int instancePoolIndex = 0;
|
||||
private static int maxListLengthTracker = 0;
|
||||
static final List<DynamicLightInstance> lightRenderList = new LinkedList();
|
||||
static final Matrix4f inverseViewMatrix = new Matrix4f();
|
||||
static int inverseViewMatrixSerial = 0;
|
||||
static DynamicLightBucketLoader bucketLoader = null;
|
||||
static DynamicLightsAcceleratedEffectRenderer accelParticleRenderer = null;
|
||||
static int lastTotal = 0;
|
||||
private static long lastTick = 0l;
|
||||
|
||||
public static final void enableDynamicLightsRender() {
|
||||
if(bucketLoader == null) {
|
||||
bucketLoader = new DynamicLightBucketLoader();
|
||||
bucketLoader.initialize();
|
||||
bucketLoader.bindUniformBuffer(0);
|
||||
FixedFunctionPipeline.loadExtensionPipeline(deferredExtPipeline);
|
||||
}
|
||||
if(accelParticleRenderer == null) {
|
||||
accelParticleRenderer = new DynamicLightsAcceleratedEffectRenderer();
|
||||
accelParticleRenderer.initialize();
|
||||
}
|
||||
lightRenderList.clear();
|
||||
instancePoolIndex = 0;
|
||||
maxListLengthTracker = 0;
|
||||
}
|
||||
|
||||
public static final void bindAcceleratedEffectRenderer(EffectRenderer renderer) {
|
||||
renderer.acceleratedParticleRenderer = accelParticleRenderer;
|
||||
}
|
||||
|
||||
public static final void disableDynamicLightsRender(boolean unloadPipeline) {
|
||||
if(bucketLoader != null) {
|
||||
bucketLoader.destroy();
|
||||
bucketLoader = null;
|
||||
if(unloadPipeline) {
|
||||
FixedFunctionPipeline.loadExtensionPipeline(null);
|
||||
}
|
||||
}
|
||||
if(accelParticleRenderer != null) {
|
||||
accelParticleRenderer.destroy();
|
||||
accelParticleRenderer = null;
|
||||
}
|
||||
destroyAll();
|
||||
lightRenderList.clear();
|
||||
instancePoolIndex = 0;
|
||||
maxListLengthTracker = 0;
|
||||
}
|
||||
|
||||
public static final boolean isDynamicLightsRender() {
|
||||
return bucketLoader != null;
|
||||
}
|
||||
|
||||
public static final boolean isInDynamicLightsPass() {
|
||||
return GlStateManager.isExtensionPipeline() && bucketLoader != null;
|
||||
}
|
||||
|
||||
public static final void reportForwardRenderObjectPosition(int centerX, int centerY, int centerZ) {
|
||||
if(bucketLoader != null) {
|
||||
bucketLoader.loadLightSourceBucket(centerX, centerY, centerZ);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void reportForwardRenderObjectPosition2(float x, float y, float z) {
|
||||
if(bucketLoader != null) {
|
||||
float posX = (float)((x + TileEntityRendererDispatcher.staticPlayerX) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerX / 16.0) << 4));
|
||||
float posY = (float)((y + TileEntityRendererDispatcher.staticPlayerY) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerY / 16.0) << 4));
|
||||
float posZ = (float)((z + TileEntityRendererDispatcher.staticPlayerZ) - (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerZ / 16.0) << 4));
|
||||
bucketLoader.loadLightSourceBucket((int)posX, (int)posY, (int)posZ);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void renderDynamicLight(String lightName, double posX, double posY, double posZ, float radius) {
|
||||
if(bucketLoader != null) {
|
||||
DynamicLightInstance dl;
|
||||
if(instancePoolIndex < lightInstancePool.size()) {
|
||||
dl = lightInstancePool.get(instancePoolIndex);
|
||||
}else {
|
||||
lightInstancePool.add(dl = new DynamicLightInstance());
|
||||
}
|
||||
++instancePoolIndex;
|
||||
dl.updateLight(posX, posY, posZ, radius);
|
||||
lightRenderList.add(dl);
|
||||
}
|
||||
}
|
||||
|
||||
public static final void clearRenderList() {
|
||||
if(instancePoolIndex > maxListLengthTracker) {
|
||||
maxListLengthTracker = instancePoolIndex;
|
||||
}
|
||||
lightRenderList.clear();
|
||||
instancePoolIndex = 0;
|
||||
}
|
||||
|
||||
public static final void commitLightSourceBuckets(double renderPosX, double renderPosY, double renderPosZ) {
|
||||
lastTotal = lightRenderList.size();
|
||||
if(bucketLoader != null) {
|
||||
bucketLoader.clearBuckets();
|
||||
int entityChunkOriginX = MathHelper.floor_double(renderPosX / 16.0) << 4;
|
||||
int entityChunkOriginY = MathHelper.floor_double(renderPosY / 16.0) << 4;
|
||||
int entityChunkOriginZ = MathHelper.floor_double(renderPosZ / 16.0) << 4;
|
||||
Iterator<DynamicLightInstance> itr = lightRenderList.iterator();
|
||||
while(itr.hasNext()) {
|
||||
DynamicLightInstance dl = itr.next();
|
||||
float lightChunkPosX = (float)(dl.posX - entityChunkOriginX);
|
||||
float lightChunkPosY = (float)(dl.posY - entityChunkOriginY);
|
||||
float lightChunkPosZ = (float)(dl.posZ - entityChunkOriginZ);
|
||||
bucketLoader.bucketLightSource(lightChunkPosX, lightChunkPosY, lightChunkPosZ, dl);
|
||||
}
|
||||
bucketLoader.setRenderPos(renderPosX, renderPosY, renderPosZ);
|
||||
bucketLoader.truncateOverflowingBuffers();
|
||||
}
|
||||
updateTimers();
|
||||
clearRenderList();
|
||||
}
|
||||
|
||||
public static final void setupInverseViewMatrix() {
|
||||
Matrix4f.invert(GlStateManager.getModelViewReference(), inverseViewMatrix);
|
||||
inverseViewMatrixSerial = GlStateManager.getModelViewSerial();
|
||||
}
|
||||
|
||||
private static final void updateTimers() {
|
||||
long millis = System.currentTimeMillis();
|
||||
if(millis - lastTick > 5000l) {
|
||||
lastTick = millis;
|
||||
if(maxListLengthTracker < (lightInstancePool.size() >> 1)) {
|
||||
List<DynamicLightInstance> newPool = new ArrayList(Math.max(maxListLengthTracker, 16));
|
||||
for(int i = 0; i < maxListLengthTracker; ++i) {
|
||||
newPool.add(lightInstancePool.get(i));
|
||||
}
|
||||
lightInstancePool = newPool;
|
||||
}
|
||||
maxListLengthTracker = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void destroyAll() {
|
||||
lightInstancePool = new ArrayList();
|
||||
}
|
||||
|
||||
public static String getF3String() {
|
||||
return "DynamicLightsTotal: " + lastTotal;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program;
|
||||
|
||||
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IShaderGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IUniformGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.IProgramUniforms;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderCompiler;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderProgram;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderSource;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class DynamicLightsAccelParticleShader extends ShaderProgram<DynamicLightsAccelParticleShader.Uniforms> {
|
||||
|
||||
public static DynamicLightsAccelParticleShader compile() {
|
||||
IShaderGL accelParticleVSH = ShaderCompiler.compileShader("accel_particle_dynamiclights", GL_VERTEX_SHADER,
|
||||
ShaderSource.accel_particle_dynamiclights_vsh);
|
||||
IShaderGL accelParticleFSH = null;
|
||||
try {
|
||||
accelParticleFSH = ShaderCompiler.compileShader("accel_particle_dynamiclights", GL_FRAGMENT_SHADER,
|
||||
ShaderSource.accel_particle_dynamiclights_fsh);
|
||||
IProgramGL prog = ShaderCompiler.linkProgram("accel_particle_dynamiclights", accelParticleVSH, accelParticleFSH);
|
||||
return new DynamicLightsAccelParticleShader(prog);
|
||||
}finally {
|
||||
if(accelParticleVSH != null) {
|
||||
accelParticleVSH.free();
|
||||
}
|
||||
if(accelParticleFSH != null) {
|
||||
accelParticleFSH.free();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DynamicLightsAccelParticleShader(IProgramGL prog) {
|
||||
super(prog, new Uniforms());
|
||||
}
|
||||
|
||||
public static class Uniforms implements IProgramUniforms {
|
||||
|
||||
public IUniformGL u_color4f = null;
|
||||
public IUniformGL u_modelViewMatrix4f = null;
|
||||
public IUniformGL u_projectionMatrix4f = null;
|
||||
public IUniformGL u_inverseViewMatrix4f = null;
|
||||
public IUniformGL u_texCoordSize2f_particleSize1f = null;
|
||||
public IUniformGL u_transformParam_1_2_5_f = null;
|
||||
public IUniformGL u_transformParam_3_4_f = null;
|
||||
|
||||
public int u_chunkLightingDataBlockBinding = -1;
|
||||
|
||||
private Uniforms() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUniforms(IProgramGL prog) {
|
||||
u_modelViewMatrix4f = _wglGetUniformLocation(prog, "u_modelViewMatrix4f");
|
||||
u_projectionMatrix4f = _wglGetUniformLocation(prog, "u_projectionMatrix4f");
|
||||
u_inverseViewMatrix4f = _wglGetUniformLocation(prog, "u_inverseViewMatrix4f");
|
||||
u_texCoordSize2f_particleSize1f = _wglGetUniformLocation(prog, "u_texCoordSize2f_particleSize1f");
|
||||
u_transformParam_1_2_5_f = _wglGetUniformLocation(prog, "u_transformParam_1_2_5_f");
|
||||
u_transformParam_3_4_f = _wglGetUniformLocation(prog, "u_transformParam_3_4_f");
|
||||
u_color4f = _wglGetUniformLocation(prog, "u_color4f");
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_inputTexture"), 0);
|
||||
_wglUniform1i(_wglGetUniformLocation(prog, "u_lightmapTexture"), 1);
|
||||
int blockIndex = _wglGetUniformBlockIndex(prog, "u_chunkLightingData");
|
||||
if(blockIndex != -1) {
|
||||
_wglUniformBlockBinding(prog, blockIndex, 0);
|
||||
u_chunkLightingDataBlockBinding = 0;
|
||||
}else {
|
||||
u_chunkLightingDataBlockBinding = -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program;
|
||||
|
||||
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.internal.IUniformGL;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.IProgramUniforms;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderProgram;
|
||||
|
||||
/**
|
||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
public class DynamicLightsExtPipelineShader extends ShaderProgram<DynamicLightsExtPipelineShader.Uniforms> {
|
||||
|
||||
public final int coreState;
|
||||
|
||||
public DynamicLightsExtPipelineShader(IProgramGL program, int coreState) {
|
||||
super(program, new Uniforms());
|
||||
this.coreState = coreState;
|
||||
}
|
||||
|
||||
public static class Uniforms implements IProgramUniforms {
|
||||
|
||||
public int u_chunkLightingDataBlockBinding = -1;
|
||||
|
||||
public int inverseViewMatrixSerial = -1;
|
||||
public IUniformGL u_inverseViewMatrix4f = null;
|
||||
|
||||
Uniforms() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUniforms(IProgramGL prog) {
|
||||
u_inverseViewMatrix4f = _wglGetUniformLocation(prog, "u_inverseViewMatrix4f");
|
||||
int blockIndex = _wglGetUniformBlockIndex(prog, "u_chunkLightingData");
|
||||
if(blockIndex != -1) {
|
||||
_wglUniformBlockBinding(prog, blockIndex, 0);
|
||||
u_chunkLightingDataBlockBinding = 0;
|
||||
}else {
|
||||
u_chunkLightingDataBlockBinding = -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue