00001
00002
00003 #ifndef __PROJECTION_H
00004 #define __PROJECTION_H
00005
00006 #include <gra/GRAObject.h>
00007
00021 using namespace esg;
00022
00023 namespace gra {
00024
00025 class GRA_EXPORT Projection : public GRAObject {
00026 protected:
00027 Matrix4 _projMat;
00028 float _left;
00029 float _right;
00030 float _bottom;
00031 float _top;
00032 float _near;
00033 float _far;
00034
00035 protected:
00036 void _set_clipping_planes(double , double ,
00037 double , double ,
00038 double , double );
00039
00040 public:
00047 Projection(double , double ,
00048 double , double ,
00049 double , double );
00050 Projection(const Projection&);
00051
00057 virtual Projection* clone() const = 0;
00058
00064 void set(const Projection& );
00065
00073 Vector4 project(const Vector4& ) const;
00074 Vector3 project(const Vector3& ) const;
00075
00084 bool projectAndClip(const Vector4& ,
00085 Vector4* ) const;
00086 bool projectAndClip(const Vector3& ,
00087 Vector3* ) const;
00088
00102 bool projectToPlane(const Vector3& ,
00103 Vector2& ) const;
00104
00113 bool clip(const Vector4& ) const;
00114 bool clip(const Vector3& ) const;
00115
00119 inline float getLeftPlane (void) const { return _left; }
00120 inline float getRightPlane (void) const { return _right; }
00121 inline float getBottomPlane (void) const { return _bottom; }
00122 inline float getTopPlane (void) const { return _top; }
00123 inline float getNearPlane (void) const { return _near; }
00124 inline float getFarPlane (void) const { return _far; }
00125 inline float getPlaneWidth (void) const { return _right - _left; }
00126 inline float getPlaneHeight (void) const { return _top - _bottom; }
00127
00131 void getProjectionArea(Vector3&,
00132 Vector3&,
00133 Vector3&,
00134 Vector3& ) const;
00135
00143 virtual Vector3 getProjectionDirection(const Vector2& ) = 0;
00144 };
00145
00146 }
00147
00148 #endif // __PROJECTION_H