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


Java VertexBuffer.getData方法代码示例

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


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

示例1: resetToBind

import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
void resetToBind() {
    for (Mesh mesh : targets){
        if (isMeshAnimated(mesh)) {
            VertexBuffer bi = mesh.getBuffer(Type.BoneIndex);
            ByteBuffer bib = (ByteBuffer) bi.getData();
            if (!bib.hasArray()) {
                mesh.prepareForAnim(true); // prepare for software animation
            }
            VertexBuffer bindPos = mesh.getBuffer(Type.BindPosePosition);
            VertexBuffer bindNorm = mesh.getBuffer(Type.BindPoseNormal);
            VertexBuffer pos = mesh.getBuffer(Type.Position);
            VertexBuffer norm = mesh.getBuffer(Type.Normal);
            FloatBuffer pb = (FloatBuffer) pos.getData();
            FloatBuffer nb = (FloatBuffer) norm.getData();
            FloatBuffer bpb = (FloatBuffer) bindPos.getData();
            FloatBuffer bnb = (FloatBuffer) bindNorm.getData();
            pb.clear();
            nb.clear();
            bpb.clear();
            bnb.clear();
            pb.put(bpb).clear();
            nb.put(bnb).clear();
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:26,代码来源:SkeletonControl.java

示例2: update

import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
public void update(Vector3f[] points){
    VertexBuffer vb = getBuffer(Type.Position);
    if (vb == null){
        setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(points));
        return;
    }

    FloatBuffer b = BufferUtils.createFloatBuffer(points);
    FloatBuffer a = (FloatBuffer) vb.getData();
    b.rewind();
    a.rewind();
    a.put(b);
    a.rewind();

    vb.updateData(a);
    
    updateBound();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:19,代码来源:WireFrustum.java

示例3: pushTexCoord

import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
private void pushTexCoord(Attributes attribs) throws SAXException {
    if (texCoordIndex >= 8) {
        return; // More than 8 not supported by ogre.
    }
    Type type = TEXCOORD_TYPES[texCoordIndex];

    VertexBuffer tcvb = mesh.getBuffer(type);
    FloatBuffer buf = (FloatBuffer) tcvb.getData();

    buf.put(parseFloat(attribs.getValue("u")));
    if (tcvb.getNumComponents() >= 2) {
        buf.put(parseFloat(attribs.getValue("v")));
        if (tcvb.getNumComponents() >= 3) {
            buf.put(parseFloat(attribs.getValue("w")));
            if (tcvb.getNumComponents() == 4) {
                buf.put(parseFloat(attribs.getValue("x")));
            }
        }
    }

    texCoordIndex++;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:23,代码来源:MeshLoader.java

示例4: morph

import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
protected void morph( VertexBuffer sourcePos, VertexBuffer sourceNorms,
                      VertexBuffer targetPos, VertexBuffer targetNorms ) {
    FloatBuffer sp = (FloatBuffer)sourcePos.getData();
    sp.rewind();

    FloatBuffer sn = (FloatBuffer)sourceNorms.getData();
    sn.rewind();

    FloatBuffer tp = (FloatBuffer)targetPos.getData();
    tp.rewind();

    FloatBuffer tn = (FloatBuffer)targetNorms.getData();
    tn.rewind();

    morph(sp, sn, tp, tn);

    sp.rewind();
    sn.rewind();

    tp.rewind();
    targetPos.updateData(tp);
    tn.rewind();
    targetNorms.updateData(tn);
}
 
开发者ID:jMonkeyEngine-Contributions,项目名称:Lemur,代码行数:25,代码来源:DMesh.java

示例5: resetToBind

import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
void resetToBind() {
    for (Mesh mesh : targets) {
        if (isMeshAnimated(mesh)) {
            VertexBuffer bi = mesh.getBuffer(Type.BoneIndex);
            ByteBuffer bib = (ByteBuffer) bi.getData();
            if (!bib.hasArray()) {
                mesh.prepareForAnim(true); // prepare for software animation
            }
            VertexBuffer bindPos = mesh.getBuffer(Type.BindPosePosition);
            VertexBuffer bindNorm = mesh.getBuffer(Type.BindPoseNormal);
            VertexBuffer pos = mesh.getBuffer(Type.Position);
            VertexBuffer norm = mesh.getBuffer(Type.Normal);
            FloatBuffer pb = (FloatBuffer) pos.getData();
            FloatBuffer nb = (FloatBuffer) norm.getData();
            FloatBuffer bpb = (FloatBuffer) bindPos.getData();
            FloatBuffer bnb = (FloatBuffer) bindNorm.getData();
            pb.clear();
            nb.clear();
            bpb.clear();
            bnb.clear();
            pb.put(bpb).clear();
            nb.put(bnb).clear();
        }
    }
}
 
开发者ID:samynk,项目名称:DArtE,代码行数:26,代码来源:DAESkeletonControl.java

示例6: resetToBind

import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
public void resetToBind() {
        for (int i = 0; i < targets.length; i++) {
            Mesh mesh = targets[i];
            if (targets[i].getBuffer(Type.BindPosePosition) != null) {
//                VertexBuffer bi = mesh.getBuffer(Type.BoneIndex);
//                ByteBuffer bib = (ByteBuffer) bi.getData();
//                if (!bib.hasArray())
//                    mesh.prepareForAnim(true); // prepare for software animation

                VertexBuffer bindPos = mesh.getBuffer(Type.BindPosePosition);
                VertexBuffer bindNorm = mesh.getBuffer(Type.BindPoseNormal);
                VertexBuffer pos = mesh.getBuffer(Type.Position);
                VertexBuffer norm = mesh.getBuffer(Type.Normal);
                FloatBuffer pb = (FloatBuffer) pos.getData();
                FloatBuffer nb = (FloatBuffer) norm.getData();
                FloatBuffer bpb = (FloatBuffer) bindPos.getData();
                FloatBuffer bnb = (FloatBuffer) bindNorm.getData();
                pb.clear();
                nb.clear();
                bpb.clear();
                bnb.clear();
                pb.put(bpb).clear();
                nb.put(bnb).clear();
            }
        }
    }
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:27,代码来源:SkeletonControl.java

示例7: _resetToBind

import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
void _resetToBind(PMDMesh mesh) {
    VertexBuffer vb = mesh.getBuffer(VertexBuffer.Type.Position);
    FloatBuffer vfb = (FloatBuffer) vb.getData();
    VertexBuffer nb = mesh.getBuffer(VertexBuffer.Type.Normal);
    FloatBuffer nfb = (FloatBuffer) nb.getData();

    VertexBuffer bvb = mesh.getBuffer(VertexBuffer.Type.BindPosePosition);
    FloatBuffer bvfb = (FloatBuffer) bvb.getData();
    VertexBuffer bnb = mesh.getBuffer(VertexBuffer.Type.BindPoseNormal);
    FloatBuffer bnfb = (FloatBuffer) bnb.getData();

    for (int i = 0; i < vfb.capacity(); i++) {
        vfb.put(i, bvfb.get(i));
    }
    for (int i = 0; i < nfb.capacity(); i++) {
        nfb.put(i, bnfb.get(i));
    }
    vb.setUpdateNeeded();
    nb.setUpdateNeeded();
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:21,代码来源:PMDNode.java

示例8: resetToBindSkinBackData

import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
void resetToBindSkinBackData(PMDSkinMesh mesh) {
        VertexBuffer vb = mesh.getSkinvb2(); // mesh.getBuffer(VertexBuffer.Type.Position);
        FloatBuffer vfb = (FloatBuffer) vb.getData();
//        VertexBuffer nb = mesh.getSkinnb2(); //mesh.getBuffer(VertexBuffer.Type.Normal);
//        FloatBuffer nfb = (FloatBuffer) nb.getData();

        VertexBuffer bvb = mesh.getBuffer(VertexBuffer.Type.BindPosePosition);
        FloatBuffer bvfb = (FloatBuffer) bvb.getData();
        VertexBuffer bnb = mesh.getBuffer(VertexBuffer.Type.BindPoseNormal);
        FloatBuffer bnfb = (FloatBuffer) bnb.getData();

        for (int i = 0; i < vfb.capacity(); i++) {
            vfb.put(i, bvfb.get(i));
        }
//        for (int i = 0; i < nfb.capacity(); i++) {
//            nfb.put(i, bnfb.get(i));
//        }
        vb.setUpdateNeeded();
//        nb.setUpdateNeeded();
    }
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:21,代码来源:PMDNode.java

示例9: getChildren

import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
@Override
@FXThread
public @NotNull Array<TreeNode<?>> getChildren(@NotNull final NodeTree<?> nodeTree) {

    final VertexBuffer vertexBuffer = getElement();

    final Buffer data = vertexBuffer.getData();
    if (data == null) return EMPTY_ARRAY;

    final Array<TreeNode<?>> result = ArrayFactory.newArray(TreeNode.class);
    result.add(FACTORY_REGISTRY.createFor(data));

    return result;
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:15,代码来源:VertexBufferTreeNode.java

示例10: populateHdataFromMesh

import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
/**
 * Populate the height data from the supplied mesh.
 * The mesh's dimensions should be the same as width and height
 * of this geomap
 */
public void populateHdataFromMesh(Mesh mesh) {
    hdata = BufferUtils.createFloatBuffer(width*height);
    hdata.rewind();
    VertexBuffer pb = mesh.getBuffer(Type.Position);
    FloatBuffer fb = (FloatBuffer) pb.getData();
    for (int r=0; r<height; r++) {
        for (int c=0; c<width; c++) {
            float f = fb.get( (width*r) + c + 1);
            hdata.put( f );
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:BufferGeomap.java

示例11: drawTriangleList

import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
public void drawTriangleList(VertexBuffer indexBuf, Mesh mesh, int count) {
    Mesh.Mode mode = mesh.getMode();

    Buffer indexData = indexBuf.getData();
    indexData.rewind();

    if (mesh.getMode() == Mode.Hybrid) {
        throw new UnsupportedOperationException();
        /*
        int[] modeStart = mesh.getModeStart();
        int[] elementLengths = mesh.getElementLengths();
        
        int elMode = convertElementMode(Mode.Triangles);
        int fmt = convertVertexFormat(indexBuf.getFormat());
        //            int elSize = indexBuf.getFormat().getComponentSize();
        //            int listStart = modeStart[0];
        int stripStart = modeStart[1];
        int fanStart = modeStart[2];
        int curOffset = 0;
        for (int i = 0; i < elementLengths.length; i++) {
        if (i == stripStart) {
        elMode = convertElementMode(Mode.TriangleStrip);
        } else if (i == fanStart) {
        elMode = convertElementMode(Mode.TriangleStrip);
        }
        int elementLength = elementLengths[i];
        indexData.position(curOffset);
        
        drawElements(elMode,
        fmt,
        indexData);
        
        curOffset += elementLength;
        }*/
    } else {
        drawElements(convertElementMode(mode),
                convertVertexFormat(indexBuf.getFormat()),
                indexData);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:41,代码来源:LwjglGL1Renderer.java

示例12: preloadScene

import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
/**
 * Preloads a scene for rendering.
 * <p>
 * After invocation of this method, the underlying
 * renderer would have uploaded any textures, shaders and meshes
 * used by the given scene to the video driver. 
 * Using this method is useful when wishing to avoid the initial pause
 * when rendering a scene for the first time. Note that it is not 
 * guaranteed that the underlying renderer will actually choose to upload
 * the data to the GPU so some pause is still to be expected.
 * 
 * @param scene The scene to preload
 */
public void preloadScene(Spatial scene) {
    if (scene instanceof Node) {
        // recurse for all children
        Node n = (Node) scene;
        List<Spatial> children = n.getChildren();
        for (int i = 0; i < children.size(); i++) {
            preloadScene(children.get(i));
        }
    } else if (scene instanceof Geometry) {
        // add to the render queue
        Geometry gm = (Geometry) scene;
        if (gm.getMaterial() == null) {
            throw new IllegalStateException("No material is set for Geometry: " + gm.getName());
        }

        gm.getMaterial().preload(this);
        Mesh mesh = gm.getMesh();
        if (mesh != null) {
            for (Entry<VertexBuffer> entry : mesh.getBuffers()) {
                VertexBuffer buf = entry.getValue();
                if (buf.getData() != null) {
                    renderer.updateBufferData(buf);
                }
            }
        }
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:41,代码来源:RenderManager.java

示例13: pushTangent

import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
private void pushTangent(Attributes attribs) throws SAXException {
    try {
        VertexBuffer tangentBuf = mesh.getBuffer(Type.Tangent);
        FloatBuffer buf = (FloatBuffer) tangentBuf.getData();
        buf.put(parseFloat(attribs.getValue("x"))).put(parseFloat(attribs.getValue("y"))).put(parseFloat(attribs.getValue("z")));
        if (tangentBuf.getNumComponents() == 4) {
            buf.put(parseFloat(attribs.getValue("w")));
        }
    } catch (Exception ex) {
        throw new SAXException("Failed to push attrib", ex);
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:MeshLoader.java

示例14: convertToUByte

import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
public static VertexBuffer convertToUByte(VertexBuffer vb){
    FloatBuffer fb = (FloatBuffer) vb.getData();
    ByteBuffer bb = BufferUtils.createByteBuffer(fb.capacity());
    convertToUByte(fb, bb);

    VertexBuffer newVb = new VertexBuffer(vb.getBufferType());
    newVb.setupData(vb.getUsage(),
                    vb.getNumComponents(),
                    Format.UnsignedByte,
                    bb);
    newVb.setNormalized(true);
    return newVb;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:14,代码来源:FloatToFixed.java

示例15: convertToFixed

import com.jme3.scene.VertexBuffer; //导入方法依赖的package包/类
public static VertexBuffer convertToFixed(VertexBuffer vb){
    if (vb.getFormat() == Format.Int)
        return vb;

    FloatBuffer fb = (FloatBuffer) vb.getData();
    IntBuffer ib = BufferUtils.createIntBuffer(fb.capacity());
    convertToFixed(fb, ib);

    VertexBuffer newVb = new VertexBuffer(vb.getBufferType());
    newVb.setupData(vb.getUsage(),
                    vb.getNumComponents(),
                    Format.Int,
                    ib);
    return newVb;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:16,代码来源:FloatToFixed.java


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