当前位置: 首页>>代码示例>>Java>>正文


Java VertexFormat.getElements方法代码示例

本文整理汇总了Java中net.minecraft.client.renderer.vertex.VertexFormat.getElements方法的典型用法代码示例。如果您正苦于以下问题:Java VertexFormat.getElements方法的具体用法?Java VertexFormat.getElements怎么用?Java VertexFormat.getElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.client.renderer.vertex.VertexFormat的用法示例。


在下文中一共展示了VertexFormat.getElements方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: draw

import net.minecraft.client.renderer.vertex.VertexFormat; //导入方法依赖的package包/类
@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();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:39,代码来源:WorldVertexBufferUploader.java

示例2: func_181679_a

import net.minecraft.client.renderer.vertex.VertexFormat; //导入方法依赖的package包/类
@SuppressWarnings("incomplete-switch")
public void func_181679_a(WorldRenderer p_181679_1_)
{
    if (p_181679_1_.getVertexCount() > 0)
    {
        VertexFormat vertexformat = p_181679_1_.getVertexFormat();
        int i = vertexformat.getNextOffset();
        ByteBuffer bytebuffer = p_181679_1_.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.func_181720_d(j));

            switch (vertexformatelement$enumusage)
            {
                case POSITION:
                    GL11.glVertexPointer(vertexformatelement.getElementCount(), k, i, bytebuffer);
                    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
                    break;

                case UV:
                    OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + l);
                    GL11.glTexCoordPointer(vertexformatelement.getElementCount(), k, i, bytebuffer);
                    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
                    OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
                    break;

                case COLOR:
                    GL11.glColorPointer(vertexformatelement.getElementCount(), k, i, bytebuffer);
                    GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
                    break;

                case NORMAL:
                    GL11.glNormalPointer(k, i, bytebuffer);
                    GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
            }
        }

        GL11.glDrawArrays(p_181679_1_.getDrawMode(), 0, p_181679_1_.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();

            switch (vertexformatelement$enumusage1)
            {
                case POSITION:
                    GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
                    break;

                case UV:
                    OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + k1);
                    GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
                    OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
                    break;

                case COLOR:
                    GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);
                    GlStateManager.resetColor();
                    break;

                case NORMAL:
                    GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY);
            }
        }
    }

    p_181679_1_.reset();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:78,代码来源:WorldVertexBufferUploader.java

示例3: moreSpecific

import net.minecraft.client.renderer.vertex.VertexFormat; //导入方法依赖的package包/类
public static boolean moreSpecific(VertexFormat first, VertexFormat second)
{
    int size = first.getNextOffset();
    if(size != second.getNextOffset()) return false;

    int padding = 0;
    int j = 0;
    for(VertexFormatElement firstAttr : first.getElements())
    {
        while(j < second.getElementCount() && second.getElement(j).getUsage() == EnumUsage.PADDING)
        {
            padding += second.getElement(j++).getSize();
        }
        if(j >= second.getElementCount() && padding == 0)
        {
            // if no padding is left, but there are still elements in first (we're processing one) - it doesn't fit
            return false;
        }
        if(padding == 0)
        {
            // no padding - attributes have to match
            VertexFormatElement secondAttr = second.getElement(j++);
            if(
                firstAttr.getIndex() != secondAttr.getIndex() ||
                firstAttr.getElementCount() != secondAttr.getElementCount() ||
                firstAttr.getType() != secondAttr.getType() ||
                firstAttr.getUsage() != secondAttr.getUsage())
            {
                return false;
            }
        }
        else
        {
            // padding - attribute should fit in it
            padding -= firstAttr.getSize();
            if(padding < 0) return false;
        }
    }

    if(padding != 0 || j != second.getElementCount()) return false;
    return true;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:43,代码来源:Attributes.java


注:本文中的net.minecraft.client.renderer.vertex.VertexFormat.getElements方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。