X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Frender%2Fplaceable.h;fp=source%2Frender%2Fplaceable.h;h=35999a06e1df5f30820511167d0c107d8941a955;hb=7aaec9a70b8d7733429bec043f8e33e02956f266;hp=0000000000000000000000000000000000000000;hpb=bec07999d95b76f4b47cffcc564d0cd0afc0435e;p=libs%2Fgl.git diff --git a/source/render/placeable.h b/source/render/placeable.h new file mode 100644 index 00000000..35999a06 --- /dev/null +++ b/source/render/placeable.h @@ -0,0 +1,44 @@ +#ifndef MSP_GL_PLACEABLE_H_ +#define MSP_GL_PLACEABLE_H_ + +#include "matrix.h" +#include "renderable.h" + +namespace Msp { +namespace GL { + +/** +A base class for things that can be positioned and oriented in 3D space. +*/ +class Placeable +{ +protected: + Matrix matrix; + + Placeable() { } +public: + virtual ~Placeable() { } + + virtual void set_matrix(const Matrix &); + + /** Returns the Placeable's matrix. This function returns a pointer for + compatibility with Renderable. The returned pointer is never null. */ + virtual const Matrix *get_matrix() const { return &matrix; } +}; + + +class PlacedRenderable: public Renderable, public Placeable +{ +protected: + PlacedRenderable() { } + +public: + /* Reimplement to clear ambiguity between Renderable and Placeable. This + overrides both base classes' implementations. */ + virtual const Matrix *get_matrix() const { return &matrix; } +}; + +} // namespace GL +} // namespace Msp + +#endif