lldynamictexture.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLDYNAMICTEXTURE_H
00033 #define LL_LLDYNAMICTEXTURE_H
00034 
00035 #include "llgl.h"
00036 #include "linked_lists.h"
00037 #include "llcamera.h"
00038 #include "llcoord.h"
00039 #include "llimagegl.h"
00040 
00041 class LLDynamicTexture
00042 {
00043 public:
00044         enum EOrder { ORDER_FIRST = 0, ORDER_MIDDLE = 1, ORDER_LAST = 2, ORDER_RESET = 3, ORDER_COUNT = 4 };
00045 
00046         LLDynamicTexture(S32 width,
00047                                          S32 height,
00048                                          S32 components,                // = 4,
00049                                          EOrder order,                  // = ORDER_MIDDLE,
00050                                          BOOL clamp);
00051         virtual ~LLDynamicTexture();
00052 
00053         S32                     getOriginX()    { return mOrigin.mX; }
00054         S32                     getOriginY()    { return mOrigin.mY; }
00055         S32                     getWidth()              { return mWidth; }
00056         S32                     getHeight()             { return mHeight; }
00057         S32                     getComponents() { return mComponents; }
00058         S32                     getSize()               { return mWidth * mHeight * mComponents; }
00059 
00060         virtual BOOL needsRender() { return TRUE; }
00061         virtual void preRender(BOOL clear_depth = TRUE);
00062         virtual BOOL render();
00063         virtual void postRender(BOOL success);
00064         virtual void bindTexture();
00065         virtual void unbindTexture();
00066 
00067         static BOOL     updateAllInstances();
00068 
00069         static void destroyGL();
00070         static void restoreGL();
00071 
00072 protected:
00073         void releaseGLTexture();
00074         void generateGLTexture();
00075         void generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes = FALSE);
00076 
00077 protected:
00078         S32 mWidth;
00079         S32 mHeight;
00080         S32 mComponents;
00081         LLPointer<LLImageGL> mTexture;
00082         F32 mLastBindTime;
00083         BOOL mClamp;
00084         LLCoordGL mOrigin;
00085 
00086         LLCamera mCamera;
00087         static LLLinkedList<LLDynamicTexture> sInstances[ LLDynamicTexture::ORDER_COUNT ];
00088         static S32 sNumRenders;
00089 };
00090 
00091 #endif

Generated on Thu Jul 1 06:08:28 2010 for Second Life Viewer by  doxygen 1.4.7