From 0f25e6ec6b7e58f6e6e5cc5d64a9bcd5b19ad726 Mon Sep 17 00:00:00 2001 From: MachineMuse Date: Sat, 29 Jun 2013 04:34:50 -0600 Subject: [PATCH 1/3] 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; From ca011729d36e2cbdc520d712ef1acdb98b950681 Mon Sep 17 00:00:00 2001 From: MachineMuse Date: Sat, 29 Jun 2013 23:24:03 -0600 Subject: [PATCH 2/3] Fixed both RenderAllExcept behaviours --- .../client/model/obj/WavefrontObject.java | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/client/net/minecraftforge/client/model/obj/WavefrontObject.java b/client/net/minecraftforge/client/model/obj/WavefrontObject.java index 35f287672..a9ff77ea4 100644 --- a/client/net/minecraftforge/client/model/obj/WavefrontObject.java +++ b/client/net/minecraftforge/client/model/obj/WavefrontObject.java @@ -232,29 +232,41 @@ public class WavefrontObject implements IModelCustom public void renderAllExcept(String... excludedGroupNames) { + boolean exclude; for (GroupObject groupObject : groupObjects) { + exclude=false; for (String excludedGroupName : excludedGroupNames) { - if (!excludedGroupName.equalsIgnoreCase(groupObject.name)) + if (excludedGroupName.equalsIgnoreCase(groupObject.name)) { - groupObject.render(); + exclude=true; } } + if(!exclude) + { + groupObject.render(); + } } } public void tessellateAllExcept(Tessellator tessellator, String... excludedGroupNames) { + boolean exclude; for (GroupObject groupObject : groupObjects) { + exclude=false; for (String excludedGroupName : excludedGroupNames) { - if (!excludedGroupName.equalsIgnoreCase(groupObject.name)) + if (excludedGroupName.equalsIgnoreCase(groupObject.name)) { - groupObject.render(tessellator); + exclude=true; } } + if(!exclude) + { + groupObject.render(tessellator); + } } } @@ -388,7 +400,7 @@ public class WavefrontObject implements IModelCustom face.vertices = new Vertex[tokens.length]; face.textureCoordinates = new TextureCoordinate[tokens.length]; face.vertexNormals = new Vertex[tokens.length]; - + for (int i = 0; i < tokens.length; ++i) { subTokens = tokens[i].split("/"); @@ -405,7 +417,7 @@ public class WavefrontObject implements IModelCustom { face.vertices = new Vertex[tokens.length]; face.textureCoordinates = new TextureCoordinate[tokens.length]; - + for (int i = 0; i < tokens.length; ++i) { subTokens = tokens[i].split("/"); @@ -421,7 +433,7 @@ public class WavefrontObject implements IModelCustom { face.vertices = new Vertex[tokens.length]; face.vertexNormals = new Vertex[tokens.length]; - + for (int i = 0; i < tokens.length; ++i) { subTokens = tokens[i].split("//"); @@ -436,7 +448,7 @@ public class WavefrontObject implements IModelCustom else if (isValidFace_V_Line(line)) { face.vertices = new Vertex[tokens.length]; - + for (int i = 0; i < tokens.length; ++i) { face.vertices[i] = vertices.get(Integer.parseInt(tokens[i]) - 1); From 2c9e11299e86f3ea27a9dba956965f63f4c78f63 Mon Sep 17 00:00:00 2001 From: RedmenNL Date: Wed, 26 Jun 2013 15:20:14 +0200 Subject: [PATCH 3/3] Added more render methods to IModelCustom interface. --- client/net/minecraftforge/client/model/IModelCustom.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/net/minecraftforge/client/model/IModelCustom.java b/client/net/minecraftforge/client/model/IModelCustom.java index 35b4c01ea..dce97e39e 100644 --- a/client/net/minecraftforge/client/model/IModelCustom.java +++ b/client/net/minecraftforge/client/model/IModelCustom.java @@ -5,5 +5,7 @@ package net.minecraftforge.client.model; public interface IModelCustom { String getType(); void renderAll(); + void renderOnly(String... groupNames); void renderPart(String partName); + void renderAllExcept(String... excludedGroupNames); }