+ It's sexy and I know it

This commit is contained in:
Nicolas BARBOTIN 2018-01-30 16:23:06 +01:00
parent e40b919a49
commit 14ae656684
7 changed files with 100 additions and 1 deletions

View File

@ -69,7 +69,7 @@ public class WebDisplays {
//Config
public static final double PAD_RATIO = 59.0 / 30.0;
public String homePage = "https://google.com"; //TODO: Read from config
public String homePage = "mod://webdisplays/main.html"; //TODO: Read from config
public double padResX;
public double padResY;
private int lastPadId = 0;

View File

@ -42,6 +42,8 @@ public class ScreenRenderer extends TileEntitySpecialRenderer<TileEntityScreen>
if(scr.browser == null) {
scr.browser = ((ClientProxy) WebDisplays.PROXY).getMCEF().createBrowser(scr.url);
scr.browser.resize(scr.resolution.x, scr.resolution.y);
scr.doTurnOnAnim = true;
scr.turnOnTime = System.currentTimeMillis();
}
tmpi.set(scr.side.right);
@ -84,9 +86,22 @@ public class ScreenRenderer extends TileEntitySpecialRenderer<TileEntityScreen>
break;
}
if(scr.doTurnOnAnim) {
long lt = System.currentTimeMillis() - scr.turnOnTime;
float ft = ((float) lt) / 100.0f;
if(ft >= 1.0f) {
ft = 1.0f;
scr.doTurnOnAnim = false;
}
glScalef(ft, ft, 1.0f);
}
float sw = ((float) scr.size.x) * 0.5f - 2.f / 16.f;
float sh = ((float) scr.size.y) * 0.5f - 2.f / 16.f;
//TODO: Use tesselator
glBindTexture(GL_TEXTURE_2D, scr.browser.getTextureID());
glBegin(GL_QUADS);
glColor4f(1.f, 1.f, 1.f, 1.f); glTexCoord2f(0.f, 1.f); glVertex3f(-sw, -sh, 0.505f);

View File

@ -50,6 +50,8 @@ public class TileEntityScreen extends TileEntity {
public int otherRights;
public IBrowser browser;
public ArrayList<ItemStack> upgrades;
public boolean doTurnOnAnim;
public long turnOnTime;
public static boolean isYouTubeURL(String url) {
return url.matches(YT_REGEX1) || url.matches(YT_REGEX2);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style type="text/css">
@keyframes cube-rot {
from { transform: rotateX(-20deg) rotateY(0); }
to { transform: rotateX(-20deg) rotateY(360deg); }
}
#centercube {
margin-left: auto;
margin-right: auto;
margin-top: 50vh;
transform: translateY(-50px);
}
#threedee {
perspective: 800px;
perspective-origin: 50px 50px;
}
#cube {
position: relative;
width: 100px;
height: 100px;
transform-style: preserve-3d;
animation: cube-rot 2s infinite linear;
}
#cube div {
position: absolute;
width: 100px;
height: 100px;
background-image: url("side.png");
}
#front {
transform: translateZ(50px);
background-image: url("front.png") !important;
}
#back {
transform: translateZ(-50px) rotateY(180deg);
}
#left {
transform: translateX(-50px) rotateY(-90deg);
}
#right {
transform: translateX(50px) rotateY(90deg);
}
#top {
transform: translateY(-50px) rotateX(-90deg);
}
#wd {
padding-left: 20px;
}
</style>
</head>
<body>
<table id="centercube">
<tr>
<td id="threedee">
<div id="cube">
<div id="front"></div>
<div id="back"></div>
<div id="left"></div>
<div id="right"></div>
<div id="top"></div>
</div>
</td>
<td id="wd">
<img src="webdisplays.png" />
</td>
</tr>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB