mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 17:41:12 +02:00
FIxing the Render::Item compilation on mac
This commit is contained in:
parent
1a59f4a97c
commit
22c99d02b9
1 changed files with 26 additions and 13 deletions
|
@ -24,7 +24,11 @@
|
||||||
namespace render {
|
namespace render {
|
||||||
|
|
||||||
class Context;
|
class Context;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Item {
|
class Item {
|
||||||
public:
|
public:
|
||||||
typedef std::vector<Item> Vector;
|
typedef std::vector<Item> Vector;
|
||||||
|
@ -59,24 +63,16 @@ public:
|
||||||
// Payload is whatever is in this Item and implement the Payload Interface
|
// Payload is whatever is in this Item and implement the Payload Interface
|
||||||
class PayloadInterface {
|
class PayloadInterface {
|
||||||
public:
|
public:
|
||||||
virtual const State&& getState() const = 0;
|
virtual const State getState() const = 0;
|
||||||
virtual const Bound&& getBound() const = 0;
|
virtual const Bound getBound() const = 0;
|
||||||
virtual void render(Context& context) = 0;
|
virtual void render(Context& context) = 0;
|
||||||
|
|
||||||
~PayloadInterface() {}
|
~PayloadInterface() {}
|
||||||
protected:
|
protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T> class Payload : public PayloadInterface {
|
|
||||||
public:
|
|
||||||
virtual const State&& getState() const { return getState<T>(*this); }
|
|
||||||
virtual const Bound&& getBound() const { return getBound<T>(*this); }
|
|
||||||
virtual void render(Context& context) { render<T>(*this, context); }
|
|
||||||
protected:
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef std::shared_ptr<PayloadInterface> PayloadPointer;
|
typedef std::shared_ptr<PayloadInterface> PayloadPointer;
|
||||||
|
|
||||||
Item() {}
|
Item() {}
|
||||||
Item(PayloadPointer& payload):
|
Item(PayloadPointer& payload):
|
||||||
_payload(payload) {}
|
_payload(payload) {}
|
||||||
|
@ -108,7 +104,7 @@ public:
|
||||||
bool isPickable() const { return _state[PICKABLE]; }
|
bool isPickable() const { return _state[PICKABLE]; }
|
||||||
|
|
||||||
// Payload Interface
|
// Payload Interface
|
||||||
const Bound&& getBound() const { return _payload->getBound(); }
|
const Bound getBound() const { return _payload->getBound(); }
|
||||||
void render(Context& context) { _payload->render(context); }
|
void render(Context& context) { _payload->render(context); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -118,6 +114,21 @@ protected:
|
||||||
friend class Scene;
|
friend class Scene;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T> const Item::State payloadGetState(const T* payload) { return Item::State(); }
|
||||||
|
template <class T> const Item::Bound payloadGetBound(const T* payload) { return Item::Bound(); }
|
||||||
|
template <class T> void payloadRender(const T* payload) { }
|
||||||
|
|
||||||
|
template <class T> class ItemPayload : public Item::PayloadInterface {
|
||||||
|
public:
|
||||||
|
virtual const Item::State getState() const { return payloadGetState<T>(_pointee); }
|
||||||
|
virtual const Item::Bound getBound() const { return payloadGetBound<T>(_pointee); }
|
||||||
|
virtual void render(Context& context) { payloadRender<T>(_pointee, context); }
|
||||||
|
|
||||||
|
ItemPayload(std::shared_ptr<T>& pointee) : _pointee(pointee) {}
|
||||||
|
protected:
|
||||||
|
std::shared_ptr<T> _pointee;
|
||||||
|
};
|
||||||
|
|
||||||
typedef Item::PayloadInterface Payload;
|
typedef Item::PayloadInterface Payload;
|
||||||
typedef Item::PayloadPointer PayloadPointer;
|
typedef Item::PayloadPointer PayloadPointer;
|
||||||
typedef std::vector< PayloadPointer > Payloads;
|
typedef std::vector< PayloadPointer > Payloads;
|
||||||
|
@ -217,6 +228,8 @@ protected:
|
||||||
friend class Engine;
|
friend class Engine;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef std::shared_ptr<Scene> ScenePointer;
|
typedef std::shared_ptr<Scene> ScenePointer;
|
||||||
typedef std::vector<ScenePointer> Scenes;
|
typedef std::vector<ScenePointer> Scenes;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue