KJB
|
#include <gui_selectable.h>
Public Member Functions | |
virtual bool | selection_hit (unsigned int *index_stack, unsigned int *index_stack_end, int button, int state)=0 |
virtual void | render (bool select_mode) const =0 |
virtual void | render () const |
Public Member Functions inherited from kjb::Renderable | |
virtual | ~Renderable () |
Deletes this Renderable. More... | |
Interface for a renderable object to be selectable with the cursor, using opengl's glSelect functionality.
The render() method should call glLoadName() before rendering each selectable object (the caller will call glPushName(0) before calling this object's render method, so you don't need to).
If an object form this class is clicked during selection, process_hit is called with the index of the rendered object.
Objects implementing this interface can be attached to a Viewer by calling Viewer::add_selection_listener
|
pure virtual |
Special render method. if select_mode is true, glLoadName() should be called before every selectable object. If some objects aren't selectable, you shouldn't render them when select_mode == true;
|
inlinevirtual |
alias for select(false)
Implements kjb::Renderable.
|
pure virtual |
Process a hit stack returned by glSelectBuffer, Most object will simply dereference index_stack to get the index of the hit item. Heirarchical objects will use the first index to determine which object to dispatch to with the rest of the stack.
index_stack | stack of indicies that make up this hit record |
index_stack_end | one past the end of the stack array. |
button | Which button was clicked. see glutMouseFunction for valued values |
state | Auxiliary state when click occurred (shift, ctrl, etc). see glutMouseFunction for valid values. |