Package java.nio

Examples of java.nio.FloatBuffer.capacity()


      }
      // tex
      bu = mesh.getFloatBuffer(Type.TexCoord);
      if(bu != null) {
        bu.rewind();
        for(int i=0; i<bu.capacity(); i+=3) {
          p.printf(Locale.ENGLISH,"vt %.4f %.4f %.4f\n", bu.get(), bu.get(), bu.get());
        }
      }
      // norm
      bu = mesh.getFloatBuffer(Type.Normal);
View Full Code Here


      }
      // norm
      bu = mesh.getFloatBuffer(Type.Normal);
      if(bu != null) {
        bu.rewind();
        for(int i=0; i<bu.capacity(); i+=3) {
          p.printf(Locale.ENGLISH,"vn %.4f %.4f %.4f\n", bu.get(), bu.get(), bu.get());
        }
      }
      //indices
      IndexBuffer ib = mesh.getIndexBuffer();
View Full Code Here

        if (!isUseGPU() && _currentPose != null) {
            // Get a handle to the source and dest vertices buffers
            final FloatBuffer bindVerts = _bindPoseData.getVertexBuffer();
            FloatBuffer storeVerts = _meshData.getVertexBuffer();
            bindVerts.rewind();
            if (storeVerts == null || storeVerts.capacity() != bindVerts.capacity()) {
                storeVerts = BufferUtils.createFloatBuffer(bindVerts.capacity());
                _meshData.setVertexBuffer(storeVerts);
            } else {
                storeVerts.rewind();
            }
View Full Code Here

            final FloatBuffer bindNorms = _bindPoseData.getNormalBuffer();
            FloatBuffer storeNorms = _meshData.getNormalBuffer();
            if (bindNorms != null) {
                bindNorms.rewind();

                if (storeNorms == null || storeNorms.capacity() < bindNorms.capacity()) {
                    storeNorms = BufferUtils.createFloatBuffer(bindNorms.capacity());
                    _meshData.setNormalBuffer(storeNorms);
                } else {
                    storeNorms.rewind();
                }
View Full Code Here

    public void setVector4Length(int length){
        if (location == -1)
            return;

        FloatBuffer fb = (FloatBuffer) value;
        if (fb == null || fb.capacity() < length * 4) {
            value = BufferUtils.createFloatBuffer(length * 4);
        }

        varType = VarType.Vector4Array;
        updateNeeded = true;
View Full Code Here

                    //setInBuffer(binormal, binormals, i);
                }
            }
        }
        tangents.limit(tangents.capacity());
        // If the model already had a tangent buffer, replace it with the regenerated one
        mesh.clearBuffer(Type.Tangent);
        mesh.setBuffer(Type.Tangent, 4, tangents);
       
       
View Full Code Here

        // Set up the buffers for the mesh

        // Vertex buffer:
        FloatBuffer vertices = mesh.getMeshData().getVertexBuffer();
        if (vertices.capacity() < _splitVerts.length * 3) {
            vertices = BufferUtils.createFloatBuffer(_splitVerts);
        } else {
            vertices.clear();
            for (final Vector3 vertex : _splitVerts) {
                vertices.put((float) vertex.getX()).put((float) vertex.getY()).put((float) vertex.getZ());
View Full Code Here

            vertices.flip();
        }

        // Normal buffer:
        FloatBuffer normals = mesh.getMeshData().getNormalBuffer();
        if (normals == null || normals.capacity() < _splitNormals.length * 3) {
            normals = BufferUtils.createFloatBuffer(_splitNormals);
        } else {
            normals.clear();
            for (final Vector3 normal : _splitNormals) {
                normals.put((float) normal.getX()).put((float) normal.getY()).put((float) normal.getZ());
View Full Code Here

        // Color buffer:
        FloatBuffer colors = null;
        if (_splitColors != null) {
            colors = mesh.getMeshData().getColorBuffer();
            if (colors.capacity() < _splitColors.length * 4) {
                colors = BufferUtils.createFloatBuffer(_splitColors);
            } else {
                colors.clear();
                for (final ColorRGBA color : _splitColors) {
                    colors.put(color.getRed()).put(color.getGreen()).put(color.getBlue()).put(color.getAlpha());
View Full Code Here

        // Tex coord buffer:
        FloatBuffer texCoords = null;
        if (_splitTexCoords != null) {
            texCoords = mesh.getMeshData().getTextureCoords(0).getBuffer();
            if (texCoords.capacity() < _splitTexCoords.length * 2) {
                texCoords = BufferUtils.createFloatBuffer(_splitTexCoords);
            } else {
                texCoords.clear();
                for (final Vector2 texCoord : _splitTexCoords) {
                    texCoords.put((float) texCoord.getX()).put((float) texCoord.getY());
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.