• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Usage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.jme3.scene.VertexBuffer.Usage的典型用法代码示例。如果您正苦于以下问题:Java Usage类的具体用法?Java Usage怎么用?Java Usage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Usage类属于com.jme3.scene.VertexBuffer包,在下文中一共展示了Usage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startFaces

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
private void startFaces(String count) throws SAXException {
    int numFaces = parseInt(count);
    int numIndices;

    if (mesh.getMode() == Mesh.Mode.Triangles) {
        numIndices = numFaces * 3;
    } else {
        throw new SAXException("Triangle strip or fan not supported!");
    }

    vb = new VertexBuffer(VertexBuffer.Type.Index);
    if (!usesBigIndices) {
        sb = BufferUtils.createShortBuffer(numIndices);
        ib = null;
        vb.setupData(Usage.Static, 3, Format.UnsignedShort, sb);
    } else {
        ib = BufferUtils.createIntBuffer(numIndices);
        sb = null;
        vb.setupData(Usage.Static, 3, Format.UnsignedInt, ib);
    }
    mesh.setBuffer(vb);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:23,代码来源:MeshLoader.java


示例2: startLodFaceList

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
private void startLodFaceList(String submeshindex, String numfaces) {
    int index = Integer.parseInt(submeshindex);
    int faceCount = Integer.parseInt(numfaces);

    vb = new VertexBuffer(VertexBuffer.Type.Index);
    sb = BufferUtils.createShortBuffer(faceCount * 3);
    ib = null;
    vb.setupData(Usage.Static, 3, Format.UnsignedShort, sb);

    List<VertexBuffer> levels = lodLevels.get(index);
    if (levels == null) {
        levels = new ArrayList<VertexBuffer>();
        Mesh submesh = geoms.get(index).getMesh();
        levels.add(submesh.getBuffer(Type.Index));
        lodLevels.put(index, levels);
    }

    levels.add(vb);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:MeshLoader.java


示例3: RenderDeviceJme

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
public RenderDeviceJme(NiftyJmeDisplay display) {
    this.display = display;
    
    quadColor = new VertexBuffer(Type.Color);
    quadColor.setNormalized(true);
    ByteBuffer bb = BufferUtils.createByteBuffer(4 * 4);
    quadColor.setupData(Usage.Stream, 4, Format.UnsignedByte, bb);
    quad.setBuffer(quadColor);
    
    quadModTC.setUsage(Usage.Stream);
    
    niftyMat = new Material(display.getAssetManager(), "Common/MatDefs/Nifty/NiftyTex.j3md");
    niftyMat.getAdditionalRenderState().setDepthTest(false);
    niftyQuadMat = new Material(display.getAssetManager(), "Common/MatDefs/Nifty/NiftyQuad.j3md");
    niftyQuadMat.getAdditionalRenderState().setDepthTest(false);
}
 
开发者ID:AMPBEdu,项目名称:gjOryx,代码行数:17,代码来源:RenderDeviceJme.java


示例4: setBuffer

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
/**
 * Creates a {@link VertexBuffer} for the mesh or modifies
 * the existing one per the parameters given.
 * 
 * @param type The type of the buffer
 * @param components Number of components
 * @param format Data format
 * @param buf The buffer data
 * 
 * @throws UnsupportedOperationException If the buffer already set is 
 * incompatible with the parameters given.
 */
public void setBuffer(Type type, int components, Format format, Buffer buf){
    VertexBuffer vb = buffers.get(type.ordinal());
    if (vb == null){
        vb = new VertexBuffer(type);
        vb.setupData(Usage.Dynamic, components, format, buf);
        setBuffer(vb);
    }else{
        if (vb.getNumComponents() != components || vb.getFormat() != format){
            throw new UnsupportedOperationException("The buffer already set "
                    + "is incompatible with the given parameters");
        }
        vb.updateData(buf);
        updateCounts();
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:28,代码来源:Mesh.java


示例5: convertUsage

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
/*********************************************************************\
|* Vertex Buffers and Attributes                                     *|
\*********************************************************************/
private int convertUsage(Usage usage) {
    switch (usage) {
        case Static:
            return GL_STATIC_DRAW;
        case Dynamic:
            return GL_DYNAMIC_DRAW;
        case Stream:
            return GL_STREAM_DRAW;
        default:
            throw new UnsupportedOperationException("Unknown usage type.");
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:16,代码来源:LwjglRenderer.java


示例6: updateVertexArray

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
public void updateVertexArray(Mesh mesh) {
    int id = mesh.getId();
    if (id == -1) {
        IntBuffer temp = intBuf1;
        ARBVertexArrayObject.glGenVertexArrays(temp);
        id = temp.get(0);
        mesh.setId(id);
    }

    if (context.boundVertexArray != id) {
        ARBVertexArrayObject.glBindVertexArray(id);
        context.boundVertexArray = id;
    }

    VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
    if (interleavedData != null && interleavedData.isUpdateNeeded()) {
        updateBufferData(interleavedData);
    }

    IntMap<VertexBuffer> buffers = mesh.getBuffers();
    for (Entry<VertexBuffer> entry : buffers) {
        VertexBuffer vb = entry.getValue();

        if (vb.getBufferType() == Type.InterleavedData
                || vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers
                || vb.getBufferType() == Type.Index) {
            continue;
        }

        if (vb.getStride() == 0) {
            // not interleaved
            setVertexAttrib(vb);
        } else {
            // interleaved
            setVertexAttrib(vb, interleavedData);
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:39,代码来源:LwjglRenderer.java


示例7: SkeletonPoints

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
public SkeletonPoints(Skeleton skeleton){
    this.skeleton = skeleton;

    setMode(Mode.Points);

    VertexBuffer pb = new VertexBuffer(Type.Position);
    FloatBuffer fpb = BufferUtils.createFloatBuffer(skeleton.getBoneCount() * 3);
    pb.setupData(Usage.Stream, 3, Format.Float, fpb);
    setBuffer(pb);

    setPointSize(7);

    updateCounts();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:15,代码来源:SkeletonPoints.java


示例8: startBoneAssigns

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
private void startBoneAssigns() {
    if (mesh != sharedMesh && usesSharedVerts) {
        // will use bone assignments from shared mesh (?)
        return;
    }

    // current mesh will have bone assigns
    //int vertCount = mesh.getVertexCount();
    // each vertex has
    // - 4 bone weights
    // - 4 bone indices
    if (HARDWARE_SKINNING) {
        weightsFloatData = BufferUtils.createFloatBuffer(vertCount * 4);
        indicesData = BufferUtils.createByteBuffer(vertCount * 4);
    } else {
        // create array-backed buffers if software skinning for access speed
        weightsFloatData = FloatBuffer.allocate(vertCount * 4);
        indicesData = ByteBuffer.allocate(vertCount * 4);
    }
    
    VertexBuffer weights = new VertexBuffer(Type.BoneWeight);
    VertexBuffer indices = new VertexBuffer(Type.BoneIndex);

    Usage usage = HARDWARE_SKINNING ? Usage.Static : Usage.CpuOnly;
    weights.setupData(usage, 4, Format.Float, weightsFloatData);
    indices.setupData(usage, 4, Format.UnsignedByte, indicesData);

    mesh.setBuffer(weights);
    mesh.setBuffer(indices);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:31,代码来源:MeshLoader.java


示例9: RenderDeviceJme

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
public RenderDeviceJme(NiftyJmeDisplay display){
    this.display = display;

    quadColor = new VertexBuffer(Type.Color);
    quadColor.setNormalized(true);
    ByteBuffer bb = BufferUtils.createByteBuffer(4 * 4);
    quadColor.setupData(Usage.Stream, 4, Format.UnsignedByte, bb);
    quad.setBuffer(quadColor);

    quadModTC.setUsage(Usage.Stream);

    niftyMat = new Material(display.getAssetManager(), "Common/MatDefs/Nifty/Nifty.j3md");
    niftyMat.getAdditionalRenderState().setDepthTest(false);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:15,代码来源:RenderDeviceJme.java


示例10: initParticleData

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
@Override
public void initParticleData(ParticleEmitter emitter, int numParticles) {
    setMode(Mode.Points);

    this.emitter = emitter;

    // set positions
    FloatBuffer pb = BufferUtils.createVector3Buffer(numParticles);
    VertexBuffer pvb = new VertexBuffer(VertexBuffer.Type.Position);
    pvb.setupData(Usage.Stream, 3, Format.Float, pb);
    setBuffer(pvb);

    // set colors
    ByteBuffer cb = BufferUtils.createByteBuffer(numParticles * 4);
    VertexBuffer cvb = new VertexBuffer(VertexBuffer.Type.Color);
    cvb.setupData(Usage.Stream, 4, Format.UnsignedByte, cb);
    cvb.setNormalized(true);
    setBuffer(cvb);

    // set sizes
    FloatBuffer sb = BufferUtils.createFloatBuffer(numParticles);
    VertexBuffer svb = new VertexBuffer(VertexBuffer.Type.Size);
    svb.setupData(Usage.Stream, 1, Format.Float, sb);
    setBuffer(svb);

    // set UV-scale
    FloatBuffer tb = BufferUtils.createFloatBuffer(numParticles*4);
    VertexBuffer tvb = new VertexBuffer(VertexBuffer.Type.TexCoord);
    tvb.setupData(Usage.Stream, 4, Format.Float, tb);
    setBuffer(tvb);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:32,代码来源:ParticlePointMesh.java


示例11: setImagesXY

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
@Override
public void setImagesXY(int imagesX, int imagesY) {
    this.imagesX = imagesX;
    this.imagesY = imagesY;
    if (imagesX != 1 || imagesY != 1){
        uniqueTexCoords = true;
        getBuffer(VertexBuffer.Type.TexCoord).setUsage(Usage.Stream);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:10,代码来源:ParticleTriMesh.java


示例12: convertUsage

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
/*********************************************************************\
 |* Vertex Buffers and Attributes                                     *|
 \*********************************************************************/
private int convertUsage(Usage usage) {
    switch (usage) {
        case Static:
            return GL20.GL_STATIC_DRAW;
        case Dynamic:
            return GL20.GL_DYNAMIC_DRAW;
        case Stream:
            return GL20.GL_STREAM_DRAW;
        default:
            throw new RuntimeException("Unknown usage type.");
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:16,代码来源:GdxRenderer.java


示例13: convertUsage

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
private int convertUsage(Usage usage) {
    switch (usage) {
        case Static:
            return gl.GL_STATIC_DRAW;
        case Dynamic:
            return gl.GL_DYNAMIC_DRAW;
        case Stream:
            return gl.GL_STREAM_DRAW;
        default:
            throw new RuntimeException("Unknown usage type: " + usage);
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:13,代码来源:JoglRenderer.java


示例14: renderMeshDefault

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
private void renderMeshDefault(Mesh mesh, int lod, int count) {
    VertexBuffer indices = null;
    VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
    IntMap<VertexBuffer> buffers = mesh.getBuffers();
    if (mesh.getNumLodLevels() > 0) {
        indices = mesh.getLodLevel(lod);
    } else {
        indices = buffers.get(Type.Index.ordinal());
    }
    for (Entry<VertexBuffer> entry : buffers) {
        VertexBuffer vb = entry.getValue();

        if (vb.getBufferType() == Type.InterleavedData
                || vb.getUsage() == Usage.CpuOnly) // ignore cpu-only buffers
        {
            continue;
        }

        if (vb.getBufferType() == Type.Index) {
            indices = vb;
        } else {
            if (vb.getStride() == 0) {
                // not interleaved
                setVertexAttrib(vb);
            } else {
                // interleaved
                setVertexAttrib(vb, interleavedData);
            }
        }
    }

    if (indices != null) {
        drawTriangleList(indices, mesh, count);
    } else {
        gl.glDrawArrays(convertElementMode(mesh.getMode()), 0, mesh.getVertexCount());
    }
    clearVertexAttribs();
    clearTextureUnits();
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:40,代码来源:JoglRenderer.java


示例15: renderMeshVBO

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
private void renderMeshVBO(Mesh mesh, int lod, int count) {
    VertexBuffer indices = null;
    VertexBuffer interleavedData = mesh.getBuffer(Type.InterleavedData);
    if (interleavedData != null && interleavedData.isUpdateNeeded()) {
        updateBufferData(interleavedData);
    }
    IntMap<VertexBuffer> buffers = mesh.getBuffers();
    if (mesh.getNumLodLevels() > 0) {
        indices = mesh.getLodLevel(lod);
    } else {
        indices = buffers.get(Type.Index.ordinal());
    }
    for (Entry<VertexBuffer> entry : buffers) {
        VertexBuffer vb = entry.getValue();

        if (vb.getBufferType() == Type.InterleavedData
                || vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers
                || vb.getBufferType() == Type.Index) {
            continue;
        }

        if (vb.getStride() == 0) {
            // not interleaved
            setVertexAttribVBO(vb, null);
        } else {
            // interleaved
            setVertexAttribVBO(vb, interleavedData);
        }
    }

    if (indices != null) {
        drawTriangleListVBO(indices, mesh, count);
    } else {
        gl.glDrawArrays(convertElementMode(mesh.getMode()), 0, mesh.getVertexCount());
    }
    clearVertexAttribs();
    clearTextureUnits();
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:39,代码来源:JoglRenderer.java


示例16: renderMesh

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
public void renderMesh(Mesh mesh, int lod, int count) {
	if (mesh.getVertexCount() == 0)
        return;
    if (context.pointSize != mesh.getPointSize()) {
        gl.glPointSize(mesh.getPointSize());
        context.pointSize = mesh.getPointSize();
    }
    if (context.lineWidth != mesh.getLineWidth()) {
        gl.glLineWidth(mesh.getLineWidth());
        context.lineWidth = mesh.getLineWidth();
    }

    checkTexturingUsed();

    if (vbo) {
        renderMeshVBO(mesh, lod, count);
    } else {
        boolean dynamic = false;
        if (mesh.getNumLodLevels() == 0) {
            IntMap<VertexBuffer> bufs = mesh.getBuffers();
            for (Entry<VertexBuffer> entry : bufs) {
                if (entry.getValue().getUsage() != VertexBuffer.Usage.Static) {
                    dynamic = true;
                    break;
                }
            }
        } else {
            dynamic = true;
        }

        if (!dynamic) {
            // dealing with a static object, generate display list
            renderMeshDisplayList(mesh);
        } else {
            renderMeshDefault(mesh, lod, count);
        }
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:39,代码来源:JoglRenderer.java


示例17: convertUsage

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
/*********************************************************************\
|* Vertex Buffers and Attributes                                     *|
\*********************************************************************/
private int convertUsage(Usage usage) {
    switch (usage) {
        case Static:
            return GLES20.GL_STATIC_DRAW;
        case Dynamic:
            return GLES20.GL_DYNAMIC_DRAW;
        case Stream:
            return GLES20.GL_STREAM_DRAW;
        default:
            throw new RuntimeException("Unknown usage type.");
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:16,代码来源:OGLESShaderRenderer.java


示例18: convertUsage

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
private int convertUsage(Usage usage) {
    switch (usage) {
        case Static:
            return GL.GL_STATIC_DRAW;
        case Dynamic:
            return GL.GL_DYNAMIC_DRAW;
        case Stream:
            return GL2ES2.GL_STREAM_DRAW;
        default:
            throw new RuntimeException("Unknown usage type: " + usage);
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:13,代码来源:JoglRenderer.java


示例19: renderMesh

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
public void renderMesh(Mesh mesh, int lod, int count) {
    GL gl = GLContext.getCurrentGL();
    if (context.pointSize != mesh.getPointSize()) {
        gl.getGL2().glPointSize(mesh.getPointSize());
        context.pointSize = mesh.getPointSize();
    }
    if (context.lineWidth != mesh.getLineWidth()) {
        gl.glLineWidth(mesh.getLineWidth());
        context.lineWidth = mesh.getLineWidth();
    }

    checkTexturingUsed();

    if (vbo) {
        renderMeshVBO(mesh, lod, count);
    }
    else {
        boolean dynamic = false;
        if (mesh.getNumLodLevels() == 0) {
            IntMap<VertexBuffer> bufs = mesh.getBuffers();
            for (Entry<VertexBuffer> entry : bufs) {
                if (entry.getValue().getUsage() != VertexBuffer.Usage.Static) {
                    dynamic = true;
                    break;
                }
            }
        }
        else {
            dynamic = true;
        }

        if (!dynamic) {
            // dealing with a static object, generate display list
            renderMeshDisplayList(mesh);
        }
        else {
            renderMeshDefault(mesh, lod, count);
        }
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:41,代码来源:JoglRenderer.java


示例20: startFaces

import com.jme3.scene.VertexBuffer.Usage; //导入依赖的package包/类
private void startFaces(String count) throws SAXException {
    int numFaces = parseInt(count);
    int indicesPerFace = 0;

    switch (mesh.getMode()) {
        case Triangles:
            indicesPerFace = 3;
            break;
        case Lines:
            indicesPerFace = 2;
            break;
        case Points:
            indicesPerFace = 1;
            break;
        default:
            throw new SAXException("Strips or fans not supported!");
    }

    int numIndices = indicesPerFace * numFaces;

    vb = new VertexBuffer(VertexBuffer.Type.Index);
    if (!usesBigIndices) {
        sb = BufferUtils.createShortBuffer(numIndices);
        ib = null;
        vb.setupData(Usage.Static, indicesPerFace, Format.UnsignedShort, sb);
    } else {
        ib = BufferUtils.createIntBuffer(numIndices);
        sb = null;
        vb.setupData(Usage.Static, indicesPerFace, Format.UnsignedInt, ib);
    }
    mesh.setBuffer(vb);
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:33,代码来源:MeshLoader.java



注:本文中的com.jme3.scene.VertexBuffer.Usage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RotateEvent类代码示例发布时间:2022-05-23
下一篇:
Java VLCUtil类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap