public void addQuad( EnumFacing face, float x1, float y1, float z1, float x2, float y2, float z2 ) { // If brightness is forced to specific values, extend the vertex format to contain the multi-texturing lightmap // offset VertexFormat savedFormat = null; if( this.renderFullBright ) { savedFormat = this.format; this.format = new VertexFormat( savedFormat ); if( !this.format.getElements().contains( DefaultVertexFormats.TEX_2S ) ) { this.format.addElement( DefaultVertexFormats.TEX_2S ); } } this.putFace( face, x1, y1, z1, x2, y2, z2 ); // Restore old format if( savedFormat != null ) { this.format = savedFormat; } }
@SideOnly(Side.CLIENT) public abstract class ParticleAttack extends Particle { public static final VertexFormat VERTEX_FORMAT = (new VertexFormat()).addElement(DefaultVertexFormats.POSITION_3F).addElement(DefaultVertexFormats.TEX_2F).addElement(DefaultVertexFormats.COLOR_4UB).addElement(DefaultVertexFormats.TEX_2S).addElement(DefaultVertexFormats.NORMAL_3B).addElement(DefaultVertexFormats.PADDING_1B);
public static VertexFormat getFormatWithLightMap( VertexFormat format ) { // Do not use this when Optifine is present or if the vanilla lighting pipeline is used if( FMLClientHandler.instance().hasOptifine() || !ForgeModContainer.forgeLightPipelineEnabled ) { return format; } VertexFormat result; if( format == DefaultVertexFormats.BLOCK ) { result = DefaultVertexFormats.BLOCK; } else if( format == DefaultVertexFormats.ITEM ) { result = itemFormatWithLightMap; } else if( !format.hasUvOffset( 1 ) ) { result = new VertexFormat( format ); result.addElement( DefaultVertexFormats.TEX_2S ); } else { result = format; // Already has the needed UV, so keep it } return result; } }
@Override public BufferBuilder.State getVertexState() { this.rawIntBuffer.rewind(); int i = this.getBufferSize(); this.rawIntBuffer.limit(i); int[] aint = new int[i]; this.rawIntBuffer.get(aint); this.rawIntBuffer.limit(this.rawIntBuffer.capacity()); this.rawIntBuffer.position(i); return new BufferBuilder.State(aint, new VertexFormat(this.vertexFormat)); }
public static VertexFormat getFormatWithLightMap(VertexFormat format) { if (isLightMapDisabled()) { return format; } if (format == DefaultVertexFormats.BLOCK) { return DefaultVertexFormats.BLOCK; } else if (format == DefaultVertexFormats.ITEM) { return ITEM_FORMAT_WITH_LIGHTMAP; } else if (!format.hasUvOffset(1)) { VertexFormat result = new VertexFormat(format); result.addElement(DefaultVertexFormats.TEX_2S); return result; } return format; }
@Override public void setVertexState(BufferBuilder.State state) { this.rawIntBuffer.clear(); this.growBuffer(state.getRawBuffer().length * 4); this.rawIntBuffer.put(state.getRawBuffer()); this.vertexCount = state.getVertexCount(); this.vertexFormat = new VertexFormat(state.getVertexFormat()); }