#include "transformable.h"
#include "transform.h"

Vector transformable_get_position(Transformable self) {
    return self.tc->get_transform(self.data)->position;
}

void transformable_set_position(Transformable self, Vector position) {
    self.tc->get_transform(self.data)->position = position;
}

void transformable_move(Transformable self, Vector delta) {
    Vector* position = &self.tc->get_transform(self.data)->position;
    *position = vaddf(*position, delta);
}

Vector transformable_get_scale(Transformable self) {
    return self.tc->get_transform(self.data)->scale;
}

void transformable_set_scale(Transformable self, Vector scale) {
    self.tc->get_transform(self.data)->scale = scale;
}

void transformable_scale(Transformable self, Vector factor) {
    Vector* scale = &self.tc->get_transform(self.data)->scale;
    *scale = vmulf(*scale, factor);
}

float transformable_get_rotation(Transformable self) {
    return self.tc->get_transform(self.data)->rotation;
}

void transformable_set_rotation(Transformable self, float rotation) {
    self.tc->get_transform(self.data)->rotation = rotation;
}

void transformable_rotate(Transformable self, float delta) {
    float* rotation = &self.tc->get_transform(self.data)->rotation;
    *rotation = *rotation + delta;
}
