This repository has been archived by the owner on Dec 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVisualPickVisitor.h
43 lines (34 loc) · 1.58 KB
/
VisualPickVisitor.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
#ifndef SOFA_SIMPLEGUI_VisualPickVisitor_H
#define SOFA_SIMPLEGUI_VisualPickVisitor_H
#include <sofa/simulation/VisualVisitor.h>
#include <sofa/type/vector.h>
namespace sofa::simplegui
{
/**
* @brief The VisualPickVisitor class displays the scene for OpenGL picking.
* It uses the glPushName instruction, and it must be called within a specific OpenGL context, see http://www.lighthouse3d.com/opengl/picking/
* The names vector member contains the names of all the objects rendered, in the traversal order.
* This allows to associate a hit number to an object during the pre-processing.
* @sa SofaGL
* @author Francois Faure, 2014
*
* @warning The code is directly adapted from VisualDrawVisitor, without much insight
*/
class VisualPickVisitor : public ::sofa::simulation::VisualVisitor
{
public:
bool hasShader;
VisualPickVisitor(core::visual::VisualParams* params);
Result processNodeTopDown(simulation::Node* node) override;
void processNodeBottomUp(simulation::Node* node) override;
virtual void fwdVisualModel(simulation::Node* node, core::visual::VisualModel* vm);
void processVisualModel(simulation::Node* node, core::visual::VisualModel* vm) override;
void processObject(simulation::Node* node, core::objectmodel::BaseObject* o) override;
virtual void bwdVisualModel(simulation::Node* node, core::visual::VisualModel* vm);
const char* getClassName() const override { return "VisualPickVisitor"; }
sofa::type::vector<std::string> names; // names of the object displayed
private:
int pickedId;
};
}
#endif // SOFA_SIMPLEGUI_VisualPickVisitor_H