Java 类net.minecraft.client.renderer.vertex.VertexFormat 实例源码

项目:CustomWorldGen    文件:B3DLoader.java   
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
    TextureAtlasSprite missing = bakedTextureGetter.apply(new ResourceLocation("missingno"));
    for(Map.Entry<String, ResourceLocation> e : textures.entrySet())
    {
        if(e.getValue().getResourcePath().startsWith("#"))
        {
            FMLLog.severe("unresolved texture '%s' for b3d model '%s'", e.getValue().getResourcePath(), modelLocation);
            builder.put(e.getKey(), missing);
        }
        else
        {
            builder.put(e.getKey(), bakedTextureGetter.apply(e.getValue()));
        }
    }
    builder.put("missingno", missing);
    return new BakedWrapper(model.getRoot(), state, smooth, gui3d, format, meshes, builder.build());
}
项目:pnc-repressurized    文件:ModelProgrammingPuzzle.java   
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {

    ImmutableMap<TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state);

    TRSRTransformation transform = state.apply(Optional.empty()).orElse(TRSRTransformation.identity());
    TextureAtlasSprite widgetSprite = bakedTextureGetter.apply(getWidgetTexture(widget));
    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();

    int width = widget.getWidth() + (widget.getParameters() != null && widget.getParameters().length > 0 ? 10 : 0);
    int height = widget.getHeight() + (widget.hasStepOutput() ? 5 : 0);

    Pair<Double, Double> maxUV = widget.getMaxUV();
    int textureSize = widget.getTextureSize();
    float scale = 1F / (float) Math.max(maxUV.getLeft(), maxUV.getRight());
    float transX = 0;//maxUV.getLeft().floatValue();
    float transY = -1 + maxUV.getRight().floatValue();
    transform = transform.compose(new TRSRTransformation(new Vector3f(0, 0, 0), null, new Vector3f(scale, scale, 1), null));
    transform = transform.compose(new TRSRTransformation(new Vector3f(transX, transY, 0), null, new Vector3f(1, 1, 1), null));

    builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16 * maxUV.getLeft().floatValue(), 16 * maxUV.getRight().floatValue(), NORTH_Z_BASE, widgetSprite, EnumFacing.NORTH, 0xffffffff));
    builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16 * maxUV.getLeft().floatValue(), 16 * maxUV.getRight().floatValue(), SOUTH_Z_BASE, widgetSprite, EnumFacing.SOUTH, 0xffffffff));

    return new BakedProgrammingPuzzle(this, builder.build(), widgetSprite, format, Maps.immutableEnumMap(transformMap), Maps.newHashMap());
}
项目:CustomWorldGen    文件:OBJModel.java   
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
    builder.put(ModelLoader.White.LOCATION.toString(), ModelLoader.White.INSTANCE);
    TextureAtlasSprite missing = bakedTextureGetter.apply(new ResourceLocation("missingno"));
    for (Map.Entry<String, Material> e : matLib.materials.entrySet())
    {
        if (e.getValue().getTexture().getTextureLocation().getResourcePath().startsWith("#"))
        {
            FMLLog.severe("OBJLoader: Unresolved texture '%s' for obj model '%s'", e.getValue().getTexture().getTextureLocation().getResourcePath(), modelLocation);
            builder.put(e.getKey(), missing);
        }
        else
        {
            builder.put(e.getKey(), bakedTextureGetter.apply(e.getValue().getTexture().getTextureLocation()));
        }
    }
    builder.put("missingno", missing);
    return new OBJBakedModel(this, state, format, builder.build());
}
项目:CustomWorldGen    文件:B3DLoader.java   
public BakedWrapper(final Node<?> node, final IModelState state, final boolean smooth, final boolean gui3d, final VertexFormat format, final ImmutableSet<String> meshes, final ImmutableMap<String, TextureAtlasSprite> textures)
{
    this(node, state, smooth, gui3d, format, meshes, textures, CacheBuilder.newBuilder()
        .maximumSize(128)
        .expireAfterAccess(2, TimeUnit.MINUTES)
        .<Integer, B3DState>build(new CacheLoader<Integer, B3DState>()
        {
            public B3DState load(Integer frame) throws Exception
            {
                IModelState parent = state;
                Animation newAnimation = node.getAnimation();
                if(parent instanceof B3DState)
                {
                    B3DState ps = (B3DState)parent;
                    parent = ps.getParent();
                }
                return new B3DState(newAnimation, frame, frame, 0, parent);
            }
        }));
}
项目:DecompiledMinecraft    文件:WorldRenderer.java   
public void begin(int p_181668_1_, VertexFormat p_181668_2_)
{
    if (this.isDrawing)
    {
        throw new IllegalStateException("Already building!");
    }
    else
    {
        this.isDrawing = true;
        this.reset();
        this.drawMode = p_181668_1_;
        this.vertexFormat = p_181668_2_;
        this.field_181677_f = p_181668_2_.getElement(this.field_181678_g);
        this.needsUpdate = false;
        this.byteBuffer.limit(this.byteBuffer.capacity());
    }
}
项目:chesttransporter    文件:ModelCT.java   
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    try
    {
        IModel sub = ModelLoaderRegistry.getModel(handle);
        IBakedModel baked = sub.bake(state, format, bakedTextureGetter);

        return new BakedModelCH(baked, ModelRegistry.getInstance().bake(state, format, bakedTextureGetter));
    } catch (Exception e)
    {
        e.printStackTrace();
    }

    return ModelLoaderRegistry.getMissingModel().bake(state, format, bakedTextureGetter);
}
项目:CustomWorldGen    文件:MultiModel.java   
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    IBakedModel bakedBase = null;

    if (base != null)
        bakedBase = base.bake(state, format, bakedTextureGetter);

    ImmutableMap.Builder<String, IBakedModel> mapBuilder = ImmutableMap.builder();

    for (Entry<String, Pair<IModel, IModelState>> entry : parts.entrySet())
    {
        Pair<IModel, IModelState> pair = entry.getValue();
        mapBuilder.put(entry.getKey(), pair.getLeft().bake(new ModelStateComposition(state, pair.getRight()), format, bakedTextureGetter));
    }

    if(bakedBase == null && parts.isEmpty())
    {
        FMLLog.log(Level.ERROR, "MultiModel %s is empty (no base model or parts were provided/resolved)", location);
        IModel missing = ModelLoaderRegistry.getMissingModel();
        return missing.bake(missing.getDefaultState(), format, bakedTextureGetter);
    }
    return new Baked(location, true, bakedBase, mapBuilder.build());
}
项目:CustomWorldGen    文件:ItemTextureQuadConverter.java   
/**
 * Generates a Front/Back quad for an itemmodel. Therefore only supports facing NORTH and SOUTH.
 * Coordinates are [0,16] to match the usual coordinates used in TextureAtlasSprites
 */
