mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
first attempt at CT
This commit is contained in:
parent
352394ad20
commit
d59e27e73f
99
src/main/java/com/hbm/render/block/ct/IconCT.java
Normal file
99
src/main/java/com/hbm/render/block/ct/IconCT.java
Normal file
@ -0,0 +1,99 @@
|
||||
package com.hbm.render.block.ct;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class IconCT implements IIcon {
|
||||
|
||||
|
||||
public static final int l = 0; //left
|
||||
public static final int r = 1; //right
|
||||
public static final int t = 0; //top
|
||||
public static final int b = 2; //bottom
|
||||
public static final int f = 0; //full
|
||||
public static final int c = 4; //connected
|
||||
public static final int j = 8; //junction
|
||||
public static final int h = 12; //horizontal
|
||||
public static final int v = 16; //vertical
|
||||
|
||||
public static final int ftl = 0;
|
||||
public static final int ftr = 1;
|
||||
public static final int fbl = 2;
|
||||
public static final int fbr = 3;
|
||||
public static final int ctl = 4;
|
||||
public static final int ctr = 5;
|
||||
public static final int cbl = 6;
|
||||
public static final int cbr = 7;
|
||||
public static final int jtl = 8;
|
||||
public static final int jtr = 9;
|
||||
public static final int jbl = 10;
|
||||
public static final int jbr = 11;
|
||||
public static final int htl = 12;
|
||||
public static final int htr = 13;
|
||||
public static final int hbl = 14;
|
||||
public static final int hbr = 15;
|
||||
public static final int vtl = 16;
|
||||
public static final int vtr = 17;
|
||||
public static final int vbl = 18;
|
||||
public static final int vbr = 19;
|
||||
|
||||
private IIcon parent;
|
||||
private int type;
|
||||
private float minU;
|
||||
private float maxU;
|
||||
private float minV;
|
||||
private float maxV;
|
||||
|
||||
|
||||
public IconCT(IIcon parent, int type) {
|
||||
this.parent = parent;
|
||||
this.type = type;
|
||||
|
||||
int sub = ((type & f) != 0) ? 2 : 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth() {
|
||||
return this.parent.getIconWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return this.parent.getIconHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMinU() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxU() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMinV() {
|
||||
return this.minV;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMaxV() {
|
||||
return this.maxV;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getInterpolatedU(double interp) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getInterpolatedV(double interp) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconName() {
|
||||
return this.parent.getIconName() + "_" + type;
|
||||
}
|
||||
|
||||
}
|
||||
101
src/main/java/com/hbm/render/block/ct/RenderBlocksCT.java
Normal file
101
src/main/java/com/hbm/render/block/ct/RenderBlocksCT.java
Normal file
@ -0,0 +1,101 @@
|
||||
package com.hbm.render.block.ct;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
|
||||
public class RenderBlocksCT extends RenderBlocks {
|
||||
|
||||
VertInfo tl;
|
||||
VertInfo tc;
|
||||
VertInfo tr;
|
||||
VertInfo cl;
|
||||
VertInfo cc;
|
||||
VertInfo cr;
|
||||
VertInfo bl;
|
||||
VertInfo bc;
|
||||
VertInfo br;
|
||||
|
||||
Tessellator tess;
|
||||
|
||||
public RenderBlocksCT() {
|
||||
super();
|
||||
this.tess = Tessellator.instance;
|
||||
}
|
||||
|
||||
private void initSideInfo() {
|
||||
|
||||
if(!this.enableAO)
|
||||
return;
|
||||
|
||||
this.tl = new VertInfo(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft, this.brightnessTopLeft);
|
||||
this.tr = new VertInfo(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight, this.brightnessTopRight);
|
||||
this.bl = new VertInfo(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft, this.brightnessBottomLeft);
|
||||
this.br = new VertInfo(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight, this.brightnessBottomRight);
|
||||
|
||||
this.tc = VertInfo.avg(tl, tr);
|
||||
this.bc = VertInfo.avg(bl, br);
|
||||
this.cl = VertInfo.avg(tl, bl);
|
||||
this.cr = VertInfo.avg(tr, br);
|
||||
|
||||
this.cc = VertInfo.avg(tl, tr, bl, br);
|
||||
}
|
||||
|
||||
private void drawFace(double[] ftl, double[] ftr, double[] fbl, double[] fbr) {
|
||||
|
||||
double[] ftc = avgCoords(ftl, ftr);
|
||||
///TODO///
|
||||
}
|
||||
|
||||
private void drawVert(double x, double y, double z, double u, double v, VertInfo info) {
|
||||
|
||||
if(this.enableAO) {
|
||||
tess.setColorOpaque_F(info.red, info.blue, info.green);
|
||||
tess.setBrightness(info.brightness);
|
||||
}
|
||||
|
||||
tess.addVertexWithUV(x, y, z, u, v);
|
||||
}
|
||||
|
||||
private double[] avgCoords(double[] first, double[] second) {
|
||||
return new double[] {
|
||||
(first[0] + second[0]) / 2,
|
||||
(first[1] + second[1]) / 2,
|
||||
(first[2] + second[2]) / 2
|
||||
};
|
||||
}
|
||||
|
||||
public static class VertInfo {
|
||||
float red;
|
||||
float green;
|
||||
float blue;
|
||||
int brightness;
|
||||
|
||||
public VertInfo(float red, float green, float blue, int brightness) {
|
||||
this.red = red;
|
||||
this.green = green;
|
||||
this.blue = blue;
|
||||
this.brightness = brightness;
|
||||
}
|
||||
|
||||
public static VertInfo avg(VertInfo...infos) {
|
||||
float r = 0F;
|
||||
float g = 0F;
|
||||
float b = 0F;
|
||||
int l = 0;
|
||||
|
||||
for(VertInfo vert : infos) {
|
||||
r += vert.red;
|
||||
g += vert.green;
|
||||
b += vert.blue;
|
||||
l += vert.brightness;
|
||||
}
|
||||
|
||||
r /= infos.length;
|
||||
g /= infos.length;
|
||||
b /= infos.length;
|
||||
l /= infos.length;
|
||||
|
||||
return new VertInfo(r, g, b, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
src/main/resources/assets/hbm/textures/blocks/test_ct.png
Normal file
BIN
src/main/resources/assets/hbm/textures/blocks/test_ct.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 122 B |
BIN
src/main/resources/assets/hbm/textures/blocks/test_ct_ct.png
Normal file
BIN
src/main/resources/assets/hbm/textures/blocks/test_ct_ct.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 161 B |
Loading…
x
Reference in New Issue
Block a user