Transformations now commited step by step, fixes many transformation related bugs
This commit is contained in:
parent
b4babf978e
commit
a2e4a795f7
8 changed files with 127 additions and 47 deletions
|
|
@ -15,8 +15,13 @@ struct DrawData;
|
|||
|
||||
class CoordSpaceHelperTransform {
|
||||
public:
|
||||
CoordSpaceHelperTransform();
|
||||
CoordSpaceHelperTransform(const WorldVec& translationPos);
|
||||
CoordSpaceHelperTransform(const WorldVec& rotatePos, double angle);
|
||||
CoordSpaceHelperTransform(const WorldVec& scalePos, const WorldMultiplier& inverseScaleAmount);
|
||||
|
||||
WorldVec from_space_world(const WorldVec& coord) const;
|
||||
WorldVec to_space_world(const WorldVec& coord) const;
|
||||
//WorldVec to_space_world(const WorldVec& coord) const;
|
||||
|
||||
CoordSpaceHelper other_coord_space_to_this_space(const CoordSpaceHelper& other) const;
|
||||
CoordSpaceHelper other_coord_space_from_this_space(const CoordSpaceHelper& other) const;
|
||||
|
|
@ -24,12 +29,21 @@ class CoordSpaceHelperTransform {
|
|||
bool operator==(const CoordSpaceHelperTransform& otherCoords) const;
|
||||
bool operator!=(const CoordSpaceHelperTransform& otherCoords) const;
|
||||
|
||||
enum class TransformType {
|
||||
NONE,
|
||||
TRANSLATE,
|
||||
ROTATE,
|
||||
SCALE
|
||||
};
|
||||
|
||||
private:
|
||||
void set_rotation(double newRotation);
|
||||
void translate(const WorldVec& translation);
|
||||
void rotate_about(const WorldVec& rotatePos, double angle);
|
||||
void scale_about(const WorldVec& scalePos, const WorldMultiplier& scaleAmount);
|
||||
|
||||
WorldVec pos{0, 0};
|
||||
TransformType transformType = TransformType::NONE;
|
||||
WorldVec pos{0, 0}; // rotation center, scale center, or translation value
|
||||
WorldMultiplier inverseScale{1};
|
||||
double rotation = 0.0;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue