下面列出了net.minecraft.util.IIcon#getInterpolatedV ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
void set(double x, double y, double z, IIcon icon, IIcon icon1, IIcon icon2) {
tessellator = Tessellator.instance;
i0u0 = icon.getMinU();
i0uh = icon.getInterpolatedU(8.0D);
i0u1 = icon.getMaxU();
i0v0 = icon.getMinV();
i0v1 = icon.getMaxV();
i1u0 = icon1.getInterpolatedU(7.0D);
i1u1 = icon1.getInterpolatedU(9.0D);
i1v0 = icon1.getMinV();
i1vh = icon1.getInterpolatedV(8.0D);
i1v1 = icon1.getMaxV();
i1v = i1v1 - i1v0;
i2u0 = icon2.getInterpolatedU(7.0D);
i2u1 = icon2.getInterpolatedU(9.0D);
i2v0 = icon2.getMinV();
i2v1 = icon2.getMaxV();
i2v = i2v1 - i2v0;
x0 = x;
xh = x0 + 0.5D;
x1 = x + 1;
xp0 = x0 + 0.5D - 0.0625D;
xp1 = x0 + 0.5D + 0.0625D;
z0 = z;
zh = z0 + 0.5D;
z1 = z + 1;
zp0 = z0 + 0.5D - 0.0625D;
zp1 = z0 + 0.5D + 0.0625D;
y0 = y;
y1 = y + 1;
}
public void drawCrossedSquares(IIcon icon, double x, double y, double z, float scale)
{
Tessellator tessellator = Tessellator.instance;
x += state.renderOffsetX;
y += state.renderOffsetY;
z += state.renderOffsetZ;
double uMin = icon.getInterpolatedU(state.renderMinX * 16.0D);
double uMax = icon.getInterpolatedU(state.renderMaxX * 16.0D);
double vMin = icon.getInterpolatedV(16 - state.renderMaxY * 16.0D);
double vMax = icon.getInterpolatedV(16 - state.renderMinY * 16.0D);
double d7 = 0.45D * (double)scale;
double xMin = x + 0.5D - d7;
double xMax = x + 0.5D + d7;
double yMin = y + state.renderMinY * scale;
double yMax = y + state.renderMaxY * scale;
double zMin = z + 0.5D - d7;
double zMax = z + 0.5D + d7;
tessellator.addVertexWithUV(xMin, yMax, zMin, uMin, vMin);
tessellator.addVertexWithUV(xMin, yMin, zMin, uMin, vMax);
tessellator.addVertexWithUV(xMax, yMin, zMax, uMax, vMax);
tessellator.addVertexWithUV(xMax, yMax, zMax, uMax, vMin);
tessellator.addVertexWithUV(xMax, yMax, zMax, uMin, vMin);
tessellator.addVertexWithUV(xMax, yMin, zMax, uMin, vMax);
tessellator.addVertexWithUV(xMin, yMin, zMin, uMax, vMax);
tessellator.addVertexWithUV(xMin, yMax, zMin, uMax, vMin);
tessellator.addVertexWithUV(xMin, yMax, zMax, uMin, vMin);
tessellator.addVertexWithUV(xMin, yMin, zMax, uMin, vMax);
tessellator.addVertexWithUV(xMax, yMin, zMin, uMax, vMax);
tessellator.addVertexWithUV(xMax, yMax, zMin, uMax, vMin);
tessellator.addVertexWithUV(xMax, yMax, zMin, uMin, vMin);
tessellator.addVertexWithUV(xMax, yMin, zMin, uMin, vMax);
tessellator.addVertexWithUV(xMin, yMin, zMax, uMax, vMax);
tessellator.addVertexWithUV(xMin, yMax, zMax, uMax, vMin);
}
private void drawCrossedSquares(RenderBlocks renderer, IIcon icon, double x, double y, double z, float scale)
{
Tessellator tessellator = Tessellator.instance;
if (renderer.hasOverrideBlockTexture())
icon = renderer.overrideBlockTexture;
double uMin = icon.getInterpolatedU(renderer.renderMinX * 16.0D);
double uMax = icon.getInterpolatedU(renderer.renderMaxX * 16.0D);
double vMin = icon.getInterpolatedV(16 - renderer.renderMaxY * 16.0D);
double vMax = icon.getInterpolatedV(16 - renderer.renderMinY * 16.0D);
double d7 = 0.45D * (double)scale;
double xMin = x + 0.5D - d7;
double xMax = x + 0.5D + d7;
double yMin = y + renderer.renderMinY * scale;
double yMax = y + renderer.renderMaxY * scale;
double zMin = z + 0.5D - d7;
double zMax = z + 0.5D + d7;
tessellator.addVertexWithUV(xMin, yMax, zMin, uMin, vMin);
tessellator.addVertexWithUV(xMin, yMin, zMin, uMin, vMax);
tessellator.addVertexWithUV(xMax, yMin, zMax, uMax, vMax);
tessellator.addVertexWithUV(xMax, yMax, zMax, uMax, vMin);
tessellator.addVertexWithUV(xMax, yMax, zMax, uMin, vMin);
tessellator.addVertexWithUV(xMax, yMin, zMax, uMin, vMax);
tessellator.addVertexWithUV(xMin, yMin, zMin, uMax, vMax);
tessellator.addVertexWithUV(xMin, yMax, zMin, uMax, vMin);
tessellator.addVertexWithUV(xMin, yMax, zMax, uMin, vMin);
tessellator.addVertexWithUV(xMin, yMin, zMax, uMin, vMax);
tessellator.addVertexWithUV(xMax, yMin, zMin, uMax, vMax);
tessellator.addVertexWithUV(xMax, yMax, zMin, uMax, vMin);
tessellator.addVertexWithUV(xMax, yMax, zMin, uMin, vMin);
tessellator.addVertexWithUV(xMax, yMin, zMin, uMin, vMax);
tessellator.addVertexWithUV(xMin, yMin, zMax, uMax, vMax);
tessellator.addVertexWithUV(xMin, yMax, zMax, uMax, vMin);
}
void set(double x, double y, double z, IIcon icon, IIcon icon1, IIcon icon2)
{
tessellator = Tessellator.instance;
i0u0 = icon.getMinU();
i0uh = icon.getInterpolatedU(8.0D);
i0u1 = icon.getMaxU();
i0v0 = icon.getMinV();
i0v1 = icon.getMaxV();
i1u0 = icon1.getInterpolatedU(7.0D);
i1u1 = icon1.getInterpolatedU(9.0D);
i1v0 = icon1.getMinV();
i1vh = icon1.getInterpolatedV(8.0D);
i1v1 = icon1.getMaxV();
i1v = i1v1 - i1v0;
i2u0 = icon2.getInterpolatedU(7.0D);
i2u1 = icon2.getInterpolatedU(9.0D);
i2v0 = icon2.getMinV();
i2v1 = icon2.getMaxV();
i2v = i2v1 - i2v0;
x0 = x;
xh = x0 + 0.5D;
x1 = x + 1;
xp0 = x0 + 0.5D - 0.0625D;
xp1 = x0 + 0.5D + 0.0625D;
z0 = z;
zh = z0 + 0.5D;
z1 = z + 1;
zp0 = z0 + 0.5D - 0.0625D;
zp1 = z0 + 0.5D + 0.0625D;
y0 = y;
y1 = y + 1;
}
void setupSides(IIcon icon, int a, int b, int c, int d, int e, int ta, int tb, int tc, int td) {
L[a] = brightnessBottomLeft;
L[b] = brightnessBottomRight;
L[c] = brightnessTopRight;
L[d] = brightnessTopLeft;
L[e] = (brightnessBottomLeft + brightnessTopLeft + brightnessTopRight + brightnessBottomRight) / 4;
R[a] = colorRedBottomLeft;
R[b] = colorRedBottomRight;
R[c] = colorRedTopRight;
R[d] = colorRedTopLeft;
R[e] = (colorRedBottomLeft + colorRedTopLeft + colorRedTopRight + colorRedBottomRight) / 4;
G[a] = colorGreenBottomLeft;
G[b] = colorGreenBottomRight;
G[c] = colorGreenTopRight;
G[d] = colorGreenTopLeft;
G[e] = (colorGreenBottomLeft + colorGreenTopLeft + colorGreenTopRight + colorGreenBottomRight) / 4;
B[a] = colorBlueBottomLeft;
B[b] = colorBlueBottomRight;
B[c] = colorBlueTopRight;
B[d] = colorBlueTopLeft;
B[e] = (colorBlueBottomLeft + colorBlueTopLeft + colorBlueTopRight + colorBlueBottomRight) / 4;
double u0 = icon.getMaxU();
double u1 = icon.getMinU();
double v0 = icon.getMaxV();
double v1 = icon.getMinV();
U[ta] = u0;
U[tb] = u0;
U[tc] = u1;
U[td] = u1;
U[e] = icon.getInterpolatedU(8.0D);
V[ta] = v0;
V[tb] = v1;
V[tc] = v1;
V[td] = v0;
V[e] = icon.getInterpolatedV(8.0D);
}
private void drawLiquidSpiral(int src, int dst, FluidStack stack, double start, double end, double time, double theta0, double x, double y, double z)
{
IIcon tex = RenderUtils.prepareFluidRender(stack, 255);
CCRenderState.startDrawing(7);
Tessellator t = Tessellator.instance;
t.setTranslation(x, y, z);
Vector3[] last = new Vector3[]{new Vector3(), new Vector3(), new Vector3(), new Vector3()};
Vector3[] next = new Vector3[]{new Vector3(), new Vector3(), new Vector3(), new Vector3()};
double tess = 0.05;
Vector3 a = getPerp(src, dst);
boolean rev = sum(a.copy().crossProduct(getPathNormal(src, dst, 0))) != sum(sideVec[src]);
for(double di = end; di <= start; di+=tess)
{
Vector3 b = getPathNormal(src, dst, di);
Vector3 c = getPath(src, dst, di);
if(rev)
b.negate();
double r = (2*di-time/10+theta0+dst/6)*2*Math.PI;
double sz = 0.1;
Vector3 p = c.add(a.copy().multiply(MathHelper.sin(r)*sz)).add(b.copy().multiply(MathHelper.cos(r)*sz));
double s1 = 0.02;
double s2 =-0.02;
next[0].set(p).add(a.x*s1+b.x*s1, a.y*s1+b.y*s1, a.z*s1+b.z*s1);
next[1].set(p).add(a.x*s2+b.x*s1, a.y*s2+b.y*s1, a.z*s2+b.z*s1);
next[2].set(p).add(a.x*s2+b.x*s2, a.y*s2+b.y*s2, a.z*s2+b.z*s2);
next[3].set(p).add(a.x*s1+b.x*s2, a.y*s1+b.y*s2, a.z*s1+b.z*s2);
if(di > end)
{
double u1 = tex.getInterpolatedU(Math.abs(di)*16);
double u2 = tex.getInterpolatedU(Math.abs(di-tess)*16);
for(int i = 0; i < 4; i++)
{
int j = (i+1)%4;
Vector3 axis = next[j].copy().subtract(next[i]);
double v1 = tex.getInterpolatedV(Math.abs(next[i].scalarProject(axis))*16);
double v2 = tex.getInterpolatedV(Math.abs(next[j].scalarProject(axis))*16);
t.addVertexWithUV(next[i].x, next[i].y, next[i].z, u1, v1);
t.addVertexWithUV(next[j].x, next[j].y, next[j].z, u1, v2);
t.addVertexWithUV(last[j].x, last[j].y, last[j].z, u2, v2);
t.addVertexWithUV(last[i].x, last[i].y, last[i].z, u2, v1);
}
}
Vector3[] tmp = last;
last = next;
next = tmp;
}
CCRenderState.draw();
t.setTranslation(0, 0, 0);
RenderUtils.postFluidRender();
}
private void setUV (IIcon icon, double uMin, double vMin, double uMax, double vMax) {
uv[0] = icon.getInterpolatedU(uMin * 16);
uv[1] = icon.getInterpolatedU(uMax * 16);
uv[2] = icon.getInterpolatedV(vMin * 16);
uv[3] = icon.getInterpolatedV(vMax * 16);
}
public void drawCrossedSquaresBounded(IIcon icon, double x, double y, double z, float scale)
{
Tessellator tessellator = Tessellator.instance;
x += state.renderOffsetX;
y += state.renderOffsetY;
z += state.renderOffsetZ;
double vMin = icon.getInterpolatedV(16 - state.renderMaxY * 16.0D);
double vMax = icon.getInterpolatedV(16 - state.renderMinY * 16.0D);
double xzNN = Math.max(state.renderMinX, state.renderMinZ);
double xzPP = Math.min(state.renderMaxX, state.renderMaxZ);
double xNN = x + .5 - (.5 - xzNN) * 0.9;
double zNN = z + .5 - (.5 - xzNN) * 0.9;
double xNP = x + .5 - (.5 - Math.max(state.renderMinX, 1 - state.renderMaxZ)) * 0.9;
double zNP = z + .5 - (.5 - Math.min(1 - state.renderMinX, state.renderMaxZ)) * 0.9;
double xPN = x + .5 - (.5 - Math.min(state.renderMaxX, 1 - state.renderMinZ)) * 0.9;
double zPN = z + .5 - (.5 - Math.max(1 - state.renderMaxX, state.renderMinZ)) * 0.9;
double xPP = x + .5 - (.5 - xzPP) * 0.9;
double zPP = z + .5 - (.5 - xzPP) * 0.9;
double yMin = y + state.renderMinY * scale;
double yMax = y + state.renderMaxY * scale;
double uNN = icon.getInterpolatedU(xzNN * 16.0D);
double uPP = icon.getInterpolatedU(xzPP * 16.0D);
tessellator.addVertexWithUV(xNN, yMax, zNN, uNN, vMin);
tessellator.addVertexWithUV(xNN, yMin, zNN, uNN, vMax);
tessellator.addVertexWithUV(xPP, yMin, zPP, uPP, vMax);
tessellator.addVertexWithUV(xPP, yMax, zPP, uPP, vMin);
uNN = icon.getInterpolatedU(16 - xzNN * 16.0D);
uPP = icon.getInterpolatedU(16 - xzPP * 16.0D);
tessellator.addVertexWithUV(xPP, yMax, zPP, uPP, vMin);
tessellator.addVertexWithUV(xPP, yMin, zPP, uPP, vMax);
tessellator.addVertexWithUV(xNN, yMin, zNN, uNN, vMax);
tessellator.addVertexWithUV(xNN, yMax, zNN, uNN, vMin);
double uNP = icon.getInterpolatedU(Math.max(state.renderMinX, 1 - state.renderMaxZ) * 16.0D);
double uPN = icon.getInterpolatedU(Math.min(state.renderMaxX, 1 - state.renderMinZ) * 16.0D);
tessellator.addVertexWithUV(xNP, yMax, zNP, uNP, vMin);
tessellator.addVertexWithUV(xNP, yMin, zNP, uNP, vMax);
tessellator.addVertexWithUV(xPN, yMin, zPN, uPN, vMax);
tessellator.addVertexWithUV(xPN, yMax, zPN, uPN, vMin);
uNP = icon.getInterpolatedU(16 - Math.max(state.renderMinX, 1 - state.renderMaxZ) * 16.0D);
uPN = icon.getInterpolatedU(16 - Math.min(state.renderMaxX, 1 - state.renderMinZ) * 16.0D);
tessellator.addVertexWithUV(xPN, yMax, zPN, uPN, vMin);
tessellator.addVertexWithUV(xPN, yMin, zPN, uPN, vMax);
tessellator.addVertexWithUV(xNP, yMin, zNP, uNP, vMax);
tessellator.addVertexWithUV(xNP, yMax, zNP, uNP, vMin);
}
void setupSides(IIcon icon, int a, int b, int c, int d, int e, int ta, int tb, int tc, int td)
{
L[a] = brightnessBottomLeft;
L[b] = brightnessBottomRight;
L[c] = brightnessTopRight;
L[d] = brightnessTopLeft;
L[e] = (brightnessBottomLeft + brightnessTopLeft + brightnessTopRight + brightnessBottomRight) / 4;
R[a] = colorRedBottomLeft;
R[b] = colorRedBottomRight;
R[c] = colorRedTopRight;
R[d] = colorRedTopLeft;
R[e] = (colorRedBottomLeft + colorRedTopLeft + colorRedTopRight + colorRedBottomRight) / 4;
G[a] = colorGreenBottomLeft;
G[b] = colorGreenBottomRight;
G[c] = colorGreenTopRight;
G[d] = colorGreenTopLeft;
G[e] = (colorGreenBottomLeft + colorGreenTopLeft + colorGreenTopRight + colorGreenBottomRight) / 4;
B[a] = colorBlueBottomLeft;
B[b] = colorBlueBottomRight;
B[c] = colorBlueTopRight;
B[d] = colorBlueTopLeft;
B[e] = (colorBlueBottomLeft + colorBlueTopLeft + colorBlueTopRight + colorBlueBottomRight) / 4;
double u0 = icon.getMaxU();
double u1 = icon.getMinU();
double v0 = icon.getMaxV();
double v1 = icon.getMinV();
U[ta] = u0;
U[tb] = u0;
U[tc] = u1;
U[td] = u1;
U[e] = icon.getInterpolatedU(8.0D);
V[ta] = v0;
V[tb] = v1;
V[tc] = v1;
V[td] = v0;
V[e] = icon.getInterpolatedV(8.0D);
}
private static void renderRotorBladeConnection(RenderBlocks renderer, Block block, int metadata,
ForgeDirection rotorDir, ForgeDirection bladeDir, int x, int y, int z, boolean drawOuterRectangle) {
// This is the dimension in which the blade expands
ForgeDirection normal = findNormal(rotorDir, bladeDir);
// Used for proper calculation of the IJK coords
int rotorDirMultiplier = rotorDir.offsetX < 0 || rotorDir.offsetY < 0 || rotorDir.offsetZ < 0 ? -1 : 1;
int bladeDirMultiplier = bladeDir.offsetX < 0 || bladeDir.offsetY < 0 || bladeDir.offsetZ < 0 ? -1 : 1;
int normalDirMultiplier = normal.offsetX < 0 || normal.offsetY < 0 || normal.offsetZ < 0 ? -1 : 1;
// Compute the 8 coordinates of the inner and outer rectangles in IJK space, which we'll re-orient later
// I = blade dir, J = rotor dir, K = normal dir
double rotorDirectionOffset = 0.05D;
double bladeInnerOffset = 0.2D;
double bladeOuterOffset = 0.5D;
double normalInnerOffset = 0.2D;
double normalOuterOffset = 0.4D;
double rotorOffsets[] = new double[8];
rotorOffsets[0] = rotorOffsets[3] = rotorOffsets[4] = rotorOffsets[7] = 0.5D + (rotorDirMultiplier * rotorDirectionOffset);
rotorOffsets[1] = rotorOffsets[2] = rotorOffsets[5] = rotorOffsets[6] = 0.5D - (rotorDirMultiplier * rotorDirectionOffset);
double bladeOffsets[] = new double[8];
bladeOffsets[0] = bladeOffsets[1] = bladeOffsets[2] = bladeOffsets[3] = 0.5D + (bladeDirMultiplier * bladeInnerOffset);
bladeOffsets[4] = bladeOffsets[5] = bladeOffsets[6] = bladeOffsets[7] = 0.5D + (bladeDirMultiplier * bladeOuterOffset);
double normalOffsets[] = new double[8];
normalOffsets[0] = normalOffsets[1] = 0.5D - (normalDirMultiplier * normalInnerOffset);
normalOffsets[2] = normalOffsets[3] = 0.5D + (normalDirMultiplier * normalInnerOffset);
normalOffsets[4] = normalOffsets[5] = 0.5D - (normalDirMultiplier * normalOuterOffset);
normalOffsets[6] = normalOffsets[7] = 0.5D + (normalDirMultiplier * normalOuterOffset);
// Now calculate our 8 coordinates in XYZ space from IJK space
double[] xCoords = {0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D};
double[] yCoords = {0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D};
double[] zCoords = {0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D};
int xMagRotor = Math.abs(rotorDir.offsetX);
int xMagBlade = Math.abs(bladeDir.offsetX);
int xMagNormal = Math.abs(normal.offsetX);
int yMagRotor = Math.abs(rotorDir.offsetY);
int yMagBlade = Math.abs(bladeDir.offsetY);
int yMagNormal = Math.abs(normal.offsetY);
int zMagRotor = Math.abs(rotorDir.offsetZ);
int zMagBlade = Math.abs(bladeDir.offsetZ);
int zMagNormal = Math.abs(normal.offsetZ);
for(int i = 0; i < 8; i++) {
xCoords[i] = rotorOffsets[i] * xMagRotor + bladeOffsets[i] * xMagBlade + normalOffsets[i] * xMagNormal;
yCoords[i] = rotorOffsets[i] * yMagRotor + bladeOffsets[i] * yMagBlade + normalOffsets[i] * yMagNormal;
zCoords[i] = rotorOffsets[i] * zMagRotor + bladeOffsets[i] * zMagBlade + normalOffsets[i] * zMagNormal;
}
// Calculate UV coords for each face.
double[] u = {0D, 0D, 16D, 16D};
double[] v = {0D, 16D, 16D, 0D};
IIcon IIcon = BigReactors.blockTurbineRotorPart.getRotorConnectorIcon();
for(int i = 0; i < 4; i++) {
u[i] = IIcon.getInterpolatedU(u[i]);
v[i] = IIcon.getInterpolatedV(v[i]);
}
// Element buffer, which of these do we draw?
int[][] quads;
if(rotorDir.offsetX != 0 || (bladeDir.offsetX != 0 && rotorDir.offsetY != 0)) {
quads = quadSet2;
}
else {
quads = quadSet1;
}
Tessellator tessellator = Tessellator.instance;
tessellator.addTranslation(x, y, z);
for(int face = drawOuterRectangle ? 0 : 1; face < quads.length; face++) {
for(int vertex = 0; vertex < quads[face].length; vertex++) {
int idx = quads[face][vertex];
tessellator.addVertexWithUV(xCoords[idx], yCoords[idx], zCoords[idx], u[vertex], v[vertex]);
}
}
tessellator.addTranslation(-x, -y, -z);
renderer.setRenderBounds(0D, 0D, 0D, 1D, 1D, 1D);
}
private static void renderRotorBladeConnection(RenderBlocks renderer, Block block, int metadata,
ForgeDirection rotorDir, ForgeDirection bladeDir, int x, int y, int z, boolean drawOuterRectangle) {
// This is the dimension in which the blade expands
ForgeDirection normal = findNormal(rotorDir, bladeDir);
// Used for proper calculation of the IJK coords
int rotorDirMultiplier = rotorDir.offsetX < 0 || rotorDir.offsetY < 0 || rotorDir.offsetZ < 0 ? -1 : 1;
int bladeDirMultiplier = bladeDir.offsetX < 0 || bladeDir.offsetY < 0 || bladeDir.offsetZ < 0 ? -1 : 1;
int normalDirMultiplier = normal.offsetX < 0 || normal.offsetY < 0 || normal.offsetZ < 0 ? -1 : 1;
// Compute the 8 coordinates of the inner and outer rectangles in IJK space, which we'll re-orient later
// I = blade dir, J = rotor dir, K = normal dir
double rotorDirectionOffset = 0.05D;
double bladeInnerOffset = 0.2D;
double bladeOuterOffset = 0.5D;
double normalInnerOffset = 0.2D;
double normalOuterOffset = 0.4D;
double rotorOffsets[] = new double[8];
rotorOffsets[0] = rotorOffsets[3] = rotorOffsets[4] = rotorOffsets[7] = 0.5D + (rotorDirMultiplier * rotorDirectionOffset);
rotorOffsets[1] = rotorOffsets[2] = rotorOffsets[5] = rotorOffsets[6] = 0.5D - (rotorDirMultiplier * rotorDirectionOffset);
double bladeOffsets[] = new double[8];
bladeOffsets[0] = bladeOffsets[1] = bladeOffsets[2] = bladeOffsets[3] = 0.5D + (bladeDirMultiplier * bladeInnerOffset);
bladeOffsets[4] = bladeOffsets[5] = bladeOffsets[6] = bladeOffsets[7] = 0.5D + (bladeDirMultiplier * bladeOuterOffset);
double normalOffsets[] = new double[8];
normalOffsets[0] = normalOffsets[1] = 0.5D - (normalDirMultiplier * normalInnerOffset);
normalOffsets[2] = normalOffsets[3] = 0.5D + (normalDirMultiplier * normalInnerOffset);
normalOffsets[4] = normalOffsets[5] = 0.5D - (normalDirMultiplier * normalOuterOffset);
normalOffsets[6] = normalOffsets[7] = 0.5D + (normalDirMultiplier * normalOuterOffset);
// Now calculate our 8 coordinates in XYZ space from IJK space
double[] xCoords = {0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D};
double[] yCoords = {0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D};
double[] zCoords = {0D, 0D, 0D, 0D, 0D, 0D, 0D, 0D};
int xMagRotor = Math.abs(rotorDir.offsetX);
int xMagBlade = Math.abs(bladeDir.offsetX);
int xMagNormal = Math.abs(normal.offsetX);
int yMagRotor = Math.abs(rotorDir.offsetY);
int yMagBlade = Math.abs(bladeDir.offsetY);
int yMagNormal = Math.abs(normal.offsetY);
int zMagRotor = Math.abs(rotorDir.offsetZ);
int zMagBlade = Math.abs(bladeDir.offsetZ);
int zMagNormal = Math.abs(normal.offsetZ);
for(int i = 0; i < 8; i++) {
xCoords[i] = rotorOffsets[i] * xMagRotor + bladeOffsets[i] * xMagBlade + normalOffsets[i] * xMagNormal;
yCoords[i] = rotorOffsets[i] * yMagRotor + bladeOffsets[i] * yMagBlade + normalOffsets[i] * yMagNormal;
zCoords[i] = rotorOffsets[i] * zMagRotor + bladeOffsets[i] * zMagBlade + normalOffsets[i] * zMagNormal;
}
// Calculate UV coords for each face.
double[] u = {0D, 0D, 16D, 16D};
double[] v = {0D, 16D, 16D, 0D};
IIcon IIcon = BigReactors.blockTurbineRotorPart.getRotorConnectorIcon();
for(int i = 0; i < 4; i++) {
u[i] = IIcon.getInterpolatedU(u[i]);
v[i] = IIcon.getInterpolatedV(v[i]);
}
// Element buffer, which of these do we draw?
int[][] quads;
if(rotorDir.offsetX != 0 || (bladeDir.offsetX != 0 && rotorDir.offsetY != 0)) {
quads = quadSet2;
}
else {
quads = quadSet1;
}
Tessellator tessellator = Tessellator.instance;
tessellator.addTranslation(x, y, z);
for(int face = drawOuterRectangle ? 0 : 1; face < quads.length; face++) {
for(int vertex = 0; vertex < quads[face].length; vertex++) {
int idx = quads[face][vertex];
tessellator.addVertexWithUV(xCoords[idx], yCoords[idx], zCoords[idx], u[vertex], v[vertex]);
}
}
tessellator.addTranslation(-x, -y, -z);
renderer.setRenderBounds(0D, 0D, 0D, 1D, 1D, 1D);
}