Package java.nio

Examples of java.nio.FloatBuffer.limit()


        InputCapsule ic = im.getCapsule(this);
        hdata = ic.readFloatArray("hdataarray", null);
        if (hdata == null) {
            FloatBuffer buf = ic.readFloatBuffer("hdata", null);
            if (buf != null) {
                hdata = new float[buf.limit()];
                buf.get(hdata);
            }
        }
        width = ic.readInt("width", 0);
        height = ic.readInt("height", 0);
View Full Code Here


                            }

                            if (mirrorU && clone.getBuffer(Type.TexCoord) != null) {
                                LOGGER.finer("Mirroring U coordinates.");
                                FloatBuffer cloneUVs = (FloatBuffer) clone.getBuffer(Type.TexCoord).getData();
                                for (int i = 0; i < cloneUVs.limit(); i += 2) {
                                    cloneUVs.put(i, 1.0f - cloneUVs.get(i));
                                }
                            }
                            if (mirrorV && clone.getBuffer(Type.TexCoord) != null) {
                                LOGGER.finer("Mirroring V coordinates.");
View Full Code Here

                                }
                            }
                            if (mirrorV && clone.getBuffer(Type.TexCoord) != null) {
                                LOGGER.finer("Mirroring V coordinates.");
                                FloatBuffer cloneUVs = (FloatBuffer) clone.getBuffer(Type.TexCoord).getData();
                                for (int i = 1; i < cloneUVs.limit(); i += 2) {
                                    cloneUVs.put(i, 1.0f - cloneUVs.get(i));
                                }
                            }

                            Geometry geometry = new Geometry(spatial.getName() + " - mirror " + mirrorNames[mirrorIndex], clone);
View Full Code Here

        fpb.limit(vertCount * 3);
        pb.updateData(fpb);

        ftb.rewind();
        ftb = BufferUtils.ensureLargeEnough(ftb, vertCount * 2);
        ftb.limit(vertCount * 2);
        tb.updateData(ftb);

        bcb.rewind();
        bcb = BufferUtils.ensureLargeEnough(bcb, vertCount * 4);
        bcb.limit(vertCount * 4);
 
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

        float maxx = -Float.MAX_VALUE, minx = Float.MAX_VALUE;
        float maxy = -Float.MAX_VALUE, miny = Float.MAX_VALUE;
        float maxz = -Float.MAX_VALUE, minz = Float.MAX_VALUE;

        FloatBuffer positions = mesh.getFloatBuffer(VertexBuffer.Type.Position);
        int limit = positions.limit();
        for (int i = 0; i < limit; i += 3) {
            float x = positions.get(i);
            float y = positions.get(i + 1);
            float z = positions.get(i + 2);
            center.addLocal(x, y, z);
View Full Code Here

        float s = scale.x * scale.y * scale.z;

        if (s < 0 && geometry.getMesh() != null) {// negative s means that the scale is mirroring the object
            FloatBuffer normals = geometry.getMesh().getFloatBuffer(Type.Normal);
            if (normals != null) {
                for (int i = 0; i < normals.limit(); i += 3) {
                    if (scale.x < 0) {
                        normals.put(i, -normals.get(i));
                    }
                    if (scale.y < 0) {
                        normals.put(i + 1, -normals.get(i + 1));
View Full Code Here

        // Recalculate collision mesh
        terrainBlock.createCollisionData();

        float entropy = 0;
        for (int i = 0; i < positions.limit() / 3; i++){
            BufferUtils.populateFromBuffer(pos, positions, i);

            float realHeight = pos.y;

            pos.addLocal(0, bbox.getYExtent(), 0);
View Full Code Here

                }
            }

            final FloatBuffer norms = mesh.getMeshData().getNormalBuffer();
            final FloatBuffer verts = mesh.getMeshData().getVertexBuffer();
            if (norms != null && verts != null && norms.limit() == verts.limit()) {
                FloatBuffer lineVerts = normalLines.getMeshData().getVertexBuffer();
                if (lineVerts.capacity() < (3 * (2 * mesh.getMeshData().getVertexCount()))) {
                    normalLines.getMeshData().setVertexBuffer(null);
                    lineVerts = BufferUtils.createVector3Buffer(mesh.getMeshData().getVertexCount() * 2);
                    normalLines.getMeshData().setVertexBuffer(lineVerts);
View Full Code Here

                    normalLines.getMeshData().setVertexBuffer(null);
                    lineVerts = BufferUtils.createVector3Buffer(mesh.getMeshData().getVertexCount() * 2);
                    normalLines.getMeshData().setVertexBuffer(lineVerts);
                } else {
                    lineVerts.clear();
                    lineVerts.limit(3 * 2 * mesh.getMeshData().getVertexCount());
                    normalLines.getMeshData().setVertexBuffer(lineVerts);
                }

                FloatBuffer lineColors = normalLines.getMeshData().getColorBuffer();
                if (lineColors.capacity() < (4 * (2 * mesh.getMeshData().getVertexCount()))) {
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.