2013-03-15 03:14:02 +01:00
|
|
|
package net.minecraftforge.client.model.obj;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
2013-03-19 03:37:03 +01:00
|
|
|
import net.minecraft.client.renderer.Tessellator;
|
2013-04-02 20:38:24 +02:00
|
|
|
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
|
2013-03-15 03:14:02 +01:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
2013-04-03 03:17:40 +02:00
|
|
|
public class GroupObject
|
|
|
|
{
|
2013-03-15 03:14:02 +01:00
|
|
|
|
2013-03-19 20:21:10 +01:00
|
|
|
public String name;
|
|
|
|
public ArrayList<Face> faces = new ArrayList<Face>();
|
2013-04-02 20:38:24 +02:00
|
|
|
public int glDrawingMode;
|
2013-04-03 03:17:40 +02:00
|
|
|
|
|
|
|
public GroupObject()
|
|
|
|
{
|
2013-04-02 20:38:24 +02:00
|
|
|
this("");
|
2013-03-19 20:21:10 +01:00
|
|
|
}
|
2013-03-15 03:14:02 +01:00
|
|
|
|
2013-04-03 03:17:40 +02:00
|
|
|
public GroupObject(String name)
|
|
|
|
{
|
2013-04-02 20:38:24 +02:00
|
|
|
this(name, GL11.GL_TRIANGLES);
|
2013-03-19 03:37:03 +01:00
|
|
|
}
|
2013-04-03 03:17:40 +02:00
|
|
|
|
|
|
|
public GroupObject(String name, int glDrawingMode)
|
|
|
|
{
|
2013-04-02 20:38:24 +02:00
|
|
|
this.name = name;
|
|
|
|
this.glDrawingMode = glDrawingMode;
|
2013-03-28 05:02:15 +01:00
|
|
|
}
|
|
|
|
|
2013-04-03 03:17:40 +02:00
|
|
|
public void render()
|
|
|
|
{
|
|
|
|
if (faces.size() > 0)
|
|
|
|
{
|
2013-04-02 20:38:24 +02:00
|
|
|
Tessellator tessellator = Tessellator.instance;
|
|
|
|
tessellator.startDrawing(glDrawingMode);
|
2013-04-03 03:17:40 +02:00
|
|
|
render(tessellator);
|
2013-04-02 20:38:24 +02:00
|
|
|
tessellator.draw();
|
2013-03-28 05:02:15 +01:00
|
|
|
}
|
|
|
|
}
|
2013-04-03 03:17:40 +02:00
|
|
|
|
|
|
|
public void render(Tessellator tessellator)
|
|
|
|
{
|
|
|
|
if (faces.size() > 0)
|
|
|
|
{
|
|
|
|
for (Face face : faces)
|
|
|
|
{
|
2013-04-03 02:29:00 +02:00
|
|
|
face.addFaceForRender(tessellator);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-03-15 03:14:02 +01:00
|
|
|
}
|