|
| SelectorGPU (const std::string &name, Scene *scene) |
| Defined in compute shader. More...
|
|
| ~SelectorGPU () |
|
void | changeMode () |
| debug, change kernel count More...
|
|
void | pickObject (const glm::ivec2 &mouse) |
| select closest object to mouse More...
|
|
void | getPixelCount (int &width, int &height) const |
|
| SelectorBase (const std::string &name, Scene *scene) |
|
| ~SelectorBase () |
|
void | reset () |
| set up EffectObject More...
|
|
void | draw () const |
| draw selectable object ids into a texture More...
|
|
void | update (double deltaT) |
| empty function More...
|
|
int | getBufferWidth () const |
|
int | getBufferHeight () const |
|
size_t | getLastSelected () const |
|
size_t | getLastDistance () const |
|
| SceneObject (std::shared_ptr< SceneObject > &effectParent, const glm::mat4 &modelMatrix=glm::mat4(1)) |
|
| SceneObject (const std::string &name, Scene *scene=0, Model *model=0, const glm::mat4 &modelMatrix=glm::mat4(1)) |
|
virtual | ~SceneObject () |
|
Model * | getModel () const |
|
Shader * | getShader () const |
|
glm::mat4 | getModelMatrix () const |
|
glm::mat4 | getGlobalModelMatrix () const |
|
std::string | getName () const |
|
std::shared_ptr< SceneObject > | getParent () const |
|
void | setAnimationTime (double time) |
|
bool | setAnimation (const Animation &anim) |
|
bool | delChild (size_t idx) |
|
bool | getChild (size_t idx, std::shared_ptr< SceneObject > &child) const |
|
bool | addChild (std::shared_ptr< SceneObject > &child) |
|
bool | remEffect (const std::string &name) |
|
SceneObject * | getEffect (const std::string &name) const |
|
bool | addEffect (const std::string &name, std::unique_ptr< SceneObject > &effect) |
|
bool | doNotRender () |
|
bool | getIsVolSun () |
|
virtual bool | animate (double time) |
|
virtual void | setShader (Shader *val) |
|
Implements the GPU based object selection.
The SelectorGPU class implements an alternative selection method. The selectable objects are rendered into a texture the same way as in the quadtree based method. After rendering a compute shader is executed on the texture, returning the id and the distance of the closest object to the mouse. This way memory transfer and cpu time can be saved. By selecting different count of kernels, the size of the screen ROI can be modified. The following pseudocode demonstrates the object selection by the compute shader:
ivec2 pixel = compute pixel position from thread id
if pixel out of pick
buffer bounds
return;
uint id = imageLoad(pickBuffer, pixel)
if id == 0
return;
uint dist = (distance(mouse, pixel) << 16) | id;
- Author
- Adam