Fix observer, handle vertical flips in modellist

This commit is contained in:
Mike Primm 2022-01-30 01:16:47 -06:00
parent fcdb7d04b5
commit 2ba2eb8517
5 changed files with 24 additions and 9 deletions

View File

@ -409,6 +409,7 @@ public class IsoHDPerspective implements HDPerspective {
switch(pd.sidevis) {
case TOP:
case TOPFLIP:
case TOPFLIPV:
if (det < 0.000001) {
return hitcnt;
}
@ -458,6 +459,9 @@ public class IsoHDPerspective implements HDPerspective {
if (pd.sidevis == SideVisible.TOPFLIP) {
patch_u[hitcnt] = 1 - u;
}
else if (pd.sidevis == SideVisible.TOPFLIPV) {
patch_v[hitcnt] = 1 - v;
}
}
else {
if (pd.sidevis == SideVisible.FLIP) {

View File

@ -457,6 +457,6 @@ public class PatchDefinition implements RenderPatch {
// System.out.println(String.format("txtO=%s, txtU=%s, txtV=%s, uv=%f/%f/%f/%f", txtorig, txtU, txtV, patchuv[0], patchuv[1], patchuv[2],
// patchuv[3]));
update(txtorig.x, txtorig.y, txtorig.z, txtU.x, txtU.y, txtU.z, txtV.x, txtV.y, txtV.z,
patchuv[0], patchuv[2], patchuv[1], patchuv[3], flipU ? SideVisible.TOPFLIP : SideVisible.TOP, textureid, patchuv[1], patchuv[3]);
patchuv[0], patchuv[2], patchuv[1], patchuv[3], flipU ? SideVisible.TOPFLIP : (flipV ? SideVisible.TOPFLIPV : SideVisible.TOP), textureid, patchuv[1], patchuv[3]);
}
}

View File

@ -2329,3 +2329,17 @@ patchrotate:id=magenta_glazed_terracotta,data=1,roty=90
patchblock:id=white_glazed_terracotta,id=orange_glazed_terracotta,id=magenta_glazed_terracotta,id=light_blue_glazed_terracotta,id=yellow_glazed_terracotta,id=lime_glazed_terracotta,id=pink_glazed_terracotta,id=gray_glazed_terracotta,id=light_gray_glazed_terracotta,id=cyan_glazed_terracotta,id=purple_glazed_terracotta,id=blue_glazed_terracotta,id=brown_glazed_terracotta,id=green_glazed_terracotta,id=red_glazed_terracotta,id=black_glazed_terracotta,data=3
patchrotate:id=magenta_glazed_terracotta,data=1,roty=270
# Observer Block (top, front, bottom, side)
modellist:id=observer,data=0,data=1,box=0/0/0:16/16/16:d/0/0/0/16/16:u/0/0/16/16/0:n/1:s/2:w/3:e/3
patchblock:id=observer,data=2,data=3
patchrotate:id=observer,data=0,roty=90
patchblock:id=observer,data=4,data=5
patchrotate:id=observer,data=0,roty=180
patchblock:id=observer,data=6,data=7
patchrotate:id=observer,data=0,roty=270
patchblock:id=observer,data=8,data=9
patchrotate:id=observer,data=0,rotx=270
patchblock:id=observer,data=10,data=11
patchrotate:id=observer,data=0,rotx=90

View File

@ -451,6 +451,7 @@ texture:id=spruce_door_bottom
texture:id=spruce_door_top
texture:id=observer_front
texture:id=observer_back
texture:id=observer_back_on
texture:id=observer_side
texture:id=observer_top
texture:id=end_rod
@ -1654,13 +1655,9 @@ block:id=structure_block,data=3,stdrot=true,allfaces=0:structure_block_data
# Structure void
block:id=structure_void,transparency=TRANSPARENT
# Observer Block
block:id=observer,data=0-1,top=4000:observer_back,east=0:observer_top,south=4000:observer_side,north=4000:observer_side,west=0:observer_top,bottom=4000:observer_front
block:id=observer,data=2-3,top=4000:observer_front,east=5000:observer_top,south=4000:observer_side,north=4000:observer_side,west=5000:observer_top,bottom=4000:observer_back
block:id=observer,data=4-5,top=4000:observer_top,east=0:observer_front,south=0:observer_side,north=0:observer_side,west=0:observer_back,bottom=4000:observer_top
block:id=observer,data=6-7,top=6000:observer_top,east=0:observer_back,south=0:observer_side,north=0:observer_side,west=0:observer_front,bottom=6000:observer_top
block:id=observer,data=8-9,top=5000:observer_top,east=0:observer_side,south=0:observer_back,north=0:observer_front,west=0:observer_side,bottom=5000:observer_top
block:id=observer,data=10-11,top=0:observer_top,east=0:observer_side,south=0:observer_front,north=0:observer_back,west=0:observer_side,bottom=0:observer_top
# Observer Block (top, front, bottom, side)
block:id=observer,data=0,data=2,data=4,data=6,data=8,data=10,patch0=0:observer_top,patch1=0:observer_front,patch2=0:observer_back_on,patch3=0:observer_side
block:id=observer,data=1,data=3,data=5,data=7,data=9,data=11,patch0=0:observer_top,patch1=0:observer_front,patch2=0:observer_back,patch3=0:observer_side
# Shulker Blocks (facing bottom)
block:id=shulker_box,data=0,top=4005,bottom=0,south=5004,north=5002,east=5003,west=5001,txtid=shulker

View File

@ -1,7 +1,7 @@
package org.dynmap.renderer;
public interface RenderPatchFactory {
public enum SideVisible { TOP, BOTTOM, BOTH, FLIP, TOPFLIP };
public enum SideVisible { TOP, BOTTOM, BOTH, FLIP, TOPFLIP, TOPFLIPV };
/**
* Get/create patch with given attributes.