2018-04-08 00:21:45 +02:00
|
|
|
#ifndef PW_SCENE_TRANSFORM_HPP
|
|
|
|
#define PW_SCENE_TRANSFORM_HPP
|
|
|
|
|
|
|
|
#include <pw/core/matrix.hpp>
|
|
|
|
#include <pw/scene/component.hpp>
|
|
|
|
|
|
|
|
namespace pw {
|
|
|
|
|
|
|
|
class transform : public component {
|
|
|
|
public:
|
2018-04-11 17:55:55 +02:00
|
|
|
|
2019-01-05 10:13:16 +01:00
|
|
|
transform() = default;
|
|
|
|
|
2018-04-08 00:21:45 +02:00
|
|
|
using component::component;
|
2019-01-02 23:22:09 +01:00
|
|
|
using component::ref;
|
2018-04-08 00:21:45 +02:00
|
|
|
|
2019-01-02 23:22:09 +01:00
|
|
|
inline const matrix44& local() const { return _local; }
|
|
|
|
void set_local(const matrix44 &local);
|
2018-04-08 00:21:45 +02:00
|
|
|
|
2019-01-02 23:22:09 +01:00
|
|
|
void set_global(const matrix44 &global);
|
2018-04-11 17:55:55 +02:00
|
|
|
|
|
|
|
void update();
|
|
|
|
|
2019-01-01 21:47:35 +01:00
|
|
|
inline void translate(const real_t &x, const real_t &y, const real_t &z) {
|
|
|
|
_local.at(0,3) += x;_local.at(1,3) += y;_local.at(2,3) += z;
|
|
|
|
}
|
|
|
|
|
2018-04-08 00:21:45 +02:00
|
|
|
protected:
|
|
|
|
|
2019-01-02 23:22:09 +01:00
|
|
|
matrix44 _local;
|
|
|
|
matrix44 _global;
|
2018-04-08 00:21:45 +02:00
|
|
|
};
|
|
|
|
|
2018-12-30 23:36:53 +01:00
|
|
|
|
|
|
|
|
2018-04-08 00:21:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|