Separate coord space transform class for more correct scaling
This commit is contained in:
parent
46370e5762
commit
d261293d6b
7 changed files with 307 additions and 7 deletions
35
src/CoordSpaceHelperTransform.hpp
Normal file
35
src/CoordSpaceHelperTransform.hpp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
#include "SharedTypes.hpp"
|
||||
#include <Helpers/Serializers.hpp>
|
||||
#include <array>
|
||||
#include <Helpers/SCollision.hpp>
|
||||
#include "CoordSpaceHelper.hpp"
|
||||
|
||||
#ifndef IS_SERVER
|
||||
#include "include/core/SkMatrix.h"
|
||||
#include "include/core/SkCanvas.h"
|
||||
#endif
|
||||
|
||||
class World;
|
||||
struct DrawData;
|
||||
|
||||
class CoordSpaceHelperTransform {
|
||||
public:
|
||||
WorldVec from_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;
|
||||
|
||||
bool operator==(const CoordSpaceHelperTransform& otherCoords) const;
|
||||
bool operator!=(const CoordSpaceHelperTransform& otherCoords) const;
|
||||
|
||||
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};
|
||||
WorldMultiplier inverseScale{1};
|
||||
double rotation = 0.0;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue