-
Notifications
You must be signed in to change notification settings - Fork 0
/
picker.h
46 lines (34 loc) · 1.01 KB
/
picker.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
44
45
46
#ifndef PICKER_H
#define PICKER_H
#include <vector>
#include <map>
#include <memory>
#include <stdexcept>
#if __GNUG__
# include <tr1/memory>
#endif
#include "cvec.h"
#include "scenegraph.h"
#include "asstcommon.h"
#include "ppm.h"
#include "drawer.h"
class Picker : public SgNodeVisitor {
std::vector<std::tr1::shared_ptr<SgNode> > nodeStack_;
typedef std::map<int, std::tr1::shared_ptr<SgRbtNode> > IdToRbtNodeMap;
IdToRbtNodeMap idToRbtNode_;
int idCounter_;
bool srgbFrameBuffer_;
Drawer drawer_;
void addToMap(int id, std::tr1::shared_ptr<SgRbtNode> node);
std::tr1::shared_ptr<SgRbtNode> find(int id);
Cvec3 idToColor(int id);
int colorToId(const PackedPixel& p);
public:
Picker(const RigTForm& initialRbt, const ShaderState& curSS);
virtual bool visit(SgTransformNode& node);
virtual bool postVisit(SgTransformNode& node);
virtual bool visit(SgShapeNode& node);
virtual bool postVisit(SgShapeNode& node);
std::tr1::shared_ptr<SgRbtNode> getRbtNodeAtXY(int x, int y);
};
#endif