00001
00032 #ifndef LL_LLCUBEMAP_H
00033 #define LL_LLCUBEMAP_H
00034
00035 #include "llgl.h"
00036 #include "llviewerimage.h"
00037
00038 #include <vector>
00039
00040 class LLVector3;
00041
00042
00043 class LLCubeMap : public LLRefCount
00044 {
00045 public:
00046 LLCubeMap();
00047 void init(const std::vector<LLPointer<LLImageRaw> >& rawimages);
00048 void initGL();
00049 void initRawData(const std::vector<LLPointer<LLImageRaw> >& rawimages);
00050 void initGLData();
00051
00052 void bind();
00053 void enable(S32 stage);
00054
00055 void enableTexture(S32 stage);
00056 void enableTextureCoords(S32 stage);
00057
00058 void disable(void);
00059 void disableTexture(void);
00060 void disableTextureCoords(void);
00061 void setMatrix(S32 stage);
00062 void restoreMatrix();
00063
00064 void finishPaint();
00065
00066 GLuint getGLName();
00067
00068 LLVector3 map(U8 side, U16 v_val, U16 h_val) const;
00069 BOOL project(F32& v_val, F32& h_val, BOOL& outside,
00070 U8 side, const LLVector3& dir) const;
00071 BOOL project(F32& v_min, F32& v_max, F32& h_min, F32& h_max,
00072 U8 side, LLVector3 dir[4]) const;
00073 void paintIn(LLVector3 dir[4], const LLColor4U& col);
00074 void destroyGL();
00075
00076 protected:
00077 ~LLCubeMap();
00078 LLGLenum mTargets[6];
00079 LLPointer<LLImageGL> mImages[6];
00080 LLPointer<LLImageRaw> mRawImages[6];
00081 S32 mTextureStage;
00082 S32 mTextureCoordStage;
00083 S32 mMatrixStage;
00084 };
00085
00086 #endif