Added tessellation methods to obj model, for ISBRH-friendliness

This commit is contained in:
MachineMuse 2013-06-29 04:34:50 -06:00
parent dac97174ff
commit 0f25e6ec6b
1 changed files with 43 additions and 2 deletions

View File

@ -169,13 +169,17 @@ public class WavefrontObject implements IModelCustom
{
tessellator.startDrawing(GL11.GL_TRIANGLES);
}
tessellateAll(tessellator);
tessellator.draw();
}
public void tessellateAll(Tessellator tessellator)
{
for (GroupObject groupObject : groupObjects)
{
groupObject.render(tessellator);
}
tessellator.draw();
}
public void renderOnly(String... groupNames)
@ -192,6 +196,19 @@ public class WavefrontObject implements IModelCustom
}
}
public void tessellateOnly(Tessellator tessellator, String... groupNames) {
for (GroupObject groupObject : groupObjects)
{
for (String groupName : groupNames)
{
if (groupName.equalsIgnoreCase(groupObject.name))
{
groupObject.render(tessellator);
}
}
}
}
public void renderPart(String partName)
{
for (GroupObject groupObject : groupObjects)
@ -203,6 +220,16 @@ public class WavefrontObject implements IModelCustom
}
}
public void tessellatePart(Tessellator tessellator, String partName) {
for (GroupObject groupObject : groupObjects)
{
if (partName.equalsIgnoreCase(groupObject.name))
{
groupObject.render(tessellator);
}
}
}
public void renderAllExcept(String... excludedGroupNames)
{
for (GroupObject groupObject : groupObjects)
@ -217,6 +244,20 @@ public class WavefrontObject implements IModelCustom
}
}
public void tessellateAllExcept(Tessellator tessellator, String... excludedGroupNames)
{
for (GroupObject groupObject : groupObjects)
{
for (String excludedGroupName : excludedGroupNames)
{
if (!excludedGroupName.equalsIgnoreCase(groupObject.name))
{
groupObject.render(tessellator);
}
}
}
}
private Vertex parseVertex(String line, int lineCount) throws ModelFormatException
{
Vertex vertex = null;