Annotation of /trunk/indra/newview/lldrawpoolbump.h
Parent Directory
|
Revision Log
Revision 135 - (view) (download)
| 1 : | mjm | 135 | /** |
| 2 : | * @file lldrawpoolbump.h | ||
| 3 : | * @brief LLDrawPoolBump class definition | ||
| 4 : | * | ||
| 5 : | * $LicenseInfo:firstyear=2003&license=viewergpl$ | ||
| 6 : | * | ||
| 7 : | * Copyright (c) 2003-2009, Linden Research, Inc. | ||
| 8 : | * | ||
| 9 : | * Second Life Viewer Source Code | ||
| 10 : | * The source code in this file ("Source Code") is provided by Linden Lab | ||
| 11 : | * to you under the terms of the GNU General Public License, version 2.0 | ||
| 12 : | * ("GPL"), unless you have obtained a separate licensing agreement | ||
| 13 : | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
| 14 : | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
| 15 : | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
| 16 : | * | ||
| 17 : | * There are special exceptions to the terms and conditions of the GPL as | ||
| 18 : | * it is applied to this Source Code. View the full text of the exception | ||
| 19 : | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
| 20 : | * online at | ||
| 21 : | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
| 22 : | * | ||
| 23 : | * By copying, modifying or distributing this software, you acknowledge | ||
| 24 : | * that you have read and understood your obligations described above, | ||
| 25 : | * and agree to abide by those obligations. | ||
| 26 : | * | ||
| 27 : | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
| 28 : | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
| 29 : | * COMPLETENESS OR PERFORMANCE. | ||
| 30 : | * $/LicenseInfo$ | ||
| 31 : | */ | ||
| 32 : | |||
| 33 : | #ifndef LL_LLDRAWPOOLBUMP_H | ||
| 34 : | #define LL_LLDRAWPOOLBUMP_H | ||
| 35 : | |||
| 36 : | #include "lldrawpool.h" | ||
| 37 : | #include "llstring.h" | ||
| 38 : | #include "lltextureentry.h" | ||
| 39 : | #include "lluuid.h" | ||
| 40 : | |||
| 41 : | class LLImageRaw; | ||
| 42 : | class LLSpatialGroup; | ||
| 43 : | class LLDrawInfo; | ||
| 44 : | |||
| 45 : | class LLDrawPoolBump : public LLRenderPass | ||
| 46 : | { | ||
| 47 : | protected : | ||
| 48 : | LLDrawPoolBump(const U32 type):LLRenderPass(type) { mShiny = FALSE; } | ||
| 49 : | public: | ||
| 50 : | static U32 sVertexMask; | ||
| 51 : | BOOL mShiny; | ||
| 52 : | |||
| 53 : | virtual U32 getVertexDataMask() { return sVertexMask; } | ||
| 54 : | |||
| 55 : | LLDrawPoolBump(); | ||
| 56 : | |||
| 57 : | virtual void render(S32 pass = 0); | ||
| 58 : | virtual void beginRenderPass( S32 pass ); | ||
| 59 : | virtual void endRenderPass( S32 pass ); | ||
| 60 : | virtual S32 getNumPasses(); | ||
| 61 : | /*virtual*/ void prerender(); | ||
| 62 : | /*virtual*/ void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture); | ||
| 63 : | |||
| 64 : | void renderBump(U32 type, U32 mask); | ||
| 65 : | void renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture); | ||
| 66 : | |||
| 67 : | S32 numBumpPasses(); | ||
| 68 : | |||
| 69 : | void beginShiny(bool invisible = false); | ||
| 70 : | void renderShiny(bool invisible = false); | ||
| 71 : | void endShiny(bool invisible = false); | ||
| 72 : | |||
| 73 : | void beginFullbrightShiny(); | ||
| 74 : | void renderFullbrightShiny(); | ||
| 75 : | void endFullbrightShiny(); | ||
| 76 : | |||
| 77 : | void beginBump(); | ||
| 78 : | void renderBump(); | ||
| 79 : | void endBump(); | ||
| 80 : | |||
| 81 : | virtual S32 getNumDeferredPasses() { return 1; } | ||
| 82 : | /*virtual*/ void beginDeferredPass(S32 pass); | ||
| 83 : | /*virtual*/ void endDeferredPass(S32 pass); | ||
| 84 : | /*virtual*/ void renderDeferred(S32 pass); | ||
| 85 : | |||
| 86 : | virtual S32 getNumPostDeferredPasses() { return 1; } | ||
| 87 : | /*virtual*/ void beginPostDeferredPass(S32 pass); | ||
| 88 : | /*virtual*/ void endPostDeferredPass(S32 pass); | ||
| 89 : | /*virtual*/ void renderPostDeferred(S32 pass); | ||
| 90 : | |||
| 91 : | BOOL bindBumpMap(LLDrawInfo& params, S32 channel = -2); | ||
| 92 : | }; | ||
| 93 : | |||
| 94 : | enum EBumpEffect | ||
| 95 : | { | ||
| 96 : | BE_NO_BUMP = 0, | ||
| 97 : | BE_BRIGHTNESS = 1, | ||
| 98 : | BE_DARKNESS = 2, | ||
| 99 : | BE_STANDARD_0 = 3, // Standard must always be the last one | ||
| 100 : | BE_COUNT = 4 | ||
| 101 : | }; | ||
| 102 : | |||
| 103 : | //////////////////////////////////////////////////////////////// | ||
| 104 : | // List of standard bumpmaps that are specificed by LLTextureEntry::mBump's lower bits | ||
| 105 : | |||
| 106 : | class LLStandardBumpmap | ||
| 107 : | { | ||
| 108 : | public: | ||
| 109 : | LLStandardBumpmap() : mLabel() {} | ||
| 110 : | LLStandardBumpmap( const std::string& label ) : mLabel(label) {} | ||
| 111 : | |||
| 112 : | std::string mLabel; | ||
| 113 : | LLPointer<LLViewerImage> mImage; | ||
| 114 : | |||
| 115 : | static U32 sStandardBumpmapCount; // Number of valid values in gStandardBumpmapList[] | ||
| 116 : | |||
| 117 : | static void init(); | ||
| 118 : | static void shutdown(); | ||
| 119 : | static void restoreGL(); | ||
| 120 : | static void destroyGL(); | ||
| 121 : | }; | ||
| 122 : | |||
| 123 : | extern LLStandardBumpmap gStandardBumpmapList[TEM_BUMPMAP_COUNT]; | ||
| 124 : | |||
| 125 : | //////////////////////////////////////////////////////////////// | ||
| 126 : | // List of one-component bump-maps created from other texures. | ||
| 127 : | |||
| 128 : | struct LLBumpImageEntry; | ||
| 129 : | |||
| 130 : | class LLBumpImageList | ||
| 131 : | { | ||
| 132 : | public: | ||
| 133 : | LLBumpImageList() {} | ||
| 134 : | ~LLBumpImageList(); | ||
| 135 : | |||
| 136 : | void init(); | ||
| 137 : | void shutdown(); | ||
| 138 : | void destroyGL(); | ||
| 139 : | void restoreGL(); | ||
| 140 : | void updateImages(); | ||
| 141 : | |||
| 142 : | |||
| 143 : | LLImageGL* getBrightnessDarknessImage(LLViewerImage* src_image, U8 bump_code); | ||
| 144 : | // LLImageGL* getTestImage(); | ||
| 145 : | void addTextureStats(U8 bump, const LLUUID& base_image_id, F32 virtual_size); | ||
| 146 : | |||
| 147 : | static void onSourceBrightnessLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ); | ||
| 148 : | static void onSourceDarknessLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ); | ||
| 149 : | static void onSourceStandardLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ); | ||
| 150 : | static void generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nrm_image); | ||
| 151 : | |||
| 152 : | |||
| 153 : | private: | ||
| 154 : | static void onSourceLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump ); | ||
| 155 : | |||
| 156 : | private: | ||
| 157 : | typedef std::map<LLUUID, LLPointer<LLImageGL> > bump_image_map_t; | ||
| 158 : | bump_image_map_t mBrightnessEntries; | ||
| 159 : | bump_image_map_t mDarknessEntries; | ||
| 160 : | }; | ||
| 161 : | |||
| 162 : | extern LLBumpImageList gBumpImageList; | ||
| 163 : | |||
| 164 : | class LLDrawPoolInvisible : public LLDrawPoolBump | ||
| 165 : | { | ||
| 166 : | public: | ||
| 167 : | LLDrawPoolInvisible() : LLDrawPoolBump(LLDrawPool::POOL_INVISIBLE) { } | ||
| 168 : | |||
| 169 : | enum | ||
| 170 : | { | ||
| 171 : | VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX | ||
| 172 : | }; | ||
| 173 : | |||
| 174 : | virtual U32 getVertexDataMask() { return VERTEX_DATA_MASK; } | ||
| 175 : | |||
| 176 : | virtual void prerender() { } | ||
| 177 : | |||
| 178 : | virtual void render(S32 pass = 0); | ||
| 179 : | virtual void beginRenderPass( S32 pass ) { } | ||
| 180 : | virtual void endRenderPass( S32 pass ) { } | ||
| 181 : | virtual S32 getNumPasses() {return 1;} | ||
| 182 : | |||
| 183 : | virtual S32 getNumDeferredPasses() { return 1; } | ||
| 184 : | /*virtual*/ void beginDeferredPass(S32 pass); | ||
| 185 : | /*virtual*/ void endDeferredPass(S32 pass); | ||
| 186 : | /*virtual*/ void renderDeferred(S32 pass); | ||
| 187 : | }; | ||
| 188 : | |||
| 189 : | |||
| 190 : | #endif // LL_LLDRAWPOOLBUMP_H |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

