/** * Draw this primitve. This is typically called only once as the generated drawing instructions are saved by the * renderer and reused later. */ public void draw(VertexBuffer renderer, float scale) { Vec3d vec3d = this.vertexPositions[1].vector3D.subtractReverse(this.vertexPositions[0].vector3D); Vec3d vec3d1 = this.vertexPositions[1].vector3D.subtractReverse(this.vertexPositions[2].vector3D); Vec3d vec3d2 = vec3d1.crossProduct(vec3d).normalize(); float f = (float)vec3d2.xCoord; float f1 = (float)vec3d2.yCoord; float f2 = (float)vec3d2.zCoord; if (this.invertNormal) { f = -f; f1 = -f1; f2 = -f2; } renderer.begin(7, DefaultVertexFormats.OLDMODEL_POSITION_TEX_NORMAL); for (int i = 0; i < 4; ++i) { PositionTextureVertex positiontexturevertex = this.vertexPositions[i]; renderer.pos(positiontexturevertex.vector3D.xCoord * (double)scale, positiontexturevertex.vector3D.yCoord * (double)scale, positiontexturevertex.vector3D.zCoord * (double)scale).tex((double)positiontexturevertex.texturePositionX, (double)positiontexturevertex.texturePositionY).normal(f, f1, f2).endVertex(); } Tessellator.getInstance().draw(); }
/** * Compiles a GL display list for this model */ private void compileDisplayList(float scale) { this.displayList = GLAllocation.generateDisplayLists(1); GlStateManager.glNewList(this.displayList, 4864); VertexBuffer vertexbuffer = Tessellator.getInstance().getBuffer(); for (int i = 0; i < this.cubeList.size(); ++i) { ((ModelBox)this.cubeList.get(i)).render(vertexbuffer, scale); } GlStateManager.glEndList(); this.compiled = true; }