Examples of TFloatList


Examples of gnu.trove.list.TFloatList

    @Override
    public Quat4f deserialize(PersistedData data, DeserializationContext context) {
        if (data.isArray()) {
            PersistedDataArray dataArray = data.getAsArray();
            if (dataArray.isNumberArray() && dataArray.size() > 3) {
                TFloatList floats = dataArray.getAsFloatArray();
                return new Quat4f(floats.get(0), floats.get(1), floats.get(2), floats.get(3));
            }
        }
        return null;
    }
View Full Code Here

Examples of gnu.trove.list.TFloatList

        return result;
    }

    @Override
    public TFloatList getAsFloatArray() {
        TFloatList result = new TFloatArrayList(size());
        for (JsonElement element : array) {
            result.add(element.getAsFloat());
        }
        return result;
    }
View Full Code Here

Examples of gnu.trove.list.TFloatList

        return result;
    }

    @Override
    public TFloatList getAsFloatArray() {
        TFloatList result = new TFloatArrayList(data.getFloatCount());
        for (int i = 0; i < data.getFloatCount(); ++i) {
            result.add(data.getFloat(i));
        }
        return result;
    }
View Full Code Here

Examples of gnu.trove.list.TFloatList

            logger.error("Unable to load mesh for " + urls, e);
            return null;
        }

        MeshData data = new MeshData();
        TFloatList colorsMesh = data.getColors();
        TFloatList verticesMesh = data.getVertices();
        TFloatList texCoord0Mesh = data.getTexCoord0();
        TFloatList normalsMesh = data.getNormals();
        TIntList indicesMesh = data.getIndices();

        // Scale vertices coordinates by unitsPerMeter
        for (int i = 0; i < this.vertices.size(); i++) {
            float originalVertexValue = this.vertices.get(i);
            float adjustedVertexValue = (float) (originalVertexValue * unitsPerMeter);
            verticesMesh.add(adjustedVertexValue);
        }

        colorsMesh.addAll(this.colors);
        texCoord0Mesh.addAll(this.texCoord0);
        normalsMesh.addAll(this.normals);
        indicesMesh.addAll(this.indices);

        if (data.getVertices() == null) {
            throw new IOException("No vertices define");
        }
View Full Code Here

Examples of gnu.trove.list.TFloatList

        meshBuilder.addBox(offset, size, u, v);
        return addMesh(bone, meshBuilder);
    }

    public SkeletalMeshDataBuilder addMesh(Bone bone, MeshData data) {
        TFloatList meshVertices = data.getVertices();
        TIntList meshIndices = data.getIndices();
        TFloatList texCoord0 = data.getTexCoord0();
        int weightsStart = weights.size();
        addBone(bone);
        for (int i = 0; i < meshVertices.size() / 3; i++) {
            float x = meshVertices.get(i * 3);
            float y = meshVertices.get(i * 3 + 1);
            float z = meshVertices.get(i * 3 + 2);
            BoneWeight weight = new BoneWeight(new Vector3f(x, y, z), 1, bone.getIndex());
            // TODO Meshes may contain normal vectors and we may copy them to the weight here
            //   - but they are recalculated later on in either case. needs some rework
            addWeight(weight);
            vertexStartWeights.add(weightsStart + i);
            vertexWeightCounts.add(1);
            uvs.add(new Vector2f(texCoord0.get(i * 2), texCoord0.get(i * 2 + 1)));
        }

        for (int i = 0; i < meshIndices.size(); i++) {
            indices.add(meshIndices.get(i) + weightsStart);
        }
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.