@Override public void render(@Nonnull BufferBuilder buffer, float par2) { TexturedQuad[] var3 = this.quadList; for (TexturedQuad var6 : var3) { var6.draw(buffer, par2); } }
public ModelTopBox(ModelRenderer p_i1171_1_, int p_i1171_2_, int p_i1171_3_, float p_i1171_4_, float p_i1171_5_, float p_i1171_6_, float p_i1171_7_, float p_i1171_8_, float p_i1171_9_, float p_i1171_10_) { super(p_i1171_1_, p_i1171_2_, p_i1171_3_, p_i1171_4_, p_i1171_5_, p_i1171_6_, (int) p_i1171_7_, (int) p_i1171_8_, (int) p_i1171_9_, p_i1171_10_); try{ Field field = ModelBox.class.getDeclaredField("quadList"); quads = (TexturedQuad[]) field.get(this); } catch(Throwable th){ th.printStackTrace(); } }
public ModelHornGlow(HornGlowRenderer par1ModelRenderer, int par2, int par3, float par4, float par5, float par6, int par7, int par8, int par9, float par10) { super(par1ModelRenderer, par2, par3, par4, par5, par6, par7, par8, par9, par10); this.quadList = new TexturedQuad[6]; float var11 = par4 + par7; float var12 = par5 + par8; float var13 = par6 + par9; float halfpar4 = par4 + par7 * 0.05F; float halfpar6 = par6 + par9 * 0.05F; float halfvar11 = par4 + par7 * 0.95F; float halfvar13 = par6 + par9 * 0.95F; par4 -= par10; par5 -= par10; par6 -= par10; var11 += par10; var12 += par10; var13 += par10; if (par1ModelRenderer.mirror) { float var26 = var11; var11 = par4; par4 = var26; } PositionTextureVertex var32 = new PositionTextureVertex(halfpar4, par5, halfpar6, 0.0F, 0.0F); PositionTextureVertex var15 = new PositionTextureVertex(halfvar11, par5, halfpar6, 0.0F, 8.0F); PositionTextureVertex var16 = new PositionTextureVertex(var11, var12, par6, 8.0F, 8.0F); PositionTextureVertex var17 = new PositionTextureVertex(par4, var12, par6, 8.0F, 0.0F); PositionTextureVertex var18 = new PositionTextureVertex(halfpar4, par5, halfvar13, 0.0F, 0.0F); PositionTextureVertex var19 = new PositionTextureVertex(halfvar11, par5, halfvar13, 0.0F, 8.0F); PositionTextureVertex var20 = new PositionTextureVertex(var11, var12, var13, 8.0F, 8.0F); PositionTextureVertex var21 = new PositionTextureVertex(par4, var12, var13, 8.0F, 0.0F); this.quadList[0] = new TexturedQuad(new PositionTextureVertex[]{var19, var15, var16, var20}, par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); this.quadList[1] = new TexturedQuad(new PositionTextureVertex[]{var32, var18, var21, var17}, par2, par3 + par9, par2 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); this.quadList[2] = new TexturedQuad(new PositionTextureVertex[]{var19, var18, var32, var15}, par2 + par9, par3, par2 + par9 + par7, par3 + par9, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); this.quadList[3] = new TexturedQuad(new PositionTextureVertex[]{var16, var17, var21, var20}, par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par7, par3, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); this.quadList[4] = new TexturedQuad(new PositionTextureVertex[]{var15, var32, var17, var16}, par2 + par9, par3 + par9, par2 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); this.quadList[5] = new TexturedQuad(new PositionTextureVertex[]{var18, var19, var20, var21}, par2 + par9 + par7 + par9, par3 + par9, par2 + par9 + par7 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); if (par1ModelRenderer.mirror) { TexturedQuad[] var22 = this.quadList; for (TexturedQuad var25 : var22) { var25.flipFace(); } } }
public void addTexturedQuads(Matrix4f positionTransform, Matrix3f textureTransform, Collection<TexturedQuad> texturedQuads) { if (texturedQuads != null && texturedQuads.size() > 0) { allTexturedQuads.add(new FutureQuad<>(texturedQuads, positionTransform, textureTransform)); } }
public void addTexturedQuads(Matrix4f positionTransform, Matrix3f textureTransform, TexturedQuad... texturedQuads) { if (texturedQuads != null && texturedQuads.length > 0) { allTexturedQuads.add(new FutureQuad<>(Lists.newArrayList(texturedQuads), positionTransform, textureTransform)); } }
@SuppressWarnings("ObjectAllocationInLoop") @Override @SideOnly(Side.CLIENT) public void render(VertexBuffer renderer, float scale) { if (quadList == null) { final List<TexturedQuad> outputQuads = Lists.newArrayList(); for (final FutureQuad<TexturedQuad> texturedQuads : allTexturedQuads) { for (final TexturedQuad texturedQuad : texturedQuads.quads) { final PositionTextureVertex[] newPositions = new PositionTextureVertex[4]; for (int i = 0; i < texturedQuad.vertexPositions.length; i++) { final PositionTextureVertex vertexPosition = texturedQuad.vertexPositions[i]; @SuppressWarnings("NumericCastThatLosesPrecision") final Vector4f position = new Vector4f((float) vertexPosition.vector3D.xCoord, (float) vertexPosition.vector3D.yCoord, (float) vertexPosition.vector3D.zCoord, 1); final Vector3f textureCoords = new Vector3f( vertexPosition.texturePositionX, vertexPosition.texturePositionY, 1); final Vector4f transformedPosition = Matrix4f.transform(texturedQuads.positionTransform, position, null); final Vector3f transformedTexture = Matrix3f.transform(texturedQuads.textureTransform, textureCoords, null); newPositions[i] = new PositionTextureVertex( transformedPosition.getX(), transformedPosition.getY(), transformedPosition.getZ(), transformedTexture.getX(), transformedTexture.getY() ); } outputQuads.add(new TexturedQuad(newPositions)); } } for (final FutureQuad<BakedQuad> bakedQuads : allBakedQuads) { for (final BakedQuad bakedQuad : bakedQuads.quads) { try { final VertexConsumer consumer = new VertexConsumer(bakedQuad.getFormat(), bakedQuads.positionTransform, bakedQuads.textureTransform); bakedQuad.pipe(consumer); outputQuads.add(consumer.getOutputQuad()); } catch (Exception e) { if (!errored) { LogManager.getLogger("ShearMadnessAPI").log(Level.ERROR, "Error creating chiseled model", e); } errored = true; } } } quadList = new TexturedQuad[outputQuads.size()]; quadList = outputQuads.toArray(quadList); } for (final TexturedQuad texturedquad : quadList) { texturedquad.draw(renderer, scale); } }
TexturedQuad getOutputQuad() { return new TexturedQuad(vertices); }
/** * Set the vertices of the box ! A * {@link #setTexture(ModelRenderer, int[][]) setTexture()} is necessary * after that.<br> * * Order of the vertices:<br> * vertices[0] = (0, 0, 0) (bloc's origin)<br> * vertices[1] = (x, 0, 0)<br> * vertices[2] = (x, y, 0)<br> * vertices[3] = (0, y, 0)<br> * vertices[4] = (0, 0, z)<br> * vertices[5] = (x, 0, z)<br> * vertices[6] = (x, y, z) (bloc's end)<br> * vertices[7] = (0, y, z)<br> * * @param positionTextureVertex * The 8 vertices that will replace the old ones. */ public void setVertex(PositionTextureVertex positionTextureVertex[]) { if (positionTextureVertex.length == 8) { this.quadList[0] = new TexturedQuad(new PositionTextureVertex[] { positionTextureVertex[5], positionTextureVertex[1], positionTextureVertex[2], positionTextureVertex[6] }); this.quadList[1] = new TexturedQuad(new PositionTextureVertex[] { positionTextureVertex[0], positionTextureVertex[4], positionTextureVertex[7], positionTextureVertex[3] }); this.quadList[2] = new TexturedQuad(new PositionTextureVertex[] { positionTextureVertex[5], positionTextureVertex[4], positionTextureVertex[0], positionTextureVertex[1] }); this.quadList[3] = new TexturedQuad(new PositionTextureVertex[] { positionTextureVertex[2], positionTextureVertex[3], positionTextureVertex[7], positionTextureVertex[6] }); this.quadList[4] = new TexturedQuad(new PositionTextureVertex[] { positionTextureVertex[1], positionTextureVertex[0], positionTextureVertex[3], positionTextureVertex[2] }); this.quadList[5] = new TexturedQuad(new PositionTextureVertex[] { positionTextureVertex[4], positionTextureVertex[5], positionTextureVertex[6], positionTextureVertex[7] }); } }
/** * Get texture offset of the model based on its box */ private int[] getModelOffset(ModelBox box, ModelRenderer renderer, ModelBase model) { TextureOffset offset = model.getTextureOffset(box.boxName); if (offset != null) { return new int[] {offset.textureOffsetX, offset.textureOffsetY}; } int[] zero = new int[] {0, 0}; Field field = this.getFieldByType(TexturedQuad[].class, ModelBox.class); TexturedQuad[] quads; field.setAccessible(true); try { quads = (TexturedQuad[]) field.get(box); } catch (Exception e) { e.printStackTrace(); return zero; } /* Getting the minimum */ float minX = 1.0F; float minY = 1.0F; for (TexturedQuad quad : quads) { for (PositionTextureVertex vertex : quad.vertexPositions) { minX = Math.min(vertex.texturePositionX, minX); minY = Math.min(vertex.texturePositionY, minY); } } minX *= renderer.textureWidth; minY *= renderer.textureHeight; return new int[] {(int) minX, (int) minY}; }
public MCAModelBox(ModelRenderer par1ModelRenderer, int textureX, int textureY, float posX, float posY, float posZ, int sizeX, int sizeY, int sizeZ, float scaleFactor) { super(par1ModelRenderer, textureX, textureY, posX, posY, posZ, sizeX, sizeY, sizeZ, scaleFactor); this.MCAquadList = new TexturedQuad[6]; float endX = posX + (float)sizeX; float endY = posY + (float)sizeY; float endZ = posZ + (float)sizeZ; posX -= scaleFactor; posY -= scaleFactor; posZ -= scaleFactor; endX += scaleFactor; endY += scaleFactor; endZ += scaleFactor; if (par1ModelRenderer.mirror) { float tempValueForSwitch = endX; endX = posX; posX = tempValueForSwitch; } /** Create PTV with RANDOM UV values (0 and 8). They will be set correctly later. */ PositionTextureVertex PTV_back_left_bottom = new PositionTextureVertex(posX, posY, posZ, 0.0F, 0.0F); PositionTextureVertex PTV_back_right_bottom = new PositionTextureVertex(endX, posY, posZ, 0.0F, 8.0F); PositionTextureVertex PTV_back_right_top = new PositionTextureVertex(endX, endY, posZ, 8.0F, 8.0F); PositionTextureVertex PTV_back_left_top = new PositionTextureVertex(posX, endY, posZ, 8.0F, 0.0F); PositionTextureVertex PTV_front_left_bottom = new PositionTextureVertex(posX, posY, endZ, 0.0F, 0.0F); PositionTextureVertex PTV_front_right_bottom = new PositionTextureVertex(endX, posY, endZ, 0.0F, 8.0F); PositionTextureVertex PTV_front_right_top = new PositionTextureVertex(endX, endY, endZ, 8.0F, 8.0F); PositionTextureVertex PTV_front_left_top = new PositionTextureVertex(posX, endY, endZ, 8.0F, 0.0F); //... /** Create the TexturedQuads. The constructor of each quad defines the order of the PTV (counterclockwise) and fixes their UV. */ //Right quad (TODO fix texture) this.MCAquadList[0] = new TexturedQuad(new PositionTextureVertex[] {PTV_back_right_top, PTV_front_right_top, PTV_front_right_bottom, PTV_back_right_bottom}, textureX + sizeZ + sizeX, textureY + sizeZ, textureX + sizeZ + sizeX + sizeZ, textureY + sizeZ + sizeY, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); //Left quad (TODO fix texture) this.MCAquadList[1] = new TexturedQuad(new PositionTextureVertex[] {PTV_front_left_top, PTV_back_left_top, PTV_back_left_bottom, PTV_front_left_bottom}, textureX, textureY + sizeZ, textureX + sizeZ, textureY + sizeZ + sizeY, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); //Bottom quad this.MCAquadList[2] = new TexturedQuad(new PositionTextureVertex[] {PTV_front_right_bottom, PTV_front_left_bottom, PTV_back_left_bottom, PTV_back_right_bottom}, textureX + sizeZ + sizeX, textureY, textureX + sizeZ + sizeX + sizeX, textureY + sizeZ, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); //Top quad this.MCAquadList[3] = new TexturedQuad(new PositionTextureVertex[] {PTV_back_right_top, PTV_back_left_top, PTV_front_left_top, PTV_front_right_top}, textureX + sizeZ, textureY, textureX + sizeZ + sizeX, textureY + sizeZ, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); //Back quad this.MCAquadList[4] = new TexturedQuad(new PositionTextureVertex[] {PTV_back_left_top, PTV_back_right_top, PTV_back_right_bottom, PTV_back_left_bottom}, textureX + sizeZ + sizeX + sizeZ, textureY + sizeZ, textureX + sizeZ + sizeX + sizeZ + sizeX, textureY + sizeZ + sizeY, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); //Front quad this.MCAquadList[5] = new TexturedQuad(new PositionTextureVertex[] {PTV_front_right_top, PTV_front_left_top, PTV_front_left_bottom, PTV_front_right_bottom}, textureX + sizeZ, textureY + sizeZ, textureX + sizeZ + sizeX, textureY + sizeZ + sizeY, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); if (par1ModelRenderer.mirror) { for (int j1 = 0; j1 < this.MCAquadList.length; ++j1) { this.MCAquadList[j1].flipFace(); } } }
public ModelBoxTFC(ModelRenderer renderer, int textureX,int textureY, float xPos, float yPos, float zPos, float width, float height, float depth, float p_i46359_10_, boolean mirror) { super(renderer, textureX, textureY, xPos,yPos,zPos, (int)width, (int)height, (int)depth, p_i46359_10_, mirror); this.quadList = new TexturedQuad[6]; float f = xPos + (float)width; float f1 = yPos + (float)height; float f2 = zPos + (float)depth; xPos = xPos - p_i46359_10_; yPos = yPos - p_i46359_10_; zPos = zPos - p_i46359_10_; f = f + p_i46359_10_; f1 = f1 + p_i46359_10_; f2 = f2 + p_i46359_10_; if (mirror) { float f3 = f; f = xPos; xPos = f3; } PositionTextureVertex positiontexturevertex7 = new PositionTextureVertex(xPos, yPos, zPos, 0.0F, 0.0F); PositionTextureVertex positiontexturevertex = new PositionTextureVertex(f, yPos, zPos, 0.0F, 8.0F); PositionTextureVertex positiontexturevertex1 = new PositionTextureVertex(f, f1, zPos, 8.0F, 8.0F); PositionTextureVertex positiontexturevertex2 = new PositionTextureVertex(xPos, f1, zPos, 8.0F, 0.0F); PositionTextureVertex positiontexturevertex3 = new PositionTextureVertex(xPos, yPos, f2, 0.0F, 0.0F); PositionTextureVertex positiontexturevertex4 = new PositionTextureVertex(f, yPos, f2, 0.0F, 8.0F); PositionTextureVertex positiontexturevertex5 = new PositionTextureVertex(f, f1, f2, 8.0F, 8.0F); PositionTextureVertex positiontexturevertex6 = new PositionTextureVertex(xPos, f1, f2, 8.0F, 0.0F); this.quadList[0] = new TexturedQuadTFC(new PositionTextureVertex[] {positiontexturevertex4, positiontexturevertex, positiontexturevertex1, positiontexturevertex5}, textureX + depth + width, textureY + depth, textureX + depth + width + depth, textureY + depth + height, renderer.textureWidth, renderer.textureHeight);//Left side if(height == 0 || depth == 0) quadList[0] = null; this.quadList[1] = new TexturedQuadTFC(new PositionTextureVertex[] {positiontexturevertex7, positiontexturevertex3, positiontexturevertex6, positiontexturevertex2}, textureX, textureY + depth, textureX + depth, textureY + depth + height, renderer.textureWidth, renderer.textureHeight);//Right Side if(height == 0 || depth == 0) quadList[1] = null; this.quadList[2] = new TexturedQuadTFC(new PositionTextureVertex[] {positiontexturevertex4, positiontexturevertex3, positiontexturevertex7, positiontexturevertex}, textureX + depth, textureY, textureX + depth + width, textureY + depth, renderer.textureWidth, renderer.textureHeight);//Top if(width == 0 || depth == 0) quadList[2] = null; this.quadList[3] = new TexturedQuadTFC(new PositionTextureVertex[] {positiontexturevertex1, positiontexturevertex2, positiontexturevertex6, positiontexturevertex5}, textureX + depth + width, textureY + depth, textureX + depth + width + width, textureY, renderer.textureWidth, renderer.textureHeight);//bottom if(width == 0 || depth == 0) quadList[3] = null; this.quadList[4] = new TexturedQuadTFC(new PositionTextureVertex[] {positiontexturevertex, positiontexturevertex7, positiontexturevertex2, positiontexturevertex1}, textureX + depth, textureY + depth, textureX + depth + width, textureY + depth + height, renderer.textureWidth, renderer.textureHeight);//front if(height == 0 || width == 0) quadList[4] = null; this.quadList[5] = new TexturedQuadTFC(new PositionTextureVertex[] {positiontexturevertex3, positiontexturevertex4, positiontexturevertex5, positiontexturevertex6}, textureX + depth + width + depth, textureY + depth, textureX + depth + width + depth + width, textureY + depth + height, renderer.textureWidth, renderer.textureHeight);//back if(height == 0 || width == 0) quadList[5] = null; if (mirror) { for (int i = 0; i < this.quadList.length; ++i) { this.quadList[i].flipFace(); } } }
public ModelIngot(ModelRenderer renderer, int textureOffsetX, int textureOffsetY) { // x1 y1 z1 wdt hgt detph scalechange super(renderer, textureOffsetX, textureOffsetY, 0.5F, 0, 0.5F, 15, 4, 7, 0); float originX = .5f; float originY = 0; float originZ = .5f; this.vertexPositions = new PositionTextureVertex[8]; this.quadList = new TexturedQuad[6]; float maxX = originX + 15; float maxY = originY + 4; float maxZ = originZ + 7; PositionTextureVertex vert0 = new PositionTextureVertex(originX, originY, originZ, 0.0F, 0.0F); PositionTextureVertex vert1 = new PositionTextureVertex(maxX, originY, originZ, 0.0F, 8.0F); PositionTextureVertex vert2 = new PositionTextureVertex(maxX-1, maxY, originZ+1, 8.0F, 8.0F); PositionTextureVertex vert3 = new PositionTextureVertex(originX+1, maxY, originZ+1, 8.0F, 0.0F); PositionTextureVertex vert4 = new PositionTextureVertex(originX, originY, maxZ, 0.0F, 0.0F); PositionTextureVertex vert5 = new PositionTextureVertex(maxX, originY, maxZ, 0.0F, 8.0F); PositionTextureVertex vert6 = new PositionTextureVertex(maxX-1, maxY, maxZ-1, 8.0F, 8.0F); PositionTextureVertex vert7 = new PositionTextureVertex(originX+1, maxY, maxZ-1, 8.0F, 0.0F); this.vertexPositions[0] = vert0; this.vertexPositions[1] = vert1; this.vertexPositions[2] = vert2; this.vertexPositions[3] = vert3; this.vertexPositions[4] = vert4; this.vertexPositions[5] = vert5; this.vertexPositions[6] = vert6; this.vertexPositions[7] = vert7; int x1 = textureOffsetX + 4; int x2 = textureOffsetX + 20; int x3 = textureOffsetX + 44; int x4 = textureOffsetX + 60; int y1 = textureOffsetY + 4; int y2 = textureOffsetY + 8; int y3 = textureOffsetY + 16; int y4 = textureOffsetY + 20; int y5 = textureOffsetY + 28 + 10; this.quadList[0] = new TexturedQuad(new PositionTextureVertex[] {vert5, vert1, vert2, vert6}, x3, y1, x4, y2, renderer.textureWidth, renderer.textureHeight); // petit this.quadList[1] = new TexturedQuad(new PositionTextureVertex[] {vert0, vert4, vert7, vert3}, x1, y1, x2, y2, renderer.textureWidth, renderer.textureHeight); // petit this.quadList[2] = new TexturedQuad(new PositionTextureVertex[] {vert5, vert4, vert0, vert1}, x2, y4, x3, y5, renderer.textureWidth, renderer.textureHeight); // bottom this.quadList[3] = new TexturedQuad(new PositionTextureVertex[] {vert2, vert3, vert7, vert6}, x2, y2, x3, y3, renderer.textureWidth, renderer.textureHeight); // top this.quadList[4] = new TexturedQuad(new PositionTextureVertex[] {vert1, vert0, vert3, vert2}, x2, y1, x3, y2, renderer.textureWidth, renderer.textureHeight); // long this.quadList[5] = new TexturedQuad(new PositionTextureVertex[] {vert4, vert5, vert6, vert7}, x3, y4, x2, y3, renderer.textureWidth, renderer.textureHeight); // long }
public ModelBox(ModelRenderer p_i1171_1_, int p_i1171_2_, int p_i1171_3_, float p_i1171_4_, float p_i1171_5_, float p_i1171_6_, int p_i1171_7_, int p_i1171_8_, int p_i1171_9_, float p_i1171_10_) { this.field_78252_a = p_i1171_4_; this.field_78250_b = p_i1171_5_; this.field_78251_c = p_i1171_6_; this.field_78248_d = p_i1171_4_ + (float)p_i1171_7_; this.field_78249_e = p_i1171_5_ + (float)p_i1171_8_; this.field_78246_f = p_i1171_6_ + (float)p_i1171_9_; this.field_78253_h = new PositionTextureVertex[8]; this.field_78254_i = new TexturedQuad[6]; float var11 = p_i1171_4_ + (float)p_i1171_7_; float var12 = p_i1171_5_ + (float)p_i1171_8_; float var13 = p_i1171_6_ + (float)p_i1171_9_; p_i1171_4_ -= p_i1171_10_; p_i1171_5_ -= p_i1171_10_; p_i1171_6_ -= p_i1171_10_; var11 += p_i1171_10_; var12 += p_i1171_10_; var13 += p_i1171_10_; if(p_i1171_1_.field_78809_i) { float var14 = var11; var11 = p_i1171_4_; p_i1171_4_ = var14; } PositionTextureVertex var23 = new PositionTextureVertex(p_i1171_4_, p_i1171_5_, p_i1171_6_, 0.0F, 0.0F); PositionTextureVertex var15 = new PositionTextureVertex(var11, p_i1171_5_, p_i1171_6_, 0.0F, 8.0F); PositionTextureVertex var16 = new PositionTextureVertex(var11, var12, p_i1171_6_, 8.0F, 8.0F); PositionTextureVertex var17 = new PositionTextureVertex(p_i1171_4_, var12, p_i1171_6_, 8.0F, 0.0F); PositionTextureVertex var18 = new PositionTextureVertex(p_i1171_4_, p_i1171_5_, var13, 0.0F, 0.0F); PositionTextureVertex var19 = new PositionTextureVertex(var11, p_i1171_5_, var13, 0.0F, 8.0F); PositionTextureVertex var20 = new PositionTextureVertex(var11, var12, var13, 8.0F, 8.0F); PositionTextureVertex var21 = new PositionTextureVertex(p_i1171_4_, var12, var13, 8.0F, 0.0F); this.field_78253_h[0] = var23; this.field_78253_h[1] = var15; this.field_78253_h[2] = var16; this.field_78253_h[3] = var17; this.field_78253_h[4] = var18; this.field_78253_h[5] = var19; this.field_78253_h[6] = var20; this.field_78253_h[7] = var21; this.field_78254_i[0] = new TexturedQuad(new PositionTextureVertex[]{var19, var15, var16, var20}, p_i1171_2_ + p_i1171_9_ + p_i1171_7_, p_i1171_3_ + p_i1171_9_, p_i1171_2_ + p_i1171_9_ + p_i1171_7_ + p_i1171_9_, p_i1171_3_ + p_i1171_9_ + p_i1171_8_, p_i1171_1_.field_78801_a, p_i1171_1_.field_78799_b); this.field_78254_i[1] = new TexturedQuad(new PositionTextureVertex[]{var23, var18, var21, var17}, p_i1171_2_, p_i1171_3_ + p_i1171_9_, p_i1171_2_ + p_i1171_9_, p_i1171_3_ + p_i1171_9_ + p_i1171_8_, p_i1171_1_.field_78801_a, p_i1171_1_.field_78799_b); this.field_78254_i[2] = new TexturedQuad(new PositionTextureVertex[]{var19, var18, var23, var15}, p_i1171_2_ + p_i1171_9_, p_i1171_3_, p_i1171_2_ + p_i1171_9_ + p_i1171_7_, p_i1171_3_ + p_i1171_9_, p_i1171_1_.field_78801_a, p_i1171_1_.field_78799_b); this.field_78254_i[3] = new TexturedQuad(new PositionTextureVertex[]{var16, var17, var21, var20}, p_i1171_2_ + p_i1171_9_ + p_i1171_7_, p_i1171_3_ + p_i1171_9_, p_i1171_2_ + p_i1171_9_ + p_i1171_7_ + p_i1171_7_, p_i1171_3_, p_i1171_1_.field_78801_a, p_i1171_1_.field_78799_b); this.field_78254_i[4] = new TexturedQuad(new PositionTextureVertex[]{var15, var23, var17, var16}, p_i1171_2_ + p_i1171_9_, p_i1171_3_ + p_i1171_9_, p_i1171_2_ + p_i1171_9_ + p_i1171_7_, p_i1171_3_ + p_i1171_9_ + p_i1171_8_, p_i1171_1_.field_78801_a, p_i1171_1_.field_78799_b); this.field_78254_i[5] = new TexturedQuad(new PositionTextureVertex[]{var18, var19, var20, var21}, p_i1171_2_ + p_i1171_9_ + p_i1171_7_ + p_i1171_9_, p_i1171_3_ + p_i1171_9_, p_i1171_2_ + p_i1171_9_ + p_i1171_7_ + p_i1171_9_ + p_i1171_7_, p_i1171_3_ + p_i1171_9_ + p_i1171_8_, p_i1171_1_.field_78801_a, p_i1171_1_.field_78799_b); if(p_i1171_1_.field_78809_i) { for(int var22 = 0; var22 < this.field_78254_i.length; ++var22) { this.field_78254_i[var22].func_78235_a(); } } }
/** * Create a box from PositionTextureVertex and texture it with textUVs.<br> * See {@link #setVertex(PositionTextureVertex[]) setVertex()} and * {@link #setTexture(ModelRenderer, int[][]) setTexture()} for orders. * * @param renderer * The (CS)ModelRenderer to which the box will be add. * @param positionTextureVertex * The 8 vertices used to create the box. * @param textUVs * The 6 pairs of points used to set the textures' UVs for each * faces. * @param mirror * True if the texture should be mirrored, False if it shouldn't. */ public CSModelBox(ModelRenderer renderer, PositionTextureVertex positionTextureVertex[], int[][] textUVs, boolean mirror) { this(positionTextureVertex); this.setTexture(renderer, textUVs); this.checkBlockForShadow(); if (mirror) for (TexturedQuad texturedquad : this.quadList) texturedquad.flipFace(); }
/** * Set the textures' UVs for each faces.<br> * * Faces order:<br> * faces[0] = X1<br> * faces[1] = X0<br> * faces[2] = Y0<br> * faces[3] = Y1<br> * faces[4] = Z0<br> * faces[5] = Z1<br> * Textures' UVs order :<br> * coord[0] = U0 (x0)<br> * coord[1] = V0 (y0) (Top/Left)<br> * coord[2] = U1 (x1)<br> * coord[3] = V1 (y1) (Bottom/Right)<br> * * @param renderer * The (CS)ModelRenderer to which the box will be add. * @param textUVs * The 6 pairs of points used to set the textures' UVs for each * faces. */ public void setTexture(ModelRenderer renderer, int[][] textUVs) { int[] textUV; if (textUVs.length == 6) for (int i = 0; i < 6; i++) { textUV = textUVs[i]; if (textUV.length == 4) this.quadList[i] = new TexturedQuad(this.quadList[i].vertexPositions, textUV[0], textUV[1], textUV[2], textUV[3], renderer.textureWidth, renderer.textureHeight); } }
/** * Copies an array of vertices and quads to the current shape. This method converts quads * to polygons and then calls the main copyTo method. * * @param verts the array of vertices you want to copy * @param quad the array of quads you want to copy */ public void copyTo (PositionTextureVertex[] verts, TexturedQuad[] quad) { final TexturedPolygon[] poly = new TexturedPolygon[quad.length]; for (int idx = 0; idx < quad.length; idx++) poly[idx] = new TexturedPolygon(quad[idx].vertexPositions); this.copyTo(verts, poly); }
/** * Just create a box with a list of {@link facesNumber} unset TexturedQuad. * * @param facesNumber * The number of faces the box will have. */ public CSModelBox(int facesNumber) { this.quadList = new TexturedQuad[facesNumber]; }
/** * Function used to prepare the rendering of the bloc. * * @param renderer * VertexBuffer from the Tesselator. * @param scale * Scale factor. */ public void render(VertexBuffer renderer, float scale) { for (TexturedQuad texturedquad : this.quadList) texturedquad.draw(renderer, scale); }
/** * Get the TexturedQuad array so it can be modified. * * @return The TexturedQuad array. */ public TexturedQuad[] getQuadList() { return this.quadList; }