Examples of VertexBuffer


Examples of com.jme3.scene.VertexBuffer

        clearVertexAttribs();
        clearTextureUnits();
    }

    private void renderMeshDefault(Mesh mesh, int lod, int count) {
        VertexBuffer indices;

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

//        IntMap<VertexBuffer> buffers = mesh.getBuffers();
//        SafeArrayList<VertexBuffer> buffersList = mesh.getBufferList();
View Full Code Here

Examples of com.jme3.scene.VertexBuffer

        getMesh().getBuffer(Type.Tangent).updateData(newTangentBuffer);
        getMesh().getBuffer(Type.Binormal).updateData(newBinormalBuffer);
    }

    private void setInBuffer(Mesh mesh, int index, Vector3f normal, Vector3f tangent, Vector3f binormal) {
        VertexBuffer NB = mesh.getBuffer(Type.Normal);
        VertexBuffer TB = mesh.getBuffer(Type.Tangent);
        VertexBuffer BB = mesh.getBuffer(Type.Binormal);
        BufferUtils.setInBuffer(normal, (FloatBuffer)NB.getData(), index);
        BufferUtils.setInBuffer(tangent, (FloatBuffer)TB.getData(), index);
        BufferUtils.setInBuffer(binormal, (FloatBuffer)BB.getData(), index);
        NB.setUpdateNeeded();
        TB.setUpdateNeeded();
        BB.setUpdateNeeded();
    }
View Full Code Here

Examples of com.jme3.scene.VertexBuffer

                if (textureIndex < TextureHelper.TEXCOORD_TYPES.length) {
                    combinedTexture.flatten(geometry, geometriesOMA, userDefinedUVCoordinates, blenderContext);

                    this.setTexture(material, combinedTexture.getMappingType(), combinedTexture.getResultTexture());
                    List<Vector2f> uvs = combinedTexture.getResultUVS();
                    VertexBuffer uvCoordsBuffer = new VertexBuffer(TextureHelper.TEXCOORD_TYPES[textureIndex++]);
                    uvCoordsBuffer.setupData(Usage.Static, 2, Format.Float, BufferUtils.createFloatBuffer(uvs.toArray(new Vector2f[uvs.size()])));
                    geometry.getMesh().setBuffer(uvCoordsBuffer);
                } else {
                    LOGGER.log(Level.WARNING, "The texture could not be applied because JME only supports up to {0} different UV's.", TextureHelper.TEXCOORD_TYPES.length);
                }
            }
        } else if (userDefinedUVCoordinates != null && userDefinedUVCoordinates.size() > 0) {
            LOGGER.fine("No textures found for the mesh, but UV coordinates are applied.");
            int textureIndex = 0;
            if (userDefinedUVCoordinates.size() > TextureHelper.TEXCOORD_TYPES.length) {
                LOGGER.log(Level.WARNING, "The blender file has defined more than {0} different UV coordinates for the mesh. JME supports only {0} UV coordinates buffers.", TextureHelper.TEXCOORD_TYPES.length);
            }
            for (Entry<String, List<Vector2f>> entry : userDefinedUVCoordinates.entrySet()) {
                if (textureIndex < TextureHelper.TEXCOORD_TYPES.length) {
                    List<Vector2f> uvs = entry.getValue();
                    VertexBuffer uvCoordsBuffer = new VertexBuffer(TextureHelper.TEXCOORD_TYPES[textureIndex++]);
                    uvCoordsBuffer.setupData(Usage.Static, 2, Format.Float, BufferUtils.createFloatBuffer(uvs.toArray(new Vector2f[uvs.size()])));
                    geometry.getMesh().setBuffer(uvCoordsBuffer);
                } else {
                    LOGGER.log(Level.WARNING, "The texture could not be applied because JME only supports up to {0} different UV's.", TextureHelper.TEXCOORD_TYPES.length);
                }
            }
View Full Code Here

Examples of com.jme3.scene.VertexBuffer

  /**
   * Calculates the BoundingSphere for a Geometry
   */
  public static BoundingSphere getBoundingSphere(Geometry g)
    {
    VertexBuffer posBuffer = g.getMesh().getBuffer(Type.Position);
    BoundingSphere bs = new BoundingSphere();
    bs.computeFromPoints((FloatBuffer)posBuffer.getData());

    return bs;
    }
View Full Code Here

Examples of com.jme3.scene.VertexBuffer

   * @param g
   * @return
   */
  public static BoundingBox getAABoundingBox(Geometry g)
    {
    VertexBuffer posBuffer = g.getMesh().getBuffer(Type.Position);
    BoundingBox bb = new BoundingBox();
    bb.computeFromPoints((FloatBuffer)posBuffer.getData());

    return bb;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.