當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。