Search in sources :

Example 1 with CameraComponent

use of com.talosvfx.talos.editor.addons.scene.logic.components.CameraComponent in project talos by rockbite.

the class CameraPane method setFrom.

public void setFrom(GameObject cameraObject) {
    CameraComponent component = cameraObject.getComponent(CameraComponent.class);
    // viewport size
    Vector2 size = component.size;
    float aspect = size.x / size.y;
    float width = 200;
    float height = 200;
    if (aspect > 1f) {
        height = height / aspect;
    }
    if (aspect < 1f) {
        width = width * aspect;
    }
    cameraPreview.setCamera(cameraObject);
    cameraPreview.setViewport(size.x, size.y, width, height);
    previewSize.set(width, height);
    title.setText(cameraObject.getName());
    this.cameraObject = cameraObject;
}
Also used : Vector2(com.badlogic.gdx.math.Vector2) CameraComponent(com.talosvfx.talos.editor.addons.scene.logic.components.CameraComponent)

Example 2 with CameraComponent

use of com.talosvfx.talos.editor.addons.scene.logic.components.CameraComponent in project talos by rockbite.

the class CameraTransformGizmo method reportResizeUpdated.

@Override
protected void reportResizeUpdated(boolean isRapid) {
    TransformComponent transform = gameObject.getComponent(TransformComponent.class);
    Notifications.fireEvent(Notifications.obtainEvent(ComponentUpdated.class).set(transform, isRapid));
    CameraComponent camera = gameObject.getComponent(CameraComponent.class);
    Notifications.fireEvent(Notifications.obtainEvent(ComponentUpdated.class).set(camera, isRapid));
}
Also used : CameraComponent(com.talosvfx.talos.editor.addons.scene.logic.components.CameraComponent) TransformComponent(com.talosvfx.talos.editor.addons.scene.logic.components.TransformComponent)

Example 3 with CameraComponent

use of com.talosvfx.talos.editor.addons.scene.logic.components.CameraComponent in project talos by rockbite.

the class CameraTransformGizmo method transformOldToNew.

@Override
protected void transformOldToNew() {
    TransformComponent transform = gameObject.getComponent(TransformComponent.class);
    CameraComponent cameraComponent = gameObject.getComponent(CameraComponent.class);
    // bring old next points to local space
    for (int i = 0; i < 4; i++) {
        TransformComponent.worldToLocal(gameObject.parent, nextPoints[i]);
    }
    cameraComponent.size.set(nextPoints[RB].dst(nextPoints[LB]), nextPoints[LB].dst(nextPoints[LT]));
    cameraComponent.size = lowerPrecision(cameraComponent.size);
    // this is midpoint
    tmp.set(nextPoints[RT]).sub(nextPoints[LB]).scl(0.5f).add(nextPoints[LB]);
    transform.position = lowerPrecision(transform.position);
}
Also used : CameraComponent(com.talosvfx.talos.editor.addons.scene.logic.components.CameraComponent) TransformComponent(com.talosvfx.talos.editor.addons.scene.logic.components.TransformComponent)

Example 4 with CameraComponent

use of com.talosvfx.talos.editor.addons.scene.logic.components.CameraComponent in project talos by rockbite.

the class CameraTransformGizmo method updatePointsFromComponent.

@Override
protected void updatePointsFromComponent() {
    // this is center position of camera
    getWorldLocAround(tmp, 0, 0);
    TransformComponent transformComponent = gameObject.getComponent(TransformComponent.class);
    CameraComponent cameraComponent = gameObject.getComponent(CameraComponent.class);
    points[LB].set(tmp.x - cameraComponent.size.x / 2f, tmp.y - cameraComponent.size.y / 2f);
    points[LT].set(tmp.x - cameraComponent.size.x / 2f, tmp.y + cameraComponent.size.y / 2f);
    points[RT].set(tmp.x + cameraComponent.size.x / 2f, tmp.y + cameraComponent.size.y / 2f);
    points[RB].set(tmp.x + cameraComponent.size.x / 2f, tmp.y - cameraComponent.size.y / 2f);
    points[LB].rotateAroundDeg(tmp, transformComponent.rotation);
    points[LT].rotateAroundDeg(tmp, transformComponent.rotation);
    points[RT].rotateAroundDeg(tmp, transformComponent.rotation);
    points[RB].rotateAroundDeg(tmp, transformComponent.rotation);
    // midpoint
    tmp.set(points[RT]).sub(points[LB]).scl(0.5f).add(points[LB]);
    updateRotationAreas(tmp.x, tmp.y);
}
Also used : CameraComponent(com.talosvfx.talos.editor.addons.scene.logic.components.CameraComponent) TransformComponent(com.talosvfx.talos.editor.addons.scene.logic.components.TransformComponent)

Aggregations

CameraComponent (com.talosvfx.talos.editor.addons.scene.logic.components.CameraComponent)4 TransformComponent (com.talosvfx.talos.editor.addons.scene.logic.components.TransformComponent)3 Vector2 (com.badlogic.gdx.math.Vector2)1