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


Java VertexFormat.getNextOffset方法代码示例

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


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

示例1: endSetVertexFormat

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

示例2: drawArrays

import net.minecraft.client.renderer.vertex.VertexFormat; //导入方法依赖的package包/类
public static void drawArrays(int drawMode, int first, int count, WorldRenderer wrr)
{
    if (count != 0)
    {
        VertexFormat vertexformat = wrr.getVertexFormat();
        int i = vertexformat.getNextOffset();

        if (i == 56)
        {
            ByteBuffer bytebuffer = wrr.getByteBuffer();
            bytebuffer.position(32);
            GL20.glVertexAttribPointer(Shaders.midTexCoordAttrib, 2, GL11.GL_FLOAT, false, i, bytebuffer);
            bytebuffer.position(40);
            GL20.glVertexAttribPointer(Shaders.tangentAttrib, 4, GL11.GL_SHORT, false, i, bytebuffer);
            bytebuffer.position(48);
            GL20.glVertexAttribPointer(Shaders.entityAttrib, 3, GL11.GL_SHORT, false, i, bytebuffer);
            bytebuffer.position(0);
            GL20.glEnableVertexAttribArray(Shaders.midTexCoordAttrib);
            GL20.glEnableVertexAttribArray(Shaders.tangentAttrib);
            GL20.glEnableVertexAttribArray(Shaders.entityAttrib);
            GL11.glDrawArrays(drawMode, first, count);
            GL20.glDisableVertexAttribArray(Shaders.midTexCoordAttrib);
            GL20.glDisableVertexAttribArray(Shaders.tangentAttrib);
            GL20.glDisableVertexAttribArray(Shaders.entityAttrib);
        }
        else
        {
            GL11.glDrawArrays(drawMode, first, count);
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:32,代码来源:SVertexBuilder.java

示例3: endSetVertexFormat

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

示例4: drawArrays

import net.minecraft.client.renderer.vertex.VertexFormat; //导入方法依赖的package包/类
public static void drawArrays(int drawMode, int first, int count, VertexBuffer wrr)
{
    if (count != 0)
    {
        VertexFormat vertexformat = wrr.getVertexFormat();
        int i = vertexformat.getNextOffset();

        if (i == 56)
        {
            ByteBuffer bytebuffer = wrr.getByteBuffer();
            bytebuffer.position(32);
            GL20.glVertexAttribPointer(Shaders.midTexCoordAttrib, 2, GL11.GL_FLOAT, false, i, bytebuffer);
            bytebuffer.position(40);
            GL20.glVertexAttribPointer(Shaders.tangentAttrib, 4, GL11.GL_SHORT, false, i, bytebuffer);
            bytebuffer.position(48);
            GL20.glVertexAttribPointer(Shaders.entityAttrib, 3, GL11.GL_SHORT, false, i, bytebuffer);
            bytebuffer.position(0);
            GL20.glEnableVertexAttribArray(Shaders.midTexCoordAttrib);
            GL20.glEnableVertexAttribArray(Shaders.tangentAttrib);
            GL20.glEnableVertexAttribArray(Shaders.entityAttrib);
            GL11.glDrawArrays(drawMode, first, count);
            GL20.glDisableVertexAttribArray(Shaders.midTexCoordAttrib);
            GL20.glDisableVertexAttribArray(Shaders.tangentAttrib);
            GL20.glDisableVertexAttribArray(Shaders.entityAttrib);
        }
        else
        {
            GL11.glDrawArrays(drawMode, first, count);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:32,代码来源:SVertexBuilder.java

示例5: pack

import net.minecraft.client.renderer.vertex.VertexFormat; //导入方法依赖的package包/类
public static void pack(float[] from, int[] to, VertexFormat formatTo, int v, int e)
{
    VertexFormatElement element = formatTo.getElement(e);
    int vertexStart = v * formatTo.getNextOffset() + formatTo.getOffset(e);
    int count = element.getElementCount();
    VertexFormatElement.EnumType type = element.getType();
    int size = type.getSize();
    int mask = (256 << (8 * (size - 1))) - 1;
    for(int i = 0; i < 4; i++)
    {
        if(i < count)
        {
            int pos = vertexStart + size * i;
            int index = pos >> 2;
            int offset = pos & 3;
            int bits = 0;
            float f = i < from.length ? from[i] : 0;
            if(type == VertexFormatElement.EnumType.FLOAT)
            {
                bits = Float.floatToRawIntBits(f);
            }
            else if(
                type == VertexFormatElement.EnumType.UBYTE ||
                type == VertexFormatElement.EnumType.USHORT ||
                type == VertexFormatElement.EnumType.UINT
            )
            {
                bits = (int)(f * mask);
            }
            else
            {
                bits = (int)(f * mask / 2);
            }
            to[index] &= ~(mask << (offset * 8));
            to[index] |= (((bits & mask) << (offset * 8)));
            // TODO handle overflow into to[index + 1]
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:40,代码来源:LightUtil.java

示例6: 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

示例7: 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

示例8: 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

示例9: unpack

import net.minecraft.client.renderer.vertex.VertexFormat; //导入方法依赖的package包/类
public static void unpack(int[] from, float[] to, VertexFormat formatFrom, int v, int e)
{
    int length = 4 < to.length ? 4 : to.length;
    VertexFormatElement element = formatFrom.getElement(e);
    int vertexStart = v * formatFrom.getNextOffset() + formatFrom.getOffset(e);
    int count = element.getElementCount();
    VertexFormatElement.EnumType type = element.getType();
    int size = type.getSize();
    int mask = (256 << (8 * (size - 1))) - 1;
    for(int i = 0; i < length; i++)
    {
        if(i < count)
        {
            int pos = vertexStart + size * i;
            int index = pos >> 2;
            int offset = pos & 3;
            int bits = from[index];
            bits = bits >>> (offset * 8);
            if((pos + size - 1) / 4 != index)
            {
                bits |= from[index + 1] << ((4 - offset) * 8);
            }
            bits &= mask;
            if(type == VertexFormatElement.EnumType.FLOAT)
            {
                to[i] = Float.intBitsToFloat(bits);
            }
            else if(type == VertexFormatElement.EnumType.UBYTE || type == VertexFormatElement.EnumType.USHORT)
            {
                to[i] = (float)bits / mask;
            }
            else if(type == VertexFormatElement.EnumType.UINT)
            {
                to[i] = (float)((double)(bits & 0xFFFFFFFFL) / 0xFFFFFFFFL);
            }
            else if(type == VertexFormatElement.EnumType.BYTE)
            {
                to[i] = ((float)(byte)bits) / mask * 2;
            }
            else if(type == VertexFormatElement.EnumType.SHORT)
            {
                to[i] = ((float)(short)bits) / mask * 2;
            }
            else if(type == VertexFormatElement.EnumType.INT)
            {
                to[i] = ((float)(bits & 0xFFFFFFFFL)) / 0xFFFFFFFFL * 2;
            }
        }
        else
        {
            to[i] = 0;
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:55,代码来源:LightUtil.java

示例10: UnpackedBakedQuad

import net.minecraft.client.renderer.vertex.VertexFormat; //导入方法依赖的package包/类
public UnpackedBakedQuad(float[][][] unpackedData, int tint, EnumFacing orientation, TextureAtlasSprite texture, boolean applyDiffuseLighting, VertexFormat format)
{
    super(new int[format.getNextOffset() /* / 4 * 4 */], tint, orientation, texture, applyDiffuseLighting, format);
    this.unpackedData = unpackedData;
    this.format = format;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:7,代码来源:UnpackedBakedQuad.java


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