public VertexTransformerWrapper(final IVertexConsumer parent, final BakedQuad parentQuad, final IVertexTransformer transformer) { this.parent = parent; this.parentQuad = parentQuad; this.vertexFormat = parent.getVertexFormat(); this.transformer = transformer; }
public void pipe(IVertexConsumer p_pipe_1_) { Reflector.callVoid(Reflector.LightUtil_putBakedQuad, new Object[] {p_pipe_1_, this}); }
@Override public void pipe(IVertexConsumer consumer) { quadulate(); computeNormals(); consumer.setApplyDiffuseLighting(applyDifuseLighting); consumer.setTexture(sprite); consumer.setQuadOrientation(getQuadFace()); consumer.setQuadTint(tintIndex); for (int v = 0; v < 4; v++) { for (int e = 0; e < consumer.getVertexFormat().getElementCount(); e++) { VertexFormatElement element = consumer.getVertexFormat().getElement(e); switch (element.getUsage()) { case POSITION: Vector3d pos = vertices[v].vec; consumer.put(e, (float) pos.x, (float) pos.y, (float) pos.z, 1); break; case NORMAL: Vector3d normal = normals[v]; consumer.put(e, (float) normal.x, (float) normal.y, (float) normal.z, 0); break; case COLOR: ColorData colour = colours[v]; consumer.put(e, (colour.r & 0xFF) / 255, (colour.g & 0xFF) / 255, (colour.b & 0xFF) / 255, (colour.a & 0xFF) / 255); break; case UV: if (element.getIndex() == 0) { UVData uv = vertices[v].uv; consumer.put(e, (float) uv.u, (float) uv.v, 0, 1); } else { int brightness = lightMaps[v]; consumer.put(e, (float) ((brightness >> 4) & 15 * 32) / 65535, (float) ((brightness >> 20) & 15 * 32) / 65535, 0, 1); } break; case PADDING: case GENERIC: default: consumer.put(e); } } } }
@Override public void pipe(IVertexConsumer consumer) { quadulate(); computeNormals(); consumer.setApplyDiffuseLighting(applyDifuseLighting); consumer.setTexture(sprite); consumer.setQuadOrientation(getQuadFace()); consumer.setQuadTint(tintIndex); for (int v = 0; v < 4; v++) { for (int e = 0; e < consumer.getVertexFormat().getElementCount(); e++) { VertexFormatElement element = consumer.getVertexFormat().getElement(e); switch (element.getUsage()) { case POSITION: Vector3 pos = vertices[v].vec; consumer.put(e, (float) pos.x, (float) pos.y, (float) pos.z, 1); break; case NORMAL: Vector3 normal = normals[v]; consumer.put(e, (float) normal.x, (float) normal.y, (float) normal.z, 0); break; case COLOR: Colour colour = colours[v]; consumer.put(e, (colour.r & 0xFF) / 255F, (colour.g & 0xFF) / 255F, (colour.b & 0xFF) / 255F, (colour.a & 0xFF) / 255F); break; case UV: if (element.getIndex() == 0) { UV uv = vertices[v].uv; consumer.put(e, (float) uv.u, (float) uv.v, 0, 1); } else { int brightness = lightMaps[v]; consumer.put(e, (float) ((brightness & 0xFFFF) / 0xFFFF) * 2, (float) ((brightness >> 16 & 0xFFFF) / 0xFFFF) * 2, 0, 1); } break; case PADDING: case GENERIC: default: consumer.put(e); } } } }