38 lines
640 B
C++
38 lines
640 B
C++
#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:
|
|
|
|
transform() = default;
|
|
|
|
using component::component;
|
|
using component::ref;
|
|
|
|
inline const matrix44& local() const { return _local; }
|
|
void set_local(const matrix44 &local);
|
|
|
|
void set_global(const matrix44 &global);
|
|
|
|
void update();
|
|
|
|
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;
|
|
}
|
|
|
|
protected:
|
|
|
|
matrix44 _local;
|
|
matrix44 _global;
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|