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 public:
00047 static U32 sVertexMask;
00048
00049 virtual U32 getVertexDataMask() { return sVertexMask; }
00050
00051 LLDrawPoolBump();
00052
00053 virtual void render(S32 pass = 0);
00054 void beginRenderPass( S32 pass );
00055 void endRenderPass( S32 pass );
00056 S32 getNumPasses();
00057 void prerender();
00058 void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture);
00059
00060 void renderBump(U32 type, U32 mask);
00061 void renderBumpActive(U32 type, U32 mask);
00062 void renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture);
00063 void renderGroupBump(LLSpatialGroup* group, U32 type, U32 mask);
00064
00065 S32 numBumpPasses();
00066
00067 void beginShiny();
00068 void renderShiny();
00069 void endShiny();
00070 void renderActive(U32 type, U32 mask, BOOL texture = TRUE);
00071
00072 void beginBump();
00073 void renderBump();
00074 void endBump();
00075 BOOL bindBumpMap(LLDrawInfo& params);
00076 };
00077
00078 enum EBumpEffect
00079 {
00080 BE_NO_BUMP = 0,
00081 BE_BRIGHTNESS = 1,
00082 BE_DARKNESS = 2,
00083 BE_STANDARD_0 = 3,
00084 BE_COUNT = 4
00085 };
00086
00088
00089
00090 class LLStandardBumpmap
00091 {
00092 public:
00093 LLStandardBumpmap() : mLabel() {}
00094 LLStandardBumpmap( const char* label ) : mLabel(label) {}
00095
00096 LLString mLabel;
00097 LLPointer<LLViewerImage> mImage;
00098
00099 static U32 sStandardBumpmapCount;
00100
00101 static void init();
00102 static void shutdown();
00103 static void restoreGL();
00104 static void destroyGL();
00105 };
00106
00107 extern LLStandardBumpmap gStandardBumpmapList[TEM_BUMPMAP_COUNT];
00108
00110
00111
00112 struct LLBumpImageEntry;
00113
00114 class LLBumpImageList
00115 {
00116 public:
00117 LLBumpImageList() {}
00118 ~LLBumpImageList();
00119
00120 void init();
00121 void shutdown();
00122 void destroyGL();
00123 void restoreGL();
00124 void updateImages();
00125
00126
00127 LLImageGL* getBrightnessDarknessImage(LLViewerImage* src_image, U8 bump_code);
00128
00129 void addTextureStats(U8 bump, const LLUUID& base_image_id,
00130 F32 pixel_area, F32 texel_area_ratio, F32 cos_center_angle);
00131
00132 static void onSourceBrightnessLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
00133 static void onSourceDarknessLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
00134
00135 private:
00136 static void onSourceLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump );
00137
00138 private:
00139 typedef std::map<LLUUID, LLPointer<LLImageGL> > bump_image_map_t;
00140 bump_image_map_t mBrightnessEntries;
00141 bump_image_map_t mDarknessEntries;
00142 };
00143
00144 extern LLBumpImageList gBumpImageList;
00145
00146
00147
00148 #endif // LL_LLDRAWPOOLBUMP_H