00001
00013 #ifndef __VU_SPHERICVIEW_H__
00014 #define __VU_SPHERICVIEW_H__
00015
00016 #include <stddef.h>
00017 #include "vuSimpleTypes.h"
00018 #include "vuFixelMap.h"
00019 #include "vuLinAlg/vuVector.h"
00020
00021 class vuSphericView_ST
00022 {
00023 public:
00024 virtual vuVector &getLookFrom() = 0;
00025 };
00026
00027 template <int SIZE, class TYPE>
00028 class vuSphericView : public vuSphericView_ST {
00029 public:
00030
00031 vuSphericView();
00032
00033
00034 vuSphericView(vuFixelMap<SIZE,TYPE> *map, vuVector &lookFrom, vuVector &up);
00035
00036
00037 vuSphericView(dword width, dword height, vuVector lookFrom=vuVector(1,0,0),
00038 vuVector up=vuVector(0,1,0));
00039
00040
00041 virtual ~vuSphericView();
00042
00043
00044 vuSphericView(const vuSphericView &other);
00045
00046 void setLookFrom(const vuVector &lookFrom);
00047 vuVector &getLookFrom();
00048
00049 void setUp(const vuVector &up);
00050 vuVector &getUp();
00051
00052 vuFixelMap<SIZE,TYPE> *getMap();
00053
00054 dword getWidth();
00055 dword getHeight();
00056
00058 void initOpenGL(void);
00060 void glResize(dword width, dword height);
00062 void glRender();
00063
00064
00065 vuSphericView &operator=(const vuSphericView &other);
00066
00067 bool writeToFileStream(ostream *out);
00068
00069 bool readFromFileStream(istream *in, dword width, dword height);
00070
00071 void readFromBuffer(byte *buffer, dword width, dword height);
00072
00073 void writeIntoBuffer(byte *buffer, dword width, dword height);
00074
00075 static dword getSizeInByte(dword width, dword height);
00076
00077 protected:
00078 vuFixelMap<SIZE,TYPE> *m_map;
00079 vuVector m_lookFrom;
00080 vuVector m_up;
00081 bool m_isMapNewed;
00082 };
00083
00084 template class vuSphericView<1,byte>;
00085 template class vuSphericView<2,byte>;
00086 template class vuSphericView<3,byte>;
00087
00088 template class vuSphericView<1,float>;
00089 template class vuSphericView<2,float>;
00090 template class vuSphericView<3,float>;
00091
00092
00093 typedef vuSphericView<1,byte> vuSphericView1B;
00094 typedef vuSphericView<2,byte> vuSphericView2B;
00095 typedef vuSphericView<3,byte> vuSphericView3B;
00096
00097 typedef vuSphericView<1,float> vuSphericView1F;
00098 typedef vuSphericView<2,float> vuSphericView2F;
00099 typedef vuSphericView<3,float> vuSphericView3F;
00100
00101 #endif