ComputerGraphik TU WIEN
selectorGPU.hpp
Go to the documentation of this file.
1 #ifndef SELECTORGPU_HPP
2 #define SELECTORGPU_HPP
3 
4 #include <string>
5 #include <vector>
6 
7 #include "selectorBase.hpp"
8 
9 class Shader;
10 
12 
41 class SelectorGPU : public SelectorBase {
42 
43  enum { KernelSize = 8 };
44 
45 public:
46  SelectorGPU(const std::string& name, Scene* scene);
47  ~SelectorGPU();
48 
49  void changeMode();
50  void pickObject(const glm::ivec2& mouse);
51 
52  void getPixelCount(int& width, int& height) const { width = windowX * KernelSize; height = windowY * KernelSize; }
53 
54 private:
55  int mode;
56  int windowX;
57  int windowY;
58 
59  GLuint objectBuffer;
61  std::vector<GLuint> buffer;
62 };
63 
64 #endif //SELECTORGPU_HPP
Definition: selectorGPU.hpp:43
std::vector< GLuint > buffer
buffer to store compute shader result on CPU
Definition: selectorGPU.hpp:61
void getPixelCount(int &width, int &height) const
Definition: selectorGPU.hpp:52
GLuint objectBuffer
buffer to store compute shader result on GPU
Definition: selectorGPU.hpp:59
void pickObject(const glm::ivec2 &mouse)
select closest object to mouse
Definition: selectorGPU.cpp:62
int windowX
number of kernels used in compute shader
Definition: selectorGPU.hpp:56
void changeMode()
debug, change kernel count
Definition: selectorGPU.cpp:30
int height
height of screen
Definition: selectorBase.hpp:37
SelectorGPU(const std::string &name, Scene *scene)
Defined in compute shader.
Definition: selectorGPU.cpp:14
int windowY
number of kernels used in compute shader
Definition: selectorGPU.hpp:57
Encapsulates the Rendering Engine, holds a complete scene and it's assets.
Definition: scene.hpp:71
Scene * scene
Definition: sceneObject.hpp:68
~SelectorGPU()
Definition: selectorGPU.cpp:25
std::string name
Definition: sceneObject.hpp:73
Encapsulates a shader program.
Definition: shader.hpp:9
Base class for selectors.
Definition: selectorBase.hpp:15
int mode
debug, help to set window
Definition: selectorGPU.hpp:55
int width
width of screen
Definition: selectorBase.hpp:34
Implements the GPU based object selection.
Definition: selectorGPU.hpp:41
Shader * computeShader
the compute shader to use
Definition: selectorGPU.hpp:60