Example usage for com.badlogic.gdx.utils FloatArray ensureCapacity

List of usage examples for com.badlogic.gdx.utils FloatArray ensureCapacity

Introduction

In this page you can find the example usage for com.badlogic.gdx.utils FloatArray ensureCapacity.

Prototype

public float[] ensureCapacity(int additionalCapacity) 

Source Link

Document

Increases the size of the backing array to accommodate the specified number of additional items.

Usage

From source file:com.company.minery.utils.spine.SkeletonBounds.java

License:Open Source License

public void update(Skeleton skeleton, boolean updateAabb) {
    Array<BoundingBoxAttachment> boundingBoxes = this.boundingBoxes;
    Array<FloatArray> polygons = this.polygons;
    Array<Slot> slots = skeleton.slots;
    int slotCount = slots.size;

    boundingBoxes.clear();/*from w w w .j  a v  a  2s . co m*/
    polygonPool.freeAll(polygons);
    polygons.clear();

    for (int i = 0; i < slotCount; i++) {
        Slot slot = slots.get(i);
        Attachment attachment = slot.attachment;
        if (attachment instanceof BoundingBoxAttachment) {
            BoundingBoxAttachment boundingBox = (BoundingBoxAttachment) attachment;
            boundingBoxes.add(boundingBox);

            FloatArray polygon = polygonPool.obtain();
            polygons.add(polygon);
            int vertexCount = boundingBox.getVertices().length;
            polygon.ensureCapacity(vertexCount);
            polygon.size = vertexCount;

            boundingBox.computeWorldVertices(slot.bone, polygon.items);
        }
    }

    if (updateAabb)
        aabbCompute();
}

From source file:com.vmilea.gdx.flare.actor.ComplexActorProperty.java

License:Apache License

public final void get(Actor target, FloatArray output) {
    int count = getCount();
    if (output.size != count) {
        output.size = 0;//from  w w w.  ja v a2s  . c  o  m
        output.ensureCapacity(count);
        output.size = count;
    }

    get(target, output.items);
}