-
Notifications
You must be signed in to change notification settings - Fork 5
/
Renderable.h
54 lines (47 loc) · 1.22 KB
/
Renderable.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once
#include "Enums.h"
#include "Texture.h"
#include "Camera.h"
#include "TileDeck.h"
#include "DrawBatch.h"
class Renderable {
public:
DIMENSION dimension;
int priority;
bool visible;
Deck *deck;
float enfat_epsilon;
int index;
bool wireframe;
Renderable() : dimension(DIMENSION_INVAL), priority(0), visible(true), deck(NULL), enfat_epsilon(0), index(-1), wireframe(false) {
}
~Renderable() {}
inline void setDeck( Deck *d ){
deck = d;
}
inline void setWireframe(bool flg) { wireframe=flg; }
inline void setVisible(bool flg){ visible = flg; }
inline bool getVisible() { return visible; }
inline void setPriority(int prio) { priority = prio; }
inline int getPriority() { return priority; }
inline void swapPriority( Renderable *target ) {
int p = priority;
priority = target->priority;
target->priority = p;
}
inline void ensureFront( Renderable *target ) {
if( target->priority > priority ) {
swapPriority(target);
}
}
inline void ensurePriority( Renderable *lower ) {
if( priority >= lower->priority ) {
return;
} else {
int tmp = priority;
priority = lower->priority;
lower->priority = tmp;
}
}
virtual void render(Camera *cam, DrawBatchList *bl ){};
};