lldrawpoolbump.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLDRAWPOOLBUMP_H
00033 #define LL_LLDRAWPOOLBUMP_H
00034 
00035 #include "lldrawpool.h"
00036 #include "llstring.h"
00037 #include "lltextureentry.h"
00038 #include "lluuid.h"
00039 
00040 class LLImageRaw;
00041 class LLSpatialGroup;
00042 class LLDrawInfo;
00043 
00044 class LLDrawPoolBump : public LLRenderPass
00045 {
00046 protected :
00047         LLDrawPoolBump(const U32 type):LLRenderPass(type) { mShiny = FALSE; }
00048 public:
00049         static U32 sVertexMask;
00050         BOOL mShiny;
00051 
00052         virtual U32 getVertexDataMask() { return sVertexMask; }
00053 
00054         LLDrawPoolBump();
00055 
00056         virtual void render(S32 pass = 0);
00057         virtual void beginRenderPass( S32 pass );
00058         virtual void endRenderPass( S32 pass );
00059         virtual S32      getNumPasses();
00060         /*virtual*/ void prerender();
00061         /*virtual*/ void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture);
00062 
00063         void renderBump(U32 type, U32 mask);
00064         void renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture);
00065         void renderGroupBump(LLSpatialGroup* group, U32 type, U32 mask);
00066         
00067         S32 numBumpPasses();
00068         
00069         void beginShiny(bool invisible = false);
00070         void renderShiny(bool invisible = false);
00071         void endShiny(bool invisible = false);
00072         
00073         void beginFullbrightShiny();
00074         void renderFullbrightShiny();
00075         void endFullbrightShiny();
00076 
00077         void beginBump();
00078         void renderBump();
00079         void endBump();
00080         BOOL bindBumpMap(LLDrawInfo& params);
00081 };
00082 
00083 enum EBumpEffect
00084 {
00085         BE_NO_BUMP = 0,
00086         BE_BRIGHTNESS = 1,
00087         BE_DARKNESS = 2,
00088         BE_STANDARD_0 = 3,  // Standard must always be the last one
00089         BE_COUNT = 4
00090 };
00091 
00093 // List of standard bumpmaps that are specificed by LLTextureEntry::mBump's lower bits
00094 
00095 class LLStandardBumpmap
00096 {
00097 public: 
00098         LLStandardBumpmap() : mLabel() {} 
00099         LLStandardBumpmap( const char* label ) : mLabel(label) {}
00100         
00101         LLString        mLabel;
00102         LLPointer<LLViewerImage> mImage;
00103 
00104         static  U32 sStandardBumpmapCount;  // Number of valid values in gStandardBumpmapList[]
00105 
00106         static void init();
00107         static void shutdown();
00108         static void     restoreGL();
00109         static void destroyGL();
00110 };
00111 
00112 extern LLStandardBumpmap gStandardBumpmapList[TEM_BUMPMAP_COUNT];
00113 
00115 // List of one-component bump-maps created from other texures.
00116 
00117 struct LLBumpImageEntry;
00118 
00119 class LLBumpImageList
00120 {
00121 public:
00122         LLBumpImageList() {}
00123         ~LLBumpImageList();
00124 
00125         void            init();
00126         void            shutdown();
00127         void            destroyGL();
00128         void            restoreGL();
00129         void            updateImages();
00130 
00131 
00132         LLImageGL*      getBrightnessDarknessImage(LLViewerImage* src_image, U8 bump_code);
00133 //      LLImageGL*      getTestImage();
00134         void            addTextureStats(U8 bump, const LLUUID& base_image_id,
00135                                                                 F32 pixel_area, F32 texel_area_ratio, F32 cos_center_angle);
00136 
00137         static void onSourceBrightnessLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
00138         static void onSourceDarknessLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
00139 
00140 private:
00141         static void onSourceLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump );
00142 
00143 private:
00144         typedef std::map<LLUUID, LLPointer<LLImageGL> > bump_image_map_t;
00145         bump_image_map_t mBrightnessEntries;
00146         bump_image_map_t mDarknessEntries;
00147 };
00148 
00149 extern LLBumpImageList gBumpImageList;
00150 
00151 class LLDrawPoolInvisible : public LLDrawPoolBump
00152 {
00153 public:
00154         LLDrawPoolInvisible() : LLDrawPoolBump(LLDrawPool::POOL_INVISIBLE) { }
00155 
00156         enum
00157         {
00158                 VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX
00159         };
00160         
00161         virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; }
00162 
00163         virtual void prerender() { }
00164 
00165         virtual void render(S32 pass = 0);
00166         virtual void beginRenderPass( S32 pass ) { }
00167         virtual void endRenderPass( S32 pass ) { }
00168         virtual S32      getNumPasses() {return 1;}
00169 };
00170 
00171 
00172 #endif // LL_LLDRAWPOOLBUMP_H

Generated on Fri May 16 08:33:18 2008 for SecondLife by  doxygen 1.5.5