2017-03-03 20:04:23 +00:00
|
|
|
#ifndef TRANSFORM_H
|
|
|
|
#define TRANSFORM_H
|
|
|
|
|
2017-03-15 22:19:58 +00:00
|
|
|
#if defined(_WIN32)
|
|
|
|
# ifdef _GD_CPP_CORE_API_IMPL
|
|
|
|
# define GD_CPP_CORE_API __declspec(dllexport)
|
|
|
|
# else
|
|
|
|
# define GD_CPP_CORE_API __declspec(dllimport)
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
# define GD_CPP_CORE_API
|
|
|
|
#endif
|
|
|
|
|
2017-03-06 07:49:24 +00:00
|
|
|
#include "Basis.hpp"
|
2017-03-03 20:04:23 +00:00
|
|
|
|
2017-03-06 07:49:24 +00:00
|
|
|
#include "Plane.hpp"
|
|
|
|
#include "Rect3.hpp"
|
2017-03-03 20:04:23 +00:00
|
|
|
|
|
|
|
namespace godot {
|
|
|
|
|
2017-03-15 22:19:58 +00:00
|
|
|
class GD_CPP_CORE_API Transform {
|
2017-03-03 20:04:23 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
Basis basis;
|
|
|
|
Vector3 origin;
|
|
|
|
|
|
|
|
void invert();
|
|
|
|
Transform inverse() const;
|
|
|
|
|
|
|
|
void affine_invert();
|
|
|
|
Transform affine_inverse() const;
|
|
|
|
|
|
|
|
Transform rotated(const Vector3& p_axis,real_t p_phi) const;
|
|
|
|
|
|
|
|
void rotate(const Vector3& p_axis,real_t p_phi);
|
|
|
|
void rotate_basis(const Vector3& p_axis,real_t p_phi);
|
|
|
|
|
|
|
|
void set_look_at( const Vector3& p_eye, const Vector3& p_target, const Vector3& p_up );
|
|
|
|
Transform looking_at( const Vector3& p_target, const Vector3& p_up ) const;
|
|
|
|
|
|
|
|
void scale(const Vector3& p_scale);
|
|
|
|
Transform scaled(const Vector3& p_scale) const;
|
|
|
|
void scale_basis(const Vector3& p_scale);
|
|
|
|
void translate( real_t p_tx, real_t p_ty, real_t p_tz );
|
|
|
|
void translate( const Vector3& p_translation );
|
|
|
|
Transform translated( const Vector3& p_translation ) const;
|
|
|
|
|
2017-03-06 02:30:46 +00:00
|
|
|
inline const Basis& get_basis() const { return basis; }
|
|
|
|
inline void set_basis(const Basis& p_basis) { basis=p_basis; }
|
2017-03-03 20:04:23 +00:00
|
|
|
|
2017-03-06 02:30:46 +00:00
|
|
|
inline const Vector3& get_origin() const { return origin; }
|
|
|
|
inline void set_origin(const Vector3& p_origin) { origin=p_origin; }
|
2017-03-03 20:04:23 +00:00
|
|
|
|
|
|
|
void orthonormalize();
|
|
|
|
Transform orthonormalized() const;
|
|
|
|
|
|
|
|
bool operator==(const Transform& p_transform) const;
|
|
|
|
bool operator!=(const Transform& p_transform) const;
|
|
|
|
|
|
|
|
Vector3 xform(const Vector3& p_vector) const;
|
|
|
|
Vector3 xform_inv(const Vector3& p_vector) const;
|
|
|
|
|
|
|
|
Plane xform(const Plane& p_plane) const;
|
|
|
|
Plane xform_inv(const Plane& p_plane) const;
|
|
|
|
|
|
|
|
Rect3 xform(const Rect3& p_aabb) const;
|
|
|
|
Rect3 xform_inv(const Rect3& p_aabb) const;
|
|
|
|
|
|
|
|
void operator*=(const Transform& p_transform);
|
|
|
|
Transform operator*(const Transform& p_transform) const;
|
|
|
|
|
|
|
|
Transform interpolate_with(const Transform& p_transform, real_t p_c) const;
|
|
|
|
|
2017-03-06 02:30:46 +00:00
|
|
|
Transform inverse_xform(const Transform& t) const;
|
2017-03-03 20:04:23 +00:00
|
|
|
|
2017-03-06 02:30:46 +00:00
|
|
|
void set(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz,real_t tx, real_t ty, real_t tz);
|
2017-03-03 20:04:23 +00:00
|
|
|
|
|
|
|
operator String() const;
|
|
|
|
|
2017-04-04 19:02:44 +00:00
|
|
|
inline Transform(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz,real_t tx, real_t ty, real_t tz) {
|
|
|
|
set(xx, xy, xz, yx, yy, yz, zx, zy, zz,tx, ty, tz);
|
|
|
|
}
|
|
|
|
|
2017-03-03 20:04:23 +00:00
|
|
|
Transform(const Basis& p_basis, const Vector3& p_origin=Vector3());
|
2017-03-06 02:30:46 +00:00
|
|
|
inline Transform() {}
|
2017-03-03 20:04:23 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // TRANSFORM_H
|