diff options
Diffstat (limited to 'indra/newview/pipeline.h')
-rw-r--r-- | indra/newview/pipeline.h | 389 |
1 files changed, 278 insertions, 111 deletions
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 2054492b72..b80765dac6 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -2,50 +2,47 @@ * @file pipeline.h * @brief Rendering pipeline definitions * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #ifndef LL_PIPELINE_H #define LL_PIPELINE_H +#include "llcamera.h" #include "llerror.h" #include "lldarrayptr.h" #include "lldqueueptr.h" -#include "llstat.h" #include "lldrawpool.h" #include "llspatialpartition.h" #include "m4math.h" -#include "llmemory.h" +#include "llpointer.h" #include "lldrawpool.h" #include "llgl.h" #include "lldrawable.h" #include "llrendertarget.h" -class LLViewerImage; +#include <stack> + +class LLViewerTexture; class LLEdge; class LLFace; class LLViewerObject; @@ -56,6 +53,7 @@ class LLRenderFunc; class LLCubeMap; class LLCullResult; class LLVOAvatar; +class LLGLSLShader; typedef enum e_avatar_skinning_method { @@ -65,13 +63,37 @@ typedef enum e_avatar_skinning_method BOOL compute_min_max(LLMatrix4& box, LLVector2& min, LLVector2& max); // Shouldn't be defined here! bool LLRayAABB(const LLVector3 ¢er, const LLVector3 &size, const LLVector3& origin, const LLVector3& dir, LLVector3 &coord, F32 epsilon = 0); -BOOL LLLineSegmentAABB(const LLVector3& start, const LLVector3& end, const LLVector3& center, const LLVector3& size); -BOOL setup_hud_matrices(BOOL for_select); +BOOL setup_hud_matrices(); // use whole screen to render hud +BOOL setup_hud_matrices(const LLRect& screen_region); // specify portion of screen (in pixels) to render hud attachments from (for picking) +glh::matrix4f glh_copy_matrix(GLdouble* src); glh::matrix4f glh_get_current_modelview(); -void glh_set_current_modelview(glh::matrix4f& mat); +void glh_set_current_modelview(const glh::matrix4f& mat); glh::matrix4f glh_get_current_projection(); void glh_set_current_projection(glh::matrix4f& mat); glh::matrix4f gl_ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat znear, GLfloat zfar); +glh::matrix4f gl_perspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar); +glh::matrix4f gl_lookat(LLVector3 eye, LLVector3 center, LLVector3 up); + +extern LLFastTimer::DeclareTimer FTM_RENDER_GEOMETRY; +extern LLFastTimer::DeclareTimer FTM_RENDER_GRASS; +extern LLFastTimer::DeclareTimer FTM_RENDER_INVISIBLE; +extern LLFastTimer::DeclareTimer FTM_RENDER_OCCLUSION; +extern LLFastTimer::DeclareTimer FTM_RENDER_SHINY; +extern LLFastTimer::DeclareTimer FTM_RENDER_SIMPLE; +extern LLFastTimer::DeclareTimer FTM_RENDER_TERRAIN; +extern LLFastTimer::DeclareTimer FTM_RENDER_TREES; +extern LLFastTimer::DeclareTimer FTM_RENDER_UI; +extern LLFastTimer::DeclareTimer FTM_RENDER_WATER; +extern LLFastTimer::DeclareTimer FTM_RENDER_WL_SKY; +extern LLFastTimer::DeclareTimer FTM_RENDER_ALPHA; +extern LLFastTimer::DeclareTimer FTM_RENDER_CHARACTERS; +extern LLFastTimer::DeclareTimer FTM_RENDER_BUMP; +extern LLFastTimer::DeclareTimer FTM_RENDER_FULLBRIGHT; +extern LLFastTimer::DeclareTimer FTM_RENDER_GLOW; +extern LLFastTimer::DeclareTimer FTM_STATESORT; +extern LLFastTimer::DeclareTimer FTM_PIPELINE; +extern LLFastTimer::DeclareTimer FTM_CLIENT_COPY; + class LLPipeline { @@ -85,16 +107,13 @@ public: void resizeScreenTexture(); void releaseGLBuffers(); void createGLBuffers(); + void allocateScreenBuffer(U32 resX, U32 resY); void resetVertexBuffers(LLDrawable* drawable); void setUseVBO(BOOL use_vbo); void generateImpostor(LLVOAvatar* avatar); - void generateReflectionMap(LLCubeMap* cube_map, LLCamera& camera); - void blurReflectionMap(LLCubeMap* cube_in, LLCubeMap* cube_out); void bindScreenToTexture(); - void renderBloom(BOOL for_snapshot); - - LLCubeMap* findReflectionMap(const LLVector3& location); + void renderBloom(BOOL for_snapshot, F32 zoom_factor = 1.f, int subfield = 0); void init(); void cleanup(); @@ -102,15 +121,15 @@ public: /// @brief Get a draw pool from pool type (POOL_SIMPLE, POOL_MEDIA) and texture. /// @return Draw pool, or NULL if not found. - LLDrawPool *findPool(const U32 pool_type, LLViewerImage *tex0 = NULL); + LLDrawPool *findPool(const U32 pool_type, LLViewerTexture *tex0 = NULL); /// @brief Get a draw pool for faces of the appropriate type and texture. Create if necessary. /// @return Always returns a draw pool. - LLDrawPool *getPool(const U32 pool_type, LLViewerImage *tex0 = NULL); + LLDrawPool *getPool(const U32 pool_type, LLViewerTexture *tex0 = NULL); /// @brief Figures out draw pool type from texture entry. Creates pool if necessary. - static LLDrawPool* getPoolFromTE(const LLTextureEntry* te, LLViewerImage* te_image); - static U32 getPoolTypeFromTE(const LLTextureEntry* te, LLViewerImage* imagep); + static LLDrawPool* getPoolFromTE(const LLTextureEntry* te, LLViewerTexture* te_image); + static U32 getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* imagep); void addPool(LLDrawPool *poolp); // Only to be used by LLDrawPool classes for splitting pools! void removePool( LLDrawPool* poolp ); @@ -127,13 +146,30 @@ public: void markMoved(LLDrawable *drawablep, BOOL damped_motion = FALSE); void markShift(LLDrawable *drawablep); void markTextured(LLDrawable *drawablep); + void markGLRebuild(LLGLUpdate* glu); + void markRebuild(LLSpatialGroup* group, BOOL priority = FALSE); void markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag = LLDrawable::REBUILD_ALL, BOOL priority = FALSE); - //get the object between start and end that's closest to start. Return the point of collision in collision. - LLViewerObject* pickObject(const LLVector3 &start, const LLVector3 &end, LLVector3 &collision); + //get the object between start and end that's closest to start. + LLViewerObject* lineSegmentIntersectInWorld(const LLVector3& start, const LLVector3& end, + BOOL pick_transparent, + S32* face_hit, // return the face hit + LLVector3* intersection = NULL, // return the intersection point + LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point + LLVector3* normal = NULL, // return the surface normal at the intersection point + LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point + ); + LLViewerObject* lineSegmentIntersectInHUD(const LLVector3& start, const LLVector3& end, + BOOL pick_transparent, + S32* face_hit, // return the face hit + LLVector3* intersection = NULL, // return the intersection point + LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point + LLVector3* normal = NULL, // return the surface normal at the intersection point + LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point + ); // Something about these textures has changed. Dirty them. - void dirtyPoolObjectTextures(const std::set<LLViewerImage*>& textures); + void dirtyPoolObjectTextures(const std::set<LLViewerFetchedTexture*>& textures); void resetDrawOrders(); @@ -152,6 +188,7 @@ public: BOOL canUseVertexShaders(); BOOL canUseWindLightShaders() const; BOOL canUseWindLightShadersOnObjects() const; + BOOL canUseAntiAliasing() const; // phases void resetFrameStats(); @@ -160,8 +197,16 @@ public: void updateMoveNormalAsync(LLDrawable* drawablep); void updateMovedList(LLDrawable::drawable_vector_t& move_list); void updateMove(); + BOOL visibleObjectsInFrustum(LLCamera& camera); + BOOL getVisibleExtents(LLCamera& camera, LLVector3 &min, LLVector3& max); + BOOL getVisiblePointCloud(LLCamera& camera, LLVector3 &min, LLVector3& max, std::vector<LLVector3>& fp, LLVector3 light_dir = LLVector3(0,0,0)); void updateCull(LLCamera& camera, LLCullResult& result, S32 water_clip = 0); //if water_clip is 0, ignore water plane, 1, cull to above plane, -1, cull to below plane + void createObjects(F32 max_dtime); + void createObject(LLViewerObject* vobj); void updateGeom(F32 max_dtime); + void updateGL(); + void rebuildPriorityGroups(); + void rebuildGroups(); //calculate pixel area of given box from vantage point of given camera static F32 calcPixelArea(LLVector3 center, LLVector3 size, LLCamera& camera); @@ -179,13 +224,28 @@ public: void grabReferences(LLCullResult& result); void renderGeom(LLCamera& camera, BOOL forceVBOUpdate = FALSE); - void processImagery(LLCamera& camera); + void renderGeomDeferred(LLCamera& camera); + void renderGeomPostDeferred(LLCamera& camera); + void renderGeomShadow(LLCamera& camera); + void bindDeferredShader(LLGLSLShader& shader, U32 light_index = 0, LLRenderTarget* gi_source = NULL, LLRenderTarget* last_gi_post = NULL, U32 noise_map = 0xFFFFFFFF); + void setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep); + + void unbindDeferredShader(LLGLSLShader& shader); + void renderDeferredLighting(); + void generateWaterReflection(LLCamera& camera); + void generateSunShadow(LLCamera& camera); + void generateHighlight(LLCamera& camera); + void renderHighlight(const LLViewerObject* obj, F32 fade); + void setHighlightObject(LLDrawable* obj) { mHighlightObject = obj; } + + + void renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& camera, LLCullResult& result, BOOL use_shader = TRUE, BOOL use_occlusion = TRUE); + void generateGI(LLCamera& camera, LLVector3& lightDir, std::vector<LLVector3>& vpc); void renderHighlights(); void renderDebug(); - void renderForSelect(std::set<LLViewerObject*>& objects); - void renderFaceForUVSelect(LLFace* facep); + void renderForSelect(std::set<LLViewerObject*>& objects, BOOL render_transparent, const LLRect& screen_rect); void rebuildPools(); // Rebuild pools void findReferences(LLDrawable *drawablep); // Find the lists which have references to this object @@ -207,20 +267,32 @@ public: void shiftObjects(const LLVector3 &offset); void setLight(LLDrawable *drawablep, BOOL is_light); - void setActive(LLDrawable *drawablep, BOOL active); - + BOOL hasRenderBatches(const U32 type) const; LLCullResult::drawinfo_list_t::iterator beginRenderMap(U32 type); LLCullResult::drawinfo_list_t::iterator endRenderMap(U32 type); LLCullResult::sg_list_t::iterator beginAlphaGroups(); LLCullResult::sg_list_t::iterator endAlphaGroups(); + + + void addTrianglesDrawn(S32 index_count, U32 render_type = LLRender::TRIANGLES); - void addTrianglesDrawn(S32 count); - BOOL hasRenderType(const U32 type) const { return (type && (mRenderTypeMask & (1<<type))) ? TRUE : FALSE; } BOOL hasRenderDebugFeatureMask(const U32 mask) const { return (mRenderDebugFeatureMask & mask) ? TRUE : FALSE; } BOOL hasRenderDebugMask(const U32 mask) const { return (mRenderDebugMask & mask) ? TRUE : FALSE; } - void setRenderTypeMask(const U32 mask) { mRenderTypeMask = mask; } - U32 getRenderTypeMask() const { return mRenderTypeMask; } + + + + BOOL hasRenderType(const U32 type) const; + BOOL hasAnyRenderType(const U32 type, ...) const; + + void setRenderTypeMask(U32 type, ...); + void orRenderTypeMask(U32 type, ...); + void andRenderTypeMask(U32 type, ...); + void clearRenderTypeMask(U32 type, ...); + + void pushRenderTypeMask(); + void popRenderTypeMask(); + static void toggleRenderType(U32 type); // For UI control of render features @@ -260,7 +332,7 @@ public: static void toggleRenderHighlights(void* data); static BOOL getRenderHighlights(void* data); - static BOOL getProcessBeacons(void* data); + static void updateRenderDeferred(); private: void unloadShaders(); @@ -276,25 +348,42 @@ public: enum LLRenderTypeMask { // Following are pool types (some are also object types) - RENDER_TYPE_SKY = LLDrawPool::POOL_SKY, - RENDER_TYPE_WL_SKY = LLDrawPool::POOL_WL_SKY, - RENDER_TYPE_GROUND = LLDrawPool::POOL_GROUND, - RENDER_TYPE_TERRAIN = LLDrawPool::POOL_TERRAIN, - RENDER_TYPE_SIMPLE = LLDrawPool::POOL_SIMPLE, - RENDER_TYPE_BUMP = LLDrawPool::POOL_BUMP, - RENDER_TYPE_AVATAR = LLDrawPool::POOL_AVATAR, - RENDER_TYPE_TREE = LLDrawPool::POOL_TREE, - RENDER_TYPE_INVISIBLE = LLDrawPool::POOL_INVISIBLE, - RENDER_TYPE_WATER = LLDrawPool::POOL_WATER, - RENDER_TYPE_ALPHA = LLDrawPool::POOL_ALPHA, - RENDER_TYPE_GLOW = LLDrawPool::POOL_GLOW, - + RENDER_TYPE_SKY = LLDrawPool::POOL_SKY, + RENDER_TYPE_WL_SKY = LLDrawPool::POOL_WL_SKY, + RENDER_TYPE_GROUND = LLDrawPool::POOL_GROUND, + RENDER_TYPE_TERRAIN = LLDrawPool::POOL_TERRAIN, + RENDER_TYPE_SIMPLE = LLDrawPool::POOL_SIMPLE, + RENDER_TYPE_GRASS = LLDrawPool::POOL_GRASS, + RENDER_TYPE_FULLBRIGHT = LLDrawPool::POOL_FULLBRIGHT, + RENDER_TYPE_BUMP = LLDrawPool::POOL_BUMP, + RENDER_TYPE_AVATAR = LLDrawPool::POOL_AVATAR, + RENDER_TYPE_TREE = LLDrawPool::POOL_TREE, + RENDER_TYPE_INVISIBLE = LLDrawPool::POOL_INVISIBLE, + RENDER_TYPE_WATER = LLDrawPool::POOL_WATER, + RENDER_TYPE_ALPHA = LLDrawPool::POOL_ALPHA, + RENDER_TYPE_GLOW = LLDrawPool::POOL_GLOW, + RENDER_TYPE_PASS_SIMPLE = LLRenderPass::PASS_SIMPLE, + RENDER_TYPE_PASS_GRASS = LLRenderPass::PASS_GRASS, + RENDER_TYPE_PASS_FULLBRIGHT = LLRenderPass::PASS_FULLBRIGHT, + RENDER_TYPE_PASS_INVISIBLE = LLRenderPass::PASS_INVISIBLE, + RENDER_TYPE_PASS_INVISI_SHINY = LLRenderPass::PASS_INVISI_SHINY, + RENDER_TYPE_PASS_FULLBRIGHT_SHINY = LLRenderPass::PASS_FULLBRIGHT_SHINY, + RENDER_TYPE_PASS_SHINY = LLRenderPass::PASS_SHINY, + RENDER_TYPE_PASS_BUMP = LLRenderPass::PASS_BUMP, + RENDER_TYPE_PASS_POST_BUMP = LLRenderPass::PASS_POST_BUMP, + RENDER_TYPE_PASS_GLOW = LLRenderPass::PASS_GLOW, + RENDER_TYPE_PASS_ALPHA = LLRenderPass::PASS_ALPHA, + RENDER_TYPE_PASS_ALPHA_MASK = LLRenderPass::PASS_ALPHA_MASK, + RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK = LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, + RENDER_TYPE_PASS_ALPHA_SHADOW = LLRenderPass::PASS_ALPHA_SHADOW, // Following are object types (only used in drawable mRenderType) - RENDER_TYPE_HUD = LLDrawPool::NUM_POOL_TYPES, + RENDER_TYPE_HUD = LLRenderPass::NUM_RENDER_TYPES, RENDER_TYPE_VOLUME, - RENDER_TYPE_GRASS, RENDER_TYPE_PARTICLES, RENDER_TYPE_CLOUDS, + RENDER_TYPE_HUD_PARTICLES, + NUM_RENDER_TYPES, + END_RENDER_TYPES = NUM_RENDER_TYPES }; enum LLRenderDebugFeatureMask @@ -306,32 +395,37 @@ public: // RENDER_DEBUG_FEATURE_HW_LIGHTING = 0x0010, RENDER_DEBUG_FEATURE_FLEXIBLE = 0x0010, RENDER_DEBUG_FEATURE_FOG = 0x0020, - RENDER_DEBUG_FEATURE_PALETTE = 0x0040, RENDER_DEBUG_FEATURE_FR_INFO = 0x0080, RENDER_DEBUG_FEATURE_FOOT_SHADOWS = 0x0100, }; enum LLRenderDebugMask { - RENDER_DEBUG_COMPOSITION = 0x000020, - RENDER_DEBUG_VERIFY = 0x000080, - RENDER_DEBUG_BBOXES = 0x000200, - RENDER_DEBUG_OCTREE = 0x000400, - RENDER_DEBUG_PICKING = 0x000800, - RENDER_DEBUG_OCCLUSION = 0x001000, - RENDER_DEBUG_POINTS = 0x002000, - RENDER_DEBUG_TEXTURE_PRIORITY = 0x004000, - RENDER_DEBUG_TEXTURE_AREA = 0x008000, - RENDER_DEBUG_FACE_AREA = 0x010000, - RENDER_DEBUG_PARTICLES = 0x020000, - RENDER_DEBUG_GLOW = 0x040000, - RENDER_DEBUG_TEXTURE_ANIM = 0x080000, - RENDER_DEBUG_LIGHTS = 0x100000, - RENDER_DEBUG_BATCH_SIZE = 0x200000, + RENDER_DEBUG_COMPOSITION = 0x0000001, + RENDER_DEBUG_VERIFY = 0x0000002, + RENDER_DEBUG_BBOXES = 0x0000004, + RENDER_DEBUG_OCTREE = 0x0000008, + RENDER_DEBUG_PICKING = 0x0000010, + RENDER_DEBUG_OCCLUSION = 0x0000020, + RENDER_DEBUG_POINTS = 0x0000040, + RENDER_DEBUG_TEXTURE_PRIORITY = 0x0000080, + RENDER_DEBUG_TEXTURE_AREA = 0x0000100, + RENDER_DEBUG_FACE_AREA = 0x0000200, + RENDER_DEBUG_PARTICLES = 0x0000400, + RENDER_DEBUG_GLOW = 0x0000800, + RENDER_DEBUG_TEXTURE_ANIM = 0x0001000, + RENDER_DEBUG_LIGHTS = 0x0002000, + RENDER_DEBUG_BATCH_SIZE = 0x0004000, + RENDER_DEBUG_ALPHA_BINS = 0x0008000, + RENDER_DEBUG_RAYCAST = 0x0010000, + RENDER_DEBUG_SHAME = 0x0020000, + RENDER_DEBUG_SHADOW_FRUSTA = 0x0040000, + RENDER_DEBUG_SCULPTED = 0x0080000, + RENDER_DEBUG_AVATAR_VOLUME = 0x0100000, + RENDER_DEBUG_BUILD_QUEUE = 0x0200000, + RENDER_DEBUG_AGENT_TARGET = 0x0400000, }; - LLPointer<LLViewerImage> mAlphaSizzleImagep; - public: LLSpatialPartition* getSpatialPartition(LLViewerObject* vobj); @@ -350,7 +444,6 @@ public: S32 mMeanBatchSize; S32 mTrianglesDrawn; S32 mNumVisibleNodes; - LLStat mTrianglesDrawnStat; S32 mVerticesRelit; S32 mLightingChanges; @@ -361,26 +454,75 @@ public: static S32 sCompiles; static BOOL sShowHUDAttachments; + static BOOL sForceOldBakedUpload; // If true will not use capabilities to upload baked textures. static S32 sUseOcclusion; // 0 = no occlusion, 1 = read only, 2 = read/write - static BOOL sFastAlpha; + static BOOL sDelayVBUpdate; + static BOOL sAutoMaskAlphaDeferred; + static BOOL sAutoMaskAlphaNonDeferred; static BOOL sDisableShaders; // if TRUE, rendering will be done without shaders static BOOL sRenderBump; - static BOOL sUseFBO; + static BOOL sUseTriStrips; static BOOL sUseFarClip; - static BOOL sSkipUpdate; //skip lod updates - static BOOL sDynamicReflections; + static BOOL sShadowRender; static BOOL sWaterReflections; static BOOL sDynamicLOD; + static BOOL sPickAvatar; static BOOL sReflectionRender; static BOOL sImpostorRender; static BOOL sUnderWaterRender; static BOOL sRenderGlow; static BOOL sTextureBindTest; static BOOL sRenderFrameTest; - + static BOOL sRenderAttachedLights; + static BOOL sRenderAttachedParticles; + static BOOL sRenderDeferred; + static BOOL sAllowRebuildPriorityGroup; + static S32 sVisibleLightCount; + static F32 sMinRenderSize; + //screen texture + U32 mScreenWidth; + U32 mScreenHeight; + LLRenderTarget mScreen; + LLRenderTarget mUIScreen; + LLRenderTarget mDeferredScreen; + LLRenderTarget mEdgeMap; + LLRenderTarget mDeferredDepth; + LLRenderTarget mDeferredLight[3]; + LLMultisampleBuffer mSampleBuffer; + LLRenderTarget mGIMap; + LLRenderTarget mGIMapPost[2]; + LLRenderTarget mLuminanceMap; + LLRenderTarget mHighlight; + + //sun shadow map + LLRenderTarget mShadow[6]; + std::vector<LLVector3> mShadowFrustPoints[4]; + LLVector4 mShadowError; + LLVector4 mShadowFOV; + LLVector3 mShadowFrustOrigin[4]; + LLCamera mShadowCamera[8]; + LLVector3 mShadowExtents[4][2]; + glh::matrix4f mSunShadowMatrix[6]; + glh::matrix4f mShadowModelview[6]; + glh::matrix4f mShadowProjection[6]; + glh::matrix4f mGIMatrix; + glh::matrix4f mGIMatrixProj; + glh::matrix4f mGIModelview; + glh::matrix4f mGIProjection; + glh::matrix4f mGINormalMatrix; + glh::matrix4f mGIInvProj; + LLVector2 mGIRange; + F32 mGILightRadius; + LLPointer<LLDrawable> mShadowSpotLight[2]; + F32 mSpotLightFade[2]; + LLPointer<LLDrawable> mTargetShadowSpotLight[2]; + + LLVector4 mSunClipPlanes; + LLVector4 mSunOrthoClipPlanes; + LLVector2 mScreenScale; //water reflection texture @@ -391,25 +533,12 @@ public: //texture for making the glow LLRenderTarget mGlow[3]; - - //framebuffer objects for off-screen scratch space - //GLuint mFramebuffer[4]; - //GLuint mDepthbuffer[2]; - - //dynamic cube map scratch space - LLPointer<LLCubeMap> mCubeBuffer; - //cube map anti-aliasing buffers - GLuint mBlurCubeBuffer[3]; - GLuint mBlurCubeTexture[3]; - - //frambuffer object for rendering dynamic cube maps - GLuint mCubeFrameBuffer; - - //depth buffer object for rendering dynamic cube maps - GLuint mCubeDepth; + //noise map + U32 mNoiseMap; + U32 mTrueNoiseMap; + U32 mLightFunc; - LLColor4 mSunDiffuse; LLVector3 mSunDir; @@ -418,7 +547,9 @@ public: S32 mVertexShadersLoaded; // 0 = no, 1 = yes, -1 = failed protected: - U32 mRenderTypeMask; + BOOL mRenderTypeEnabled[NUM_RENDER_TYPES]; + std::stack<std::string> mRenderTypeEnableStack; + U32 mRenderDebugFeatureMask; U32 mRenderDebugMask; @@ -469,11 +600,43 @@ protected: // LLDrawable::drawable_list_t mBuildQ1; // priority LLDrawable::drawable_list_t mBuildQ2; // non-priority + LLSpatialGroup::sg_vector_t mGroupQ1; //priority + LLSpatialGroup::sg_vector_t mGroupQ2; // non-priority + + LLViewerObject::vobj_list_t mCreateQ; - LLDrawable::drawable_set_t mActiveQ; - LLDrawable::drawable_set_t mRetexturedList; + class HighlightItem + { + public: + const LLPointer<LLDrawable> mItem; + mutable F32 mFade; + + HighlightItem(LLDrawable* item) + : mItem(item), mFade(0) + { + } + + bool operator<(const HighlightItem& rhs) const + { + return mItem < rhs.mItem; + } + + bool operator==(const HighlightItem& rhs) const + { + return mItem == rhs.mItem; + } + + void incrFade(F32 val) const + { + mFade = llclamp(mFade+val, 0.f, 1.f); + } + }; + + std::set<HighlightItem> mHighlightSet; + LLPointer<LLDrawable> mHighlightObject; + ////////////////////////////////////////////////// // // Draw pools are responsible for storing all rendered data, @@ -513,6 +676,8 @@ protected: LLDrawPool* mWaterPool; LLDrawPool* mGroundPool; LLRenderPass* mSimplePool; + LLRenderPass* mGrassPool; + LLRenderPass* mFullbrightPool; LLDrawPool* mInvisiblePool; LLDrawPool* mGlowPool; LLDrawPool* mBumpPool; @@ -524,9 +689,7 @@ public: protected: std::vector<LLFace*> mSelectedFaces; - LLPointer<LLViewerImage> mFaceSelectImagep; - LLPointer<LLViewerImage> mBloomImagep; - LLPointer<LLViewerImage> mBloomImage2p; + LLPointer<LLViewerFetchedTexture> mFaceSelectImagep; U32 mLightMask; U32 mLightMovingMask; @@ -540,13 +703,17 @@ protected: public: static BOOL sRenderBeacons; static BOOL sRenderHighlight; - static BOOL sRenderProcessBeacons; + + //debug use + static U32 sCurRenderPoolType ; }; void render_bbox(const LLVector3 &min, const LLVector3 &max); +void render_hud_elements(); extern LLPipeline gPipeline; extern BOOL gRenderForSelect; +extern BOOL gDebugPipeline; extern const LLMatrix4* gGLLastMatrix; #endif |