OpenCOVER
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
vruiIntersection.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 #ifndef VRUI_INTERSECTION_H
9 #define VRUI_INTERSECTION_H
10 
11 #include <OpenVRUI/coAction.h>
13 #include <list>
14 #include <string>
15 #include <vector>
16 
17 namespace vrui
18 {
19 
20 class vruiNode;
21 class vruiHit;
22 
23 class OPENVRUIEXPORT vruiIntersection : public coUpdateable
24 {
25 public:
26  // add this node to the list of intersected nodes
27  // call action if node is intersected
28  void add(vruiNode *node, coAction *action);
29 
30  // keep this node from being intersected
31  void remove(vruiNode *node);
32 
33  // internal methods (do not call)
35  virtual ~vruiIntersection();
36 
37  bool update();
38 
39  void remove(coAction *action); // remove all references to this action
40  // called by ~coAction
41 
42  static vruiIntersection *getIntersectorForAction(const std::string &actionName);
43  static vruiIntersection *getIntersector(const std::string &name);
44 
46  virtual const char *getClassName() const = 0;
48  virtual const char *getActionName() const = 0;
49 
50 protected:
51  virtual void intersect() = 0; // do the intersection
52 
53  void callMisses(); // call miss method of all Actions in actionList
54  // if node was not intersected in this frame and remove it from the list
55  void callActions(vruiNode *node, vruiHit *hit);
56  // call all Actions that are attached
57  // to that part of the Scenegraph
58  // static unsigned int thisFrame; // framecounter (used to produce the miss call)
59 
60  static std::vector<int *> &frames(); // frame counters for subclasses, subclasses have to push_back a &int to this
61  // subclasses have to push_back 'this';
62  static std::vector<vruiIntersection *> &intersectors();
63  int frameIndex; // subclasses should set this to point to their index in frames
64 
65 private:
66  std::list<coAction *> actionList; // list of intersected Actions
67 };
68 }
69 #endif
Definition: vruiHit.h:20
Definition: vruiNode.h:21
Definition: coAction.h:25
int frameIndex
Definition: vruiIntersection.h:63
Definition: vruiIntersection.h:23
objects that are derived from this class are called once per frame
Definition: coUpdateManager.h:19