mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-13 00:47:32 +00:00
Rebase somehow derped. This is f33e7a535e
This commit is contained in:
1 parent
2dd426f1d7
commit
5d83d96d10
1 file changed
+35
-32
@@ -60,7 +60,9 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
if (data.length > 1)
|
||||
ent = (Entity) data[1];
|
||||
|
||||
int iconParts = toolIcons;// tool.getRenderPasses(item.getItemDamage());
|
||||
int iconParts = toolIcons;//tool.getRenderPasses(item.getItemDamage());
|
||||
// TODO: have the tools define how many render passes they have
|
||||
// (requires more logic rewrite than it sounds like)
|
||||
|
||||
IIcon[] tempParts = new IIcon[iconParts];
|
||||
label:
|
||||
@@ -105,8 +107,6 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
float[] yMin = new float[iconParts];
|
||||
float[] xMin = new float[iconParts];
|
||||
float[] yMax = new float[iconParts];
|
||||
int[] sheetWidth = new int[iconParts];
|
||||
int[] sheetHeight = new int[iconParts];
|
||||
float depth = 1f / 16f;
|
||||
|
||||
float[] width = new float[iconParts];
|
||||
@@ -122,14 +122,12 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
xMax[i] = icon.getMaxU();
|
||||
yMin[i] = icon.getMinV();
|
||||
yMax[i] = icon.getMaxV();
|
||||
sheetWidth[i] = icon.getIconWidth();
|
||||
sheetHeight[i] = icon.getIconHeight();
|
||||
width[i] = icon.getIconWidth();
|
||||
height[i] = icon.getIconHeight();
|
||||
xDiff[i] = xMin[i] - xMax[i];
|
||||
yDiff[i] = yMin[i] - yMax[i];
|
||||
width[i] = sheetWidth[i] * xDiff[i];
|
||||
height[i] = sheetHeight[i] * yDiff[i];
|
||||
xSub[i] = 0.5f * (xMax[i] - xMin[i]) / sheetWidth[i];
|
||||
ySub[i] = 0.5f * (yMax[i] - yMin[i]) / sheetHeight[i];
|
||||
xSub[i] = 0.5f * (xMax[i] - xMin[i]) / width[i];
|
||||
ySub[i] = 0.5f * (yMax[i] - yMin[i]) / height[i];
|
||||
}
|
||||
GL11.glPushMatrix();
|
||||
|
||||
@@ -192,19 +190,19 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
// make it have "depth"
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(-1, 0, 0);
|
||||
int k;
|
||||
float pos;
|
||||
float iconPos;
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (k = 0; k < width[i]; ++k)
|
||||
float w = width[i], m = xMax[i], d = xDiff[i], s = xSub[i];
|
||||
for (int k = 0, e = (int)w; k < e; ++k)
|
||||
{
|
||||
pos = k / width[i];
|
||||
iconPos = xMax[i] + xDiff[i] * pos - xSub[i];
|
||||
pos = k / w;
|
||||
iconPos = m + d * pos - s;
|
||||
tess.addVertexWithUV(pos, 0, -depth, iconPos, yMax[i]);
|
||||
tess.addVertexWithUV(pos, 0, 0, iconPos, yMax[i]);
|
||||
tess.addVertexWithUV(pos, 1, 0, iconPos, yMin[i]);
|
||||
tess.addVertexWithUV(pos, 0, 0, iconPos, yMax[i]);
|
||||
tess.addVertexWithUV(pos, 1, 0, iconPos, yMin[i]);
|
||||
tess.addVertexWithUV(pos, 1, -depth, iconPos, yMin[i]);
|
||||
}
|
||||
}
|
||||
@@ -216,14 +214,16 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (k = 0; k < width[i]; ++k)
|
||||
float w = width[i], m = xMax[i], d = xDiff[i], s = xSub[i];
|
||||
float d2 = 1f / w;
|
||||
for (int k = 0, e = (int)w; k < e; ++k)
|
||||
{
|
||||
pos = k / width[i];
|
||||
iconPos = xMax[i] + xDiff[i] * pos - xSub[i];
|
||||
posEnd = pos + 1 / width[i];
|
||||
pos = k / w;
|
||||
iconPos = m + d * pos - s;
|
||||
posEnd = pos + d2;
|
||||
tess.addVertexWithUV(posEnd, 1, -depth, iconPos, yMin[i]);
|
||||
tess.addVertexWithUV(posEnd, 1, 0, iconPos, yMin[i]);
|
||||
tess.addVertexWithUV(posEnd, 0, 0, iconPos, yMax[i]);
|
||||
tess.addVertexWithUV(posEnd, 1, 0, iconPos, yMin[i]);
|
||||
tess.addVertexWithUV(posEnd, 0, 0, iconPos, yMax[i]);
|
||||
tess.addVertexWithUV(posEnd, 0, -depth, iconPos, yMax[i]);
|
||||
}
|
||||
}
|
||||
@@ -234,13 +234,15 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (k = 0; k < height[i]; ++k)
|
||||
float h = height[i], m = yMax[i], d = yDiff[i], s = ySub[i];
|
||||
float d2 = 1f / h;
|
||||
for (int k = 0, e = (int)h; k < e; ++k)
|
||||
{
|
||||
pos = k / height[i];
|
||||
iconPos = yMax[i] + yDiff[i] * pos - ySub[i];
|
||||
posEnd = pos + 1 / height[i];
|
||||
tess.addVertexWithUV(0, posEnd, 0, xMax[i], iconPos);
|
||||
tess.addVertexWithUV(1, posEnd, 0, xMin[i], iconPos);
|
||||
pos = k / h;
|
||||
iconPos = m + d * pos - s;
|
||||
posEnd = pos + d2;
|
||||
tess.addVertexWithUV(0, posEnd, 0, xMax[i], iconPos);
|
||||
tess.addVertexWithUV(1, posEnd, 0, xMin[i], iconPos);
|
||||
tess.addVertexWithUV(1, posEnd, -depth, xMin[i], iconPos);
|
||||
tess.addVertexWithUV(0, posEnd, -depth, xMax[i], iconPos);
|
||||
}
|
||||
@@ -252,12 +254,13 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (k = 0; k < height[i]; ++k)
|
||||
float h = height[i], m = yMax[i], d = yDiff[i], s = ySub[i];
|
||||
for (int k = 0, e = (int)h; k < e; ++k)
|
||||
{
|
||||
pos = k / height[i];
|
||||
iconPos = yMax[i] + yDiff[i] * pos - ySub[i];
|
||||
tess.addVertexWithUV(1, pos, 0, xMin[i], iconPos);
|
||||
tess.addVertexWithUV(0, pos, 0, xMax[i], iconPos);
|
||||
pos = k / h;
|
||||
iconPos = m + d * pos - s;
|
||||
tess.addVertexWithUV(1, pos, 0, xMin[i], iconPos);
|
||||
tess.addVertexWithUV(0, pos, 0, xMax[i], iconPos);
|
||||
tess.addVertexWithUV(0, pos, -depth, xMax[i], iconPos);
|
||||
tess.addVertexWithUV(1, pos, -depth, xMin[i], iconPos);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user