Search in sources :

Example 1 with Bone

use of com.esotericsoftware.spine.Bone in project talos by rockbite.

the class AttachmentPointWidget method getSubWidget.

@Override
public Actor getSubWidget() {
    attachmentPointBox = new AttachmentPointBox(TalosMain.Instance().UIStage().getSkin(), "position");
    Array<String> boneNameList = new Array<>();
    boneNameList.clear();
    for (Bone bone : boneListSuppler.get()) {
        boneNameList.add(bone.getData().getName());
    }
    attachmentPointBox.setBoneList(boneNameList);
    return attachmentPointBox;
}
Also used : Array(com.badlogic.gdx.utils.Array) Bone(com.esotericsoftware.spine.Bone)

Example 2 with Bone

use of com.esotericsoftware.spine.Bone in project skin-composer by raeleus.

the class SpineDrawable method draw.

@Override
public void draw(Batch batch, float x, float y, float width, float height) {
    for (Bone bone : widthBones) {
        bone.setScaleX(width);
    }
    for (Bone bone : heightBones) {
        bone.setScaleY(height);
    }
    skeleton.setPosition(x, y);
    animationState.apply(skeleton);
    skeleton.updateWorldTransform();
    skeletonRenderer.draw(batch, skeleton);
    // reset to normal blending
    batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
}
Also used : Bone(com.esotericsoftware.spine.Bone)

Example 3 with Bone

use of com.esotericsoftware.spine.Bone in project talos by rockbite.

the class BoundEffect method update.

public void update(float delta) {
    // value attachments
    for (AttachmentPoint attachmentPoint : valueAttachments) {
        if (attachmentPoint.isStatic()) {
            scopePayload.setDynamicValue(attachmentPoint.getSlotId(), attachmentPoint.getStaticValue());
        } else {
            Bone bone = parent.getBoneByName(attachmentPoint.getBoneName());
            attachmentPoint.setBoneScale(bone.getWorldScaleX());
            float rotation = bone.getWorldRotationX();
            Color color = Color.WHITE;
            for (Slot slot : parent.getSkeleton().getSlots()) {
                if (slot.getBone().getData().getName().equals(bone.getData().getName())) {
                    // can be many
                    color = slot.getColor();
                    break;
                }
            }
            tmpVec.set(attachmentPoint.getWorldOffsetX(), attachmentPoint.getWorldOffsetY());
            tmpVec.rotate(rotation);
            tmpVec.add(parent.getBonePosX(attachmentPoint.getBoneName()), parent.getBonePosY(attachmentPoint.getBoneName()));
            if (attachmentPoint.getAttachmentType() == AttachmentPoint.AttachmentType.POSITION) {
                val.set(tmpVec.x, tmpVec.y);
            } else if (attachmentPoint.getAttachmentType() == AttachmentPoint.AttachmentType.ROTATION) {
                val.set(rotation);
            } else if (attachmentPoint.getAttachmentType() == AttachmentPoint.AttachmentType.TRANSPARENCY) {
                val.set(color.a);
            } else if (attachmentPoint.getAttachmentType() == AttachmentPoint.AttachmentType.COLOR) {
                val.set(color.r, color.g, color.b);
            }
            scopePayload.setDynamicValue(attachmentPoint.getSlotId(), val);
        }
    }
    // update position for each instance and update effect itself
    removeList.clear();
    for (ParticleEffectInstance instance : particleEffects) {
        if (instance.isComplete()) {
            removeList.add(instance);
        }
        if (positionAttachment != null) {
            if (positionAttachment.isStatic()) {
                instance.setPosition(positionAttachment.getStaticValue().get(0), positionAttachment.getStaticValue().get(1));
            } else {
                Bone bone = parent.getBoneByName(positionAttachment.getBoneName());
                positionAttachment.setBoneScale(bone.getWorldScaleX());
                tmpVec.set(positionAttachment.getWorldOffsetX(), positionAttachment.getWorldOffsetY());
                float rotation = bone.getWorldRotationX();
                tmpVec.rotate(rotation);
                tmpVec.add(parent.getBonePosX(positionAttachment.getBoneName()), parent.getBonePosY(positionAttachment.getBoneName()));
                instance.setPosition(tmpVec.x, tmpVec.y);
            }
            instance.update(delta);
        }
    }
    for (ParticleEffectInstance instance : removeList) {
        particleEffects.removeValue(instance, true);
    }
}
Also used : ParticleEffectInstance(com.talosvfx.talos.runtime.ParticleEffectInstance) Color(com.badlogic.gdx.graphics.Color) Slot(com.esotericsoftware.spine.Slot) Bone(com.esotericsoftware.spine.Bone)

Aggregations

Bone (com.esotericsoftware.spine.Bone)3 Color (com.badlogic.gdx.graphics.Color)1 Array (com.badlogic.gdx.utils.Array)1 Slot (com.esotericsoftware.spine.Slot)1 ParticleEffectInstance (com.talosvfx.talos.runtime.ParticleEffectInstance)1