Examples of TFloatList


Examples of gnu.trove.list.TFloatList

        sort(0, size);
    }

    /** {@inheritDoc} */
    public void sort(int fromIndex, int toIndex) {
        TFloatList tmp = subList(fromIndex, toIndex);
        float[] vals = tmp.toArray();
        Arrays.sort(vals);
        set(fromIndex, vals);
    }
View Full Code Here

Examples of gnu.trove.list.TFloatList

        };
    }

    /** {@inheritDoc} */
    public TFloatList grep(TFloatProcedure condition) {
        TFloatList ret = new TFloatLinkedList();
        for (TFloatLink l = head; got(l); l = l.getNext()) {
            if (condition.execute(l.getValue()))
                ret.add(l.getValue());
        }
        return ret;
    }
View Full Code Here

Examples of gnu.trove.list.TFloatList

        return ret;
    }

    /** {@inheritDoc} */
    public TFloatList inverseGrep(TFloatProcedure condition) {
        TFloatList ret = new TFloatLinkedList();
        for (TFloatLink l = head; got(l); l = l.getNext()) {
            if (!condition.execute(l.getValue()))
                ret.add(l.getValue());
        }
        return ret;
    }
View Full Code Here

Examples of gnu.trove.list.TFloatList

        return this.indexer.containsKey(vecid);
    }

    @Override
    public void clean() {
        TFloatList olddata = data;
        TIntIntMap oldindexer = indexer;
        data = new TFloatArrayList(olddata.size());
        indexer = new TIntIntHashMap(oldindexer.size());

        int pos = 0;
        TIntIntIterator iter = oldindexer.iterator();
        while (iter.hasNext()) {
            iter.advance();
            int vecid = iter.key();
            int start = iter.value();
            int length = lengths.get(vecid);

            int cursor = 0;
            indexer.put(vecid, pos);
            while (cursor < length) {
                data.add(olddata.get(start + cursor));
                pos++;
                cursor++;
            }
        }
    }
View Full Code Here

Examples of gnu.trove.list.TFloatList

        return this.indexer.containsKey(vecid);
    }

    @Override
    public void clean() {
        TFloatList olddata = data;
        TIntIntMap oldindexer = indexer;
        data = new TFloatArrayList(olddata.size());
        indexer = new TIntIntHashMap(oldindexer.size());

        int pos = 0;
        TIntIntIterator iter = oldindexer.iterator();
        while (iter.hasNext()) {
            iter.advance();
            int vecid = iter.key();
            int start = iter.value();
            int length = lengths.get(vecid);

            int cursor = 0;
            indexer.put(vecid, pos);
            while (cursor < length) {
                data.add(olddata.get(start + cursor));
                pos++;
                cursor++;
            }
        }
    }
View Full Code Here

Examples of gnu.trove.list.TFloatList

public abstract class BiomeColorBufferEffect implements BufferEffect {
  @Override
  public void post(ChunkSnapshotModel chunkModel, BufferContainer value) {
    final Map<Integer, Object> buffers = value.getBuffers();
    final TFloatList vertices = (TFloatList) buffers.get(0);
    final int vertexCount = vertices.size();
    final TFloatList biomeColors;
    if (!buffers.containsKey(5)) {
      biomeColors = new TFloatArrayList(vertexCount);
      buffers.put(5, biomeColors);
    } else {
      biomeColors = (TFloatList) buffers.get(5);
    }
    // This colors whole block faces at once. Doing it for each vertex is too expensive.
    // 24 vertex coords per face (2 mesh face per block face, 3 vertices per mesh face, 4 coords per vertices)
    // This expects vertices to be grouped by block face.
    final World world = chunkModel.getCenter().getWorld();
    for (int i = 0; i < vertexCount; i += 24) {
      float r = 0;
      float g = 0;
      float b = 0;
      final int x = GenericMath.floor(vertices.get(i));
      final int y = GenericMath.floor(vertices.get(i + 1));
      final int z = GenericMath.floor(vertices.get(i + 2));
      for (byte xx = -1; xx <= 1; xx++) {
        for (byte zz = -1; zz <= 1; zz++) {
          VanillaBiome biome = (VanillaBiome) world.getBiome(x + xx, y, z + zz);
          // Default to forest if no biome is set
          if (biome == null) {
            biome = VanillaBiomes.FOREST;
          }
          final Color color = getBiomeColor(biome);
          r += color.getRed();
          g += color.getGreen();
          b += color.getBlue();
        }
      }
      r /= 9;
      r /= 255;
      g /= 9;
      g /= 255;
      b /= 9;
      b /= 255;
      for (int ii = 0; ii < 6; ii++) {
        biomeColors.add(r);
        biomeColors.add(g);
        biomeColors.add(b);
        biomeColors.add(1);
      }
    }
  }
View Full Code Here

Examples of gnu.trove.list.TFloatList

        return data;
    }

    private MeshData processData(List<Vector3f> rawVertices, List<Vector3f> rawNormals, List<Vector2f> rawTexCoords, List<Tuple3i[]> rawIndices) throws IOException {
        MeshData result = new MeshData();
        TFloatList vertices = result.getVertices();
        TFloatList texCoord0 = result.getTexCoord0();
        TFloatList normals = result.getNormals();
        TIntList indices = result.getIndices();
        int vertCount = 0;
        for (Tuple3i[] face : rawIndices) {
            for (Tuple3i indexSet : face) {
                if (indexSet.x > rawVertices.size()) {
                    throw new IOException("Vertex index out of range: " + indexSet.x);
                }
                Vector3f vertex = rawVertices.get(indexSet.x - 1);
                vertices.add(vertex.x);
                vertices.add(vertex.y);
                vertices.add(vertex.z);

                if (indexSet.y != -1) {
                    if (indexSet.y > rawTexCoords.size()) {
                        throw new IOException("TexCoord index out of range: " + indexSet.y);
                    }
                    Vector2f texCoord = rawTexCoords.get(indexSet.y - 1);
                    texCoord0.add(texCoord.x);
                    texCoord0.add(1 - texCoord.y);
                }

                if (indexSet.z != -1) {
                    if (indexSet.z > rawNormals.size()) {
                        throw new IOException("Normal index out of range: " + indexSet.z);
                    }
                    Vector3f normal = rawNormals.get(indexSet.z - 1);
                    normals.add(normal.x);
                    normals.add(normal.y);
                    normals.add(normal.z);
                }
            }

            for (int i = 0; i < face.length - 2; ++i) {
                indices.add(vertCount);
View Full Code Here

Examples of gnu.trove.list.TFloatList

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

Examples of gnu.trove.list.TFloatList

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

Examples of gnu.trove.list.TFloatList

    @Override
    public Vector3f deserialize(PersistedData data, DeserializationContext context) {
        if (data.isArray()) {
            PersistedDataArray dataArray = data.getAsArray();
            if (dataArray.isNumberArray() && dataArray.size() > 2) {
                TFloatList floats = dataArray.getAsFloatArray();
                return new Vector3f(floats.get(0), floats.get(1), floats.get(2));
            }
        }
        return null;
    }
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.