OpenCOVER
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
17namespace vrui
18{
19
20class vruiNode;
21class vruiHit;
22
23class OPENVRUIEXPORT vruiIntersection : public coUpdateable
24{
25public:
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)
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
50protected:
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
65private:
66 std::list<coAction *> actionList; // list of intersected Actions
67};
68}
69#endif
collaborative interface manager
Definition: coVRCommunication.h:41
Definition: coAction.h:26
objects that are derived from this class are called once per frame
Definition: coUpdateManager.h:20
Definition: vruiHit.h:21
Definition: vruiIntersection.h:24
void callActions(vruiNode *node, vruiHit *hit)
static vruiIntersection * getIntersector(const std::string &name)
virtual const char * getActionName() const =0
get the associated action name
static std::vector< vruiIntersection * > & intersectors()
void remove(coAction *action)
static vruiIntersection * getIntersectorForAction(const std::string &actionName)
void remove(vruiNode *node)
int frameIndex
Definition: vruiIntersection.h:63
virtual void intersect()=0
static std::vector< int * > & frames()
void add(vruiNode *node, coAction *action)
virtual const char * getClassName() const =0
get the Element's classname
Definition: vruiNode.h:22