00001
00015 #ifndef _CUBIC_PROJECTION_H
00016 #define _CUBIC_PROJECTION_H
00017
00018 #include <Rect.H>
00019
00020 namespace xchen
00021 {
00022 enum CubeFace {LEFT_FACE, BACK_FACE, RIGHT_FACE, FRONT_FACE, TOP_FACE, BOTTOM_FACE};
00023 class CubicProjection
00024 {
00025 public:
00026 static dVector3D* Cube2Sphere(int face, double u, double v);
00027
00031 static void LookAtFace( int idx );
00032
00033
00054 static XiaViewPort GetXiaViewPort(int idx, double wh_ratio=1.0);
00055
00056 public:
00057 CubicProjection(int u_res = 100, int v_res = 100) : spherePnts(0), cubeFacePnts(0), u_resolutions(u_res), v_resolutions(v_res) { }
00058 ~CubicProjection() { delete [] spherePnts; delete [] cubeFacePnts; }
00059
00060 void CubeTextMapping2Sphere();
00061 void GenerateProjectiveCoords();
00062
00063 private:
00064 dVector3D* spherePnts;
00065 dVector2D* cubeFacePnts;
00066 int u_resolutions, v_resolutions;
00067 };
00068
00069 }
00070 #endif
00071
00072