Fix glass pane / iron bars rendering

This commit is contained in:
Mike Primm 2018-08-26 17:50:40 -05:00
parent 79632814d0
commit 4933fc1909
3 changed files with 42 additions and 24 deletions

View File

@ -19,13 +19,13 @@ public class PaneRenderer extends CustomRenderer {
private static final int TEXTURE_FACE = 0;
private static final int TEXTURE_EDGE = 1;
private static final int SIDE_XP = 0x4;
private static final int SIDE_XN = 0x1;
private static final int SIDE_ZP = 0x8;
private static final int SIDE_ZN = 0x2;
protected static final int SIDE_XP = 0x4;
protected static final int SIDE_XN = 0x1;
protected static final int SIDE_ZP = 0x8;
protected static final int SIDE_ZN = 0x2;
// Meshes, indexed by connection combination (bit 0=X-, bit 1=Z-, bit 2=X+, bit 3=Z+)
private RenderPatch[][] meshes = new RenderPatch[16][];
protected RenderPatch[][] meshes = new RenderPatch[16][];
@Override
public boolean initializeRenderer(RenderPatchFactory rpf, String blkname, BitSet blockdatamask, Map<String,String> custparm) {
@ -57,7 +57,7 @@ public class PaneRenderer extends CustomRenderer {
RenderPatch HorizY100ZTopStripTop_180 = rpf.getRotatedPatch(HorizY100ZTopStripTop, 0, 180, 0, TEXTURE_EDGE);
RenderPatch HorizY100ZTopStripTop_270 = rpf.getRotatedPatch(HorizY100ZTopStripTop, 0, 270, 0, TEXTURE_EDGE);
meshes[0] = meshes[15] = new RenderPatch[] { VertX05, VertX05_90, HorizY100ZTopStrip, HorizY100ZTopStrip_90 };
meshes[0] = new RenderPatch[] { VertX05Strip, VertX05Strip_90, VertX05Strip_180, VertX05Strip_270 };
meshes[1] = new RenderPatch[] { VertX05Left_90, HorizY100ZTopStripTop_90, VertX05Strip };
meshes[2] = new RenderPatch[] { VertX05Left_180, HorizY100ZTopStripTop_180, VertX05Strip_90 };
meshes[3] = new RenderPatch[] { VertX05Left_90, HorizY100ZTopStripTop_90, VertX05Left_180, HorizY100ZTopStripTop_180 };
@ -72,6 +72,7 @@ public class PaneRenderer extends CustomRenderer {
meshes[12] = new RenderPatch[] { VertX05Left_270, HorizY100ZTopStripTop_270, VertX05Left, HorizY100ZTopStripTop };
meshes[13] = new RenderPatch[] { VertX05_270, HorizY100ZTopStrip_270, VertX05Left, HorizY100ZTopStripTop };
meshes[14] = new RenderPatch[] { VertX05_180, HorizY100ZTopStrip_180, VertX05Left_270, HorizY100ZTopStripTop_270 };
meshes[15] = new RenderPatch[] { VertX05, VertX05_90, HorizY100ZTopStrip, HorizY100ZTopStrip_90 };
}
@Override
public int getMaximumTextureCount() {

View File

@ -0,0 +1,17 @@
package org.dynmap.hdmap.renderer;
import org.dynmap.renderer.MapDataContext;
import org.dynmap.renderer.RenderPatch;
/*
* Glass pane / iron fence renderer for 1.13+
*/
public class PaneStateRenderer extends PaneRenderer {
@Override
public RenderPatch[] getRenderPatchList(MapDataContext ctx) {
// State map: 32 states, bit 4=east, bit 3=north, bit 2=south, bit 1=waterlogged, bit 0=west
int idx = ctx.getBlockType().stateIndex;
int meshidx = (((idx & 0x10) == 0) ? SIDE_XP : 0) | (((idx & 0x08) == 0) ? SIDE_ZN : 0) | (((idx & 0x04) == 0) ? SIDE_ZP : 0) | (((idx & 0x01) == 0) ? SIDE_XN : 0);
return meshes[meshidx];
}
}

View File

@ -735,7 +735,7 @@ block:id=piston_head,data=5,data=13,scale=8
rotate:id=piston_head,data=2,rot=90
# Glass pane
# Iron fence
customblock:id=glass_pane,id=iron_bars,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=glass_pane,id=iron_bars,class=org.dynmap.hdmap.renderer.PaneStateRenderer
# Web
# Nether Wart
@ -1211,25 +1211,25 @@ layer:11,12,13,14,15
****************
# Glass pane
customblock:id=glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
# Colored glass pane
customblock:id=white_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=orange_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=magenta_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=light_blue_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=yellow_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=lime_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=pink_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=gray_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=light_gray_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=cyan_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=purple_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=blue_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=brown_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=green_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=red_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=black_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneRenderer
customblock:id=white_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
customblock:id=orange_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
customblock:id=magenta_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
customblock:id=light_blue_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
customblock:id=yellow_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
customblock:id=lime_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
customblock:id=pink_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
customblock:id=gray_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
customblock:id=light_gray_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
customblock:id=cyan_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
customblock:id=purple_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
customblock:id=blue_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
customblock:id=brown_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
customblock:id=green_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
customblock:id=red_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
customblock:id=black_stained_glass_pane,class=org.dynmap.hdmap.renderer.PaneStateRenderer
# Acacia Stairs (163)
# Dark Oak Stairs (164)