ComputerGraphik TU WIEN
selectorBase.hpp
Go to the documentation of this file.
1 #ifndef SELECTORBASE_HPP
2 #define SELECTORBASE_HPP
3 
4 #include <string>
5 #include <vector>
6 
7 #include "sceneObject.hpp"
8 
10 
15 class SelectorBase : public SceneObject {
16 
17 public:
18  SelectorBase(const std::string& name, Scene* scene);
19  ~SelectorBase();
20 
21  void reset();
22  void draw() const;
23  void update(double deltaT);
24 
25  virtual void changeMode() = 0;
26  virtual void pickObject(const glm::ivec2& mouse) = 0;
27 
28  int getBufferWidth() const { return width; }
29  int getBufferHeight() const { return height; }
30  size_t getLastSelected() const { return lastSelected; }
31  size_t getLastDistance() const { return lastDistance; }
32 
33 protected:
34  class EffectObject;
35 
36  int width;
37  int height;
38  GLuint idBuffer;
39  GLuint idTexture;
40 
41  size_t lastDistance;
42  size_t lastSelected;
43 };
44 
45 #endif //SELECTORBASE_HPP
virtual void changeMode()=0
debug, change mode
SelectorBase(const std::string &name, Scene *scene)
Definition: selectorBase.cpp:49
size_t lastSelected
selected object id after pickObject() call
Definition: selectorBase.hpp:42
void reset()
set up EffectObject
Definition: selectorBase.cpp:122
virtual void pickObject(const glm::ivec2 &mouse)=0
select closest object to mouse
Definition: selectorBase.cpp:11
size_t lastDistance
distance after pickObject() call
Definition: selectorBase.hpp:41
size_t getLastSelected() const
Definition: selectorBase.hpp:30
int height
height of screen
Definition: selectorBase.hpp:37
int getBufferHeight() const
Definition: selectorBase.hpp:29
GLuint idBuffer
frame buffer
Definition: selectorBase.hpp:38
Encapsulates the Rendering Engine, holds a complete scene and it's assets.
Definition: scene.hpp:71
Scene * scene
Definition: sceneObject.hpp:68
std::string name
Definition: sceneObject.hpp:73
void update(double deltaT)
empty function
Definition: selectorBase.cpp:81
void draw() const
draw selectable object ids into a texture
Definition: selectorBase.cpp:86
The base class of the objects which are rendered.
Definition: sceneObject.hpp:30
int getBufferWidth() const
Definition: selectorBase.hpp:28
Base class for selectors.
Definition: selectorBase.hpp:15
GLuint idTexture
texture of rendered object indices
Definition: selectorBase.hpp:39
size_t getLastDistance() const
Definition: selectorBase.hpp:31
int width
width of screen
Definition: selectorBase.hpp:34
~SelectorBase()
Definition: selectorBase.cpp:75