8 |
using std::vector; |
using std::vector; |
9 |
using std::cout; |
using std::cout; |
10 |
using namespace Vec23; |
using namespace Vec23; |
11 |
|
|
12 |
class CoordSys { |
class CoordSys { |
13 |
protected: |
protected: |
14 |
CoordSys *super; |
CoordSys *super; |
15 |
float *params; |
float *params; |
16 |
|
CoordSys *inverse; |
17 |
|
virtual CoordSys *createInverse() ; |
18 |
public: |
public: |
19 |
virtual void setSuper(CoordSys *super) { |
virtual void setSuper(CoordSys *super) { |
20 |
this->super = super; |
this->super = super; |
23 |
this->params = params; |
this->params = params; |
24 |
} |
} |
25 |
|
|
26 |
|
/** Get the inverse of this coordinate system. |
27 |
|
* Always returns non-null but it is not guaranteed |
28 |
|
* that this will work properly. (XXX canInvert()) |
29 |
|
* The returned inverse is owned by this object and |
30 |
|
* mustn't be deleted by the caller. |
31 |
|
*/ |
32 |
|
CoordSys *getInverse() { |
33 |
|
if(!inverse) |
34 |
|
inverse = createInverse(); |
35 |
|
return inverse; |
36 |
|
} |
37 |
|
|
38 |
// For Pt as well? |
// For Pt as well? |
39 |
|
|
40 |
/** Call glVertex with the given ZPt transformed |
/** Call glVertex with the given ZPt transformed |
70 |
*/ |
*/ |
71 |
virtual bool performGL() ; |
virtual bool performGL() ; |
72 |
|
|
73 |
virtual ~CoordSys() { } |
CoordSys() : super(0), params(0), inverse(0) { |
74 |
|
} |
75 |
|
virtual ~CoordSys() { |
76 |
|
if(inverse) delete inverse; |
77 |
|
} |
78 |
|
|
79 |
virtual void dump() { |
virtual void dump() { |
80 |
cout << "Unknown coordsys\n"; |
cout << "Unknown coordsys\n"; |