public static UnpackedBakedQuad genQuad(VertexFormat format, TRSRTransformation transform, float x1, float y1, float x2, float y2, float z, TextureAtlasSprite sprite, EnumFacing facing, int color)
{
    float u1 = sprite.getInterpolatedU(x1);
    float v1 = sprite.getInterpolatedV(y1);
    float u2 = sprite.getInterpolatedU(x2);
    float v2 = sprite.getInterpolatedV(y2);

    x1 /= 16f;
    y1 /= 16f;
    x2 /= 16f;
    y2 /= 16f;

    float tmp = y1;
    y1 = 1f - y2;
    y2 = 1f - tmp;

    return putQuad(format, transform, facing, sprite, color, x1, y1, x2, y2, z, u1, v1, u2, v2);
}
项目:CustomWorldGen    文件:LightUtil.java   
public static int[] mapFormats(VertexFormat from, VertexFormat to)
{
    int fromCount = from.getElementCount();
    int toCount = to.getElementCount();
    int[] eMap = new int[fromCount];

    for(int e = 0; e < fromCount; e++)
    {
        VertexFormatElement expected = from.getElement(e);
        int e2;
        for(e2 = 0; e2 < toCount; e2++)
        {
            VertexFormatElement current = to.getElement(e2);
            if(expected.getUsage() == current.getUsage() && expected.getIndex() == current.getIndex())
            {
                break;
            }
        }
        eMap[e] = e2;
    }
    return eMap;
}
项目:pnc-repressurized    文件:ModelProgrammingPuzzle.java   
public BakedProgrammingPuzzle(ModelProgrammingPuzzle parent, ImmutableList<BakedQuad> quads,
                              TextureAtlasSprite particle, VertexFormat format,
                              ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms,
                              Map<String, IBakedModel> cache) {
    this.quads = quads;
    this.particle = particle;
    this.format = format;
    this.parent = parent;
    this.transforms = transforms;
    this.cache = cache;
    this.overridesList = new PuzzleOverrideList(Collections.emptyList(), this);
}
项目:ExPetrum    文件:ModelCattailBaked.java   
@SuppressWarnings("SameReturnValue")
   public static IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    if (soilTextures == null)
    {
        bakeTextures(bakedTextureGetter);
        bakeModels();
    }

    return INSTANCE;
}
项目:genera    文件:ModelHandle.java   
private static void renderModel(IBakedModel model, VertexFormat fmt)
{
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder worldrenderer = tessellator.getBuffer();
    worldrenderer.begin(GL11.GL_QUADS, fmt);
    for (BakedQuad bakedquad : model.getQuads(null, null, 0))
    {
        worldrenderer.addVertexData(bakedquad.getVertexData());
    }
    tessellator.draw();
}
项目:CustomWorldGen    文件:MultiLayerModel.java   
private static ImmutableMap<Optional<BlockRenderLayer>, IBakedModel> buildModels(ImmutableMap<Optional<BlockRenderLayer>, ModelResourceLocation> models, IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    ImmutableMap.Builder<Optional<BlockRenderLayer>, IBakedModel> builder = ImmutableMap.builder();
    for(Optional<BlockRenderLayer> key : models.keySet())
    {
        IModel model = ModelLoaderRegistry.getModelOrLogError(models.get(key), "Couldn't load MultiLayerModel dependency: " + models.get(key));
        builder.put(key, model.bake(new ModelStateComposition(state, model.getDefaultState()), format, bakedTextureGetter));
    }
    return builder.build();
}
项目:DecompiledMinecraft    文件:WorldRenderer.java   
public WorldRenderer.State func_181672_a()
{
    this.rawIntBuffer.rewind();
    int i = this.func_181664_j();
    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 WorldRenderer.State(aint, new VertexFormat(this.vertexFormat));
}
项目:CustomWorldGen    文件:OBJModel.java   
public OBJBakedModel(OBJModel model, IModelState state, VertexFormat format, ImmutableMap<String, TextureAtlasSprite> textures)
{
    this.model = model;
    this.state = state;
    if (this.state instanceof OBJState) this.updateStateVisibilityMap((OBJState) this.state);
    this.format = format;
    this.textures = textures;
}
项目:BaseClient    文件:SVertexBuilder.java   
public static void endSetVertexFormat(WorldRenderer wrr)
{
    SVertexBuilder svertexbuilder = wrr.sVertexBuilder;
    VertexFormat vertexformat = wrr.getVertexFormat();
    svertexbuilder.vertexSize = vertexformat.getNextOffset() / 4;
    svertexbuilder.hasNormal = vertexformat.hasNormal();
    svertexbuilder.hasTangent = svertexbuilder.hasNormal;
    svertexbuilder.hasUV = vertexformat.hasUvOffset(0);
    svertexbuilder.offsetNormal = svertexbuilder.hasNormal ? vertexformat.getNormalOffset() / 4 : 0;
    svertexbuilder.offsetUV = svertexbuilder.hasUV ? vertexformat.getUvOffsetById(0) / 4 : 0;
    svertexbuilder.offsetUVCenter = 8;
}
项目:CustomWorldGen    文件:ItemLayerModel.java   
private static void addSideQuad(ImmutableList.Builder<BakedQuad> builder, BitSet faces, VertexFormat format, Optional<TRSRTransformation> transform, EnumFacing side, int tint, TextureAtlasSprite sprite, int uMax, int vMax, int u, int v)
{
    int si = side.ordinal();
    if(si > 4) si -= 2;
    int index = (vMax + 1) * ((uMax + 1) * si + u) + v;
    if(!faces.get(index))
    {
        faces.set(index);
        builder.add(buildSideQuad(format, transform, side, tint, sprite, u, v));
    }
}
项目:BaseClient    文件:SVertexFormat.java   
public static VertexFormat makeDefVertexFormatBlock()
{
    VertexFormat vertexformat = new VertexFormat();
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3));
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.COLOR, 4));
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2));
    vertexformat.func_181721_a(new VertexFormatElement(1, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.UV, 2));
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3));
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1));
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.PADDING, 2));
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4));
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4));
    return vertexformat;
}
项目:BaseClient    文件:SVertexFormat.java   
public static VertexFormat makeDefVertexFormatTextured()
{
    VertexFormat vertexformat = new VertexFormat();
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3));
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.PADDING, 4));
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2));
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 2));
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3));
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1));
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.PADDING, 2));
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4));
    vertexformat.func_181721_a(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4));
    return vertexformat;
}
项目:CustomWorldGen    文件:VertexBuffer.java   
public VertexBuffer.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 VertexBuffer.State(aint, new VertexFormat(this.vertexFormat));
}
项目:CustomWorldGen    文件:ModelDynBucket.java   
public BakedDynBucket(ModelDynBucket parent,
                      ImmutableList<BakedQuad> quads, TextureAtlasSprite particle, VertexFormat format, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms,
                      Map<String, IBakedModel> cache)
{
    this.quads = quads;
    this.particle = particle;
    this.format = format;
    this.parent = parent;
    this.transforms = transforms;
    this.cache = cache;
}
项目:CustomWorldGen    文件:ModelLoader.java   
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    MultipartBakedModel.Builder builder = new MultipartBakedModel.Builder();

    for (Selector selector : multipart.getSelectors())
    {
        builder.putModel(selector.getPredicate(multipart.getStateContainer()), partModels.get(selector).bake(partModels.get(selector).getDefaultState(), format, bakedTextureGetter));
    }

    IBakedModel bakedModel = builder.makeMultipartModel();
    return bakedModel;
}
项目:BaseClient    文件:WorldRenderer.java   
public void begin(int p_181668_1_, VertexFormat p_181668_2_)
{
    if (this.isDrawing)
    {
        throw new IllegalStateException("Already building!");
    }
    else
    {
        this.isDrawing = true;
        this.reset();
        this.drawMode = p_181668_1_;
        this.vertexFormat = p_181668_2_;
        this.field_181677_f = p_181668_2_.getElement(this.field_181678_g);
        this.needsUpdate = false;
        this.byteBuffer.limit(this.byteBuffer.capacity());

        if (Config.isMultiTexture())
        {
            if (this.blockLayer != null && this.quadSprites == null)
            {
                this.quadSprites = new TextureAtlasSprite[this.getBufferQuadSize()];
            }
        }
        else
        {
            this.quadSprites = null;
        }
    }
}
项目:CustomWorldGen    文件:WorldVertexBufferUploader.java   
@SuppressWarnings("incomplete-switch")
public void draw(VertexBuffer vertexBufferIn)
{
    if (vertexBufferIn.getVertexCount() > 0)
    {
        VertexFormat vertexformat = vertexBufferIn.getVertexFormat();
        int i = vertexformat.getNextOffset();
        ByteBuffer bytebuffer = vertexBufferIn.getByteBuffer();
        List<VertexFormatElement> list = vertexformat.getElements();

        for (int j = 0; j < list.size(); ++j)
        {
            VertexFormatElement vertexformatelement = (VertexFormatElement)list.get(j);
            VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.getUsage();
            int k = vertexformatelement.getType().getGlConstant();
            int l = vertexformatelement.getIndex();
            bytebuffer.position(vertexformat.getOffset(j));

            // moved to VertexFormatElement.preDraw
            vertexformatelement.getUsage().preDraw(vertexformat, j, i, bytebuffer);
        }

        GlStateManager.glDrawArrays(vertexBufferIn.getDrawMode(), 0, vertexBufferIn.getVertexCount());
        int i1 = 0;

        for (int j1 = list.size(); i1 < j1; ++i1)
        {
            VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1);
            VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.getUsage();
            int k1 = vertexformatelement1.getIndex();

            // moved to VertexFormatElement.postDraw
            vertexformatelement1.getUsage().postDraw(vertexformat, i1, i, bytebuffer);
        }
    }

    vertexBufferIn.reset();
}
项目:Backmemed    文件:BakedQuad.java   
public BakedQuad(int[] p_i0_1_, int p_i0_2_, EnumFacing p_i0_3_, TextureAtlasSprite p_i0_4_, boolean p_i0_5_, VertexFormat p_i0_6_)
{
    this.vertexData = p_i0_1_;
    this.tintIndex = p_i0_2_;
    this.face = p_i0_3_;
    this.sprite = p_i0_4_;
    this.applyDiffuseLighting = p_i0_5_;
    this.format = p_i0_6_;
    this.fixVertexData();
}
项目:CustomWorldGen    文件:ItemLayerModel.java   
public IBakedModel bake(IModelState state, final VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
{
    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
    Optional<TRSRTransformation> transform = state.apply(Optional.<IModelPart>absent());
    for(int i = 0; i < textures.size(); i++)
    {
        TextureAtlasSprite sprite = bakedTextureGetter.apply(textures.get(i));
        builder.addAll(getQuadsForSprite(i, sprite, format, transform));
    }
    TextureAtlasSprite particle = bakedTextureGetter.apply(textures.isEmpty() ? new ResourceLocation("missingno") : textures.get(0));
    ImmutableMap<TransformType, TRSRTransformation> map = IPerspectiveAwareModel.MapWrapper.getTransforms(state);
    return new BakedItemModel(builder.build(), particle, map, overrides, null);
}
项目:Backmemed    文件:SVertexBuilder.java   
public static void endSetVertexFormat(VertexBuffer wrr)
{
    SVertexBuilder svertexbuilder = wrr.sVertexBuilder;
    VertexFormat vertexformat = wrr.getVertexFormat();
    svertexbuilder.vertexSize = vertexformat.getNextOffset() / 4;
    svertexbuilder.hasNormal = vertexformat.hasNormal();
    svertexbuilder.hasTangent = svertexbuilder.hasNormal;
    svertexbuilder.hasUV = vertexformat.hasUvOffset(0);
    svertexbuilder.offsetNormal = svertexbuilder.hasNormal ? vertexformat.getNormalOffset() / 4 : 0;
    svertexbuilder.offsetUV = svertexbuilder.hasUV ? vertexformat.getUvOffsetById(0) / 4 : 0;
    svertexbuilder.offsetUVCenter = 8;
}
项目:Solar    文件:BakedCosmicResonator.java   
public BakedCosmicResonator(VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> getter) {
    super(format);
    ResourceLibrary.MOON_PHASES.forEach((key, value) -> phases.put(key, getter.apply(value)));
    full_moon = phases.get(FULL_MOON);
    new_moon = phases.get(NEW_MOON);
    eclipse = phases.get(ECLIPSE);
}
项目:CustomWorldGen    文件:ForgeHooksClient.java   
public static void postDraw(EnumUsage attrType, VertexFormat format, int element, int stride, ByteBuffer buffer)
{
    VertexFormatElement attr = format.getElement(element);
    switch(attrType)
    {
        case POSITION:
            glDisableClientState(GL_VERTEX_ARRAY);
            break;
        case NORMAL:
            glDisableClientState(GL_NORMAL_ARRAY);
            break;
        case COLOR:
            glDisableClientState(GL_COLOR_ARRAY);
            // is this really needed?
            GlStateManager.resetColor();
            break;
        case UV:
            OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + attr.getIndex());
            glDisableClientState(GL_TEXTURE_COORD_ARRAY);
            OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
            break;
        case PADDING:
            break;
        case GENERIC:
            glDisableVertexAttribArray(attr.getIndex());
        default:
            FMLLog.severe("Unimplemented vanilla attribute upload: %s", attrType.getDisplayName());
    }
}
项目:Solar    文件:BakedGravityHopper.java   
public BakedGravityHopper(VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> getter) {
    super(format);
    for(int i = 0; i < 6; i++) {
        this.overlay[i] = getter.apply(ResourceLibrary.GRAVITY_HOPPER_OVERLAY[i]);
    }
    this.base = getter.apply(ResourceLibrary.GRAVITY_HOPPER);
}
项目:Solar    文件:BakedBlinker.java   
public BakedBlinker(VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> getter) {
    super(format);
    base = getter.apply(ResourceLibrary.BLINKER_BASE);
    top_on = getter.apply(ResourceLibrary.BLINKER_TOP_ON);
    bottom_on = getter.apply(ResourceLibrary.BLINKER_BOTTOM_ON);
    top_off = getter.apply(ResourceLibrary.BLINKER_TOP_OFF);
    bottom_off = getter.apply(ResourceLibrary.BLINKER_BOTTOM_OFF);
}
项目:Backmemed    文件:SVertexFormat.java   
public static VertexFormat makeDefVertexFormatItem()
{
    VertexFormat vertexformat = new VertexFormat();
    vertexformat.addElement(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3));
    vertexformat.addElement(new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.COLOR, 4));
    vertexformat.addElement(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2));
    vertexformat.addElement(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 2));
    vertexformat.addElement(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3));
    vertexformat.addElement(new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1));
    vertexformat.addElement(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.PADDING, 2));
    vertexformat.addElement(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4));
    vertexformat.addElement(new VertexFormatElement(0, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.PADDING, 4));
    return vertexformat;
}
项目:Adventurers-Toolbox    文件:MaceModel.java   
@Override
public IBakedModel bake(IModelState state, VertexFormat format,
        java.util.function.Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {

    ImmutableMap<TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state);

    TRSRTransformation transform = (TRSRTransformation.identity());

    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();

    if (headTexture != null && haftTexture != null && handleTexture != null) {

        ImmutableList.Builder<ResourceLocation> texBuilder = ImmutableList.builder();
        if (haftTexture != null) {
            texBuilder.add(haftTexture);
        }
        if (headTexture != null) {
            texBuilder.add(headTexture);
        }
        if (handleTexture != null) {
            texBuilder.add(handleTexture);
        }
        if (adornmentTexture != null) {
            texBuilder.add(adornmentTexture);
        }
        ImmutableList<ResourceLocation> textures = texBuilder.build();

        IBakedModel model = (new ItemLayerModel(textures)).bake(state, format, bakedTextureGetter);
        builder.addAll(model.getQuads(null, null, 0));
    }

    return new BakedMaceModel(this, builder.build(), format, Maps.immutableEnumMap(transformMap),
            Maps.<String, IBakedModel>newHashMap());
}
项目:CustomWorldGen    文件:LightUtil.java   
public static void putBakedQuad(IVertexConsumer consumer, BakedQuad quad)
{
    try
    {
        consumer.setTexture(quad.getSprite());
    }
    catch(AbstractMethodError e)
    {
        // catch missing method errors caused by change to IVertexConsumer
    }
    consumer.setQuadOrientation(quad.getFace());
    if(quad.hasTintIndex())
    {
        consumer.setQuadTint(quad.getTintIndex());
    }
    consumer.setApplyDiffuseLighting(quad.shouldApplyDiffuseLighting());
    //int[] eMap = mapFormats(consumer.getVertexFormat(), DefaultVertexFormats.ITEM);
    float[] data = new float[4];
    VertexFormat formatFrom = consumer.getVertexFormat();
    VertexFormat formatTo = quad.getFormat();
    int countFrom = formatFrom.getElementCount();
    int countTo = formatTo.getElementCount();
    int[] eMap = formatMaps.getUnchecked(Pair.of(formatFrom, formatTo));
    for(int v = 0; v < 4; v++)
    {
        for(int e = 0; e < countFrom; e++)
        {
            if(eMap[e] != countTo)
            {
                unpack(quad.getVertexData(), data, quad.getFormat(), v, eMap[e]);
                consumer.put(e, data);
            }
            else
            {
                consumer.put(e);
            }
        }
    }
}
项目:Adventurers-Toolbox    文件:HoeModel.java   
@Override
public IBakedModel bake(IModelState state, VertexFormat format,
        java.util.function.Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {

    ImmutableMap<TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state);

    TRSRTransformation transform = (TRSRTransformation.identity());

    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();

    if (headTexture != null && haftTexture != null && handleTexture != null) {

        ImmutableList.Builder<ResourceLocation> texBuilder = ImmutableList.builder();
        if (haftTexture != null) {
            texBuilder.add(haftTexture);
        }
        if (headTexture != null) {
            texBuilder.add(headTexture);
        }
        if (handleTexture != null) {
            texBuilder.add(handleTexture);
        }
        if (adornmentTexture != null) {
            texBuilder.add(adornmentTexture);
        }
        ImmutableList<ResourceLocation> textures = texBuilder.build();

        IBakedModel model = (new ItemLayerModel(textures)).bake(state, format, bakedTextureGetter);
        builder.addAll(model.getQuads(null, null, 0));
    }

    return new BakedHoeModel(this, builder.build(), format, Maps.immutableEnumMap(transformMap),
            Maps.<String, IBakedModel>newHashMap());
}
项目:Backmemed    文件:RenderGlobal.java   
public RenderGlobal(Minecraft mcIn)
{
    this.renderEnv = new RenderEnv(this.theWorld, Blocks.AIR.getDefaultState(), new BlockPos(0, 0, 0));
    this.renderOverlayDamaged = false;
    this.renderOverlayEyes = false;
    this.cloudRenderer = new CloudRenderer(mcIn);
    this.mc = mcIn;
    this.renderManager = mcIn.getRenderManager();
    this.renderEngine = mcIn.getTextureManager();
    this.renderEngine.bindTexture(FORCEFIELD_TEXTURES);
    GlStateManager.glTexParameteri(3553, 10242, 10497);
    GlStateManager.glTexParameteri(3553, 10243, 10497);
    GlStateManager.bindTexture(0);
    this.updateDestroyBlockIcons();
    this.vboEnabled = OpenGlHelper.useVbo();

    if (this.vboEnabled)
    {
        this.renderContainer = new VboRenderList();
        this.renderChunkFactory = new VboChunkFactory();
    }
    else
    {
        this.renderContainer = new RenderList();
        this.renderChunkFactory = new ListChunkFactory();
    }

    this.vertexBufferFormat = new VertexFormat();
    this.vertexBufferFormat.addElement(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3));
    this.generateStars();
    this.generateSky();
    this.generateSky2();
}
项目:CustomWorldGen    文件:RenderGlobal.java   
public RenderGlobal(Minecraft mcIn)
{
    this.mc = mcIn;
    this.renderManager = mcIn.getRenderManager();
    this.renderEngine = mcIn.getTextureManager();
    this.renderEngine.bindTexture(FORCEFIELD_TEXTURES);
    GlStateManager.glTexParameteri(3553, 10242, 10497);
    GlStateManager.glTexParameteri(3553, 10243, 10497);
    GlStateManager.bindTexture(0);
    this.updateDestroyBlockIcons();
    this.vboEnabled = OpenGlHelper.useVbo();

    if (this.vboEnabled)
    {
        this.renderContainer = new VboRenderList();
        this.renderChunkFactory = new VboChunkFactory();
    }
    else
    {
        this.renderContainer = new RenderList();
        this.renderChunkFactory = new ListChunkFactory();
    }

    this.vertexBufferFormat = new VertexFormat();
    this.vertexBufferFormat.addElement(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3));
    this.generateStars();
    this.generateSky();
    this.generateSky2();
}
项目:Adventurers-Toolbox    文件:AxeModel.java   
public BakedAxeModel(AxeModel parent, ImmutableList<BakedQuad> quads, VertexFormat format,
        ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms,
        Map<String, IBakedModel> cache) {
    this.quads = quads;
    this.format = format;
    this.parent = parent;
    this.transforms = itemTransforms();
    this.cache = cache;
}
项目:Adventurers-Toolbox    文件:HammerModel.java   
@Override
public IBakedModel bake(IModelState state, VertexFormat format,
        java.util.function.Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {

    ImmutableMap<TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state);

    TRSRTransformation transform = (TRSRTransformation.identity());

    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();

    if (headTexture != null && haftTexture != null && handleTexture != null) {

        ImmutableList.Builder<ResourceLocation> texBuilder = ImmutableList.builder();
        if (haftTexture != null) {
            texBuilder.add(haftTexture);
        }
        if (headTexture != null) {
            texBuilder.add(headTexture);
        }
        if (handleTexture != null) {
            texBuilder.add(handleTexture);
        }
        if (adornmentTexture != null) {
            texBuilder.add(adornmentTexture);
        }
        ImmutableList<ResourceLocation> textures = texBuilder.build();

        IBakedModel model = (new ItemLayerModel(textures)).bake(state, format, bakedTextureGetter);
        builder.addAll(model.getQuads(null, null, 0));
    }

    return new BakedHammerModel(this, builder.build(), format, Maps.immutableEnumMap(transformMap),
            Maps.<String, IBakedModel>newHashMap());
}
项目:Adventurers-Toolbox    文件:ToolHeadModel.java   
@Override
public IBakedModel bake(IModelState state, VertexFormat format,
        java.util.function.Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {

    ImmutableMap<TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state);

    TRSRTransformation transform = (TRSRTransformation.identity());

    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
    ImmutableList<ResourceLocation> textures = ImmutableList.<ResourceLocation>of(new ResourceLocation(modid, "items/" + toolName + "/" + partName + "_" + matName));
    builder.addAll(new ItemLayerModel(textures).bake(state, format, bakedTextureGetter).getQuads(null, null, 0));
    return new BakedToolHeadModel(this, builder.build(), format, Maps.immutableEnumMap(transformMap),
            Maps.<String, IBakedModel>newHashMap());
}