From 0f25e6ec6b7e58f6e6e5cc5d64a9bcd5b19ad726 Mon Sep 17 00:00:00 2001 From: MachineMuse Date: Sat, 29 Jun 2013 04:34:50 -0600 Subject: [PATCH] Added tessellation methods to obj model, for ISBRH-friendliness --- .../client/model/obj/WavefrontObject.java | 45 ++++++++++++++++++- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/client/net/minecraftforge/client/model/obj/WavefrontObject.java b/client/net/minecraftforge/client/model/obj/WavefrontObject.java index 55603fbbb..35f287672 100644 --- a/client/net/minecraftforge/client/model/obj/WavefrontObject.java +++ b/client/net/minecraftforge/client/model/obj/WavefrontObject.java @@ -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;