diff options
author | Robin Cornelius | 2010-10-10 22:10:33 +0100 |
---|---|---|
committer | Robin Cornelius | 2010-10-10 22:10:33 +0100 |
commit | b3b30285126289f54b57bd42569bb0721e40e088 (patch) | |
tree | f4aaccb98d1a835c4ea376ec2803fc410a704052 /linden | |
parent | Merge branch 'mccabe-plugins' into plugins_merge (diff) | |
download | meta-impy-b3b30285126289f54b57bd42569bb0721e40e088.zip meta-impy-b3b30285126289f54b57bd42569bb0721e40e088.tar.gz meta-impy-b3b30285126289f54b57bd42569bb0721e40e088.tar.bz2 meta-impy-b3b30285126289f54b57bd42569bb0721e40e088.tar.xz |
Revert "port of LL renderpipeline/Kirstens S19 pipeline for bridging to Viewer 2 texture system"
This reverts commit 087e15e89930d51c3964329befb273ae3b2d330d.
Conflicts:
linden/indra/newview/llsurface.cpp
linden/indra/newview/llviewerwindow.cpp
linden/indra/newview/llvoavatar.cpp
linden/indra/newview/pipeline.cpp
linden/indra/newview/pipeline.h
Diffstat (limited to '')
209 files changed, 2000 insertions, 12426 deletions
diff --git a/linden/indra/llmath/llbbox.cpp b/linden/indra/llmath/llbbox.cpp deleted file mode 100644 index f0ec010..0000000 --- a/linden/indra/llmath/llbbox.cpp +++ /dev/null | |||
@@ -1,162 +0,0 @@ | |||
1 | /** | ||
2 | * @file llbbox.cpp | ||
3 | * @brief General purpose bounding box class (Not axis aligned) | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2001&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2001-2010, /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 | #include "linden_common.h" | ||
34 | |||
35 | // self include | ||
36 | #include "llbbox.h" | ||
37 | |||
38 | // library includes | ||
39 | #include "m4math.h" | ||
40 | |||
41 | void LLBBox::addPointLocal(const LLVector3& p) | ||
42 | { | ||
43 | if (mEmpty) | ||
44 | { | ||
45 | mMinLocal = p; | ||
46 | mMaxLocal = p; | ||
47 | mEmpty = FALSE; | ||
48 | } | ||
49 | else | ||
50 | { | ||
51 | mMinLocal.mV[VX] = llmin( p.mV[VX], mMinLocal.mV[VX] ); | ||
52 | mMinLocal.mV[VY] = llmin( p.mV[VY], mMinLocal.mV[VY] ); | ||
53 | mMinLocal.mV[VZ] = llmin( p.mV[VZ], mMinLocal.mV[VZ] ); | ||
54 | mMaxLocal.mV[VX] = llmax( p.mV[VX], mMaxLocal.mV[VX] ); | ||
55 | mMaxLocal.mV[VY] = llmax( p.mV[VY], mMaxLocal.mV[VY] ); | ||
56 | mMaxLocal.mV[VZ] = llmax( p.mV[VZ], mMaxLocal.mV[VZ] ); | ||
57 | } | ||
58 | } | ||
59 | |||
60 | void LLBBox::addPointAgent( LLVector3 p) | ||
61 | { | ||
62 | p -= mPosAgent; | ||
63 | p.rotVec( ~mRotation ); | ||
64 | addPointLocal( p ); | ||
65 | } | ||
66 | |||
67 | |||
68 | void LLBBox::addBBoxAgent(const LLBBox& b) | ||
69 | { | ||
70 | if (mEmpty) | ||
71 | { | ||
72 | mPosAgent = b.mPosAgent; | ||
73 | mRotation = b.mRotation; | ||
74 | mMinLocal.clearVec(); | ||
75 | mMaxLocal.clearVec(); | ||
76 | } | ||
77 | LLVector3 vertex[8]; | ||
78 | vertex[0].setVec( b.mMinLocal.mV[VX], b.mMinLocal.mV[VY], b.mMinLocal.mV[VZ] ); | ||
79 | vertex[1].setVec( b.mMinLocal.mV[VX], b.mMinLocal.mV[VY], b.mMaxLocal.mV[VZ] ); | ||
80 | vertex[2].setVec( b.mMinLocal.mV[VX], b.mMaxLocal.mV[VY], b.mMinLocal.mV[VZ] ); | ||
81 | vertex[3].setVec( b.mMinLocal.mV[VX], b.mMaxLocal.mV[VY], b.mMaxLocal.mV[VZ] ); | ||
82 | vertex[4].setVec( b.mMaxLocal.mV[VX], b.mMinLocal.mV[VY], b.mMinLocal.mV[VZ] ); | ||
83 | vertex[5].setVec( b.mMaxLocal.mV[VX], b.mMinLocal.mV[VY], b.mMaxLocal.mV[VZ] ); | ||
84 | vertex[6].setVec( b.mMaxLocal.mV[VX], b.mMaxLocal.mV[VY], b.mMinLocal.mV[VZ] ); | ||
85 | vertex[7].setVec( b.mMaxLocal.mV[VX], b.mMaxLocal.mV[VY], b.mMaxLocal.mV[VZ] ); | ||
86 | |||
87 | LLMatrix4 m( b.mRotation ); | ||
88 | m.translate( b.mPosAgent ); | ||
89 | m.translate( -mPosAgent ); | ||
90 | m.rotate( ~mRotation ); | ||
91 | |||
92 | for( S32 i=0; i<8; i++ ) | ||
93 | { | ||
94 | addPointLocal( vertex[i] * m ); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | |||
99 | void LLBBox::expand( F32 delta ) | ||
100 | { | ||
101 | mMinLocal.mV[VX] -= delta; | ||
102 | mMinLocal.mV[VY] -= delta; | ||
103 | mMinLocal.mV[VZ] -= delta; | ||
104 | mMaxLocal.mV[VX] += delta; | ||
105 | mMaxLocal.mV[VY] += delta; | ||
106 | mMaxLocal.mV[VZ] += delta; | ||
107 | } | ||
108 | |||
109 | LLVector3 LLBBox::localToAgent(const LLVector3& v) const | ||
110 | { | ||
111 | LLMatrix4 m( mRotation ); | ||
112 | m.translate( mPosAgent ); | ||
113 | return v * m; | ||
114 | } | ||
115 | |||
116 | LLVector3 LLBBox::agentToLocal(const LLVector3& v) const | ||
117 | { | ||
118 | LLMatrix4 m; | ||
119 | m.translate( -mPosAgent ); | ||
120 | m.rotate( ~mRotation ); // inverse rotation | ||
121 | return v * m; | ||
122 | } | ||
123 | |||
124 | LLVector3 LLBBox::localToAgentBasis(const LLVector3& v) const | ||
125 | { | ||
126 | LLMatrix4 m( mRotation ); | ||
127 | return v * m; | ||
128 | } | ||
129 | |||
130 | LLVector3 LLBBox::agentToLocalBasis(const LLVector3& v) const | ||
131 | { | ||
132 | LLMatrix4 m( ~mRotation ); // inverse rotation | ||
133 | return v * m; | ||
134 | } | ||
135 | |||
136 | BOOL LLBBox::containsPointLocal(const LLVector3& p) const | ||
137 | { | ||
138 | if ( (p.mV[VX] < mMinLocal.mV[VX]) | ||
139 | ||(p.mV[VX] > mMaxLocal.mV[VX]) | ||
140 | ||(p.mV[VY] < mMinLocal.mV[VY]) | ||
141 | ||(p.mV[VY] > mMaxLocal.mV[VY]) | ||
142 | ||(p.mV[VZ] < mMinLocal.mV[VZ]) | ||
143 | ||(p.mV[VZ] > mMaxLocal.mV[VZ])) | ||
144 | { | ||
145 | return FALSE; | ||
146 | } | ||
147 | return TRUE; | ||
148 | } | ||
149 | |||
150 | BOOL LLBBox::containsPointAgent(const LLVector3& p) const | ||
151 | { | ||
152 | LLVector3 point_local = agentToLocal(p); | ||
153 | return containsPointLocal(point_local); | ||
154 | } | ||
155 | |||
156 | |||
157 | /* | ||
158 | LLBBox operator*(const LLBBox &a, const LLMatrix4 &b) | ||
159 | { | ||
160 | return LLBBox( a.mMin * b, a.mMax * b ); | ||
161 | } | ||
162 | */ | ||
diff --git a/linden/indra/llmath/llbbox.h b/linden/indra/llmath/llbbox.h deleted file mode 100644 index 3559284..0000000 --- a/linden/indra/llmath/llbbox.h +++ /dev/null | |||
@@ -1,103 +0,0 @@ | |||
1 | /** | ||
2 | * @file llbbox.h | ||
3 | * @brief General purpose bounding box class | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2001&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2001-2010, /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_BBOX_H | ||
34 | #define LL_BBOX_H | ||
35 | |||
36 | #include "v3math.h" | ||
37 | #include "llquaternion.h" | ||
38 | |||
39 | // Note: "local space" for an LLBBox is defined relative to agent space in terms of | ||
40 | // a translation followed by a rotation. There is no scale term since the LLBBox's min and | ||
41 | // max are not necessarily symetrical and define their own extents. | ||
42 | |||
43 | class LLBBox | ||
44 | { | ||
45 | public: | ||
46 | LLBBox() {mEmpty = TRUE;} | ||
47 | LLBBox( const LLVector3& pos_agent, | ||
48 | const LLQuaternion& rot, | ||
49 | const LLVector3& min_local, | ||
50 | const LLVector3& max_local ) | ||
51 | : | ||
52 | mMinLocal( min_local ), mMaxLocal( max_local ), mPosAgent(pos_agent), mRotation( rot), mEmpty( TRUE ) | ||
53 | {} | ||
54 | |||
55 | // Default copy constructor is OK. | ||
56 | |||
57 | const LLVector3& getPositionAgent() const { return mPosAgent; } | ||
58 | const LLQuaternion& getRotation() const { return mRotation; } | ||
59 | |||
60 | const LLVector3& getMinLocal() const { return mMinLocal; } | ||
61 | void setMinLocal( const LLVector3& min ) { mMinLocal = min; } | ||
62 | |||
63 | const LLVector3& getMaxLocal() const { return mMaxLocal; } | ||
64 | void setMaxLocal( const LLVector3& max ) { mMaxLocal = max; } | ||
65 | |||
66 | LLVector3 getCenterLocal() const { return (mMaxLocal - mMinLocal) * 0.5f + mMinLocal; } | ||
67 | LLVector3 getCenterAgent() const { return localToAgent( getCenterLocal() ); } | ||
68 | |||
69 | LLVector3 getExtentLocal() const { return mMaxLocal - mMinLocal; } | ||
70 | |||
71 | BOOL containsPointLocal(const LLVector3& p) const; | ||
72 | BOOL containsPointAgent(const LLVector3& p) const; | ||
73 | |||
74 | void addPointAgent(LLVector3 p); | ||
75 | void addBBoxAgent(const LLBBox& b); | ||
76 | |||
77 | void addPointLocal(const LLVector3& p); | ||
78 | void addBBoxLocal(const LLBBox& b) { addPointLocal( b.mMinLocal ); addPointLocal( b.mMaxLocal ); } | ||
79 | |||
80 | void expand( F32 delta ); | ||
81 | |||
82 | LLVector3 localToAgent( const LLVector3& v ) const; | ||
83 | LLVector3 agentToLocal( const LLVector3& v ) const; | ||
84 | |||
85 | // Changes rotation but not position | ||
86 | LLVector3 localToAgentBasis(const LLVector3& v) const; | ||
87 | LLVector3 agentToLocalBasis(const LLVector3& v) const; | ||
88 | |||
89 | |||
90 | // friend LLBBox operator*(const LLBBox& a, const LLMatrix4& b); | ||
91 | |||
92 | private: | ||
93 | LLVector3 mMinLocal; | ||
94 | LLVector3 mMaxLocal; | ||
95 | LLVector3 mPosAgent; // Position relative to Agent's Region | ||
96 | LLQuaternion mRotation; | ||
97 | BOOL mEmpty; // Nothing has been added to this bbox yet | ||
98 | }; | ||
99 | |||
100 | //LLBBox operator*(const LLBBox &a, const LLMatrix4 &b); | ||
101 | |||
102 | |||
103 | #endif // LL_BBOX_H | ||
diff --git a/linden/indra/llmath/llcamera.cpp b/linden/indra/llmath/llcamera.cpp index 9c37fcf..e6b6797 100644 --- a/linden/indra/llmath/llcamera.cpp +++ b/linden/indra/llmath/llcamera.cpp | |||
@@ -246,10 +246,6 @@ S32 LLCamera::AABBInFrustum(const LLVector3 ¢er, const LLVector3& radius) | |||
246 | for (U32 i = 0; i < mPlaneCount; i++) | 246 | for (U32 i = 0; i < mPlaneCount; i++) |
247 | { | 247 | { |
248 | mask = mAgentPlanes[i].mask; | 248 | mask = mAgentPlanes[i].mask; |
249 | if (mask == 0xff) | ||
250 | { | ||
251 | continue; | ||
252 | } | ||
253 | LLPlane p = mAgentPlanes[i].p; | 249 | LLPlane p = mAgentPlanes[i].p; |
254 | LLVector3 n = LLVector3(p); | 250 | LLVector3 n = LLVector3(p); |
255 | float d = p.mV[3]; | 251 | float d = p.mV[3]; |
@@ -298,10 +294,6 @@ S32 LLCamera::AABBInFrustumNoFarClip(const LLVector3 ¢er, const LLVector3& r | |||
298 | } | 294 | } |
299 | 295 | ||
300 | mask = mAgentPlanes[i].mask; | 296 | mask = mAgentPlanes[i].mask; |
301 | if (mask == 0xff) | ||
302 | { | ||
303 | continue; | ||
304 | } | ||
305 | LLPlane p = mAgentPlanes[i].p; | 297 | LLPlane p = mAgentPlanes[i].p; |
306 | LLVector3 n = LLVector3(p); | 298 | LLVector3 n = LLVector3(p); |
307 | float d = p.mV[3]; | 299 | float d = p.mV[3]; |
@@ -445,11 +437,6 @@ int LLCamera::sphereInFrustum(const LLVector3 &sphere_center, const F32 radius) | |||
445 | int res = 2; | 437 | int res = 2; |
446 | for (int i = 0; i < 6; i++) | 438 | for (int i = 0; i < 6; i++) |
447 | { | 439 | { |
448 | if (mAgentPlanes[i].mask == 0xff) | ||
449 | { | ||
450 | continue; | ||
451 | } | ||
452 | |||
453 | float d = mAgentPlanes[i].p.dist(sphere_center); | 440 | float d = mAgentPlanes[i].p.dist(sphere_center); |
454 | 441 | ||
455 | if (d > radius) | 442 | if (d > radius) |
@@ -635,17 +622,6 @@ U8 LLCamera::calcPlaneMask(const LLPlane& plane) | |||
635 | return mask; | 622 | return mask; |
636 | } | 623 | } |
637 | 624 | ||
638 | void LLCamera::ignoreAgentFrustumPlane(S32 idx) | ||
639 | { | ||
640 | if (idx < 0 || idx > (S32) mPlaneCount) | ||
641 | { | ||
642 | return; | ||
643 | } | ||
644 | |||
645 | mAgentPlanes[idx].mask = 0xff; | ||
646 | mAgentPlanes[idx].p.clearVec(); | ||
647 | } | ||
648 | |||
649 | void LLCamera::calcAgentFrustumPlanes(LLVector3* frust) | 625 | void LLCamera::calcAgentFrustumPlanes(LLVector3* frust) |
650 | { | 626 | { |
651 | 627 | ||
diff --git a/linden/indra/llmath/llcamera.h b/linden/indra/llmath/llcamera.h index 8d3ad08..85b93df 100644 --- a/linden/indra/llmath/llcamera.h +++ b/linden/indra/llmath/llcamera.h | |||
@@ -84,17 +84,6 @@ public: | |||
84 | PLANE_TOP_MASK = (1<<PLANE_TOP), | 84 | PLANE_TOP_MASK = (1<<PLANE_TOP), |
85 | PLANE_ALL_MASK = 0xf | 85 | PLANE_ALL_MASK = 0xf |
86 | }; | 86 | }; |
87 | |||
88 | enum | ||
89 | { | ||
90 | AGENT_PLANE_LEFT = 0, | ||
91 | AGENT_PLANE_RIGHT, | ||
92 | AGENT_PLANE_NEAR, | ||
93 | AGENT_PLANE_BOTTOM, | ||
94 | AGENT_PLANE_TOP, | ||
95 | AGENT_PLANE_FAR, | ||
96 | }; | ||
97 | |||
98 | enum { | 87 | enum { |
99 | HORIZ_PLANE_LEFT = 0, | 88 | HORIZ_PLANE_LEFT = 0, |
100 | HORIZ_PLANE_RIGHT = 1, | 89 | HORIZ_PLANE_RIGHT = 1, |
@@ -134,8 +123,7 @@ private: | |||
134 | public: | 123 | public: |
135 | LLVector3 mAgentFrustum[8]; //8 corners of 6-plane frustum | 124 | LLVector3 mAgentFrustum[8]; //8 corners of 6-plane frustum |
136 | F32 mFrustumCornerDist; //distance to corner of frustum against far clip plane | 125 | F32 mFrustumCornerDist; //distance to corner of frustum against far clip plane |
137 | LLPlane getAgentPlane(U32 idx) { return mAgentPlanes[idx].p; } | 126 | |
138 | |||
139 | public: | 127 | public: |
140 | LLCamera(); | 128 | LLCamera(); |
141 | LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane); | 129 | LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane); |
@@ -182,8 +170,6 @@ public: | |||
182 | // Return number of bytes copied. | 170 | // Return number of bytes copied. |
183 | size_t readFrustumFromBuffer(const char *buffer); | 171 | size_t readFrustumFromBuffer(const char *buffer); |
184 | void calcAgentFrustumPlanes(LLVector3* frust); | 172 | void calcAgentFrustumPlanes(LLVector3* frust); |
185 | void ignoreAgentFrustumPlane(S32 idx); | ||
186 | |||
187 | // Returns 1 if partly in, 2 if fully in. | 173 | // Returns 1 if partly in, 2 if fully in. |
188 | // NOTE: 'center' is in absolute frame. | 174 | // NOTE: 'center' is in absolute frame. |
189 | S32 sphereInFrustumOld(const LLVector3 ¢er, const F32 radius) const; | 175 | S32 sphereInFrustumOld(const LLVector3 ¢er, const F32 radius) const; |
diff --git a/linden/indra/llmath/llmath.h b/linden/indra/llmath/llmath.h index ec1076d..0de568c 100644 --- a/linden/indra/llmath/llmath.h +++ b/linden/indra/llmath/llmath.h | |||
@@ -203,7 +203,7 @@ inline S32 llfloor( F32 f ) | |||
203 | } | 203 | } |
204 | return result; | 204 | return result; |
205 | #else | 205 | #else |
206 | return (S32)floorf(f); | 206 | return (S32)floor(f); |
207 | #endif | 207 | #endif |
208 | } | 208 | } |
209 | 209 | ||
diff --git a/linden/indra/llmath/llmodularmath.cpp b/linden/indra/llmath/llmodularmath.cpp deleted file mode 100644 index f0afeb7..0000000 --- a/linden/indra/llmath/llmodularmath.cpp +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /** | ||
2 | * @file llmodularmath.cpp | ||
3 | * @brief LLModularMath class implementation | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2001&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2001-2010, /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 | #include "linden_common.h" | ||
34 | |||
35 | // implementation is all in the header, this include dep ensures the unit test is rerun if the implementation changes. | ||
36 | #include "llmodularmath.h" | ||
diff --git a/linden/indra/llmath/llvolume.cpp b/linden/indra/llmath/llvolume.cpp index a1d891a..b0b8a94 100644 --- a/linden/indra/llmath/llvolume.cpp +++ b/linden/indra/llmath/llvolume.cpp | |||
@@ -2208,10 +2208,16 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, | |||
2208 | S32 requested_sizeS = 0; | 2208 | S32 requested_sizeS = 0; |
2209 | S32 requested_sizeT = 0; | 2209 | S32 requested_sizeT = 0; |
2210 | 2210 | ||
2211 | sculpt_calc_mesh_resolution(sculpt_width, sculpt_height, sculpt_type, mDetail, requested_sizeS, requested_sizeT); | 2211 | // create oblong sculpties with high LOD always |
2212 | F32 sculpt_detail = mDetail; | ||
2213 | if (sculpt_width != sculpt_height && sculpt_detail < 4.0) | ||
2214 | { | ||
2215 | sculpt_detail = 4.0; | ||
2216 | } | ||
2217 | sculpt_calc_mesh_resolution(sculpt_width, sculpt_height, sculpt_type, sculpt_detail, requested_sizeS, requested_sizeT); | ||
2212 | 2218 | ||
2213 | mPathp->generate(mParams.getPathParams(), mDetail, 0, TRUE, requested_sizeS); | 2219 | mPathp->generate(mParams.getPathParams(), sculpt_detail, 0, TRUE, requested_sizeS); |
2214 | mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(), mDetail, 0, TRUE, requested_sizeT); | 2220 | mProfilep->generate(mParams.getProfileParams(), mPathp->isOpen(), sculpt_detail, 0, TRUE, requested_sizeT); |
2215 | 2221 | ||
2216 | S32 sizeS = mPathp->mPath.size(); // we requested a specific size, now see what we really got | 2222 | S32 sizeS = mPathp->mPath.size(); // we requested a specific size, now see what we really got |
2217 | S32 sizeT = mProfilep->mProfile.size(); // we requested a specific size, now see what we really got | 2223 | S32 sizeT = mProfilep->mProfile.size(); // we requested a specific size, now see what we really got |
@@ -4268,7 +4274,7 @@ LLFaceID LLVolume::generateFaceMask() | |||
4268 | } | 4274 | } |
4269 | break; | 4275 | break; |
4270 | default: | 4276 | default: |
4271 | llerrs << "Unknown profile!" << llendl; | 4277 | llerrs << "Unknown profile!" << llendl |
4272 | break; | 4278 | break; |
4273 | } | 4279 | } |
4274 | 4280 | ||
diff --git a/linden/indra/llrender/CMakeLists.txt b/linden/indra/llrender/CMakeLists.txt index 3ba841e..0bdb55f 100644 --- a/linden/indra/llrender/CMakeLists.txt +++ b/linden/indra/llrender/CMakeLists.txt | |||
@@ -32,9 +32,9 @@ set(llrender_SOURCE_FILES | |||
32 | llgldbg.cpp | 32 | llgldbg.cpp |
33 | llglslshader.cpp | 33 | llglslshader.cpp |
34 | llimagegl.cpp | 34 | llimagegl.cpp |
35 | llpostprocess.cpp | ||
35 | llrendersphere.cpp | 36 | llrendersphere.cpp |
36 | llshadermgr.cpp | 37 | llshadermgr.cpp |
37 | lltextureatlas.cpp | ||
38 | llvertexbuffer.cpp | 38 | llvertexbuffer.cpp |
39 | ) | 39 | ) |
40 | 40 | ||
@@ -53,10 +53,10 @@ set(llrender_HEADER_FILES | |||
53 | llglstates.h | 53 | llglstates.h |
54 | llgltypes.h | 54 | llgltypes.h |
55 | llimagegl.h | 55 | llimagegl.h |
56 | llpostprocess.h | ||
56 | llrender.h | 57 | llrender.h |
57 | llrendersphere.h | 58 | llrendersphere.h |
58 | llshadermgr.h | 59 | llshadermgr.h |
59 | lltextureatlas.h | ||
60 | llvertexbuffer.h | 60 | llvertexbuffer.h |
61 | ) | 61 | ) |
62 | 62 | ||
@@ -81,7 +81,6 @@ if (SERVER AND NOT WINDOWS AND NOT DARWIN) | |||
81 | ${llrender_SOURCE_FILES} | 81 | ${llrender_SOURCE_FILES} |
82 | ${server_SOURCE_FILES} | 82 | ${server_SOURCE_FILES} |
83 | ) | 83 | ) |
84 | add_dependencies(llrenderheadless prepare) | ||
85 | else (SERVER AND NOT WINDOWS AND NOT DARWIN) | 84 | else (SERVER AND NOT WINDOWS AND NOT DARWIN) |
86 | list(APPEND llrender_SOURCE_FILES | 85 | list(APPEND llrender_SOURCE_FILES |
87 | llgl.cpp | 86 | llgl.cpp |
diff --git a/linden/indra/llrender/llcubemap.cpp b/linden/indra/llrender/llcubemap.cpp index e0923e4..a5c677d 100644 --- a/linden/indra/llrender/llcubemap.cpp +++ b/linden/indra/llrender/llcubemap.cpp | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ |
6 | * | 6 | * |
7 | * Copyright (c) 2002-2010, Linden Research, Inc. | 7 | * Copyright (c) 2002-2009, Linden Research, Inc. |
8 | * | 8 | * |
9 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 10 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -63,12 +63,6 @@ LLCubeMap::LLCubeMap() | |||
63 | mTextureCoordStage(0), | 63 | mTextureCoordStage(0), |
64 | mMatrixStage(0) | 64 | mMatrixStage(0) |
65 | { | 65 | { |
66 | mTargets[0] = GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB; | ||
67 | mTargets[1] = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB; | ||
68 | mTargets[2] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB; | ||
69 | mTargets[3] = GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB; | ||
70 | mTargets[4] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB; | ||
71 | mTargets[5] = GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB; | ||
72 | } | 66 | } |
73 | 67 | ||
74 | LLCubeMap::~LLCubeMap() | 68 | LLCubeMap::~LLCubeMap() |
@@ -81,6 +75,13 @@ void LLCubeMap::initGL() | |||
81 | 75 | ||
82 | if (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps) | 76 | if (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps) |
83 | { | 77 | { |
78 | mTargets[0] = GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB; | ||
79 | mTargets[1] = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB; | ||
80 | mTargets[2] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB; | ||
81 | mTargets[3] = GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB; | ||
82 | mTargets[4] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB; | ||
83 | mTargets[5] = GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB; | ||
84 | |||
84 | // Not initialized, do stuff. | 85 | // Not initialized, do stuff. |
85 | if (mImages[0].isNull()) | 86 | if (mImages[0].isNull()) |
86 | { | 87 | { |
@@ -93,7 +94,7 @@ void LLCubeMap::initGL() | |||
93 | mImages[i] = new LLImageGL(64, 64, 4, (use_cube_mipmaps? TRUE : FALSE)); | 94 | mImages[i] = new LLImageGL(64, 64, 4, (use_cube_mipmaps? TRUE : FALSE)); |
94 | mImages[i]->setTarget(mTargets[i], LLTexUnit::TT_CUBE_MAP); | 95 | mImages[i]->setTarget(mTargets[i], LLTexUnit::TT_CUBE_MAP); |
95 | mRawImages[i] = new LLImageRaw(64, 64, 4); | 96 | mRawImages[i] = new LLImageRaw(64, 64, 4); |
96 | mImages[i]->createGLTexture(0, mRawImages[i], texname); | 97 | mImages[i]->createGLTexture(0, mRawImages[i], texname, TRUE); |
97 | 98 | ||
98 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_CUBE_MAP, texname); | 99 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_CUBE_MAP, texname); |
99 | mImages[i]->setAddressMode(LLTexUnit::TAM_CLAMP); | 100 | mImages[i]->setAddressMode(LLTexUnit::TAM_CLAMP); |
diff --git a/linden/indra/llrender/llfont.cpp b/linden/indra/llrender/llfont.cpp index 946f52f..5ee3929 100644 --- a/linden/indra/llrender/llfont.cpp +++ b/linden/indra/llrender/llfont.cpp | |||
@@ -81,7 +81,7 @@ LLFontManager::LLFontManager() | |||
81 | if (error) | 81 | if (error) |
82 | { | 82 | { |
83 | // Clean up freetype libs. | 83 | // Clean up freetype libs. |
84 | llwarns << "Freetype initialization failure!" << llendl; | 84 | llerrs << "Freetype initialization failure!" << llendl; |
85 | FT_Done_FreeType(gFTLibrary); | 85 | FT_Done_FreeType(gFTLibrary); |
86 | } | 86 | } |
87 | } | 87 | } |
diff --git a/linden/indra/llrender/llfontgl.cpp b/linden/indra/llrender/llfontgl.cpp index 9d1f1d4..5d3d6a7 100644 --- a/linden/indra/llrender/llfontgl.cpp +++ b/linden/indra/llrender/llfontgl.cpp | |||
@@ -121,7 +121,7 @@ LLFontGL::LLFontGL() | |||
121 | 121 | ||
122 | LLFontGL::LLFontGL(const LLFontGL &source) | 122 | LLFontGL::LLFontGL(const LLFontGL &source) |
123 | { | 123 | { |
124 | llwarns << "Not implemented!" << llendl; | 124 | llerrs << "Not implemented!" << llendl; |
125 | } | 125 | } |
126 | 126 | ||
127 | LLFontGL::~LLFontGL() | 127 | LLFontGL::~LLFontGL() |
@@ -278,7 +278,7 @@ void LLFontGL::destroyGL() | |||
278 | 278 | ||
279 | LLFontGL &LLFontGL::operator=(const LLFontGL &source) | 279 | LLFontGL &LLFontGL::operator=(const LLFontGL &source) |
280 | { | 280 | { |
281 | llwarns << "Not implemented" << llendl; | 281 | llerrs << "Not implemented" << llendl; |
282 | return *this; | 282 | return *this; |
283 | } | 283 | } |
284 | 284 | ||
@@ -584,7 +584,7 @@ S32 LLFontGL::render(const LLWString &wstr, | |||
584 | const LLFontGlyphInfo* fgi= getGlyphInfo(wch); | 584 | const LLFontGlyphInfo* fgi= getGlyphInfo(wch); |
585 | if (!fgi) | 585 | if (!fgi) |
586 | { | 586 | { |
587 | llwarns << "Missing Glyph Info" << llendl; | 587 | llerrs << "Missing Glyph Info" << llendl; |
588 | break; | 588 | break; |
589 | } | 589 | } |
590 | // Per-glyph bitmap texture. | 590 | // Per-glyph bitmap texture. |
diff --git a/linden/indra/llrender/llgl.cpp b/linden/indra/llrender/llgl.cpp index d73f7b6..2e9b2bd 100644 --- a/linden/indra/llrender/llgl.cpp +++ b/linden/indra/llrender/llgl.cpp | |||
@@ -59,13 +59,11 @@ | |||
59 | BOOL gDebugGL = FALSE; | 59 | BOOL gDebugGL = FALSE; |
60 | BOOL gClothRipple = FALSE; | 60 | BOOL gClothRipple = FALSE; |
61 | BOOL gNoRender = FALSE; | 61 | BOOL gNoRender = FALSE; |
62 | BOOL gGLActive = FALSE; | ||
63 | LLMatrix4 gGLObliqueProjectionInverse; | 62 | LLMatrix4 gGLObliqueProjectionInverse; |
64 | 63 | ||
65 | #define LL_GL_NAME_POOLING 0 | 64 | #define LL_GL_NAME_POOLING 0 |
66 | 65 | ||
67 | LLGLNamePool::pool_list_t LLGLNamePool::sInstances; | 66 | LLGLNamePool::pool_list_t LLGLNamePool::sInstances; |
68 | std::list<LLGLUpdate*> LLGLUpdate::sGLQ; | ||
69 | 67 | ||
70 | #if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS | 68 | #if (LL_WINDOWS || LL_LINUX || LL_SOLARIS) && !LL_MESA_HEADLESS |
71 | // ATI prototypes | 69 | // ATI prototypes |
@@ -1011,7 +1009,7 @@ void assert_glerror() | |||
1011 | 1009 | ||
1012 | if (quit) | 1010 | if (quit) |
1013 | { | 1011 | { |
1014 | llwarns << "One or more unhandled GL errors." << llendl; | 1012 | llerrs << "One or more unhandled GL errors." << llendl; |
1015 | } | 1013 | } |
1016 | } | 1014 | } |
1017 | 1015 | ||
@@ -1705,11 +1703,11 @@ void LLGLNamePool::release(GLuint name) | |||
1705 | } | 1703 | } |
1706 | else | 1704 | else |
1707 | { | 1705 | { |
1708 | llwarns << "Attempted to release a pooled name that is not in use!" << llendl; | 1706 | llerrs << "Attempted to release a pooled name that is not in use!" << llendl; |
1709 | } | 1707 | } |
1710 | } | 1708 | } |
1711 | } | 1709 | } |
1712 | llwarns << "Attempted to release a non pooled name!" << llendl; | 1710 | llerrs << "Attempted to release a non pooled name!" << llendl; |
1713 | #else | 1711 | #else |
1714 | releaseName(name); | 1712 | releaseName(name); |
1715 | #endif | 1713 | #endif |
diff --git a/linden/indra/llrender/llgl.h b/linden/indra/llrender/llgl.h index 90642b3..cc7ebff 100644 --- a/linden/indra/llrender/llgl.h +++ b/linden/indra/llrender/llgl.h | |||
@@ -359,35 +359,6 @@ protected: | |||
359 | virtual void releaseName(GLuint name) = 0; | 359 | virtual void releaseName(GLuint name) = 0; |
360 | }; | 360 | }; |
361 | 361 | ||
362 | /* | ||
363 | Interface for objects that need periodic GL updates applied to them. | ||
364 | Used to synchronize GL updates with GL thread. | ||
365 | */ | ||
366 | class LLGLUpdate | ||
367 | { | ||
368 | public: | ||
369 | |||
370 | static std::list<LLGLUpdate*> sGLQ; | ||
371 | |||
372 | BOOL mInQ; | ||
373 | LLGLUpdate() | ||
374 | : mInQ(FALSE) | ||
375 | { | ||
376 | } | ||
377 | virtual ~LLGLUpdate() | ||
378 | { | ||
379 | if (mInQ) | ||
380 | { | ||
381 | std::list<LLGLUpdate*>::iterator iter = std::find(sGLQ.begin(), sGLQ.end(), this); | ||
382 | if (iter != sGLQ.end()) | ||
383 | { | ||
384 | sGLQ.erase(iter); | ||
385 | } | ||
386 | } | ||
387 | } | ||
388 | virtual void updateGL() = 0; | ||
389 | }; | ||
390 | |||
391 | extern LLMatrix4 gGLObliqueProjectionInverse; | 362 | extern LLMatrix4 gGLObliqueProjectionInverse; |
392 | 363 | ||
393 | #include "llglstates.h" | 364 | #include "llglstates.h" |
@@ -406,6 +377,4 @@ void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor | |||
406 | 377 | ||
407 | extern BOOL gClothRipple; | 378 | extern BOOL gClothRipple; |
408 | extern BOOL gNoRender; | 379 | extern BOOL gNoRender; |
409 | extern BOOL gGLActive; | ||
410 | |||
411 | #endif // LL_LLGL_H | 380 | #endif // LL_LLGL_H |
diff --git a/linden/indra/llrender/llglslshader.cpp b/linden/indra/llrender/llglslshader.cpp index 18974a7..08d6548 100644 --- a/linden/indra/llrender/llglslshader.cpp +++ b/linden/indra/llrender/llglslshader.cpp | |||
@@ -408,7 +408,7 @@ S32 LLGLSLShader::disableTexture(S32 uniform, LLTexUnit::eTextureType mode) | |||
408 | { | 408 | { |
409 | if (gDebugGL && gGL.getTexUnit(index)->getCurrType() != mode) | 409 | if (gDebugGL && gGL.getTexUnit(index)->getCurrType() != mode) |
410 | { | 410 | { |
411 | llwarns << "Texture channel " << index << " texture type corrupted." << llendl; | 411 | llerrs << "Texture channel " << index << " texture type corrupted." << llendl; |
412 | } | 412 | } |
413 | gGL.getTexUnit(index)->disable(); | 413 | gGL.getTexUnit(index)->disable(); |
414 | } | 414 | } |
diff --git a/linden/indra/llrender/llimagegl.cpp b/linden/indra/llrender/llimagegl.cpp index 1bddd49..7cd4dd7 100644 --- a/linden/indra/llrender/llimagegl.cpp +++ b/linden/indra/llrender/llimagegl.cpp | |||
@@ -43,8 +43,6 @@ | |||
43 | #include "llmath.h" | 43 | #include "llmath.h" |
44 | #include "llgl.h" | 44 | #include "llgl.h" |
45 | #include "llrender.h" | 45 | #include "llrender.h" |
46 | #include "lltextureatlas.h" | ||
47 | |||
48 | //---------------------------------------------------------------------------- | 46 | //---------------------------------------------------------------------------- |
49 | 47 | ||
50 | const F32 MIN_TEXTURE_LIFETIME = 10.f; | 48 | const F32 MIN_TEXTURE_LIFETIME = 10.f; |
@@ -58,17 +56,19 @@ S32 LLImageGL::sGlobalTextureMemoryInBytes = 0; | |||
58 | S32 LLImageGL::sBoundTextureMemoryInBytes = 0; | 56 | S32 LLImageGL::sBoundTextureMemoryInBytes = 0; |
59 | S32 LLImageGL::sCurBoundTextureMemory = 0; | 57 | S32 LLImageGL::sCurBoundTextureMemory = 0; |
60 | S32 LLImageGL::sCount = 0; | 58 | S32 LLImageGL::sCount = 0; |
61 | std::list<U32> LLImageGL::sDeadTextureList; | ||
62 | 59 | ||
63 | BOOL LLImageGL::sGlobalUseAnisotropic = FALSE; | 60 | BOOL LLImageGL::sGlobalUseAnisotropic = FALSE; |
64 | F32 LLImageGL::sLastFrameTime = 0.f; | 61 | F32 LLImageGL::sLastFrameTime = 0.f; |
65 | BOOL LLImageGL::sUseTextureAtlas = FALSE ; // render-pipeline KL | 62 | BOOL LLImageGL::sAllowReadBackRaw = FALSE ; |
66 | 63 | ||
67 | std::set<LLImageGL*> LLImageGL::sImageList; | 64 | std::set<LLImageGL*> LLImageGL::sImageList; |
68 | 65 | ||
69 | #if !LL_RELEASE_FOR_DOWNLOAD | 66 | //**************************************************************************************************** |
67 | //The below for texture auditing use only | ||
68 | //**************************************************************************************************** | ||
70 | //----------------------- | 69 | //----------------------- |
71 | //debug use | 70 | //debug use |
71 | BOOL gAuditTexture = FALSE ; | ||
72 | #define MAX_TEXTURE_LOG_SIZE 22 //2048 * 2048 | 72 | #define MAX_TEXTURE_LOG_SIZE 22 //2048 * 2048 |
73 | std::vector<S32> LLImageGL::sTextureLoadedCounter(MAX_TEXTURE_LOG_SIZE + 1) ; | 73 | std::vector<S32> LLImageGL::sTextureLoadedCounter(MAX_TEXTURE_LOG_SIZE + 1) ; |
74 | std::vector<S32> LLImageGL::sTextureBoundCounter(MAX_TEXTURE_LOG_SIZE + 1) ; | 74 | std::vector<S32> LLImageGL::sTextureBoundCounter(MAX_TEXTURE_LOG_SIZE + 1) ; |
@@ -76,8 +76,15 @@ std::vector<S32> LLImageGL::sTextureCurBoundCounter(MAX_TEXTURE_LOG_SIZE + 1) ; | |||
76 | S32 LLImageGL::sCurTexSizeBar = -1 ; | 76 | S32 LLImageGL::sCurTexSizeBar = -1 ; |
77 | S32 LLImageGL::sCurTexPickSize = -1 ; | 77 | S32 LLImageGL::sCurTexPickSize = -1 ; |
78 | LLPointer<LLImageGL> LLImageGL::sDefaultTexturep = NULL; | 78 | LLPointer<LLImageGL> LLImageGL::sDefaultTexturep = NULL; |
79 | S32 LLImageGL::sMaxCatagories = 1 ; | ||
80 | |||
81 | std::vector<S32> LLImageGL::sTextureMemByCategory; | ||
82 | std::vector<S32> LLImageGL::sTextureMemByCategoryBound ; | ||
83 | std::vector<S32> LLImageGL::sTextureCurMemByCategoryBound ; | ||
79 | //------------------------ | 84 | //------------------------ |
80 | #endif | 85 | //**************************************************************************************************** |
86 | //End for texture auditing use only | ||
87 | //**************************************************************************************************** | ||
81 | 88 | ||
82 | //************************************************************************************** | 89 | //************************************************************************************** |
83 | //below are functions for debug use | 90 | //below are functions for debug use |
@@ -103,12 +110,9 @@ void LLImageGL::checkTexSize() const | |||
103 | { | 110 | { |
104 | GLint texname; | 111 | GLint texname; |
105 | glGetIntegerv(GL_TEXTURE_BINDING_2D, &texname); | 112 | glGetIntegerv(GL_TEXTURE_BINDING_2D, &texname); |
106 | BOOL error = FALSE; | ||
107 | if (texname != mTexName) | 113 | if (texname != mTexName) |
108 | { | 114 | { |
109 | 115 | llerrs << "Invalid texture bound!" << llendl; | |
110 | llwarns << "Invalid texture bound!" << llendl; | ||
111 | |||
112 | } | 116 | } |
113 | stop_glerror() ; | 117 | stop_glerror() ; |
114 | LLGLint x = 0, y = 0 ; | 118 | LLGLint x = 0, y = 0 ; |
@@ -121,15 +125,7 @@ void LLImageGL::checkTexSize() const | |||
121 | } | 125 | } |
122 | if(x != (mWidth >> mCurrentDiscardLevel) || y != (mHeight >> mCurrentDiscardLevel)) | 126 | if(x != (mWidth >> mCurrentDiscardLevel) || y != (mHeight >> mCurrentDiscardLevel)) |
123 | { | 127 | { |
124 | error = TRUE; | 128 | llerrs << "wrong texture size and discard level!" << llendl ; |
125 | |||
126 | llwarns << "wrong texture size and discard level!" << llendl; | ||
127 | |||
128 | } | ||
129 | |||
130 | if (error) | ||
131 | { | ||
132 | llwarns << "LLImageGL::checkTexSize failed." << llendl; | ||
133 | } | 129 | } |
134 | } | 130 | } |
135 | } | 131 | } |
@@ -137,6 +133,20 @@ void LLImageGL::checkTexSize() const | |||
137 | //************************************************************************************** | 133 | //************************************************************************************** |
138 | 134 | ||
139 | //---------------------------------------------------------------------------- | 135 | //---------------------------------------------------------------------------- |
136 | //static | ||
137 | void LLImageGL::initClass(S32 num_catagories) | ||
138 | { | ||
139 | sMaxCatagories = num_catagories ; | ||
140 | |||
141 | sTextureMemByCategory.resize(sMaxCatagories); | ||
142 | sTextureMemByCategoryBound.resize(sMaxCatagories) ; | ||
143 | sTextureCurMemByCategoryBound.resize(sMaxCatagories) ; | ||
144 | } | ||
145 | |||
146 | //static | ||
147 | void LLImageGL::cleanupClass() | ||
148 | { | ||
149 | } | ||
140 | 150 | ||
141 | //static | 151 | //static |
142 | S32 LLImageGL::dataFormatBits(S32 dataformat) | 152 | S32 LLImageGL::dataFormatBits(S32 dataformat) |
@@ -155,7 +165,7 @@ S32 LLImageGL::dataFormatBits(S32 dataformat) | |||
155 | case GL_RGBA: return 32; | 165 | case GL_RGBA: return 32; |
156 | case GL_BGRA: return 32; // Used for QuickTime media textures on the Mac | 166 | case GL_BGRA: return 32; // Used for QuickTime media textures on the Mac |
157 | default: | 167 | default: |
158 | llwarns << "LLImageGL::Unknown format: " << dataformat << llendl; | 168 | llerrs << "LLImageGL::Unknown format: " << dataformat << llendl; |
159 | return 0; | 169 | return 0; |
160 | } | 170 | } |
161 | } | 171 | } |
@@ -190,7 +200,7 @@ S32 LLImageGL::dataFormatComponents(S32 dataformat) | |||
190 | case GL_RGBA: return 4; | 200 | case GL_RGBA: return 4; |
191 | case GL_BGRA: return 4; // Used for QuickTime media textures on the Mac | 201 | case GL_BGRA: return 4; // Used for QuickTime media textures on the Mac |
192 | default: | 202 | default: |
193 | llwarns << "LLImageGL::Unknown format: " << dataformat << llendl; | 203 | llerrs << "LLImageGL::Unknown format: " << dataformat << llendl; |
194 | return 0; | 204 | return 0; |
195 | } | 205 | } |
196 | } | 206 | } |
@@ -204,25 +214,43 @@ void LLImageGL::updateStats(F32 current_time) | |||
204 | sBoundTextureMemoryInBytes = sCurBoundTextureMemory; | 214 | sBoundTextureMemoryInBytes = sCurBoundTextureMemory; |
205 | sCurBoundTextureMemory = 0; | 215 | sCurBoundTextureMemory = 0; |
206 | 216 | ||
207 | #if !LL_RELEASE_FOR_DOWNLOAD | 217 | if(gAuditTexture) |
208 | for(U32 i = 0 ; i < sTextureCurBoundCounter.size() ; i++) | ||
209 | { | 218 | { |
210 | sTextureBoundCounter[i] = sTextureCurBoundCounter[i] ; | 219 | for(U32 i = 0 ; i < sTextureCurBoundCounter.size() ; i++) |
211 | sTextureCurBoundCounter[i] = 0 ; | 220 | { |
221 | sTextureBoundCounter[i] = sTextureCurBoundCounter[i] ; | ||
222 | sTextureCurBoundCounter[i] = 0 ; | ||
223 | } | ||
224 | for(U32 i = 0 ; i < sTextureCurMemByCategoryBound.size() ; i++) | ||
225 | { | ||
226 | sTextureMemByCategoryBound[i] = sTextureCurMemByCategoryBound[i] ; | ||
227 | sTextureCurMemByCategoryBound[i] = 0 ; | ||
228 | } | ||
212 | } | 229 | } |
213 | #endif | ||
214 | } | 230 | } |
215 | 231 | ||
216 | //static | 232 | //static |
217 | //#if !LL_RELEASE_FOR_DOWNLOAD | 233 | S32 LLImageGL::updateBoundTexMemStatic(const S32 delta, const S32 size, S32 category) |
218 | //S32 LLImageGL::updateBoundTexMem(const S32 delta, const S32 size) | 234 | { |
219 | //{ | 235 | if(gAuditTexture) |
220 | // sTextureCurBoundCounter[getTextureCounterIndex(size)]++ ; | 236 | { |
221 | //#else | 237 | sTextureCurBoundCounter[getTextureCounterIndex(size)]++ ; |
222 | S32 LLImageGL::updateBoundTexMem(const S32 delta) | 238 | sTextureCurMemByCategoryBound[category] += delta ; |
223 | { | 239 | } |
224 | //#endif | 240 | |
225 | LLImageGL::sCurBoundTextureMemory += delta; | 241 | LLImageGL::sCurBoundTextureMemory += delta ; |
242 | return LLImageGL::sCurBoundTextureMemory; | ||
243 | } | ||
244 | |||
245 | S32 LLImageGL::updateBoundTexMem()const | ||
246 | { | ||
247 | if(gAuditTexture) | ||
248 | { | ||
249 | sTextureCurBoundCounter[getTextureCounterIndex(mTextureMemory / mComponents)]++ ; | ||
250 | sTextureCurMemByCategoryBound[mCategory] += mTextureMemory ; | ||
251 | } | ||
252 | |||
253 | LLImageGL::sCurBoundTextureMemory += mTextureMemory ; | ||
226 | return LLImageGL::sCurBoundTextureMemory; | 254 | return LLImageGL::sCurBoundTextureMemory; |
227 | } | 255 | } |
228 | 256 | ||
@@ -236,6 +264,7 @@ void LLImageGL::destroyGL(BOOL save_state) | |||
236 | gGL.getTexUnit(stage)->unbind(LLTexUnit::TT_TEXTURE); | 264 | gGL.getTexUnit(stage)->unbind(LLTexUnit::TT_TEXTURE); |
237 | } | 265 | } |
238 | 266 | ||
267 | sAllowReadBackRaw = true ; | ||
239 | for (std::set<LLImageGL*>::iterator iter = sImageList.begin(); | 268 | for (std::set<LLImageGL*>::iterator iter = sImageList.begin(); |
240 | iter != sImageList.end(); iter++) | 269 | iter != sImageList.end(); iter++) |
241 | { | 270 | { |
@@ -255,7 +284,7 @@ void LLImageGL::destroyGL(BOOL save_state) | |||
255 | stop_glerror(); | 284 | stop_glerror(); |
256 | } | 285 | } |
257 | } | 286 | } |
258 | // sAllowReadBackRaw = false ; | 287 | sAllowReadBackRaw = false ; |
259 | } | 288 | } |
260 | 289 | ||
261 | //static | 290 | //static |
@@ -267,13 +296,13 @@ void LLImageGL::restoreGL() | |||
267 | LLImageGL* glimage = *iter; | 296 | LLImageGL* glimage = *iter; |
268 | if(glimage->getTexName()) | 297 | if(glimage->getTexName()) |
269 | { | 298 | { |
270 | llwarns << "tex name is not 0." << llendl ; | 299 | llerrs << "tex name is not 0." << llendl ; |
271 | } | 300 | } |
272 | if (glimage->mSaveData.notNull()) | 301 | if (glimage->mSaveData.notNull()) |
273 | { | 302 | { |
274 | if (glimage->getComponents() && glimage->mSaveData->getComponents()) | 303 | if (glimage->getComponents() && glimage->mSaveData->getComponents()) |
275 | { | 304 | { |
276 | glimage->createGLTexture(glimage->mCurrentDiscardLevel, glimage->mSaveData); | 305 | glimage->createGLTexture(glimage->mCurrentDiscardLevel, glimage->mSaveData, 0, TRUE, glimage->getCategory()); |
277 | stop_glerror(); | 306 | stop_glerror(); |
278 | } | 307 | } |
279 | glimage->mSaveData = NULL; // deletes data | 308 | glimage->mSaveData = NULL; // deletes data |
@@ -355,7 +384,7 @@ void LLImageGL::init(BOOL usemipmaps) | |||
355 | mTextureState = NO_DELETE ; | 384 | mTextureState = NO_DELETE ; |
356 | mTextureMemory = 0; | 385 | mTextureMemory = 0; |
357 | mLastBindTime = 0.f; | 386 | mLastBindTime = 0.f; |
358 | 387 | ||
359 | mTarget = GL_TEXTURE_2D; | 388 | mTarget = GL_TEXTURE_2D; |
360 | mBindTarget = LLTexUnit::TT_TEXTURE; | 389 | mBindTarget = LLTexUnit::TT_TEXTURE; |
361 | mUseMipMaps = usemipmaps; | 390 | mUseMipMaps = usemipmaps; |
@@ -382,12 +411,9 @@ void LLImageGL::init(BOOL usemipmaps) | |||
382 | mHasExplicitFormat = FALSE; | 411 | mHasExplicitFormat = FALSE; |
383 | 412 | ||
384 | mGLTextureCreated = FALSE ; | 413 | mGLTextureCreated = FALSE ; |
414 | |||
385 | mIsMask = FALSE; | 415 | mIsMask = FALSE; |
386 | // mCategory = -1 ; | 416 | mCategory = -1 ; |
387 | mCanAddToAtlas = TRUE ; | ||
388 | mDiscardLevelInAtlas = -1 ; | ||
389 | mTexelsInAtlas = 0 ; | ||
390 | mTexelsInGLTexture = 0 ; | ||
391 | } | 417 | } |
392 | 418 | ||
393 | void LLImageGL::cleanup() | 419 | void LLImageGL::cleanup() |
@@ -429,7 +455,7 @@ void LLImageGL::setSize(S32 width, S32 height, S32 ncomponents) | |||
429 | // Check if dimensions are a power of two! | 455 | // Check if dimensions are a power of two! |
430 | if (!checkSize(width,height)) | 456 | if (!checkSize(width,height)) |
431 | { | 457 | { |
432 | llwarns << llformat("Texture has non power of two dimention: %dx%d",width,height) << llendl; | 458 | llerrs << llformat("Texture has non power of two dimention: %dx%d",width,height) << llendl; |
433 | } | 459 | } |
434 | 460 | ||
435 | if (mTexName) | 461 | if (mTexName) |
@@ -487,6 +513,10 @@ void LLImageGL::dump() | |||
487 | } | 513 | } |
488 | 514 | ||
489 | //---------------------------------------------------------------------------- | 515 | //---------------------------------------------------------------------------- |
516 | void LLImageGL::forceUpdateBindStats(void) const | ||
517 | { | ||
518 | mLastBindTime = sLastFrameTime; | ||
519 | } | ||
490 | 520 | ||
491 | void LLImageGL::updateBindStats(void) const | 521 | void LLImageGL::updateBindStats(void) const |
492 | { | 522 | { |
@@ -500,12 +530,8 @@ void LLImageGL::updateBindStats(void) const | |||
500 | { | 530 | { |
501 | // we haven't accounted for this texture yet this frame | 531 | // we haven't accounted for this texture yet this frame |
502 | sUniqueCount++; | 532 | sUniqueCount++; |
503 | 533 | ||
504 | //#if !LL_RELEASE_FOR_DOWNLOAD | 534 | updateBoundTexMem(); |
505 | // updateBoundTexMem(mTextureMemory, getWidth(mCurrentDiscardLevel) * getHeight(mCurrentDiscardLevel)) ; | ||
506 | //#else | ||
507 | updateBoundTexMem(mTextureMemory); | ||
508 | //#endif | ||
509 | mLastBindTime = sLastFrameTime; | 535 | mLastBindTime = sLastFrameTime; |
510 | } | 536 | } |
511 | } | 537 | } |
@@ -518,7 +544,7 @@ bool LLImageGL::bindError(const S32 stage) const | |||
518 | } | 544 | } |
519 | 545 | ||
520 | //virtual | 546 | //virtual |
521 | bool LLImageGL::bindDefaultImage(const S32 stage) const | 547 | bool LLImageGL::bindDefaultImage(const S32 stage) |
522 | { | 548 | { |
523 | return false; | 549 | return false; |
524 | } | 550 | } |
@@ -557,7 +583,6 @@ void LLImageGL::setImage(const LLImageRaw* imageraw) | |||
557 | void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) | 583 | void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) |
558 | { | 584 | { |
559 | // LLFastTimer t1(LLFastTimer::FTM_TEMP1); | 585 | // LLFastTimer t1(LLFastTimer::FTM_TEMP1); |
560 | llpushcallstacks ; | ||
561 | bool is_compressed = false; | 586 | bool is_compressed = false; |
562 | if (mFormatPrimary >= GL_COMPRESSED_RGBA_S3TC_DXT1_EXT && mFormatPrimary <= GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) | 587 | if (mFormatPrimary >= GL_COMPRESSED_RGBA_S3TC_DXT1_EXT && mFormatPrimary <= GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) |
563 | { | 588 | { |
@@ -565,7 +590,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) | |||
565 | } | 590 | } |
566 | 591 | ||
567 | // LLFastTimer t2(LLFastTimer::FTM_TEMP2); | 592 | // LLFastTimer t2(LLFastTimer::FTM_TEMP2); |
568 | llverify(gGL.getTexUnit(0)->bind(this, false, true)); | 593 | gGL.getTexUnit(0)->bind(this); |
569 | 594 | ||
570 | if (mUseMipMaps) | 595 | if (mUseMipMaps) |
571 | { | 596 | { |
@@ -728,7 +753,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) | |||
728 | } | 753 | } |
729 | else | 754 | else |
730 | { | 755 | { |
731 | llwarns << "Compressed Image has mipmaps but data does not (can not auto generate compressed mips)" << llendl; | 756 | llerrs << "Compressed Image has mipmaps but data does not (can not auto generate compressed mips)" << llendl; |
732 | } | 757 | } |
733 | mHasMipMaps = true; | 758 | mHasMipMaps = true; |
734 | } | 759 | } |
@@ -770,63 +795,10 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) | |||
770 | } | 795 | } |
771 | stop_glerror(); | 796 | stop_glerror(); |
772 | mGLTextureCreated = true; | 797 | mGLTextureCreated = true; |
773 | llpushcallstacks ; | ||
774 | } | ||
775 | |||
776 | BOOL LLImageGL::canAddToAtlas() | ||
777 | { | ||
778 | return sUseTextureAtlas && mCanAddToAtlas ; | ||
779 | } | ||
780 | |||
781 | BOOL LLImageGL::addToAtlas(const LLImageRaw* raw_image, LLTextureAtlas* atlasp, S16 slot_col, S16 slot_row) | ||
782 | { | ||
783 | if(!atlasp) | ||
784 | { | ||
785 | return FALSE ; | ||
786 | } | ||
787 | |||
788 | preAddToAtlas(raw_image->getWidth()) ; | ||
789 | LLGLuint tex_name = atlasp->insertSubTexture(raw_image, slot_col, slot_row); | ||
790 | postAddToAtlas() ; | ||
791 | |||
792 | if(tex_name > 0) //successfully added to atlas | ||
793 | { | ||
794 | //gGL.getTexUnit(0)->setHasMipMaps(mHasMipMaps); | ||
795 | //gGL.getTexUnit(0)->setTextureAddressMode(mAddressMode); | ||
796 | gGL.getTexUnit(0)->setTextureFilteringOption(mFilterOption); | ||
797 | return TRUE ; | ||
798 | } | ||
799 | |||
800 | return FALSE ; | ||
801 | } | ||
802 | |||
803 | void LLImageGL::preAddToAtlas(S32 data_width) | ||
804 | { | ||
805 | glPixelStorei(GL_UNPACK_ROW_LENGTH, data_width); | ||
806 | stop_glerror(); | ||
807 | |||
808 | if(mFormatSwapBytes) | ||
809 | { | ||
810 | glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); | ||
811 | stop_glerror(); | ||
812 | } | ||
813 | } | 798 | } |
814 | 799 | ||
815 | void LLImageGL::postAddToAtlas() | 800 | BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, BOOL force_fast_update) |
816 | { | 801 | { |
817 | if(mFormatSwapBytes) | ||
818 | { | ||
819 | glPixelStorei(GL_UNPACK_SWAP_BYTES, 0); | ||
820 | stop_glerror(); | ||
821 | } | ||
822 | |||
823 | glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); | ||
824 | stop_glerror(); | ||
825 | } | ||
826 | |||
827 | BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height) | ||
828 | { | ||
829 | llpushcallstacks ; | ||
830 | if (!width || !height) | 802 | if (!width || !height) |
831 | { | 803 | { |
832 | return TRUE; | 804 | return TRUE; |
@@ -842,7 +814,8 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 | |||
842 | return FALSE; | 814 | return FALSE; |
843 | } | 815 | } |
844 | 816 | ||
845 | if (x_pos == 0 && y_pos == 0 && width == getWidth() && height == getHeight() && data_width == width && data_height == height) | 817 | // HACK: allow the caller to explicitly force the fast path (i.e. using glTexSubImage2D here instead of calling setImage) even when updating the full texture. |
818 | if (!force_fast_update && x_pos == 0 && y_pos == 0 && width == getWidth() && height == getHeight() && data_width == width && data_height == height) | ||
846 | { | 819 | { |
847 | setImage(datap, FALSE); | 820 | setImage(datap, FALSE); |
848 | } | 821 | } |
@@ -851,7 +824,7 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 | |||
851 | if (mUseMipMaps) | 824 | if (mUseMipMaps) |
852 | { | 825 | { |
853 | dump(); | 826 | dump(); |
854 | llwarns << "setSubImage called with mipmapped image (not supported)" << llendl; | 827 | llerrs << "setSubImage called with mipmapped image (not supported)" << llendl; |
855 | } | 828 | } |
856 | llassert_always(mCurrentDiscardLevel == 0); | 829 | llassert_always(mCurrentDiscardLevel == 0); |
857 | llassert_always(x_pos >= 0 && y_pos >= 0); | 830 | llassert_always(x_pos >= 0 && y_pos >= 0); |
@@ -860,7 +833,7 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 | |||
860 | (y_pos + height) > getHeight()) | 833 | (y_pos + height) > getHeight()) |
861 | { | 834 | { |
862 | dump(); | 835 | dump(); |
863 | llwarns << "Subimage not wholly in target image!" | 836 | llerrs << "Subimage not wholly in target image!" |
864 | << " x_pos " << x_pos | 837 | << " x_pos " << x_pos |
865 | << " y_pos " << y_pos | 838 | << " y_pos " << y_pos |
866 | << " width " << width | 839 | << " width " << width |
@@ -874,7 +847,7 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 | |||
874 | (y_pos + height) > data_height) | 847 | (y_pos + height) > data_height) |
875 | { | 848 | { |
876 | dump(); | 849 | dump(); |
877 | llwarns << "Subimage not wholly in source image!" | 850 | llerrs << "Subimage not wholly in source image!" |
878 | << " x_pos " << x_pos | 851 | << " x_pos " << x_pos |
879 | << " y_pos " << y_pos | 852 | << " y_pos " << y_pos |
880 | << " width " << width | 853 | << " width " << width |
@@ -897,7 +870,7 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 | |||
897 | datap += (y_pos * data_width + x_pos) * getComponents(); | 870 | datap += (y_pos * data_width + x_pos) * getComponents(); |
898 | // Update the GL texture | 871 | // Update the GL texture |
899 | BOOL res = gGL.getTexUnit(0)->bindManual(mBindTarget, mTexName); | 872 | BOOL res = gGL.getTexUnit(0)->bindManual(mBindTarget, mTexName); |
900 | if (!res) llwarns << "LLImageGL::setSubImage(): bindTexture failed" << llendl; | 873 | if (!res) llerrs << "LLImageGL::setSubImage(): bindTexture failed" << llendl; |
901 | stop_glerror(); | 874 | stop_glerror(); |
902 | 875 | ||
903 | glTexSubImage2D(mTarget, 0, x_pos, y_pos, | 876 | glTexSubImage2D(mTarget, 0, x_pos, y_pos, |
@@ -915,13 +888,12 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 | |||
915 | stop_glerror(); | 888 | stop_glerror(); |
916 | mGLTextureCreated = true; | 889 | mGLTextureCreated = true; |
917 | } | 890 | } |
918 | llpushcallstacks ; | ||
919 | return TRUE; | 891 | return TRUE; |
920 | } | 892 | } |
921 | 893 | ||
922 | BOOL LLImageGL::setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height) | 894 | BOOL LLImageGL::setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, BOOL force_fast_update) |
923 | { | 895 | { |
924 | return setSubImage(imageraw->getData(), imageraw->getWidth(), imageraw->getHeight(), x_pos, y_pos, width, height); | 896 | return setSubImage(imageraw->getData(), imageraw->getWidth(), imageraw->getHeight(), x_pos, y_pos, width, height, force_fast_update); |
925 | } | 897 | } |
926 | 898 | ||
927 | // Copy sub image from frame buffer | 899 | // Copy sub image from frame buffer |
@@ -929,6 +901,7 @@ BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_ | |||
929 | { | 901 | { |
930 | if (gGL.getTexUnit(0)->bind(this, false, true)) | 902 | if (gGL.getTexUnit(0)->bind(this, false, true)) |
931 | { | 903 | { |
904 | //checkTexSize() ; | ||
932 | glCopyTexSubImage2D(GL_TEXTURE_2D, 0, fb_x, fb_y, x_pos, y_pos, width, height); | 905 | glCopyTexSubImage2D(GL_TEXTURE_2D, 0, fb_x, fb_y, x_pos, y_pos, width, height); |
933 | mGLTextureCreated = true; | 906 | mGLTextureCreated = true; |
934 | stop_glerror(); | 907 | stop_glerror(); |
@@ -949,17 +922,13 @@ void LLImageGL::generateTextures(S32 numTextures, U32 *textures) | |||
949 | // static | 922 | // static |
950 | void LLImageGL::deleteTextures(S32 numTextures, U32 *textures) | 923 | void LLImageGL::deleteTextures(S32 numTextures, U32 *textures) |
951 | { | 924 | { |
952 | for (S32 i = 0; i < numTextures; i++) | 925 | glDeleteTextures(numTextures, (GLuint*)textures); |
953 | { | ||
954 | sDeadTextureList.push_back(textures[i]); | ||
955 | } | ||
956 | } | 926 | } |
957 | 927 | ||
958 | // static | 928 | // static |
959 | void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels) | 929 | void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels) |
960 | { | 930 | { |
961 | glTexImage2D(target, miplevel, intformat, width, height, 0, pixformat, pixtype, pixels); | 931 | glTexImage2D(target, miplevel, intformat, width, height, 0, pixformat, pixtype, pixels); |
962 | stop_glerror(); | ||
963 | } | 932 | } |
964 | 933 | ||
965 | //create an empty GL texture: just create a texture name | 934 | //create an empty GL texture: just create a texture name |
@@ -986,26 +955,21 @@ BOOL LLImageGL::createGLTexture() | |||
986 | stop_glerror(); | 955 | stop_glerror(); |
987 | if (!mTexName) | 956 | if (!mTexName) |
988 | { | 957 | { |
989 | llwarns << "LLImageGL::createGLTexture failed to make an empty texture" << llendl; | 958 | llerrs << "LLImageGL::createGLTexture failed to make an empty texture" << llendl; |
990 | } | 959 | } |
991 | 960 | ||
992 | return TRUE ; | 961 | return TRUE ; |
993 | } | 962 | } |
994 | 963 | ||
995 | BOOL LLImageGL::createGLTextureInAtlas(S32 discard_level, const LLImageRaw* imageraw, LLTextureAtlas* atlasp, S16 slot_col, S16 slot_row) | 964 | BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename/*=0*/, BOOL to_create, S32 category) |
996 | { | 965 | { |
997 | if(!sUseTextureAtlas) | ||
998 | { | ||
999 | return FALSE ; | ||
1000 | } | ||
1001 | |||
1002 | if (gGLManager.mIsDisabled) | 966 | if (gGLManager.mIsDisabled) |
1003 | { | 967 | { |
1004 | llwarns << "Trying to create a texture while GL is disabled!" << llendl; | 968 | llwarns << "Trying to create a texture while GL is disabled!" << llendl; |
1005 | return FALSE; | 969 | return FALSE; |
1006 | } | 970 | } |
1007 | 971 | ||
1008 | // mGLTextureCreated = false ; // KL not in SD | 972 | mGLTextureCreated = false ; |
1009 | llassert(gGLManager.mInited); | 973 | llassert(gGLManager.mInited); |
1010 | stop_glerror(); | 974 | stop_glerror(); |
1011 | 975 | ||
@@ -1017,8 +981,10 @@ BOOL LLImageGL::createGLTextureInAtlas(S32 discard_level, const LLImageRaw* imag | |||
1017 | discard_level = llclamp(discard_level, 0, (S32)mMaxDiscardLevel); | 981 | discard_level = llclamp(discard_level, 0, (S32)mMaxDiscardLevel); |
1018 | 982 | ||
1019 | // Actual image width/height = raw image width/height * 2^discard_level | 983 | // Actual image width/height = raw image width/height * 2^discard_level |
1020 | S32 w = imageraw->getWidth() << discard_level; | 984 | S32 raw_w = imageraw->getWidth() ; |
1021 | S32 h = imageraw->getHeight() << discard_level; | 985 | S32 raw_h = imageraw->getHeight() ; |
986 | S32 w = raw_w << discard_level; | ||
987 | S32 h = raw_h << discard_level; | ||
1022 | 988 | ||
1023 | // setSize may call destroyGLTexture if the size does not match | 989 | // setSize may call destroyGLTexture if the size does not match |
1024 | setSize(w, h, imageraw->getComponents()); | 990 | setSize(w, h, imageraw->getComponents()); |
@@ -1050,87 +1016,27 @@ BOOL LLImageGL::createGLTextureInAtlas(S32 discard_level, const LLImageRaw* imag | |||
1050 | mFormatType = GL_UNSIGNED_BYTE; | 1016 | mFormatType = GL_UNSIGNED_BYTE; |
1051 | break; | 1017 | break; |
1052 | default: | 1018 | default: |
1053 | llwarns << "Bad number of components for texture: " << (U32)getComponents() << llendl; | 1019 | LL_DEBUGS("Openjpeg") << "Bad number of components for texture: " << (U32)getComponents() << LL_ENDL; |
1020 | to_create = false; | ||
1021 | break; | ||
1054 | } | 1022 | } |
1055 | } | 1023 | } |
1056 | 1024 | ||
1057 | if(addToAtlas(imageraw, atlasp, slot_col, slot_row)) | 1025 | if(!to_create) //not create a gl texture |
1058 | { | 1026 | { |
1059 | // destroyGLTexture(); | 1027 | destroyGLTexture(); |
1060 | mCurrentDiscardLevel = discard_level; | 1028 | mCurrentDiscardLevel = discard_level; |
1061 | mDiscardLevelInAtlas = discard_level; | ||
1062 | mTexelsInAtlas = imageraw->getWidth() * imageraw->getHeight() ; | ||
1063 | mLastBindTime = sLastFrameTime; | 1029 | mLastBindTime = sLastFrameTime; |
1064 | mGLTextureCreated = false ; | ||
1065 | return TRUE ; | 1030 | return TRUE ; |
1066 | } | 1031 | } |
1067 | return FALSE ; | ||
1068 | } | ||
1069 | |||
1070 | BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename/*=0*/) | ||
1071 | { | ||
1072 | if (gGLManager.mIsDisabled) | ||
1073 | { | ||
1074 | llwarns << "Trying to create a texture while GL is disabled!" << llendl; | ||
1075 | return FALSE; | ||
1076 | } | ||
1077 | |||
1078 | mGLTextureCreated = false ; | ||
1079 | llassert(gGLManager.mInited); | ||
1080 | stop_glerror(); | ||
1081 | |||
1082 | if (discard_level < 0) | ||
1083 | { | ||
1084 | llassert(mCurrentDiscardLevel >= 0); | ||
1085 | discard_level = mCurrentDiscardLevel; | ||
1086 | } | ||
1087 | discard_level = llclamp(discard_level, 0, (S32)mMaxDiscardLevel); | ||
1088 | |||
1089 | // Actual image width/height = raw image width/height * 2^discard_level | ||
1090 | S32 w = imageraw->getWidth() << discard_level; | ||
1091 | S32 h = imageraw->getHeight() << discard_level; | ||
1092 | |||
1093 | // setSize may call destroyGLTexture if the size does not match | ||
1094 | setSize(w, h, imageraw->getComponents()); | ||
1095 | |||
1096 | if( !mHasExplicitFormat ) | ||
1097 | { | ||
1098 | switch (mComponents) | ||
1099 | { | ||
1100 | case 1: | ||
1101 | // Use luminance alpha (for fonts) | ||
1102 | mFormatInternal = GL_LUMINANCE8; | ||
1103 | mFormatPrimary = GL_LUMINANCE; | ||
1104 | mFormatType = GL_UNSIGNED_BYTE; | ||
1105 | break; | ||
1106 | case 2: | ||
1107 | // Use luminance alpha (for fonts) | ||
1108 | mFormatInternal = GL_LUMINANCE8_ALPHA8; | ||
1109 | mFormatPrimary = GL_LUMINANCE_ALPHA; | ||
1110 | mFormatType = GL_UNSIGNED_BYTE; | ||
1111 | break; | ||
1112 | case 3: | ||
1113 | mFormatInternal = GL_RGB8; | ||
1114 | mFormatPrimary = GL_RGB; | ||
1115 | mFormatType = GL_UNSIGNED_BYTE; | ||
1116 | break; | ||
1117 | case 4: | ||
1118 | mFormatInternal = GL_RGBA8; | ||
1119 | mFormatPrimary = GL_RGBA; | ||
1120 | mFormatType = GL_UNSIGNED_BYTE; | ||
1121 | break; | ||
1122 | default: | ||
1123 | llwarns << "Bad number of components for texture: " << (U32)getComponents() << llendl; | ||
1124 | } | ||
1125 | } | ||
1126 | 1032 | ||
1033 | mCategory = category ; | ||
1127 | const U8* rawdata = imageraw->getData(); | 1034 | const U8* rawdata = imageraw->getData(); |
1128 | return createGLTexture(discard_level, rawdata, FALSE, usename); | 1035 | return createGLTexture(discard_level, rawdata, FALSE, usename); |
1129 | } | 1036 | } |
1130 | 1037 | ||
1131 | BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_hasmips, S32 usename) | 1038 | BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_hasmips, S32 usename) |
1132 | { | 1039 | { |
1133 | llpushcallstacks ; | ||
1134 | llassert(data_in); | 1040 | llassert(data_in); |
1135 | 1041 | ||
1136 | if (discard_level < 0) | 1042 | if (discard_level < 0) |
@@ -1167,7 +1073,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ | |||
1167 | } | 1073 | } |
1168 | if (!mTexName) | 1074 | if (!mTexName) |
1169 | { | 1075 | { |
1170 | llwarns << "LLImageGL::createGLTexture failed to make texture" << llendl; | 1076 | llerrs << "LLImageGL::createGLTexture failed to make texture" << llendl; |
1171 | } | 1077 | } |
1172 | 1078 | ||
1173 | if (mUseMipMaps) | 1079 | if (mUseMipMaps) |
@@ -1198,30 +1104,30 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ | |||
1198 | if (old_name != 0) | 1104 | if (old_name != 0) |
1199 | { | 1105 | { |
1200 | sGlobalTextureMemoryInBytes -= mTextureMemory; | 1106 | sGlobalTextureMemoryInBytes -= mTextureMemory; |
1201 | #if !LL_RELEASE_FOR_DOWNLOAD | 1107 | |
1202 | decTextureCounter(mTextureMemory / mComponents) ; | 1108 | if(gAuditTexture) |
1203 | #endif | 1109 | { |
1110 | decTextureCounter() ; | ||
1111 | } | ||
1204 | 1112 | ||
1205 | LLImageGL::deleteTextures(1, &old_name); | 1113 | LLImageGL::deleteTextures(1, &old_name); |
1114 | |||
1206 | stop_glerror(); | 1115 | stop_glerror(); |
1207 | } | 1116 | } |
1208 | 1117 | ||
1209 | mTextureMemory = getMipBytes(discard_level); | 1118 | mTextureMemory = getMipBytes(discard_level); |
1210 | sGlobalTextureMemoryInBytes += mTextureMemory; | 1119 | sGlobalTextureMemoryInBytes += mTextureMemory; |
1211 | mTexelsInGLTexture = getWidth() * getHeight() ; | ||
1212 | |||
1213 | #if !LL_RELEASE_FOR_DOWNLOAD | ||
1214 | incTextureCounter(mTextureMemory / mComponents) ; | ||
1215 | #endif | ||
1216 | setActive() ; | 1120 | setActive() ; |
1217 | 1121 | ||
1122 | if(gAuditTexture) | ||
1123 | { | ||
1124 | incTextureCounter() ; | ||
1125 | } | ||
1218 | // mark this as bound at this point, so we don't throw it out immediately | 1126 | // mark this as bound at this point, so we don't throw it out immediately |
1219 | mLastBindTime = sLastFrameTime; | 1127 | mLastBindTime = sLastFrameTime; |
1220 | |||
1221 | llpushcallstacks ; | ||
1222 | return TRUE; | 1128 | return TRUE; |
1223 | } | 1129 | } |
1224 | 1130 | #if 0 | |
1225 | BOOL LLImageGL::setDiscardLevel(S32 discard_level) | 1131 | BOOL LLImageGL::setDiscardLevel(S32 discard_level) |
1226 | { | 1132 | { |
1227 | llassert(discard_level >= 0); | 1133 | llassert(discard_level >= 0); |
@@ -1243,7 +1149,7 @@ BOOL LLImageGL::setDiscardLevel(S32 discard_level) | |||
1243 | { | 1149 | { |
1244 | // larger image | 1150 | // larger image |
1245 | dump(); | 1151 | dump(); |
1246 | llwarns << "LLImageGL::setDiscardLevel() called with larger discard level; use createGLTexture()" << llendl; | 1152 | llerrs << "LLImageGL::setDiscardLevel() called with larger discard level; use createGLTexture()" << llendl; |
1247 | return FALSE; | 1153 | return FALSE; |
1248 | } | 1154 | } |
1249 | else if (mUseMipMaps) | 1155 | else if (mUseMipMaps) |
@@ -1268,30 +1174,19 @@ BOOL LLImageGL::setDiscardLevel(S32 discard_level) | |||
1268 | { | 1174 | { |
1269 | #if !LL_LINUX && !LL_SOLARIS | 1175 | #if !LL_LINUX && !LL_SOLARIS |
1270 | // *FIX: This should not be skipped for the linux client. | 1176 | // *FIX: This should not be skipped for the linux client. |
1271 | llwarns << "LLImageGL::setDiscardLevel() called on image without mipmaps" << llendl; | 1177 | llerrs << "LLImageGL::setDiscardLevel() called on image without mipmaps" << llendl; |
1272 | #endif | 1178 | #endif |
1273 | return FALSE; | 1179 | return FALSE; |
1274 | } | 1180 | } |
1275 | } | 1181 | } |
1276 | 1182 | #endif | |
1277 | BOOL LLImageGL::isValidForSculpt(S32 discard_level, S32 image_width, S32 image_height, S32 ncomponents) | ||
1278 | { | ||
1279 | assert_glerror(); | ||
1280 | S32 gl_discard = discard_level - mCurrentDiscardLevel; | ||
1281 | LLGLint glwidth = 0; | ||
1282 | glGetTexLevelParameteriv(mTarget, gl_discard, GL_TEXTURE_WIDTH, (GLint*)&glwidth); | ||
1283 | LLGLint glheight = 0; | ||
1284 | glGetTexLevelParameteriv(mTarget, gl_discard, GL_TEXTURE_HEIGHT, (GLint*)&glheight); | ||
1285 | LLGLint glcomponents = 0 ; | ||
1286 | glGetTexLevelParameteriv(mTarget, gl_discard, GL_TEXTURE_INTERNAL_FORMAT, (GLint*)&glcomponents); | ||
1287 | assert_glerror(); | ||
1288 | |||
1289 | return glwidth >= image_width && glheight >= image_height && (GL_RGB8 == glcomponents || GL_RGBA8 == glcomponents) ; | ||
1290 | } | ||
1291 | 1183 | ||
1292 | BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok) | 1184 | BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok) |
1293 | { | 1185 | { |
1294 | llpushcallstacks ; | 1186 | // VWR-13505 : Merov : Allow gl texture read back so save texture works again (temporary) |
1187 | //llassert_always(sAllowReadBackRaw) ; | ||
1188 | //llerrs << "should not call this function!" << llendl ; | ||
1189 | |||
1295 | if (discard_level < 0) | 1190 | if (discard_level < 0) |
1296 | { | 1191 | { |
1297 | discard_level = mCurrentDiscardLevel; | 1192 | discard_level = mCurrentDiscardLevel; |
@@ -1396,48 +1291,41 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre | |||
1396 | return FALSE ; | 1291 | return FALSE ; |
1397 | } | 1292 | } |
1398 | //----------------------------------------------------------------------------------------------- | 1293 | //----------------------------------------------------------------------------------------------- |
1399 | llpushcallstacks ; | 1294 | |
1400 | return TRUE ; | 1295 | return TRUE ; |
1401 | } | 1296 | } |
1402 | 1297 | ||
1403 | void LLImageGL::deleteDeadTextures() | 1298 | void LLImageGL::destroyGLTexture() |
1404 | { | 1299 | { |
1405 | while (!sDeadTextureList.empty()) | 1300 | if (mTexName != 0) |
1406 | { | 1301 | { |
1407 | GLuint tex = sDeadTextureList.front(); | 1302 | stop_glerror(); |
1408 | sDeadTextureList.pop_front(); | 1303 | |
1409 | for (int i = 0; i < gGLManager.mNumTextureUnits; i++) | 1304 | for (int i = 0; i < gGLManager.mNumTextureUnits; i++) |
1410 | { | 1305 | { |
1411 | if (sCurrentBoundTextures[i] == tex) | 1306 | if (sCurrentBoundTextures[i] == mTexName) |
1412 | { | 1307 | { |
1413 | gGL.getTexUnit(i)->unbind(LLTexUnit::TT_TEXTURE); | 1308 | gGL.getTexUnit(i)->unbind(LLTexUnit::TT_TEXTURE); |
1414 | stop_glerror(); | 1309 | stop_glerror(); |
1415 | } | 1310 | } |
1416 | } | 1311 | } |
1417 | 1312 | ||
1418 | glDeleteTextures(1, &tex); | ||
1419 | stop_glerror(); | ||
1420 | } | ||
1421 | } | ||
1422 | |||
1423 | void LLImageGL::destroyGLTexture() | ||
1424 | { | ||
1425 | if (mTexName != 0) | ||
1426 | { | ||
1427 | if(mTextureMemory) | 1313 | if(mTextureMemory) |
1428 | { | 1314 | { |
1429 | #if !LL_RELEASE_FOR_DOWNLOAD | 1315 | if(gAuditTexture) |
1430 | decTextureCounter(mTextureMemory / mComponents) ; | 1316 | { |
1431 | #endif | 1317 | decTextureCounter() ; |
1318 | } | ||
1432 | sGlobalTextureMemoryInBytes -= mTextureMemory; | 1319 | sGlobalTextureMemoryInBytes -= mTextureMemory; |
1433 | mTextureMemory = 0; | 1320 | mTextureMemory = 0; |
1434 | } | 1321 | } |
1435 | 1322 | ||
1436 | LLImageGL::deleteTextures(1, &mTexName); | 1323 | LLImageGL::deleteTextures(1, &mTexName); |
1437 | mTextureState = DELETED ; | 1324 | mTextureState = DELETED ; |
1438 | mTexName = 0; | 1325 | mTexName = 0; |
1439 | mCurrentDiscardLevel = -1 ; //invalidate mCurrentDiscardLevel. | 1326 | mCurrentDiscardLevel = -1 ; //invalidate mCurrentDiscardLevel. |
1440 | mGLTextureCreated = FALSE ; | 1327 | mGLTextureCreated = FALSE ; |
1328 | stop_glerror(); | ||
1441 | } | 1329 | } |
1442 | } | 1330 | } |
1443 | 1331 | ||
@@ -1466,12 +1354,12 @@ void LLImageGL::setFilteringOption(LLTexUnit::eTextureFilterOptions option) | |||
1466 | mFilterOption = option; | 1354 | mFilterOption = option; |
1467 | } | 1355 | } |
1468 | 1356 | ||
1469 | if (mTexName != 0 && gGL.getTexUnit(gGL.getCurrentTexUnitIndex())->getCurrTexture() == mTexName) | 1357 | if (gGL.getTexUnit(gGL.getCurrentTexUnitIndex())->getCurrTexture() == mTexName) |
1470 | { | 1358 | { |
1471 | gGL.getTexUnit(gGL.getCurrentTexUnitIndex())->setTextureFilteringOption(option); | 1359 | gGL.getTexUnit(gGL.getCurrentTexUnitIndex())->setTextureFilteringOption(option); |
1472 | mTexOptionsDirty = false; | 1360 | mTexOptionsDirty = false; |
1473 | stop_glerror(); | ||
1474 | } | 1361 | } |
1362 | stop_glerror(); | ||
1475 | } | 1363 | } |
1476 | 1364 | ||
1477 | BOOL LLImageGL::getIsResident(BOOL test_now) | 1365 | BOOL LLImageGL::getIsResident(BOOL test_now) |
@@ -1547,6 +1435,11 @@ S32 LLImageGL::getMipBytes(S32 discard_level) const | |||
1547 | return res; | 1435 | return res; |
1548 | } | 1436 | } |
1549 | 1437 | ||
1438 | BOOL LLImageGL::isJustBound() const | ||
1439 | { | ||
1440 | return (BOOL)(sLastFrameTime - mLastBindTime < 0.5f); | ||
1441 | } | ||
1442 | |||
1550 | BOOL LLImageGL::getBoundRecently() const | 1443 | BOOL LLImageGL::getBoundRecently() const |
1551 | { | 1444 | { |
1552 | return (BOOL)(sLastFrameTime - mLastBindTime < MIN_TEXTURE_LIFETIME); | 1445 | return (BOOL)(sLastFrameTime - mLastBindTime < MIN_TEXTURE_LIFETIME); |
@@ -1708,7 +1601,7 @@ void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in) | |||
1708 | U32 pick_offset = pick_bit%8; | 1601 | U32 pick_offset = pick_bit%8; |
1709 | if (pick_idx >= mPickMaskSize) | 1602 | if (pick_idx >= mPickMaskSize) |
1710 | { | 1603 | { |
1711 | llwarns << "WTF?" << llendl; | 1604 | llerrs << "WTF?" << llendl; |
1712 | } | 1605 | } |
1713 | 1606 | ||
1714 | mPickMask[pick_idx] |= 1 << pick_offset; | 1607 | mPickMask[pick_idx] |= 1 << pick_offset; |
@@ -1734,7 +1627,7 @@ BOOL LLImageGL::getMask(const LLVector2 &tc) | |||
1734 | if (u < 0.f || u > 1.f || | 1627 | if (u < 0.f || u > 1.f || |
1735 | v < 0.f || v > 1.f) | 1628 | v < 0.f || v > 1.f) |
1736 | { | 1629 | { |
1737 | llwarns << "WTF?" << llendl; // WTF really useful info NOT | 1630 | llerrs << "WTF?" << llendl; |
1738 | } | 1631 | } |
1739 | 1632 | ||
1740 | S32 x = (S32)(u * width); | 1633 | S32 x = (S32)(u * width); |
@@ -1757,8 +1650,24 @@ BOOL LLImageGL::getMask(const LLVector2 &tc) | |||
1757 | return res; | 1650 | return res; |
1758 | } | 1651 | } |
1759 | 1652 | ||
1760 | //---------------------------------------------------------------------------- | 1653 | void LLImageGL::setCategory(S32 category) |
1761 | #if !LL_RELEASE_FOR_DOWNLOAD | 1654 | { |
1655 | if(!gAuditTexture) | ||
1656 | { | ||
1657 | return ; | ||
1658 | } | ||
1659 | if(mCategory != category) | ||
1660 | { | ||
1661 | if(mCategory > -1) | ||
1662 | { | ||
1663 | sTextureMemByCategory[mCategory] -= mTextureMemory ; | ||
1664 | } | ||
1665 | sTextureMemByCategory[category] += mTextureMemory ; | ||
1666 | |||
1667 | mCategory = category; | ||
1668 | } | ||
1669 | } | ||
1670 | |||
1762 | //for debug use | 1671 | //for debug use |
1763 | //val is a "power of two" number | 1672 | //val is a "power of two" number |
1764 | S32 LLImageGL::getTextureCounterIndex(U32 val) | 1673 | S32 LLImageGL::getTextureCounterIndex(U32 val) |
@@ -1782,18 +1691,38 @@ S32 LLImageGL::getTextureCounterIndex(U32 val) | |||
1782 | return ret ; | 1691 | return ret ; |
1783 | } | 1692 | } |
1784 | } | 1693 | } |
1785 | void LLImageGL::incTextureCounter(U32 val) | 1694 | void LLImageGL::incTextureCounterStatic(U32 val, S32 ncomponents, S32 category) |
1786 | { | 1695 | { |
1787 | sTextureLoadedCounter[getTextureCounterIndex(val)]++ ; | 1696 | sTextureLoadedCounter[getTextureCounterIndex(val)]++ ; |
1697 | sTextureMemByCategory[category] += (S32)val * ncomponents ; | ||
1788 | } | 1698 | } |
1789 | void LLImageGL::decTextureCounter(U32 val) | 1699 | void LLImageGL::decTextureCounterStatic(U32 val, S32 ncomponents, S32 category) |
1790 | { | 1700 | { |
1791 | sTextureLoadedCounter[getTextureCounterIndex(val)]-- ; | 1701 | sTextureLoadedCounter[getTextureCounterIndex(val)]-- ; |
1702 | sTextureMemByCategory[category] += (S32)val * ncomponents ; | ||
1703 | } | ||
1704 | void LLImageGL::incTextureCounter() | ||
1705 | { | ||
1706 | sTextureLoadedCounter[getTextureCounterIndex(mTextureMemory / mComponents)]++ ; | ||
1707 | sTextureMemByCategory[mCategory] += mTextureMemory ; | ||
1708 | } | ||
1709 | void LLImageGL::decTextureCounter() | ||
1710 | { | ||
1711 | sTextureLoadedCounter[getTextureCounterIndex(mTextureMemory / mComponents)]-- ; | ||
1712 | sTextureMemByCategory[mCategory] -= mTextureMemory ; | ||
1792 | } | 1713 | } |
1793 | void LLImageGL::setCurTexSizebar(S32 index) | 1714 | void LLImageGL::setCurTexSizebar(S32 index, BOOL set_pick_size) |
1794 | { | 1715 | { |
1795 | sCurTexSizeBar = index ; | 1716 | sCurTexSizeBar = index ; |
1796 | sCurTexPickSize = (1 << index) ; | 1717 | |
1718 | if(set_pick_size) | ||
1719 | { | ||
1720 | sCurTexPickSize = (1 << index) ; | ||
1721 | } | ||
1722 | else | ||
1723 | { | ||
1724 | sCurTexPickSize = -1 ; | ||
1725 | } | ||
1797 | } | 1726 | } |
1798 | void LLImageGL::resetCurTexSizebar() | 1727 | void LLImageGL::resetCurTexSizebar() |
1799 | { | 1728 | { |
@@ -1801,7 +1730,9 @@ void LLImageGL::resetCurTexSizebar() | |||
1801 | sCurTexPickSize = -1 ; | 1730 | sCurTexPickSize = -1 ; |
1802 | } | 1731 | } |
1803 | //---------------------------------------------------------------------------- | 1732 | //---------------------------------------------------------------------------- |
1804 | #endif | 1733 | |
1734 | //---------------------------------------------------------------------------- | ||
1735 | |||
1805 | 1736 | ||
1806 | // Manual Mip Generation | 1737 | // Manual Mip Generation |
1807 | /* | 1738 | /* |
diff --git a/linden/indra/llrender/llimagegl.h b/linden/indra/llrender/llimagegl.h index 56f79ff..c7114c3 100644 --- a/linden/indra/llrender/llimagegl.h +++ b/linden/indra/llrender/llimagegl.h | |||
@@ -45,23 +45,18 @@ | |||
45 | #define BYTES_TO_MEGA_BYTES(x) ((x) >> 20) | 45 | #define BYTES_TO_MEGA_BYTES(x) ((x) >> 20) |
46 | #define MEGA_BYTES_TO_BYTES(x) ((x) << 20) | 46 | #define MEGA_BYTES_TO_BYTES(x) ((x) << 20) |
47 | 47 | ||
48 | class LLTextureAtlas ; | ||
49 | //============================================================================ | 48 | //============================================================================ |
50 | |||
51 | class LLImageGL : public LLRefCount | 49 | class LLImageGL : public LLRefCount |
52 | { | 50 | { |
53 | friend class LLTexUnit; | 51 | friend class LLTexUnit; |
54 | public: | 52 | public: |
55 | static std::list<U32> sDeadTextureList; | ||
56 | |||
57 | static void deleteDeadTextures(); | ||
58 | |||
59 | // Size calculation | 53 | // Size calculation |
60 | static S32 dataFormatBits(S32 dataformat); | 54 | static S32 dataFormatBits(S32 dataformat); |
61 | static S32 dataFormatBytes(S32 dataformat, S32 width, S32 height); | 55 | static S32 dataFormatBytes(S32 dataformat, S32 width, S32 height); |
62 | static S32 dataFormatComponents(S32 dataformat); | 56 | static S32 dataFormatComponents(S32 dataformat); |
63 | 57 | ||
64 | void updateBindStats(void) const; | 58 | void updateBindStats(void) const; |
59 | void forceUpdateBindStats(void) const; | ||
65 | 60 | ||
66 | // needs to be called every frame | 61 | // needs to be called every frame |
67 | static void updateStats(F32 current_time); | 62 | static void updateStats(F32 current_time); |
@@ -70,12 +65,10 @@ public: | |||
70 | static void destroyGL(BOOL save_state = TRUE); | 65 | static void destroyGL(BOOL save_state = TRUE); |
71 | static void restoreGL(); | 66 | static void restoreGL(); |
72 | 67 | ||
73 | // Sometimes called externally for textures not using LLImageGL (should go away...) | 68 | // Sometimes called externally for textures not using LLImageGL (should go away...) |
74 | //#if !LL_RELEASE_FOR_DOWNLOAD | 69 | static S32 updateBoundTexMemStatic(const S32 delta, const S32 size, S32 category) ; |
75 | // static S32 updateBoundTexMem(const S32 delta, const S32 size) ; | 70 | S32 updateBoundTexMem()const; |
76 | //#else | 71 | |
77 | static S32 updateBoundTexMem(const S32 delta); | ||
78 | //#endif | ||
79 | static bool checkSize(S32 width, S32 height); | 72 | static bool checkSize(S32 width, S32 height); |
80 | 73 | ||
81 | // Not currently necessary for LLImageGL, but required in some derived classes, | 74 | // Not currently necessary for LLImageGL, but required in some derived classes, |
@@ -97,7 +90,7 @@ protected: | |||
97 | public: | 90 | public: |
98 | virtual void dump(); // debugging info to llinfos | 91 | virtual void dump(); // debugging info to llinfos |
99 | virtual bool bindError(const S32 stage = 0) const; | 92 | virtual bool bindError(const S32 stage = 0) const; |
100 | virtual bool bindDefaultImage(const S32 stage = 0) const; | 93 | virtual bool bindDefaultImage(const S32 stage = 0) ; |
101 | virtual void forceImmediateUpdate() ; | 94 | virtual void forceImmediateUpdate() ; |
102 | 95 | ||
103 | void setSize(S32 width, S32 height, S32 ncomponents); | 96 | void setSize(S32 width, S32 height, S32 ncomponents); |
@@ -109,14 +102,15 @@ public: | |||
109 | static void setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels); | 102 | static void setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels); |
110 | 103 | ||
111 | BOOL createGLTexture() ; | 104 | BOOL createGLTexture() ; |
112 | BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0); | 105 | BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE, |
106 | S32 category = sMaxCatagories - 1); | ||
113 | BOOL createGLTexture(S32 discard_level, const U8* data, BOOL data_hasmips = FALSE, S32 usename = 0); | 107 | BOOL createGLTexture(S32 discard_level, const U8* data, BOOL data_hasmips = FALSE, S32 usename = 0); |
114 | void setImage(const LLImageRaw* imageraw); | 108 | void setImage(const LLImageRaw* imageraw); |
115 | void setImage(const U8* data_in, BOOL data_hasmips = FALSE); | 109 | void setImage(const U8* data_in, BOOL data_hasmips = FALSE); |
116 | BOOL setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height); | 110 | BOOL setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, BOOL force_fast_update = FALSE); |
117 | BOOL setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height); | 111 | BOOL setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, BOOL force_fast_update = FALSE); |
118 | BOOL setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_pos, S32 width, S32 height); | 112 | BOOL setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_pos, S32 width, S32 height); |
119 | BOOL setDiscardLevel(S32 discard_level); | 113 | |
120 | // Read back a raw image for this discard level, if it exists | 114 | // Read back a raw image for this discard level, if it exists |
121 | BOOL readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok); | 115 | BOOL readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok); |
122 | void destroyGLTexture(); | 116 | void destroyGLTexture(); |
@@ -136,7 +130,7 @@ public: | |||
136 | S32 getBytes(S32 discard_level = -1) const; | 130 | S32 getBytes(S32 discard_level = -1) const; |
137 | S32 getMipBytes(S32 discard_level = -1) const; | 131 | S32 getMipBytes(S32 discard_level = -1) const; |
138 | BOOL getBoundRecently() const; | 132 | BOOL getBoundRecently() const; |
139 | //BOOL isJustBound() const; | 133 | BOOL isJustBound() const; |
140 | LLGLenum getPrimaryFormat() const { return mFormatPrimary; } | 134 | LLGLenum getPrimaryFormat() const { return mFormatPrimary; } |
141 | 135 | ||
142 | BOOL getHasGLTexture() const { return mTexName != 0; } | 136 | BOOL getHasGLTexture() const { return mTexName != 0; } |
@@ -157,8 +151,6 @@ public: | |||
157 | BOOL getUseDiscard() const { return mUseMipMaps && !mDontDiscard; } | 151 | BOOL getUseDiscard() const { return mUseMipMaps && !mDontDiscard; } |
158 | BOOL getDontDiscard() const { return mDontDiscard; } | 152 | BOOL getDontDiscard() const { return mDontDiscard; } |
159 | 153 | ||
160 | BOOL isValidForSculpt(S32 discard_level, S32 image_width, S32 image_height, S32 ncomponents) ; | ||
161 | |||
162 | void updatePickMask(S32 width, S32 height, const U8* data_in); | 154 | void updatePickMask(S32 width, S32 height, const U8* data_in); |
163 | BOOL getMask(const LLVector2 &tc); | 155 | BOOL getMask(const LLVector2 &tc); |
164 | 156 | ||
@@ -184,20 +176,8 @@ public: | |||
184 | void setActive() ; | 176 | void setActive() ; |
185 | void forceActive() ; | 177 | void forceActive() ; |
186 | void setNoDelete() ; | 178 | void setNoDelete() ; |
187 | |||
188 | BOOL canAddToAtlas() ; | ||
189 | BOOL createGLTextureInAtlas(S32 discard_level, const LLImageRaw* imageraw, LLTextureAtlas* atlasp, S16 slot_col, S16 slot_row); | ||
190 | BOOL addToAtlas(const LLImageRaw* raw_image, LLTextureAtlas* atlasp, S16 slot_col, S16 slot_row) ; | ||
191 | |||
192 | LLGLenum getTexTarget()const { return mTarget ;} | ||
193 | S8 getDiscardLevelInAtlas()const {return mDiscardLevelInAtlas;} | ||
194 | U32 getTexelsInAtlas()const { return mTexelsInAtlas ;} | ||
195 | U32 getTexelsInGLTexture()const {return mTexelsInGLTexture;} | ||
196 | 179 | ||
197 | private: | 180 | void setTextureSize(S32 size) {mTextureMemory = size;} |
198 | void preAddToAtlas(S32 data_width) ; | ||
199 | void postAddToAtlas() ; | ||
200 | |||
201 | protected: | 181 | protected: |
202 | void init(BOOL usemipmaps); | 182 | void init(BOOL usemipmaps); |
203 | virtual void cleanup(); // Clean up the LLImageGL so it can be reinitialized. Be careful when using this in derived class destructors | 183 | virtual void cleanup(); // Clean up the LLImageGL so it can be reinitialized. Be careful when using this in derived class destructors |
@@ -206,7 +186,7 @@ public: | |||
206 | // Various GL/Rendering options | 186 | // Various GL/Rendering options |
207 | S32 mTextureMemory; | 187 | S32 mTextureMemory; |
208 | mutable F32 mLastBindTime; // last time this was bound, by discard level | 188 | mutable F32 mLastBindTime; // last time this was bound, by discard level |
209 | 189 | ||
210 | private: | 190 | private: |
211 | LLPointer<LLImageRaw> mSaveData; // used for destroyGL/restoreGL | 191 | LLPointer<LLImageRaw> mSaveData; // used for destroyGL/restoreGL |
212 | U8* mPickMask; //downsampled bitmap approximation of alpha channel. NULL if no alpha channel | 192 | U8* mPickMask; //downsampled bitmap approximation of alpha channel. NULL if no alpha channel |
@@ -222,15 +202,8 @@ private: | |||
222 | U16 mWidth; | 202 | U16 mWidth; |
223 | U16 mHeight; | 203 | U16 mHeight; |
224 | S8 mCurrentDiscardLevel; | 204 | S8 mCurrentDiscardLevel; |
225 | 205 | ||
226 | S8 mDiscardLevelInAtlas; | ||
227 | U32 mTexelsInAtlas ; | ||
228 | U32 mTexelsInGLTexture; | ||
229 | |||
230 | protected: | 206 | protected: |
231 | |||
232 | BOOL mCanAddToAtlas ; | ||
233 | |||
234 | LLGLenum mTarget; // Normally GL_TEXTURE2D, sometimes something else (ex. cube maps) | 207 | LLGLenum mTarget; // Normally GL_TEXTURE2D, sometimes something else (ex. cube maps) |
235 | LLTexUnit::eTextureType mBindTarget; // Normally TT_TEXTURE, sometimes something else (ex. cube maps) | 208 | LLTexUnit::eTextureType mBindTarget; // Normally TT_TEXTURE, sometimes something else (ex. cube maps) |
236 | bool mHasMipMaps; | 209 | bool mHasMipMaps; |
@@ -268,18 +241,42 @@ public: | |||
268 | static S32 sCount; | 241 | static S32 sCount; |
269 | 242 | ||
270 | static F32 sLastFrameTime; | 243 | static F32 sLastFrameTime; |
271 | 244 | ||
272 | static LLGLuint sCurrentBoundTextures[MAX_GL_TEXTURE_UNITS]; // Currently bound texture ID | 245 | static LLGLuint sCurrentBoundTextures[MAX_GL_TEXTURE_UNITS]; // Currently bound texture ID |
273 | 246 | ||
274 | // Global memory statistics | 247 | // Global memory statistics |
275 | static S32 sGlobalTextureMemoryInBytes; // Tracks main memory texmem | 248 | static S32 sGlobalTextureMemoryInBytes; // Tracks main memory texmem |
276 | static S32 sBoundTextureMemoryInBytes; // Tracks bound texmem for last completed frame | 249 | static S32 sBoundTextureMemoryInBytes; // Tracks bound texmem for last completed frame |
277 | static S32 sCurBoundTextureMemory; // Tracks bound texmem for current frame | 250 | static S32 sCurBoundTextureMemory; // Tracks bound texmem for current frame |
278 | static U32 sBindCount; // Tracks number of texture binds for current frame | 251 | static U32 sBindCount; // Tracks number of texture binds for current frame |
279 | static U32 sUniqueCount; // Tracks number of unique texture binds for current frame | 252 | static U32 sUniqueCount; // Tracks number of unique texture binds for current frame |
280 | static BOOL sGlobalUseAnisotropic; | 253 | static BOOL sGlobalUseAnisotropic; |
281 | static BOOL sUseTextureAtlas ; | 254 | #if DEBUG_MISS |
282 | #if !LL_RELEASE_FOR_DOWNLOAD | 255 | BOOL mMissed; // Missed on last bind? |
256 | BOOL getMissed() const { return mMissed; }; | ||
257 | #else | ||
258 | BOOL getMissed() const { return FALSE; }; | ||
259 | #endif | ||
260 | |||
261 | public: | ||
262 | static void initClass(S32 num_catagories) ; | ||
263 | static void cleanupClass() ; | ||
264 | private: | ||
265 | static S32 sMaxCatagories ; | ||
266 | |||
267 | //the flag to allow to call readBackRaw(...). | ||
268 | //can be removed if we do not use that function at all. | ||
269 | static BOOL sAllowReadBackRaw ; | ||
270 | // | ||
271 | //**************************************************************************************************** | ||
272 | //The below for texture auditing use only | ||
273 | //**************************************************************************************************** | ||
274 | private: | ||
275 | S32 mCategory ; | ||
276 | public: | ||
277 | void setCategory(S32 category) ; | ||
278 | S32 getCategory()const {return mCategory ;} | ||
279 | |||
283 | //for debug use: show texture size distribution | 280 | //for debug use: show texture size distribution |
284 | //---------------------------------------- | 281 | //---------------------------------------- |
285 | static LLPointer<LLImageGL> sDefaultTexturep; //default texture to replace normal textures | 282 | static LLPointer<LLImageGL> sDefaultTexturep; //default texture to replace normal textures |
@@ -290,19 +287,27 @@ public: | |||
290 | static S32 sCurTexPickSize ; | 287 | static S32 sCurTexPickSize ; |
291 | 288 | ||
292 | static S32 getTextureCounterIndex(U32 val) ; | 289 | static S32 getTextureCounterIndex(U32 val) ; |
293 | static void incTextureCounter(U32 val) ; | 290 | static void incTextureCounterStatic(U32 val, S32 ncomponents, S32 category) ; |
294 | static void decTextureCounter(U32 val) ; | 291 | static void decTextureCounterStatic(U32 val, S32 ncomponents, S32 category) ; |
295 | static void setCurTexSizebar(S32 index) ; | 292 | static void setCurTexSizebar(S32 index, BOOL set_pick_size = TRUE) ; |
296 | static void resetCurTexSizebar(); | 293 | static void resetCurTexSizebar(); |
294 | |||
295 | void incTextureCounter() ; | ||
296 | void decTextureCounter() ; | ||
297 | //---------------------------------------- | 297 | //---------------------------------------- |
298 | #endif | ||
299 | 298 | ||
300 | #if DEBUG_MISS | 299 | //for debug use: show texture category distribution |
301 | BOOL mMissed; // Missed on last bind? | 300 | //---------------------------------------- |
302 | BOOL getMissed() const { return mMissed; }; | 301 | |
303 | #else | 302 | static std::vector<S32> sTextureMemByCategory; |
304 | BOOL getMissed() const { return FALSE; }; | 303 | static std::vector<S32> sTextureMemByCategoryBound ; |
305 | #endif | 304 | static std::vector<S32> sTextureCurMemByCategoryBound ; |
305 | //---------------------------------------- | ||
306 | //**************************************************************************************************** | ||
307 | //End of definitions for texture auditing use only | ||
308 | //**************************************************************************************************** | ||
309 | |||
306 | }; | 310 | }; |
307 | 311 | ||
312 | extern BOOL gAuditTexture; | ||
308 | #endif // LL_LLIMAGEGL_H | 313 | #endif // LL_LLIMAGEGL_H |
diff --git a/linden/indra/llrender/llrender.cpp b/linden/indra/llrender/llrender.cpp index 07ba9f1..b1fe153 100644 --- a/linden/indra/llrender/llrender.cpp +++ b/linden/indra/llrender/llrender.cpp | |||
@@ -47,7 +47,7 @@ F64 gGLLastModelView[16]; | |||
47 | F64 gGLProjection[16]; | 47 | F64 gGLProjection[16]; |
48 | S32 gGLViewport[4]; | 48 | S32 gGLViewport[4]; |
49 | 49 | ||
50 | static const U32 LL_NUM_TEXTURE_LAYERS = 16; // KL was 8 ( keep a track on this ) 16 in render-pipeline | 50 | static const U32 LL_NUM_TEXTURE_LAYERS = 8; |
51 | 51 | ||
52 | static GLenum sGLTextureType[] = | 52 | static GLenum sGLTextureType[] = |
53 | { | 53 | { |
@@ -192,25 +192,24 @@ bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind) | |||
192 | 192 | ||
193 | if (!texture->getTexName()) //if texture does not exist | 193 | if (!texture->getTexName()) //if texture does not exist |
194 | { | 194 | { |
195 | //if deleted, will re-generate it immediately | 195 | if (texture->isDeleted()) |
196 | texture->forceImmediateUpdate() ; | 196 | { |
197 | // This will re-generate the texture immediately. | ||
198 | texture->forceImmediateUpdate() ; | ||
199 | } | ||
197 | 200 | ||
201 | texture->forceUpdateBindStats() ; | ||
198 | return texture->bindDefaultImage(mIndex); | 202 | return texture->bindDefaultImage(mIndex); |
199 | } | 203 | } |
200 | 204 | ||
201 | #if !LL_RELEASE_FOR_DOWNLOAD | 205 | if(gAuditTexture && for_rendering && LLImageGL::sCurTexPickSize > 0) |
202 | if(for_rendering) | ||
203 | { | 206 | { |
204 | int w = texture->getWidth(texture->getDiscardLevel()) ; | 207 | if(texture->getWidth() * texture->getHeight() == LLImageGL::sCurTexPickSize) |
205 | int h = texture->getHeight(texture->getDiscardLevel()) ; | ||
206 | |||
207 | if(w * h == LLImageGL::sCurTexPickSize) | ||
208 | { | 208 | { |
209 | texture->updateBindStats(); | 209 | texture->updateBindStats(); |
210 | return bind(LLImageGL::sDefaultTexturep.get()); | 210 | return bind(LLImageGL::sDefaultTexturep.get()); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | #endif | ||
214 | 213 | ||
215 | if ((mCurrTexture != texture->getTexName()) || forceBind) | 214 | if ((mCurrTexture != texture->getTexName()) || forceBind) |
216 | { | 215 | { |
@@ -228,6 +227,7 @@ bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind) | |||
228 | setTextureFilteringOption(texture->mFilterOption); | 227 | setTextureFilteringOption(texture->mFilterOption); |
229 | } | 228 | } |
230 | } | 229 | } |
230 | |||
231 | return true; | 231 | return true; |
232 | } | 232 | } |
233 | 233 | ||
@@ -280,11 +280,6 @@ bool LLTexUnit::bind(LLRenderTarget* renderTarget, bool bindDepth) | |||
280 | 280 | ||
281 | if (bindDepth) | 281 | if (bindDepth) |
282 | { | 282 | { |
283 | if (renderTarget->hasStencil()) | ||
284 | { | ||
285 | llwarns << "Cannot bind a render buffer for sampling. Allocate render target without a stencil buffer if sampling of depth buffer is required." << llendl; | ||
286 | } | ||
287 | |||
288 | bindManual(renderTarget->getUsage(), renderTarget->getDepth()); | 283 | bindManual(renderTarget->getUsage(), renderTarget->getDepth()); |
289 | } | 284 | } |
290 | else | 285 | else |
@@ -298,18 +293,15 @@ bool LLTexUnit::bind(LLRenderTarget* renderTarget, bool bindDepth) | |||
298 | 293 | ||
299 | bool LLTexUnit::bindManual(eTextureType type, U32 texture, bool hasMips) | 294 | bool LLTexUnit::bindManual(eTextureType type, U32 texture, bool hasMips) |
300 | { | 295 | { |
301 | if (mIndex < 0) return false; | 296 | if (mIndex < 0 || mCurrTexture == texture) return false; |
302 | 297 | ||
303 | if(mCurrTexture != texture) | 298 | gGL.flush(); |
304 | { | ||
305 | gGL.flush(); | ||
306 | 299 | ||
307 | activate(); | 300 | activate(); |
308 | enable(type); | 301 | enable(type); |
309 | mCurrTexture = texture; | 302 | mCurrTexture = texture; |
310 | glBindTexture(sGLTextureType[type], texture); | 303 | glBindTexture(sGLTextureType[type], texture); |
311 | mHasMipMaps = hasMips; | 304 | mHasMipMaps = hasMips; |
312 | } | ||
313 | return true; | 305 | return true; |
314 | } | 306 | } |
315 | 307 | ||
@@ -422,7 +414,7 @@ void LLTexUnit::setTextureBlendType(eTextureBlendType type) | |||
422 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); | 414 | glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); |
423 | break; | 415 | break; |
424 | default: | 416 | default: |
425 | llwarns << "Unknown Texture Blend Type: " << type << llendl; | 417 | llerrs << "Unknown Texture Blend Type: " << type << llendl; |
426 | break; | 418 | break; |
427 | } | 419 | } |
428 | setColorScale(scale_amount); | 420 | setColorScale(scale_amount); |
@@ -817,7 +809,7 @@ void LLRender::setSceneBlendType(eBlendType type) | |||
817 | glBlendFunc(GL_ONE, GL_ZERO); | 809 | glBlendFunc(GL_ONE, GL_ZERO); |
818 | break; | 810 | break; |
819 | default: | 811 | default: |
820 | llwarns << "Unknown Scene Blend Type: " << type << llendl; | 812 | llerrs << "Unknown Scene Blend Type: " << type << llendl; |
821 | break; | 813 | break; |
822 | } | 814 | } |
823 | } | 815 | } |
@@ -891,7 +883,7 @@ void LLRender::begin(const GLuint& mode) | |||
891 | } | 883 | } |
892 | else if (mCount != 0) | 884 | else if (mCount != 0) |
893 | { | 885 | { |
894 | llwarns << "gGL.begin() called redundantly." << llendl; | 886 | llerrs << "gGL.begin() called redundantly." << llendl; |
895 | } | 887 | } |
896 | 888 | ||
897 | mMode = mode; | 889 | mMode = mode; |
@@ -922,22 +914,22 @@ void LLRender::flush() | |||
922 | #if 0 | 914 | #if 0 |
923 | if (!glIsEnabled(GL_VERTEX_ARRAY)) | 915 | if (!glIsEnabled(GL_VERTEX_ARRAY)) |
924 | { | 916 | { |
925 | llwarns << "foo 1" << llendl; | 917 | llerrs << "foo 1" << llendl; |
926 | } | 918 | } |
927 | 919 | ||
928 | if (!glIsEnabled(GL_COLOR_ARRAY)) | 920 | if (!glIsEnabled(GL_COLOR_ARRAY)) |
929 | { | 921 | { |
930 | llwarns << "foo 2" << llendl; | 922 | llerrs << "foo 2" << llendl; |
931 | } | 923 | } |
932 | 924 | ||
933 | if (!glIsEnabled(GL_TEXTURE_COORD_ARRAY)) | 925 | if (!glIsEnabled(GL_TEXTURE_COORD_ARRAY)) |
934 | { | 926 | { |
935 | llwarns << "foo 3" << llendl; | 927 | llerrs << "foo 3" << llendl; |
936 | } | 928 | } |
937 | 929 | ||
938 | if (glIsEnabled(GL_NORMAL_ARRAY)) | 930 | if (glIsEnabled(GL_NORMAL_ARRAY)) |
939 | { | 931 | { |
940 | llwarns << "foo 7" << llendl; | 932 | llerrs << "foo 7" << llendl; |
941 | } | 933 | } |
942 | 934 | ||
943 | GLvoid* pointer; | 935 | GLvoid* pointer; |
@@ -945,19 +937,19 @@ void LLRender::flush() | |||
945 | glGetPointerv(GL_VERTEX_ARRAY_POINTER, &pointer); | 937 | glGetPointerv(GL_VERTEX_ARRAY_POINTER, &pointer); |
946 | if (pointer != &(mBuffer[0].v)) | 938 | if (pointer != &(mBuffer[0].v)) |
947 | { | 939 | { |
948 | llwarns << "foo 4" << llendl; | 940 | llerrs << "foo 4" << llendl; |
949 | } | 941 | } |
950 | 942 | ||
951 | glGetPointerv(GL_COLOR_ARRAY_POINTER, &pointer); | 943 | glGetPointerv(GL_COLOR_ARRAY_POINTER, &pointer); |
952 | if (pointer != &(mBuffer[0].c)) | 944 | if (pointer != &(mBuffer[0].c)) |
953 | { | 945 | { |
954 | llwarns << "foo 5" << llendl; | 946 | llerrs << "foo 5" << llendl; |
955 | } | 947 | } |
956 | 948 | ||
957 | glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &pointer); | 949 | glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &pointer); |
958 | if (pointer != &(mBuffer[0].uv)) | 950 | if (pointer != &(mBuffer[0].uv)) |
959 | { | 951 | { |
960 | llwarns << "foo 6" << llendl; | 952 | llerrs << "foo 6" << llendl; |
961 | } | 953 | } |
962 | #endif | 954 | #endif |
963 | 955 | ||
diff --git a/linden/indra/llrender/llrendertarget.cpp b/linden/indra/llrender/llrendertarget.cpp index 151b761..4cf8451 100644 --- a/linden/indra/llrender/llrendertarget.cpp +++ b/linden/indra/llrender/llrendertarget.cpp | |||
@@ -47,10 +47,10 @@ void check_framebuffer_status() | |||
47 | case GL_FRAMEBUFFER_COMPLETE_EXT: | 47 | case GL_FRAMEBUFFER_COMPLETE_EXT: |
48 | break; | 48 | break; |
49 | case GL_FRAMEBUFFER_UNSUPPORTED_EXT: | 49 | case GL_FRAMEBUFFER_UNSUPPORTED_EXT: |
50 | llwarns << "WTF?" << llendl; | 50 | llerrs << "WTF?" << llendl; |
51 | break; | 51 | break; |
52 | default: | 52 | default: |
53 | llwarns << "WTF?" << llendl; | 53 | llerrs << "WTF?" << llendl; |
54 | } | 54 | } |
55 | } | 55 | } |
56 | } | 56 | } |
@@ -139,9 +139,9 @@ void LLRenderTarget::addColorAttachment(U32 color_fmt) | |||
139 | 139 | ||
140 | U32 offset = mTex.size(); | 140 | U32 offset = mTex.size(); |
141 | if (offset >= 4 || | 141 | if (offset >= 4 || |
142 | offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers)) | 142 | (offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers))) |
143 | { | 143 | { |
144 | llwarns << "Too many color attachments!" << llendl; // KL | 144 | llerrs << "Too many color attachments!" << llendl; |
145 | } | 145 | } |
146 | 146 | ||
147 | U32 tex; | 147 | U32 tex; |
@@ -203,7 +203,7 @@ void LLRenderTarget::allocateDepth() | |||
203 | gGL.getTexUnit(0)->bindManual(mUsage, mDepth); | 203 | gGL.getTexUnit(0)->bindManual(mUsage, mDepth); |
204 | U32 internal_type = LLTexUnit::getInternalType(mUsage); | 204 | U32 internal_type = LLTexUnit::getInternalType(mUsage); |
205 | gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); | 205 | gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); |
206 | LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); | 206 | LLImageGL::setManualImage(internal_type, 0, GL_DEPTH24_STENCIL8_EXT, mResX, mResY, GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, NULL); |
207 | } | 207 | } |
208 | } | 208 | } |
209 | 209 | ||
@@ -211,7 +211,7 @@ void LLRenderTarget::shareDepthBuffer(LLRenderTarget& target) | |||
211 | { | 211 | { |
212 | if (!mFBO || !target.mFBO) | 212 | if (!mFBO || !target.mFBO) |
213 | { | 213 | { |
214 | llwarns << "Cannot share depth buffer between non FBO render targets." << llendl; | 214 | llerrs << "Cannot share depth buffer between non FBO render targets." << llendl; |
215 | } | 215 | } |
216 | 216 | ||
217 | if (mDepth) | 217 | if (mDepth) |
@@ -349,16 +349,16 @@ U32 LLRenderTarget::getTexture(U32 attachment) const | |||
349 | { | 349 | { |
350 | if (attachment > mTex.size()-1) | 350 | if (attachment > mTex.size()-1) |
351 | { | 351 | { |
352 | llwarns << "Invalid attachment index [getTexture]." << llendl; // lets not crash KL its a pain in the ass! | 352 | llerrs << "Invalid attachment index." << llendl; |
353 | } | 353 | } |
354 | return mTex[attachment]; | 354 | return mTex[attachment]; |
355 | } | 355 | } |
356 | 356 | ||
357 | void LLRenderTarget::bindTexture(U32 index, S32 channel) | 357 | void LLRenderTarget::bindTexture(U32 index, S32 channel) |
358 | { | 358 | { |
359 | if (index > 6)//mTex.size()-1) // KL yeah i know its a bit arbitary but make the number big enough as some unused render defer elements cause this to go wild | 359 | if (index > mTex.size()-1) |
360 | { | 360 | { |
361 | llwarns << "Invalid attachment index [bindtexture]." << llendl; | 361 | llerrs << "Invalid attachment index." << llendl; |
362 | } | 362 | } |
363 | gGL.getTexUnit(channel)->bindManual(mUsage, mTex[index]); | 363 | gGL.getTexUnit(channel)->bindManual(mUsage, mTex[index]); |
364 | } | 364 | } |
@@ -440,7 +440,7 @@ void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, | |||
440 | #if !LL_DARWIN | 440 | #if !LL_DARWIN |
441 | if (!source.mFBO || !mFBO) | 441 | if (!source.mFBO || !mFBO) |
442 | { | 442 | { |
443 | llwarns << "Cannot copy framebuffer contents for non FBO render targets." << llendl; | 443 | llerrs << "Cannot copy framebuffer contents for non FBO render targets." << llendl; |
444 | } | 444 | } |
445 | 445 | ||
446 | if (mSampleBuffer) | 446 | if (mSampleBuffer) |
@@ -449,27 +449,12 @@ void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, | |||
449 | } | 449 | } |
450 | else | 450 | else |
451 | { | 451 | { |
452 | if (mask == GL_DEPTH_BUFFER_BIT && source.mStencil != mStencil) | 452 | glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, source.mFBO); |
453 | { | 453 | glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, mFBO); |
454 | source.bindTarget(); | ||
455 | gGL.getTexUnit(0)->bind(this, true); | ||
456 | 454 | ||
457 | glCopyTexSubImage2D(LLTexUnit::getInternalType(mUsage), 0, srcX0, srcY0, dstX0, dstY0, dstX1, dstY1); | 455 | glBlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
458 | source.flush(); | 456 | |
459 | } | 457 | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); |
460 | else | ||
461 | { | ||
462 | glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, source.mFBO); | ||
463 | stop_glerror(); | ||
464 | glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, mFBO); | ||
465 | stop_glerror(); | ||
466 | check_framebuffer_status(); | ||
467 | stop_glerror(); | ||
468 | glBlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); | ||
469 | stop_glerror(); | ||
470 | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | ||
471 | stop_glerror(); | ||
472 | } | ||
473 | } | 458 | } |
474 | #endif | 459 | #endif |
475 | } | 460 | } |
@@ -568,14 +553,14 @@ void LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth | |||
568 | 553 | ||
569 | if (!gGLManager.mHasFramebufferMultisample) | 554 | if (!gGLManager.mHasFramebufferMultisample) |
570 | { | 555 | { |
571 | llwarns << "Attempting to allocate unsupported render target type!" << llendl; | 556 | llerrs << "Attempting to allocate unsupported render target type!" << llendl; |
572 | } | 557 | } |
573 | 558 | ||
574 | mSamples = samples; | 559 | mSamples = samples; |
575 | 560 | ||
576 | if (mSamples <= 1) | 561 | if (mSamples <= 1) |
577 | { | 562 | { |
578 | llwarns << "Cannot create a multisample buffer with less than 2 samples." << llendl; | 563 | llerrs << "Cannot create a multisample buffer with less than 2 samples." << llendl; |
579 | } | 564 | } |
580 | 565 | ||
581 | stop_glerror(); | 566 | stop_glerror(); |
@@ -623,9 +608,9 @@ void LLMultisampleBuffer::addColorAttachment(U32 color_fmt) | |||
623 | 608 | ||
624 | U32 offset = mTex.size(); | 609 | U32 offset = mTex.size(); |
625 | if (offset >= 4 || | 610 | if (offset >= 4 || |
626 | offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers)) | 611 | (offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers))) |
627 | { | 612 | { |
628 | llwarns << "Too many color attachments!" << llendl; | 613 | llerrs << "Too many color attachments!" << llendl; |
629 | } | 614 | } |
630 | 615 | ||
631 | U32 tex; | 616 | U32 tex; |
@@ -646,10 +631,10 @@ void LLMultisampleBuffer::addColorAttachment(U32 color_fmt) | |||
646 | case GL_FRAMEBUFFER_COMPLETE_EXT: | 631 | case GL_FRAMEBUFFER_COMPLETE_EXT: |
647 | break; | 632 | break; |
648 | case GL_FRAMEBUFFER_UNSUPPORTED_EXT: | 633 | case GL_FRAMEBUFFER_UNSUPPORTED_EXT: |
649 | llwarns << "WTF?" << llendl; | 634 | llerrs << "WTF?" << llendl; |
650 | break; | 635 | break; |
651 | default: | 636 | default: |
652 | llwarns << "WTF?" << llendl; | 637 | llerrs << "WTF?" << llendl; |
653 | } | 638 | } |
654 | 639 | ||
655 | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); | 640 | glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); |
diff --git a/linden/indra/llrender/llrendertarget.h b/linden/indra/llrender/llrendertarget.h index 69af1ea..d5d809b 100644 --- a/linden/indra/llrender/llrendertarget.h +++ b/linden/indra/llrender/llrendertarget.h | |||
@@ -121,7 +121,6 @@ public: | |||
121 | U32 getTexture(U32 attachment = 0) const; | 121 | U32 getTexture(U32 attachment = 0) const; |
122 | 122 | ||
123 | U32 getDepth(void) const { return mDepth; } | 123 | U32 getDepth(void) const { return mDepth; } |
124 | BOOL hasStencil() const { return mStencil; } | ||
125 | 124 | ||
126 | void bindTexture(U32 index, S32 channel); | 125 | void bindTexture(U32 index, S32 channel); |
127 | 126 | ||
diff --git a/linden/indra/llrender/lltextureatlas.cpp b/linden/indra/llrender/lltextureatlas.cpp deleted file mode 100644 index c0f5419..0000000 --- a/linden/indra/llrender/lltextureatlas.cpp +++ /dev/null | |||
@@ -1,411 +0,0 @@ | |||
1 | /** | ||
2 | * @file lltextureatlas.cpp | ||
3 | * @brief LLTextureAtlas class implementation. | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2002-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 | #include "linden_common.h" | ||
33 | #include "llerror.h" | ||
34 | #include "llimage.h" | ||
35 | #include "llmath.h" | ||
36 | #include "llgl.h" | ||
37 | #include "llrender.h" | ||
38 | #include "lltextureatlas.h" | ||
39 | |||
40 | //------------------- | ||
41 | S16 LLTextureAtlas::sMaxSubTextureSize = 64 ; | ||
42 | S16 LLTextureAtlas::sSlotSize = 32 ; | ||
43 | |||
44 | #ifndef DEBUG_ATLAS | ||
45 | #define DEBUG_ATLAS 0 | ||
46 | #endif | ||
47 | |||
48 | #ifndef DEBUG_USAGE_BITS | ||
49 | #define DEBUG_USAGE_BITS 0 | ||
50 | #endif | ||
51 | //************************************************************************************************************** | ||
52 | LLTextureAtlas::LLTextureAtlas(U8 ncomponents, S16 atlas_dim) : LLImageGL(), | ||
53 | mAtlasDim(atlas_dim) | ||
54 | { | ||
55 | setComponents(ncomponents) ; | ||
56 | |||
57 | mCanAddToAtlas = FALSE ;//do not add one atlas to another. | ||
58 | mNumSlotsReserved = 0 ; | ||
59 | mMaxSlotsInAtlas = mAtlasDim * mAtlasDim ; | ||
60 | |||
61 | generateEmptyUsageBits() ; | ||
62 | |||
63 | //generate an empty texture | ||
64 | S32 dim = mAtlasDim * sSlotSize ; //number of pixels per dimension | ||
65 | LLPointer<LLImageRaw> image_raw = new LLImageRaw(dim, dim, getComponents()); | ||
66 | createGLTexture(0, image_raw, 0); | ||
67 | image_raw = NULL; | ||
68 | dontDiscard(); | ||
69 | } | ||
70 | |||
71 | LLTextureAtlas::~LLTextureAtlas() | ||
72 | { | ||
73 | if(mSpatialGroupList.size() > 0) | ||
74 | { | ||
75 | llwarns << "Not clean up the spatial groups!" << llendl ; | ||
76 | } | ||
77 | releaseUsageBits() ; | ||
78 | } | ||
79 | |||
80 | void LLTextureAtlas::getTexCoordOffset(S16 col, S16 row, F32& xoffset, F32& yoffset) | ||
81 | { | ||
82 | #if !DEBUG_ATLAS | ||
83 | xoffset = (F32)col / mAtlasDim ; | ||
84 | yoffset = (F32)row / mAtlasDim ; | ||
85 | #endif | ||
86 | } | ||
87 | |||
88 | void LLTextureAtlas::getTexCoordScale(S32 w, S32 h, F32& xscale, F32& yscale) | ||
89 | { | ||
90 | #if !DEBUG_ATLAS | ||
91 | xscale = (F32)w / (mAtlasDim * sSlotSize) ; | ||
92 | yscale = (F32)h / (mAtlasDim * sSlotSize) ; | ||
93 | #endif | ||
94 | } | ||
95 | |||
96 | //insert a texture piece into the atlas | ||
97 | LLGLuint LLTextureAtlas::insertSubTexture(const LLImageRaw* raw_image, S16 slot_col, S16 slot_row) | ||
98 | { | ||
99 | S32 w = raw_image->getWidth() ; | ||
100 | S32 h = raw_image->getHeight() ; | ||
101 | if(w < 8 || w > sMaxSubTextureSize || h < 8 || h > sMaxSubTextureSize) | ||
102 | { | ||
103 | //size overflow | ||
104 | return 0 ; | ||
105 | } | ||
106 | |||
107 | BOOL res = gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, getTexName()); | ||
108 | if (!res) llwarns << "bindTexture failed" << llendl; | ||
109 | stop_glerror(); | ||
110 | |||
111 | GLint xoffset = sSlotSize * slot_col ; | ||
112 | GLint yoffset = sSlotSize * slot_row ; | ||
113 | |||
114 | glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, TRUE); | ||
115 | glTexSubImage2D(GL_TEXTURE_2D, 0, xoffset, yoffset, | ||
116 | w, h, mFormatPrimary, mFormatType, raw_image->getData()); | ||
117 | |||
118 | return getTexName(); | ||
119 | } | ||
120 | |||
121 | //release a sub-texture slot from the atlas | ||
122 | void LLTextureAtlas::releaseSlot(S16 slot_col, S16 slot_row, S8 slot_width) | ||
123 | { | ||
124 | unmarkUsageBits(slot_width, slot_col, slot_row) ; | ||
125 | mNumSlotsReserved -= slot_width * slot_width ; | ||
126 | } | ||
127 | |||
128 | BOOL LLTextureAtlas::isEmpty() const | ||
129 | { | ||
130 | return !mNumSlotsReserved ; | ||
131 | } | ||
132 | |||
133 | BOOL LLTextureAtlas::isFull(S8 to_be_reserved) const | ||
134 | { | ||
135 | return mNumSlotsReserved + to_be_reserved > mMaxSlotsInAtlas ; | ||
136 | } | ||
137 | F32 LLTextureAtlas::getFullness() const | ||
138 | { | ||
139 | return (F32)mNumSlotsReserved / mMaxSlotsInAtlas ; | ||
140 | } | ||
141 | |||
142 | void LLTextureAtlas::addSpatialGroup(LLSpatialGroup* groupp) | ||
143 | { | ||
144 | if(groupp && !hasSpatialGroup(groupp)) | ||
145 | { | ||
146 | mSpatialGroupList.push_back(groupp); | ||
147 | } | ||
148 | } | ||
149 | |||
150 | void LLTextureAtlas::removeSpatialGroup(LLSpatialGroup* groupp) | ||
151 | { | ||
152 | if(groupp) | ||
153 | { | ||
154 | mSpatialGroupList.remove(groupp); | ||
155 | } | ||
156 | } | ||
157 | |||
158 | void LLTextureAtlas::clearSpatialGroup() | ||
159 | { | ||
160 | mSpatialGroupList.clear(); | ||
161 | } | ||
162 | void LLTextureAtlas::removeLastSpatialGroup() | ||
163 | { | ||
164 | mSpatialGroupList.pop_back() ; | ||
165 | } | ||
166 | |||
167 | LLSpatialGroup* LLTextureAtlas::getLastSpatialGroup() | ||
168 | { | ||
169 | if(mSpatialGroupList.size() > 0) | ||
170 | { | ||
171 | return mSpatialGroupList.back() ; | ||
172 | } | ||
173 | return NULL ; | ||
174 | } | ||
175 | |||
176 | BOOL LLTextureAtlas::hasSpatialGroup(LLSpatialGroup* groupp) | ||
177 | { | ||
178 | for(std::list<LLSpatialGroup*>::iterator iter = mSpatialGroupList.begin(); iter != mSpatialGroupList.end() ; ++iter) | ||
179 | { | ||
180 | if(*iter == groupp) | ||
181 | { | ||
182 | return TRUE ; | ||
183 | } | ||
184 | } | ||
185 | return FALSE ; | ||
186 | } | ||
187 | |||
188 | //-------------------------------------------------------------------------------------- | ||
189 | //private | ||
190 | void LLTextureAtlas::generateEmptyUsageBits() | ||
191 | { | ||
192 | S32 col_len = (mAtlasDim + 7) >> 3 ; | ||
193 | mUsageBits = new U8*[mAtlasDim] ; | ||
194 | *mUsageBits = new U8[mAtlasDim * col_len] ; | ||
195 | |||
196 | mUsageBits[0] = *mUsageBits ; | ||
197 | for(S32 i = 1 ; i < mAtlasDim ; i++) | ||
198 | { | ||
199 | mUsageBits[i] = mUsageBits[i-1] + col_len ; | ||
200 | |||
201 | for(S32 j = 0 ; j < col_len ; j++) | ||
202 | { | ||
203 | //init by 0 for all bits. | ||
204 | mUsageBits[i][j] = 0 ; | ||
205 | } | ||
206 | } | ||
207 | |||
208 | //do not forget mUsageBits[0]! | ||
209 | for(S32 j = 0 ; j < col_len ; j++) | ||
210 | { | ||
211 | //init by 0 for all bits. | ||
212 | mUsageBits[0][j] = 0 ; | ||
213 | } | ||
214 | |||
215 | mTestBits = NULL ; | ||
216 | #if DEBUG_USAGE_BITS | ||
217 | //------------ | ||
218 | //test | ||
219 | mTestBits = new U8*[mAtlasDim] ; | ||
220 | *mTestBits = new U8[mAtlasDim * mAtlasDim] ; | ||
221 | mTestBits[0] = *mTestBits ; | ||
222 | for(S32 i = 1 ; i < mAtlasDim ; i++) | ||
223 | { | ||
224 | mTestBits[i] = mTestBits[i-1] + mAtlasDim ; | ||
225 | |||
226 | for(S32 j = 0 ; j < mAtlasDim ; j++) | ||
227 | { | ||
228 | //init by 0 for all bits. | ||
229 | mTestBits[i][j] = 0 ; | ||
230 | } | ||
231 | } | ||
232 | |||
233 | for(S32 j = 0 ; j < mAtlasDim ; j++) | ||
234 | { | ||
235 | //init by 0 for all bits. | ||
236 | mTestBits[0][j] = 0 ; | ||
237 | } | ||
238 | #endif | ||
239 | } | ||
240 | |||
241 | void LLTextureAtlas::releaseUsageBits() | ||
242 | { | ||
243 | if(mUsageBits) | ||
244 | { | ||
245 | delete[] *mUsageBits ; | ||
246 | delete[] mUsageBits ; | ||
247 | } | ||
248 | mUsageBits = NULL ; | ||
249 | |||
250 | //test | ||
251 | if( mTestBits) | ||
252 | { | ||
253 | delete[] *mTestBits; | ||
254 | delete[] mTestBits; | ||
255 | } | ||
256 | mTestBits = NULL ; | ||
257 | } | ||
258 | |||
259 | void LLTextureAtlas::markUsageBits(S8 bits_len, U8 mask, S16 col, S16 row) | ||
260 | { | ||
261 | S16 x = col >> 3 ; | ||
262 | |||
263 | for(S8 i = 0 ; i < bits_len ; i++) | ||
264 | { | ||
265 | mUsageBits[row + i][x] |= mask ; | ||
266 | } | ||
267 | |||
268 | #if DEBUG_USAGE_BITS | ||
269 | //test | ||
270 | for(S8 i = row ; i < row + bits_len ; i++) | ||
271 | { | ||
272 | for(S8 j = col ; j < col + bits_len ; j++) | ||
273 | { | ||
274 | mTestBits[i][j] = 1 ; | ||
275 | } | ||
276 | } | ||
277 | #endif | ||
278 | } | ||
279 | |||
280 | void LLTextureAtlas::unmarkUsageBits(S8 bits_len, S16 col, S16 row) | ||
281 | { | ||
282 | S16 x = col >> 3 ; | ||
283 | U8 mask = 1 ; | ||
284 | for(S8 i = 1 ; i < bits_len ; i++) | ||
285 | { | ||
286 | mask |= (1 << i) ; | ||
287 | } | ||
288 | mask <<= (col & 7) ; | ||
289 | mask = ~mask ; | ||
290 | |||
291 | for(S8 i = 0 ; i < bits_len ; i++) | ||
292 | { | ||
293 | mUsageBits[row + i][x] &= mask ; | ||
294 | } | ||
295 | |||
296 | #if DEBUG_USAGE_BITS | ||
297 | //test | ||
298 | for(S8 i = row ; i < row + bits_len ; i++) | ||
299 | { | ||
300 | for(S8 j = col ; j < col + bits_len ; j++) | ||
301 | { | ||
302 | mTestBits[i][j] = 0 ; | ||
303 | } | ||
304 | } | ||
305 | #endif | ||
306 | } | ||
307 | |||
308 | //return true if any of bits in the range marked. | ||
309 | BOOL LLTextureAtlas::areUsageBitsMarked(S8 bits_len, U8 mask, S16 col, S16 row) | ||
310 | { | ||
311 | BOOL ret = FALSE ; | ||
312 | S16 x = col >> 3 ; | ||
313 | |||
314 | for(S8 i = 0 ; i < bits_len ; i++) | ||
315 | { | ||
316 | if(mUsageBits[row + i][x] & mask) | ||
317 | { | ||
318 | ret = TRUE ; | ||
319 | break ; | ||
320 | //return TRUE ; | ||
321 | } | ||
322 | } | ||
323 | |||
324 | #if DEBUG_USAGE_BITS | ||
325 | //test | ||
326 | BOOL ret2 = FALSE ; | ||
327 | for(S8 i = row ; i < row + bits_len ; i++) | ||
328 | { | ||
329 | for(S8 j = col ; j < col + bits_len ; j++) | ||
330 | { | ||
331 | if(mTestBits[i][j]) | ||
332 | { | ||
333 | ret2 = TRUE ; | ||
334 | } | ||
335 | } | ||
336 | } | ||
337 | |||
338 | if(ret != ret2) | ||
339 | { | ||
340 | llwarns << "bits map corrupted." << llendl ; | ||
341 | } | ||
342 | #endif | ||
343 | return ret ;//FALSE ; | ||
344 | } | ||
345 | |||
346 | //---------------------------------------------------------------------- | ||
347 | // | ||
348 | //index order: Z order, i.e.: | ||
349 | // |-----|-----|-----|-----| | ||
350 | // | 10 | 11 | 14 | 15 | | ||
351 | // |-----|-----|-----|-----| | ||
352 | // | 8 | 9 | 12 | 13 | | ||
353 | // |-----|-----|-----|-----| | ||
354 | // | 2 | 3 | 6 | 7 | | ||
355 | // |-----|-----|-----|-----| | ||
356 | // | 0 | 1 | 4 | 5 | | ||
357 | // |-----|-----|-----|-----| | ||
358 | void LLTextureAtlas::getPositionFromIndex(S16 index, S16& col, S16& row) | ||
359 | { | ||
360 | col = 0 ; | ||
361 | row = 0 ; | ||
362 | |||
363 | S16 index_copy = index ; | ||
364 | for(S16 i = 0 ; index_copy && i < 16 ; i += 2) | ||
365 | { | ||
366 | col |= ((index & (1 << i)) >> i) << (i >> 1) ; | ||
367 | row |= ((index & (1 << (i + 1))) >> (i + 1)) << (i >> 1) ; | ||
368 | index_copy >>= 2 ; | ||
369 | } | ||
370 | } | ||
371 | void LLTextureAtlas::getIndexFromPosition(S16 col, S16 row, S16& index) | ||
372 | { | ||
373 | index = 0 ; | ||
374 | S16 col_copy = col ; | ||
375 | S16 row_copy = row ; | ||
376 | for(S16 i = 0 ; (col_copy || row_copy) && i < 16 ; i++) | ||
377 | { | ||
378 | index |= ((col & 1 << i) << i) | ((row & 1 << i) << ( i + 1)) ; | ||
379 | col_copy >>= 1 ; | ||
380 | row_copy >>= 1 ; | ||
381 | } | ||
382 | } | ||
383 | //---------------------------------------------------------------------- | ||
384 | //return TRUE if succeeds. | ||
385 | BOOL LLTextureAtlas::getNextAvailableSlot(S8 bits_len, S16& col, S16& row) | ||
386 | { | ||
387 | S16 index_step = bits_len * bits_len ; | ||
388 | |||
389 | U8 mask = 1 ; | ||
390 | for(S8 i = 1 ; i < bits_len ; i++) | ||
391 | { | ||
392 | mask |= (1 << i) ; | ||
393 | } | ||
394 | |||
395 | U8 cur_mask ; | ||
396 | for(S16 index = 0 ; index < mMaxSlotsInAtlas ; index += index_step) | ||
397 | { | ||
398 | getPositionFromIndex(index, col, row) ; | ||
399 | |||
400 | cur_mask = mask << (col & 7) ; | ||
401 | if(!areUsageBitsMarked(bits_len, cur_mask, col, row)) | ||
402 | { | ||
403 | markUsageBits(bits_len, cur_mask, col, row) ; | ||
404 | mNumSlotsReserved += bits_len * bits_len ; | ||
405 | |||
406 | return TRUE ; | ||
407 | } | ||
408 | } | ||
409 | |||
410 | return FALSE ; | ||
411 | } | ||
diff --git a/linden/indra/llrender/lltextureatlas.h b/linden/indra/llrender/lltextureatlas.h deleted file mode 100644 index 4922175..0000000 --- a/linden/indra/llrender/lltextureatlas.h +++ /dev/null | |||
@@ -1,92 +0,0 @@ | |||
1 | /** | ||
2 | * @file lltextureatlas.h | ||
3 | * @brief LLTextureAtlas base class. | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2002-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 | |||
34 | #ifndef LL_TEXTUREATLAS_H | ||
35 | #define LL_TEXTUREATLAS_H | ||
36 | |||
37 | #include "llimagegl.h" | ||
38 | class LLSpatialGroup ; | ||
39 | |||
40 | class LLTextureAtlas : public LLImageGL | ||
41 | { | ||
42 | public: | ||
43 | LLTextureAtlas(U8 ncomponents, S16 atlas_dim = 16) ; | ||
44 | ~LLTextureAtlas() ; | ||
45 | |||
46 | LLGLuint insertSubTexture(const LLImageRaw* raw_image, S16 slot_col, S16 slot_row) ; | ||
47 | void releaseSlot(S16 slot_col, S16 slot_row, S8 slot_width); | ||
48 | |||
49 | BOOL getNextAvailableSlot(S8 bits_len, S16& col, S16& row) ; | ||
50 | void getTexCoordOffset(S16 col, S16 row, F32& xoffset, F32& yOffset) ; | ||
51 | void getTexCoordScale(S32 w, S32 h, F32& xscale, F32& yscale) ; | ||
52 | |||
53 | BOOL isEmpty() const ; | ||
54 | BOOL isFull(S8 to_be_reserved = 1) const ; | ||
55 | F32 getFullness() const ; | ||
56 | |||
57 | void addSpatialGroup(LLSpatialGroup* groupp) ; | ||
58 | void removeSpatialGroup(LLSpatialGroup* groupp) ; | ||
59 | LLSpatialGroup* getLastSpatialGroup() ; | ||
60 | void removeLastSpatialGroup() ; | ||
61 | BOOL hasSpatialGroup(LLSpatialGroup* groupp) ; | ||
62 | void clearSpatialGroup() ; | ||
63 | std::list<LLSpatialGroup*>* getSpatialGroupList() {return &mSpatialGroupList;} | ||
64 | private: | ||
65 | void generateEmptyUsageBits() ; | ||
66 | void releaseUsageBits() ; | ||
67 | |||
68 | void markUsageBits(S8 bits_len, U8 mask, S16 col, S16 row) ; | ||
69 | void unmarkUsageBits(S8 bits_len, S16 col, S16 row) ; | ||
70 | |||
71 | void getPositionFromIndex(S16 index, S16& col, S16& row) ; | ||
72 | void getIndexFromPosition(S16 col, S16 row, S16& index) ; | ||
73 | BOOL areUsageBitsMarked(S8 bits_len, U8 mask, S16 col, S16 row) ; | ||
74 | |||
75 | private: | ||
76 | S16 mAtlasDim ; //number of slots per edge, i.e, there are "mAtlasDim * mAtlasDim" total slots in the atlas. | ||
77 | S16 mNumSlotsReserved ; | ||
78 | S16 mMaxSlotsInAtlas ; | ||
79 | U8 **mUsageBits ; | ||
80 | std::list<LLSpatialGroup*> mSpatialGroupList ; | ||
81 | |||
82 | public: | ||
83 | //debug use only | ||
84 | U8 **mTestBits ; | ||
85 | |||
86 | public: | ||
87 | static S16 sMaxSubTextureSize ; | ||
88 | static S16 sSlotSize ; | ||
89 | }; | ||
90 | |||
91 | #endif | ||
92 | |||
diff --git a/linden/indra/llrender/llvertexbuffer.cpp b/linden/indra/llrender/llvertexbuffer.cpp index 31c2d75..461edbe 100644 --- a/linden/indra/llrender/llvertexbuffer.cpp +++ b/linden/indra/llrender/llvertexbuffer.cpp | |||
@@ -96,7 +96,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) | |||
96 | { | 96 | { |
97 | /*if (LLGLImmediate::sStarted) | 97 | /*if (LLGLImmediate::sStarted) |
98 | { | 98 | { |
99 | llwarns << "Cannot use LLGLImmediate and LLVertexBuffer simultaneously!" << llendl; | 99 | llerrs << "Cannot use LLGLImmediate and LLVertexBuffer simultaneously!" << llendl; |
100 | }*/ | 100 | }*/ |
101 | 101 | ||
102 | if (sLastMask != data_mask) | 102 | if (sLastMask != data_mask) |
@@ -129,7 +129,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) | |||
129 | { //needs to be enabled, make sure it was (DEBUG TEMPORARY) | 129 | { //needs to be enabled, make sure it was (DEBUG TEMPORARY) |
130 | if (i > 0 && !glIsEnabled(array[i])) | 130 | if (i > 0 && !glIsEnabled(array[i])) |
131 | { | 131 | { |
132 | llwarns << "Bad client state! " << array[i] << " disabled." << llendl; | 132 | llerrs << "Bad client state! " << array[i] << " disabled." << llendl; |
133 | } | 133 | } |
134 | } | 134 | } |
135 | } | 135 | } |
@@ -141,7 +141,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) | |||
141 | } | 141 | } |
142 | else if (gDebugGL && glIsEnabled(array[i])) | 142 | else if (gDebugGL && glIsEnabled(array[i])) |
143 | { //needs to be disabled, make sure it was (DEBUG TEMPORARY) | 143 | { //needs to be disabled, make sure it was (DEBUG TEMPORARY) |
144 | llwarns << "Bad client state! " << array[i] << " enabled." << llendl; | 144 | llerrs << "Bad client state! " << array[i] << " enabled." << llendl; |
145 | } | 145 | } |
146 | } | 146 | } |
147 | } | 147 | } |
@@ -197,28 +197,28 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi | |||
197 | if (start >= (U32) mRequestedNumVerts || | 197 | if (start >= (U32) mRequestedNumVerts || |
198 | end >= (U32) mRequestedNumVerts) | 198 | end >= (U32) mRequestedNumVerts) |
199 | { | 199 | { |
200 | llwarns << "Bad vertex buffer draw range: [" << start << ", " << end << "]" << llendl; | 200 | llerrs << "Bad vertex buffer draw range: [" << start << ", " << end << "]" << llendl; |
201 | } | 201 | } |
202 | 202 | ||
203 | if (indices_offset >= (U32) mRequestedNumIndices || | 203 | if (indices_offset >= (U32) mRequestedNumIndices || |
204 | indices_offset + count > (U32) mRequestedNumIndices) | 204 | indices_offset + count > (U32) mRequestedNumIndices) |
205 | { | 205 | { |
206 | llwarns << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << llendl; | 206 | llerrs << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << llendl; |
207 | } | 207 | } |
208 | 208 | ||
209 | if (mGLIndices != sGLRenderIndices) | 209 | if (mGLIndices != sGLRenderIndices) |
210 | { | 210 | { |
211 | llwarns << "Wrong index buffer bound." << llendl; | 211 | llerrs << "Wrong index buffer bound." << llendl; |
212 | } | 212 | } |
213 | 213 | ||
214 | if (mGLBuffer != sGLRenderBuffer) | 214 | if (mGLBuffer != sGLRenderBuffer) |
215 | { | 215 | { |
216 | llwarns << "Wrong vertex buffer bound." << llendl; | 216 | llerrs << "Wrong vertex buffer bound." << llendl; |
217 | } | 217 | } |
218 | 218 | ||
219 | if (mode > LLRender::NUM_MODES) | 219 | if (mode > LLRender::NUM_MODES) |
220 | { | 220 | { |
221 | llwarns << "Invalid draw mode: " << mode << llendl; | 221 | llerrs << "Invalid draw mode: " << mode << llendl; |
222 | return; | 222 | return; |
223 | } | 223 | } |
224 | 224 | ||
@@ -233,22 +233,22 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const | |||
233 | if (indices_offset >= (U32) mRequestedNumIndices || | 233 | if (indices_offset >= (U32) mRequestedNumIndices || |
234 | indices_offset + count > (U32) mRequestedNumIndices) | 234 | indices_offset + count > (U32) mRequestedNumIndices) |
235 | { | 235 | { |
236 | llwarns << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << llendl; | 236 | llerrs << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << llendl; |
237 | } | 237 | } |
238 | 238 | ||
239 | if (mGLIndices != sGLRenderIndices) | 239 | if (mGLIndices != sGLRenderIndices) |
240 | { | 240 | { |
241 | llwarns << "Wrong index buffer bound." << llendl; | 241 | llerrs << "Wrong index buffer bound." << llendl; |
242 | } | 242 | } |
243 | 243 | ||
244 | if (mGLBuffer != sGLRenderBuffer) | 244 | if (mGLBuffer != sGLRenderBuffer) |
245 | { | 245 | { |
246 | llwarns << "Wrong vertex buffer bound." << llendl; | 246 | llerrs << "Wrong vertex buffer bound." << llendl; |
247 | } | 247 | } |
248 | 248 | ||
249 | if (mode > LLRender::NUM_MODES) | 249 | if (mode > LLRender::NUM_MODES) |
250 | { | 250 | { |
251 | llwarns << "Invalid draw mode: " << mode << llendl; | 251 | llerrs << "Invalid draw mode: " << mode << llendl; |
252 | return; | 252 | return; |
253 | } | 253 | } |
254 | 254 | ||
@@ -263,17 +263,17 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const | |||
263 | if (first >= (U32) mRequestedNumVerts || | 263 | if (first >= (U32) mRequestedNumVerts || |
264 | first + count > (U32) mRequestedNumVerts) | 264 | first + count > (U32) mRequestedNumVerts) |
265 | { | 265 | { |
266 | llwarns << "Bad vertex buffer draw range: [" << first << ", " << first+count << "]" << llendl; | 266 | llerrs << "Bad vertex buffer draw range: [" << first << ", " << first+count << "]" << llendl; |
267 | } | 267 | } |
268 | 268 | ||
269 | if (mGLBuffer != sGLRenderBuffer || useVBOs() != sVBOActive) | 269 | if (mGLBuffer != sGLRenderBuffer || useVBOs() != sVBOActive) |
270 | { | 270 | { |
271 | llwarns << "Wrong vertex buffer bound." << llendl; | 271 | llerrs << "Wrong vertex buffer bound." << llendl; |
272 | } | 272 | } |
273 | 273 | ||
274 | if (mode > LLRender::NUM_MODES) | 274 | if (mode > LLRender::NUM_MODES) |
275 | { | 275 | { |
276 | llwarns << "Invalid draw mode: " << mode << llendl; | 276 | llerrs << "Invalid draw mode: " << mode << llendl; |
277 | return; | 277 | return; |
278 | } | 278 | } |
279 | 279 | ||
@@ -530,7 +530,7 @@ void LLVertexBuffer::destroyGLBuffer() | |||
530 | { | 530 | { |
531 | if (mMappedData || mMappedIndexData) | 531 | if (mMappedData || mMappedIndexData) |
532 | { | 532 | { |
533 | llwarns << "Vertex buffer destroyed while mapped!" << llendl; | 533 | llerrs << "Vertex buffer destroyed while mapped!" << llendl; |
534 | } | 534 | } |
535 | releaseBuffer(); | 535 | releaseBuffer(); |
536 | } | 536 | } |
@@ -557,7 +557,7 @@ void LLVertexBuffer::destroyGLIndices() | |||
557 | { | 557 | { |
558 | if (mMappedData || mMappedIndexData) | 558 | if (mMappedData || mMappedIndexData) |
559 | { | 559 | { |
560 | llwarns << "Vertex buffer destroyed while mapped." << llendl; | 560 | llerrs << "Vertex buffer destroyed while mapped." << llendl; |
561 | } | 561 | } |
562 | releaseIndices(); | 562 | releaseIndices(); |
563 | } | 563 | } |
@@ -634,7 +634,7 @@ void LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create) | |||
634 | 634 | ||
635 | if (mMappedData) | 635 | if (mMappedData) |
636 | { | 636 | { |
637 | llwarns << "LLVertexBuffer::allocateBuffer() called redundantly." << llendl; | 637 | llerrs << "LLVertexBuffer::allocateBuffer() called redundantly." << llendl; |
638 | } | 638 | } |
639 | if (create && (nverts || nindices)) | 639 | if (create && (nverts || nindices)) |
640 | { | 640 | { |
@@ -782,11 +782,11 @@ U8* LLVertexBuffer::mapBuffer(S32 access) | |||
782 | LLMemType mt(LLMemType::MTYPE_VERTEX_DATA); | 782 | LLMemType mt(LLMemType::MTYPE_VERTEX_DATA); |
783 | if (mFinal) | 783 | if (mFinal) |
784 | { | 784 | { |
785 | llwarns << "LLVertexBuffer::mapBuffer() called on a finalized buffer." << llendl; | 785 | llerrs << "LLVertexBuffer::mapBuffer() called on a finalized buffer." << llendl; |
786 | } | 786 | } |
787 | if (!useVBOs() && !mMappedData && !mMappedIndexData) | 787 | if (!useVBOs() && !mMappedData && !mMappedIndexData) |
788 | { | 788 | { |
789 | llwarns << "LLVertexBuffer::mapBuffer() called on unallocated buffer." << llendl; | 789 | llerrs << "LLVertexBuffer::mapBuffer() called on unallocated buffer." << llendl; |
790 | } | 790 | } |
791 | 791 | ||
792 | if (!mLocked && useVBOs()) | 792 | if (!mLocked && useVBOs()) |
@@ -813,11 +813,11 @@ U8* LLVertexBuffer::mapBuffer(S32 access) | |||
813 | glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); | 813 | glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); |
814 | if (buff != mGLBuffer) | 814 | if (buff != mGLBuffer) |
815 | { | 815 | { |
816 | llwarns << "Invalid GL vertex buffer bound: " << buff << llendl; | 816 | llerrs << "Invalid GL vertex buffer bound: " << buff << llendl; |
817 | } | 817 | } |
818 | 818 | ||
819 | 819 | ||
820 | llwarns << "glMapBuffer returned NULL (no vertex data)" << llendl; | 820 | llerrs << "glMapBuffer returned NULL (no vertex data)" << llendl; |
821 | } | 821 | } |
822 | 822 | ||
823 | if (!mMappedIndexData) | 823 | if (!mMappedIndexData) |
@@ -826,10 +826,10 @@ U8* LLVertexBuffer::mapBuffer(S32 access) | |||
826 | glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); | 826 | glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); |
827 | if (buff != mGLIndices) | 827 | if (buff != mGLIndices) |
828 | { | 828 | { |
829 | llwarns << "Invalid GL index buffer bound: " << buff << llendl; | 829 | llerrs << "Invalid GL index buffer bound: " << buff << llendl; |
830 | } | 830 | } |
831 | 831 | ||
832 | llwarns << "glMapBuffer returned NULL (no index data)" << llendl; | 832 | llerrs << "glMapBuffer returned NULL (no index data)" << llendl; |
833 | } | 833 | } |
834 | 834 | ||
835 | sMappedCount++; | 835 | sMappedCount++; |
@@ -908,7 +908,7 @@ template <class T,S32 type> struct VertexBufferStrider | |||
908 | } | 908 | } |
909 | else | 909 | else |
910 | { | 910 | { |
911 | llwarns << "VertexBufferStrider could not find valid vertex data." << llendl; | 911 | llerrs << "VertexBufferStrider could not find valid vertex data." << llendl; |
912 | } | 912 | } |
913 | return FALSE; | 913 | return FALSE; |
914 | } | 914 | } |
@@ -965,7 +965,7 @@ void LLVertexBuffer::setStride(S32 type, S32 new_stride) | |||
965 | LLMemType mt(LLMemType::MTYPE_VERTEX_DATA); | 965 | LLMemType mt(LLMemType::MTYPE_VERTEX_DATA); |
966 | if (mNumVerts) | 966 | if (mNumVerts) |
967 | { | 967 | { |
968 | llwarns << "LLVertexBuffer::setOffset called with mNumVerts = " << mNumVerts << llendl; | 968 | llerrs << "LLVertexBuffer::setOffset called with mNumVerts = " << mNumVerts << llendl; |
969 | } | 969 | } |
970 | // This code assumes that setStride() will only be called once per VBO per type. | 970 | // This code assumes that setStride() will only be called once per VBO per type. |
971 | S32 delta = new_stride - sTypeOffsets[type]; | 971 | S32 delta = new_stride - sTypeOffsets[type]; |
@@ -1020,15 +1020,15 @@ void LLVertexBuffer::setBuffer(U32 data_mask) | |||
1020 | { | 1020 | { |
1021 | GLint buff; | 1021 | GLint buff; |
1022 | glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); | 1022 | glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); |
1023 | if ((GLuint)buff != mGLBuffer) | 1023 | if (buff != mGLBuffer) |
1024 | { | 1024 | { |
1025 | llwarns << "Invalid GL vertex buffer bound: " << buff << llendl; | 1025 | llerrs << "Invalid GL vertex buffer bound: " << buff << llendl; |
1026 | } | 1026 | } |
1027 | 1027 | ||
1028 | glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); | 1028 | glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); |
1029 | if ((GLuint)buff != mGLIndices) | 1029 | if (buff != mGLIndices) |
1030 | { | 1030 | { |
1031 | llwarns << "Invalid GL index buffer bound: " << buff << llendl; | 1031 | llerrs << "Invalid GL index buffer bound: " << buff << llendl; |
1032 | } | 1032 | } |
1033 | } | 1033 | } |
1034 | 1034 | ||
@@ -1038,15 +1038,15 @@ void LLVertexBuffer::setBuffer(U32 data_mask) | |||
1038 | { | 1038 | { |
1039 | GLint buff; | 1039 | GLint buff; |
1040 | glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); | 1040 | glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); |
1041 | if ((GLuint)buff != mGLBuffer) | 1041 | if (buff != mGLBuffer) |
1042 | { | 1042 | { |
1043 | llwarns << "Invalid GL vertex buffer bound: " << buff << llendl; | 1043 | llerrs << "Invalid GL vertex buffer bound: " << buff << llendl; |
1044 | } | 1044 | } |
1045 | 1045 | ||
1046 | glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); | 1046 | glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); |
1047 | if ((GLuint)buff != mGLIndices) | 1047 | if (buff != mGLIndices) |
1048 | { | 1048 | { |
1049 | llwarns << "Invalid GL index buffer bound: " << buff << llendl; | 1049 | llerrs << "Invalid GL index buffer bound: " << buff << llendl; |
1050 | } | 1050 | } |
1051 | } | 1051 | } |
1052 | 1052 | ||
@@ -1068,7 +1068,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask) | |||
1068 | 1068 | ||
1069 | if (data_mask != 0) | 1069 | if (data_mask != 0) |
1070 | { | 1070 | { |
1071 | llwarns << "Buffer set for rendering before being filled after resize." << llendl; | 1071 | llerrs << "Buffer set for rendering before being filled after resize." << llendl; |
1072 | } | 1072 | } |
1073 | } | 1073 | } |
1074 | 1074 | ||
@@ -1129,7 +1129,7 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) const | |||
1129 | 1129 | ||
1130 | if ((data_mask & mTypeMask) != data_mask) | 1130 | if ((data_mask & mTypeMask) != data_mask) |
1131 | { | 1131 | { |
1132 | llwarns << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << llendl; | 1132 | llerrs << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << llendl; |
1133 | } | 1133 | } |
1134 | 1134 | ||
1135 | if (data_mask & MAP_NORMAL) | 1135 | if (data_mask & MAP_NORMAL) |
diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt index fafcfa8..04ed486 100644 --- a/linden/indra/newview/CMakeLists.txt +++ b/linden/indra/newview/CMakeLists.txt | |||
@@ -330,7 +330,6 @@ set(viewer_SOURCE_FILES | |||
330 | llpolymesh.cpp | 330 | llpolymesh.cpp |
331 | llpolymorph.cpp | 331 | llpolymorph.cpp |
332 | llprefsadvanced.cpp | 332 | llprefsadvanced.cpp |
333 | llpostprocess.cpp | ||
334 | llprefschat.cpp | 333 | llprefschat.cpp |
335 | llprefsim.cpp | 334 | llprefsim.cpp |
336 | llprefsvoice.cpp | 335 | llprefsvoice.cpp |
@@ -361,7 +360,6 @@ set(viewer_SOURCE_FILES | |||
361 | llsurface.cpp | 360 | llsurface.cpp |
362 | llsurfacepatch.cpp | 361 | llsurfacepatch.cpp |
363 | lltexlayer.cpp | 362 | lltexlayer.cpp |
364 | lltextureatlasmanager.cpp | ||
365 | lltexturecache.cpp | 363 | lltexturecache.cpp |
366 | lltexturectrl.cpp | 364 | lltexturectrl.cpp |
367 | lltexturefetch.cpp | 365 | lltexturefetch.cpp |
@@ -780,7 +778,6 @@ set(viewer_HEADER_FILES | |||
780 | llpolymesh.h | 778 | llpolymesh.h |
781 | llpolymorph.h | 779 | llpolymorph.h |
782 | llprefsadvanced.h | 780 | llprefsadvanced.h |
783 | llpostprocess.h | ||
784 | llprefschat.h | 781 | llprefschat.h |
785 | llprefsim.h | 782 | llprefsim.h |
786 | llprefsvoice.h | 783 | llprefsvoice.h |
@@ -813,7 +810,6 @@ set(viewer_HEADER_FILES | |||
813 | llsurfacepatch.h | 810 | llsurfacepatch.h |
814 | lltable.h | 811 | lltable.h |
815 | lltexlayer.h | 812 | lltexlayer.h |
816 | lltextureatlasmanager.h | ||
817 | lltexturecache.h | 813 | lltexturecache.h |
818 | lltexturectrl.h | 814 | lltexturectrl.h |
819 | lltexturefetch.h | 815 | lltexturefetch.h |
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index d306f0d..57ed4c0 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml | |||
@@ -5122,21 +5122,6 @@ | |||
5122 | <key>Value</key> | 5122 | <key>Value</key> |
5123 | <integer>1</integer> | 5123 | <integer>1</integer> |
5124 | </map> | 5124 | </map> |
5125 | |||
5126 | <!--KL port --> | ||
5127 | <key>EnableTextureAtlas</key> | ||
5128 | <map> | ||
5129 | <key>Comment</key> | ||
5130 | <string>Whether to use texture atlas or not</string> | ||
5131 | <key>Persist</key> | ||
5132 | <integer>1</integer> | ||
5133 | <key>Type</key> | ||
5134 | <string>Boolean</string> | ||
5135 | <key>Value</key> | ||
5136 | <integer>0</integer> | ||
5137 | </map> | ||
5138 | <!--/KL port --> | ||
5139 | |||
5140 | <key>EnableVoiceChat</key> | 5125 | <key>EnableVoiceChat</key> |
5141 | <map> | 5126 | <map> |
5142 | <key>Comment</key> | 5127 | <key>Comment</key> |
@@ -8968,74 +8953,11 @@ | |||
8968 | <string>Vector3</string> | 8953 | <string>Vector3</string> |
8969 | <key>Value</key> | 8954 | <key>Value</key> |
8970 | <array> | 8955 | <array> |
8971 | <real>1.0</real> | ||
8972 | <real>12.0</real> | ||
8973 | <real>32.0</real> | ||
8974 | </array> | ||
8975 | </map> | ||
8976 | <key>RenderShadowSplitExponent</key> | ||
8977 | <map> | ||
8978 | <key>Comment</key> | ||
8979 | <string>Near clip plane split distances for shadow map frusta (x=perspective, y=ortho, z=transition rate).</string> | ||
8980 | <key>Persist</key> | ||
8981 | <integer>1</integer> | ||
8982 | <key>Type</key> | ||
8983 | <string>Vector3</string> | ||
8984 | <key>Value</key> | ||
8985 | <array> | ||
8986 | <real>3.0</real> | ||
8987 | <real>3.0</real> | ||
8988 | <real>2.0</real> | ||
8989 | </array> | ||
8990 | </map> | ||
8991 | <key>RenderShadowOrthoClipPlanes</key> | ||
8992 | <map> | ||
8993 | <key>Comment</key> | ||
8994 | <string>Near clip plane split distances for orthographic shadow map frusta.</string> | ||
8995 | <key>Persist</key> | ||
8996 | <integer>1</integer> | ||
8997 | <key>Type</key> | ||
8998 | <string>Vector3</string> | ||
8999 | <key>Value</key> | ||
9000 | <array> | ||
9001 | <real>4.0</real> | 8956 | <real>4.0</real> |
9002 | <real>8.0</real> | 8957 | <real>8.0</real> |
9003 | <real>24.0</real> | 8958 | <real>24.0</real> |
9004 | </array> | 8959 | </array> |
9005 | </map> | 8960 | </map> |
9006 | <key>RenderShadowProjOffset</key> | ||
9007 | <map> | ||
9008 | <key>Comment</key> | ||
9009 | <string>Amount to scale distance to virtual origin of shadow perspective projection.</string> | ||
9010 | <key>Persist</key> | ||
9011 | <integer>1</integer> | ||
9012 | <key>Type</key> | ||
9013 | <string>F32</string> | ||
9014 | <key>Value</key> | ||
9015 | <real>2.0</real> | ||
9016 | </map> | ||
9017 | <key>RenderShadowSlopeThreshold</key> | ||
9018 | <map> | ||
9019 | <key>Comment</key> | ||
9020 | <string>Cutoff slope value for points to affect perspective shadow generation</string> | ||
9021 | <key>Persist</key> | ||
9022 | <integer>1</integer> | ||
9023 | <key>Type</key> | ||
9024 | <string>F32</string> | ||
9025 | <key>Value</key> | ||
9026 | <real>0.0</real> | ||
9027 | </map> | ||
9028 | <key>RenderShadowProjExponent</key> | ||
9029 | <map> | ||
9030 | <key>Comment</key> | ||
9031 | <string>Exponent applied to transition between ortho and perspective shadow projections based on viewing angle and light vector.</string> | ||
9032 | <key>Persist</key> | ||
9033 | <integer>1</integer> | ||
9034 | <key>Type</key> | ||
9035 | <string>F32</string> | ||
9036 | <key>Value</key> | ||
9037 | <real>0.5</real> | ||
9038 | </map> | ||
9039 | <key>RenderSSAOScale</key> | 8961 | <key>RenderSSAOScale</key> |
9040 | <map> | 8962 | <map> |
9041 | <key>Comment</key> | 8963 | <key>Comment</key> |
@@ -9195,184 +9117,6 @@ | |||
9195 | <key>Value</key> | 9117 | <key>Value</key> |
9196 | <integer>0</integer> | 9118 | <integer>0</integer> |
9197 | </map> | 9119 | </map> |
9198 | |||
9199 | <key>RenderGILightRadius</key> | ||
9200 | <map> | ||
9201 | <key>Comment</key> | ||
9202 | <string>Distance of ambiant bounce lighting from sun.</string> | ||
9203 | <key>Persist</key> | ||
9204 | <integer>1</integer> | ||
9205 | <key>Type</key> | ||
9206 | <string>F32</string> | ||
9207 | <key>Value</key> | ||
9208 | <real>8</real> | ||
9209 | </map> | ||
9210 | |||
9211 | <key>RenderGISamples</key> | ||
9212 | <map> | ||
9213 | <key>Comment</key> | ||
9214 | <string>Number of samples to take for GI.</string> | ||
9215 | <key>Persist</key> | ||
9216 | <integer>1</integer> | ||
9217 | <key>Type</key> | ||
9218 | <string>U32</string> | ||
9219 | <key>Value</key> | ||
9220 | <real>64</real> | ||
9221 | </map> | ||
9222 | |||
9223 | <key>RenderGIRange</key> | ||
9224 | <map> | ||
9225 | <key>Comment</key> | ||
9226 | <string>Distance to cut off GI effect.</string> | ||
9227 | <key>Persist</key> | ||
9228 | <integer>1</integer> | ||
9229 | <key>Type</key> | ||
9230 | <string>F32</string> | ||
9231 | <key>Value</key> | ||
9232 | <real>128</real> | ||
9233 | </map> | ||
9234 | |||
9235 | |||
9236 | <key>RenderGIDirectionWeight</key> | ||
9237 | <map> | ||
9238 | <key>Comment</key> | ||
9239 | <string>Weight of reflected light vector in GI angular attenuation.</string> | ||
9240 | <key>Persist</key> | ||
9241 | <integer>1</integer> | ||
9242 | <key>Type</key> | ||
9243 | <string>F32</string> | ||
9244 | <key>Value</key> | ||
9245 | <real>0.5</real> | ||
9246 | </map> | ||
9247 | |||
9248 | <key>RenderGILightOffset</key> | ||
9249 | <map> | ||
9250 | <key>Comment</key> | ||
9251 | <string>Amount to offset light from point of impact in gi map (scaled by light radius).</string> | ||
9252 | <key>Persist</key> | ||
9253 | <integer>1</integer> | ||
9254 | <key>Type</key> | ||
9255 | <string>F32</string> | ||
9256 | <key>Value</key> | ||
9257 | <real>0.0</real> | ||
9258 | </map> | ||
9259 | |||
9260 | <key>RenderGIColorCurve</key> | ||
9261 | <map> | ||
9262 | <key>Comment</key> | ||
9263 | <string>Global illumination color correction curve parameters.</string> | ||
9264 | <key>Persist</key> | ||
9265 | <integer>1</integer> | ||
9266 | <key>Type</key> | ||
9267 | <string>Vector3</string> | ||
9268 | <key>Value</key> | ||
9269 | <array> | ||
9270 | <real>0.0</real> | ||
9271 | <real>0.2</real> | ||
9272 | <real>0.02</real> | ||
9273 | </array> | ||
9274 | </map> | ||
9275 | |||
9276 | <key>RenderLuminanceColorCurve</key> | ||
9277 | <map> | ||
9278 | <key>Comment</key> | ||
9279 | <string>Luminance color correction curve parameters.</string> | ||
9280 | <key>Persist</key> | ||
9281 | <integer>1</integer> | ||
9282 | <key>Type</key> | ||
9283 | <string>Vector3</string> | ||
9284 | <key>Value</key> | ||
9285 | <array> | ||
9286 | <real>0.30</real> | ||
9287 | <real>0.0</real> | ||
9288 | <real>0.04</real> | ||
9289 | </array> | ||
9290 | </map> | ||
9291 | |||
9292 | <key>RenderGILuminanceColorCurve</key> | ||
9293 | <map> | ||
9294 | <key>Comment</key> | ||
9295 | <string>Luminance color correction curve parameters.</string> | ||
9296 | <key>Persist</key> | ||
9297 | <integer>1</integer> | ||
9298 | <key>Type</key> | ||
9299 | <string>Vector3</string> | ||
9300 | <key>Value</key> | ||
9301 | <array> | ||
9302 | <real>0.4</real> | ||
9303 | <real>0.0</real> | ||
9304 | <real>0.05</real> | ||
9305 | </array> | ||
9306 | </map> | ||
9307 | |||
9308 | <key>RenderSunLuminanceColorCurve</key> | ||
9309 | <map> | ||
9310 | <key>Comment</key> | ||
9311 | <string>Luminance color correction curve parameters.</string> | ||
9312 | <key>Persist</key> | ||
9313 | <integer>1</integer> | ||
9314 | <key>Type</key> | ||
9315 | <string>Vector3</string> | ||
9316 | <key>Value</key> | ||
9317 | <array> | ||
9318 | <real>0.6</real> | ||
9319 | <real>0.0</real> | ||
9320 | <real>-0.3</real> | ||
9321 | </array> | ||
9322 | </map> | ||
9323 | |||
9324 | <key>RenderLuminanceDetail</key> | ||
9325 | <map> | ||
9326 | <key>Comment</key> | ||
9327 | <string>Mipmap level to use for luminance</string> | ||
9328 | <key>Persist</key> | ||
9329 | <integer>1</integer> | ||
9330 | <key>Type</key> | ||
9331 | <string>F32</string> | ||
9332 | <key>Value</key> | ||
9333 | <real>8.0</real> | ||
9334 | </map> | ||
9335 | |||
9336 | <key>RenderLuminanceFade</key> | ||
9337 | <map> | ||
9338 | <key>Comment</key> | ||
9339 | <string>Scaler for speed of luminance adjustment</string> | ||
9340 | <key>Persist</key> | ||
9341 | <integer>1</integer> | ||
9342 | <key>Type</key> | ||
9343 | <string>F32</string> | ||
9344 | <key>Value</key> | ||
9345 | <real>0.05</real> | ||
9346 | </map> | ||
9347 | |||
9348 | <key>RenderGISpecularCurve</key> | ||
9349 | <map> | ||
9350 | <key>Comment</key> | ||
9351 | <string>Global illumination specular color correction curve parameters.</string> | ||
9352 | <key>Persist</key> | ||
9353 | <integer>1</integer> | ||
9354 | <key>Type</key> | ||
9355 | <string>Vector3</string> | ||
9356 | <key>Value</key> | ||
9357 | <array> | ||
9358 | <real>0.1</real> | ||
9359 | <real>0.0</real> | ||
9360 | <real>0.9</real> | ||
9361 | </array> | ||
9362 | </map> | ||
9363 | |||
9364 | <key>RenderGIIntensity</key> | ||
9365 | <map> | ||
9366 | <key>Comment</key> | ||
9367 | <string>Distance of ambiant bounce lighting from sun.</string> | ||
9368 | <key>Persist</key> | ||
9369 | <integer>1</integer> | ||
9370 | <key>Type</key> | ||
9371 | <string>F32</string> | ||
9372 | <key>Value</key> | ||
9373 | <real>0.2f</real> | ||
9374 | </map> | ||
9375 | |||
9376 | <key>RenderDeferredAlphaSoften</key> | 9120 | <key>RenderDeferredAlphaSoften</key> |
9377 | <map> | 9121 | <map> |
9378 | <key>Comment</key> | 9122 | <key>Comment</key> |
@@ -9395,178 +9139,6 @@ | |||
9395 | <key>Value</key> | 9139 | <key>Value</key> |
9396 | <real>4</real> | 9140 | <real>4</real> |
9397 | </map> | 9141 | </map> |
9398 | <key>RenderDeferredSpotShadowBias</key> | ||
9399 | <map> | ||
9400 | <key>Comment</key> | ||
9401 | <string>Bias value for spot shadows (prevent shadow acne).</string> | ||
9402 | <key>Persist</key> | ||
9403 | <integer>1</integer> | ||
9404 | <key>Type</key> | ||
9405 | <string>F32</string> | ||
9406 | <key>Value</key> | ||
9407 | <real>-64.0</real> | ||
9408 | </map> | ||
9409 | <key>RenderDeferredSpotShadowOffset</key> | ||
9410 | <map> | ||
9411 | <key>Comment</key> | ||
9412 | <string>Offset value for spot shadows (prevent shadow acne).</string> | ||
9413 | <key>Persist</key> | ||
9414 | <integer>1</integer> | ||
9415 | <key>Type</key> | ||
9416 | <string>F32</string> | ||
9417 | <key>Value</key> | ||
9418 | <real>0.8</real> | ||
9419 | </map> | ||
9420 | |||
9421 | <key>RenderShadowBias</key> | ||
9422 | <map> | ||
9423 | <key>Comment</key> | ||
9424 | <string>Bias value for shadows (prevent shadow acne).</string> | ||
9425 | <key>Persist</key> | ||
9426 | <integer>1</integer> | ||
9427 | <key>Type</key> | ||
9428 | <string>F32</string> | ||
9429 | <key>Value</key> | ||
9430 | <real>0.001</real> | ||
9431 | </map> | ||
9432 | <key>RenderShadowOffset</key> | ||
9433 | <map> | ||
9434 | <key>Comment</key> | ||
9435 | <string>Offset value for shadows (prevent shadow acne).</string> | ||
9436 | <key>Persist</key> | ||
9437 | <integer>1</integer> | ||
9438 | <key>Type</key> | ||
9439 | <string>F32</string> | ||
9440 | <key>Value</key> | ||
9441 | <real>0.6</real> | ||
9442 | </map> | ||
9443 | |||
9444 | <key>RenderShadowResolutionScale</key> | ||
9445 | <map> | ||
9446 | <key>Comment</key> | ||
9447 | <string>Scale of shadow map resolution vs. screen resolution</string> | ||
9448 | <key>Persist</key> | ||
9449 | <integer>1</integer> | ||
9450 | <key>Type</key> | ||
9451 | <string>F32</string> | ||
9452 | <key>Value</key> | ||
9453 | <real>1.0</real> | ||
9454 | </map> | ||
9455 | |||
9456 | |||
9457 | |||
9458 | <key>RenderDeferredTreeShadowBias</key> | ||
9459 | <map> | ||
9460 | <key>Comment</key> | ||
9461 | <string>Bias value for tree shadows (prevent shadow acne).</string> | ||
9462 | <key>Persist</key> | ||
9463 | <integer>1</integer> | ||
9464 | <key>Type</key> | ||
9465 | <string>F32</string> | ||
9466 | <key>Value</key> | ||
9467 | <real>1.0</real> | ||
9468 | </map> | ||
9469 | <key>RenderDeferredTreeShadowOffset</key> | ||
9470 | <map> | ||
9471 | <key>Comment</key> | ||
9472 | <string>Offset value for tree shadows (prevent shadow acne).</string> | ||
9473 | <key>Persist</key> | ||
9474 | <integer>1</integer> | ||
9475 | <key>Type</key> | ||
9476 | <string>F32</string> | ||
9477 | <key>Value</key> | ||
9478 | <real>1.0</real> | ||
9479 | </map> | ||
9480 | |||
9481 | <key>RenderHighlightFadeTime</key> | ||
9482 | <map> | ||
9483 | <key>Comment</key> | ||
9484 | <string>Transition time for mouseover highlights.</string> | ||
9485 | <key>Persist</key> | ||
9486 | <integer>1</integer> | ||
9487 | <key>Type</key> | ||
9488 | <string>F32</string> | ||
9489 | <key>Value</key> | ||
9490 | <real>0.2</real> | ||
9491 | </map> | ||
9492 | |||
9493 | <key>RenderHighlightBrightness</key> | ||
9494 | <map> | ||
9495 | <key>Comment</key> | ||
9496 | <string>Brightness of mouseover highlights.</string> | ||
9497 | <key>Persist</key> | ||
9498 | <integer>1</integer> | ||
9499 | <key>Type</key> | ||
9500 | <string>F32</string> | ||
9501 | <key>Value</key> | ||
9502 | <real>4.0</real> | ||
9503 | </map> | ||
9504 | |||
9505 | <key>RenderHighlightThickness</key> | ||
9506 | <map> | ||
9507 | <key>Comment</key> | ||
9508 | <string>Thickness of mouseover highlights.</string> | ||
9509 | <key>Persist</key> | ||
9510 | <integer>1</integer> | ||
9511 | <key>Type</key> | ||
9512 | <string>F32</string> | ||
9513 | <key>Value</key> | ||
9514 | <real>0.6</real> | ||
9515 | </map> | ||
9516 | |||
9517 | <key>RenderHighlightColor</key> | ||
9518 | <map> | ||
9519 | <key>Comment</key> | ||
9520 | <string>Brightness of mouseover highlights.</string> | ||
9521 | <key>Persist</key> | ||
9522 | <integer>1</integer> | ||
9523 | <key>Type</key> | ||
9524 | <string>Color4</string> | ||
9525 | <key>Value</key> | ||
9526 | <array> | ||
9527 | <real>0.4</real> | ||
9528 | <real>0.98</real> | ||
9529 | <real>0.93</real> | ||
9530 | <real>1.0</real> | ||
9531 | </array> | ||
9532 | </map> | ||
9533 | |||
9534 | <key>RenderSpecularResX</key> | ||
9535 | <map> | ||
9536 | <key>Comment</key> | ||
9537 | <string>Spec map resolution.</string> | ||
9538 | <key>Persist</key> | ||
9539 | <integer>1</integer> | ||
9540 | <key>Type</key> | ||
9541 | <string>U32</string> | ||
9542 | <key>Value</key> | ||
9543 | <real>128</real> | ||
9544 | </map> | ||
9545 | |||
9546 | <key>RenderSpecularResY</key> | ||
9547 | <map> | ||
9548 | <key>Comment</key> | ||
9549 | <string>Spec map resolution.</string> | ||
9550 | <key>Persist</key> | ||
9551 | <integer>1</integer> | ||
9552 | <key>Type</key> | ||
9553 | <string>U32</string> | ||
9554 | <key>Value</key> | ||
9555 | <real>128</real> | ||
9556 | </map> | ||
9557 | |||
9558 | <key>RenderSpecularExponent</key> | ||
9559 | <map> | ||
9560 | <key>Comment</key> | ||
9561 | <string>Specular exponent for generating spec map</string> | ||
9562 | <key>Persist</key> | ||
9563 | <integer>1</integer> | ||
9564 | <key>Type</key> | ||
9565 | <string>F32</string> | ||
9566 | <key>Value</key> | ||
9567 | <real>1</real> | ||
9568 | </map> | ||
9569 | |||
9570 | <key>RenderDeferred</key> | 9142 | <key>RenderDeferred</key> |
9571 | <map> | 9143 | <map> |
9572 | <key>Comment</key> | 9144 | <key>Comment</key> |
@@ -9578,31 +9150,6 @@ | |||
9578 | <key>Value</key> | 9150 | <key>Value</key> |
9579 | <integer>0</integer> | 9151 | <integer>0</integer> |
9580 | </map> | 9152 | </map> |
9581 | |||
9582 | <key>RenderDeferredShadow</key> | ||
9583 | <map> | ||
9584 | <key>Comment</key> | ||
9585 | <string>Enable shadows in deferred renderer.</string> | ||
9586 | <key>Persist</key> | ||
9587 | <integer>1</integer> | ||
9588 | <key>Type</key> | ||
9589 | <string>Boolean</string> | ||
9590 | <key>Value</key> | ||
9591 | <integer>1</integer> | ||
9592 | </map> | ||
9593 | |||
9594 | <key>RenderDeferredGI</key> | ||
9595 | <map> | ||
9596 | <key>Comment</key> | ||
9597 | <string>Enable GI in deferred renderer.</string> | ||
9598 | <key>Persist</key> | ||
9599 | <integer>1</integer> | ||
9600 | <key>Type</key> | ||
9601 | <string>Boolean</string> | ||
9602 | <key>Value</key> | ||
9603 | <integer>0</integer> | ||
9604 | </map> | ||
9605 | |||
9606 | <key>RenderDeferredSunShadow</key> | 9153 | <key>RenderDeferredSunShadow</key> |
9607 | <map> | 9154 | <map> |
9608 | <key>Comment</key> | 9155 | <key>Comment</key> |
@@ -9614,67 +9161,6 @@ | |||
9614 | <key>Value</key> | 9161 | <key>Value</key> |
9615 | <integer>1</integer> | 9162 | <integer>1</integer> |
9616 | </map> | 9163 | </map> |
9617 | |||
9618 | <key>RenderDeferredSun</key> | ||
9619 | <map> | ||
9620 | <key>Comment</key> | ||
9621 | <string>Execute sunlight shader in deferred renderer.</string> | ||
9622 | <key>Persist</key> | ||
9623 | <integer>1</integer> | ||
9624 | <key>Type</key> | ||
9625 | <string>Boolean</string> | ||
9626 | <key>Value</key> | ||
9627 | <integer>1</integer> | ||
9628 | </map> | ||
9629 | |||
9630 | <key>RenderDeferredAtmospheric</key> | ||
9631 | <map> | ||
9632 | <key>Comment</key> | ||
9633 | <string>Execute atmospheric shader in deferred renderer.</string> | ||
9634 | <key>Persist</key> | ||
9635 | <integer>1</integer> | ||
9636 | <key>Type</key> | ||
9637 | <string>Boolean</string> | ||
9638 | <key>Value</key> | ||
9639 | <integer>1</integer> | ||
9640 | </map> | ||
9641 | |||
9642 | <key>RenderDeferredBlurLight</key> | ||
9643 | <map> | ||
9644 | <key>Comment</key> | ||
9645 | <string>Execute shadow softening shader in deferred renderer.</string> | ||
9646 | <key>Persist</key> | ||
9647 | <integer>1</integer> | ||
9648 | <key>Type</key> | ||
9649 | <string>Boolean</string> | ||
9650 | <key>Value</key> | ||
9651 | <integer>1</integer> | ||
9652 | </map> | ||
9653 | |||
9654 | <key>RenderDeferredLocalLights</key> | ||
9655 | <map> | ||
9656 | <key>Comment</key> | ||
9657 | <string>Execute local lighting shader in deferred renderer.</string> | ||
9658 | <key>Persist</key> | ||
9659 | <integer>1</integer> | ||
9660 | <key>Type</key> | ||
9661 | <string>Boolean</string> | ||
9662 | <key>Value</key> | ||
9663 | <integer>1</integer> | ||
9664 | </map> | ||
9665 | |||
9666 | <key>RenderDeferredFullscreenLights</key> | ||
9667 | <map> | ||
9668 | <key>Comment</key> | ||
9669 | <string>Execute local lighting shader in deferred renderer.</string> | ||
9670 | <key>Persist</key> | ||
9671 | <integer>1</integer> | ||
9672 | <key>Type</key> | ||
9673 | <string>Boolean</string> | ||
9674 | <key>Value</key> | ||
9675 | <integer>1</integer> | ||
9676 | </map> | ||
9677 | |||
9678 | <key>RenderDeferredSunWash</key> | 9164 | <key>RenderDeferredSunWash</key> |
9679 | <map> | 9165 | <map> |
9680 | <key>Comment</key> | 9166 | <key>Comment</key> |
@@ -9697,45 +9183,6 @@ | |||
9697 | <key>Value</key> | 9183 | <key>Value</key> |
9698 | <real>-0.0001</real> | 9184 | <real>-0.0001</real> |
9699 | </map> | 9185 | </map> |
9700 | <key>RenderShadowErrorCutoff</key> | ||
9701 | <map> | ||
9702 | <key>Comment</key> | ||
9703 | <string>Cutoff error value to use ortho instead of perspective projection.</string> | ||
9704 | <key>Persist</key> | ||
9705 | <integer>1</integer> | ||
9706 | <key>Type</key> | ||
9707 | <string>F32</string> | ||
9708 | <key>Value</key> | ||
9709 | <real>5.0</real> | ||
9710 | </map> | ||
9711 | <key>RenderShadowFOVCutoff</key> | ||
9712 | <map> | ||
9713 | <key>Comment</key> | ||
9714 | <string>Cutoff FOV to use ortho instead of perspective projection.</string> | ||
9715 | <key>Persist</key> | ||
9716 | <integer>1</integer> | ||
9717 | <key>Type</key> | ||
9718 | <string>F32</string> | ||
9719 | <key>Value</key> | ||
9720 | <real>1.1</real> | ||
9721 | </map> | ||
9722 | |||
9723 | <key>RenderShadowGaussian</key> | ||
9724 | <map> | ||
9725 | <key>Comment</key> | ||
9726 | <string>Gaussian coefficients for the two shadow/SSAO blurring passes (z component unused).</string> | ||
9727 | <key>Persist</key> | ||
9728 | <integer>1</integer> | ||
9729 | <key>Type</key> | ||
9730 | <string>Vector3</string> | ||
9731 | <key>Value</key> | ||
9732 | <array> | ||
9733 | <real>3.0</real> | ||
9734 | <real>2.0</real> | ||
9735 | <real>0.0</real> | ||
9736 | </array> | ||
9737 | </map> | ||
9738 | |||
9739 | <key>RenderShadowBlurSize</key> | 9186 | <key>RenderShadowBlurSize</key> |
9740 | <map> | 9187 | <map> |
9741 | <key>Comment</key> | 9188 | <key>Comment</key> |
@@ -9745,7 +9192,7 @@ | |||
9745 | <key>Type</key> | 9192 | <key>Type</key> |
9746 | <string>F32</string> | 9193 | <string>F32</string> |
9747 | <key>Value</key> | 9194 | <key>Value</key> |
9748 | <real>0.8</real> | 9195 | <real>0.7</real> |
9749 | </map> | 9196 | </map> |
9750 | <key>RenderShadowBlurSamples</key> | 9197 | <key>RenderShadowBlurSamples</key> |
9751 | <map> | 9198 | <map> |
@@ -9756,94 +9203,8 @@ | |||
9756 | <key>Type</key> | 9203 | <key>Type</key> |
9757 | <string>U32</string> | 9204 | <string>U32</string> |
9758 | <key>Value</key> | 9205 | <key>Value</key> |
9759 | <real>4</real> | 9206 | <real>5</real> |
9760 | </map> | ||
9761 | <key>RenderShadowBlurDistFactor</key> | ||
9762 | <map> | ||
9763 | <key>Comment</key> | ||
9764 | <string>Distance scaler for shadow blur.</string> | ||
9765 | <key>Persist</key> | ||
9766 | <integer>1</integer> | ||
9767 | <key>Type</key> | ||
9768 | <string>F32</string> | ||
9769 | <key>Value</key> | ||
9770 | <real>0.1</real> | ||
9771 | </map> | ||
9772 | |||
9773 | <key>RenderGIBlurColorCurve</key> | ||
9774 | <map> | ||
9775 | <key>Comment</key> | ||
9776 | <string>Color curve for GI softening kernel</string> | ||
9777 | <key>Persist</key> | ||
9778 | <integer>1</integer> | ||
9779 | <key>Type</key> | ||
9780 | <string>Vector3</string> | ||
9781 | <key>Value</key> | ||
9782 | <array> | ||
9783 | <real>1.0</real> | ||
9784 | <real>0.6</real> | ||
9785 | <real>0.1</real> | ||
9786 | </array> | ||
9787 | </map> | ||
9788 | |||
9789 | <key>RenderGIGaussian</key> | ||
9790 | <map> | ||
9791 | <key>Comment</key> | ||
9792 | <string>Gaussian coefficient for the two GI blurring passes.</string> | ||
9793 | <key>Persist</key> | ||
9794 | <integer>1</integer> | ||
9795 | <key>Type</key> | ||
9796 | <string>F32</string> | ||
9797 | <key>Value</key> | ||
9798 | <real>64</real> | ||
9799 | </map> | ||
9800 | |||
9801 | <key>RenderGIBlurPasses</key> | ||
9802 | <map> | ||
9803 | <key>Comment</key> | ||
9804 | <string>Scale of GI softening kernel.</string> | ||
9805 | <key>Persist</key> | ||
9806 | <integer>1</integer> | ||
9807 | <key>Type</key> | ||
9808 | <string>U32</string> | ||
9809 | <key>Value</key> | ||
9810 | <real>2</real> | ||
9811 | </map> | ||
9812 | |||
9813 | <key>RenderGIBlurSize</key> | ||
9814 | <map> | ||
9815 | <key>Comment</key> | ||
9816 | <string>Scale of GI softening kernel.</string> | ||
9817 | <key>Persist</key> | ||
9818 | <integer>1</integer> | ||
9819 | <key>Type</key> | ||
9820 | <string>F32</string> | ||
9821 | <key>Value</key> | ||
9822 | <real>3.0</real> | ||
9823 | </map> | ||
9824 | <key>RenderGIBlurSamples</key> | ||
9825 | <map> | ||
9826 | <key>Comment</key> | ||
9827 | <string>Number of samples to take for each pass of GI blur (value range 1-16). Actual number of samples is value * 2 - 1.</string> | ||
9828 | <key>Persist</key> | ||
9829 | <integer>1</integer> | ||
9830 | <key>Type</key> | ||
9831 | <string>U32</string> | ||
9832 | <key>Value</key> | ||
9833 | <real>6</real> | ||
9834 | </map> | 9207 | </map> |
9835 | <key>RenderGIBlurDistFactor</key> | ||
9836 | <map> | ||
9837 | <key>Comment</key> | ||
9838 | <string>Distance scaler for GI blur.</string> | ||
9839 | <key>Persist</key> | ||
9840 | <integer>1</integer> | ||
9841 | <key>Type</key> | ||
9842 | <string>F32</string> | ||
9843 | <key>Value</key> | ||
9844 | <real>0.0</real> | ||
9845 | </map> | ||
9846 | |||
9847 | <key>RenderDynamicLOD</key> | 9208 | <key>RenderDynamicLOD</key> |
9848 | <map> | 9209 | <map> |
9849 | <key>Comment</key> | 9210 | <key>Comment</key> |
@@ -10094,17 +9455,6 @@ | |||
10094 | <key>Value</key> | 9455 | <key>Value</key> |
10095 | <integer>0</integer> | 9456 | <integer>0</integer> |
10096 | </map> | 9457 | </map> |
10097 | <key>RenderHighlightSelections</key> | ||
10098 | <map> | ||
10099 | <key>Comment</key> | ||
10100 | <string>Show selection outlines on objects</string> | ||
10101 | <key>Persist</key> | ||
10102 | <integer>1</integer> | ||
10103 | <key>Type</key> | ||
10104 | <string>Boolean</string> | ||
10105 | <key>Value</key> | ||
10106 | <integer>1</integer> | ||
10107 | </map> | ||
10108 | <key>RenderHiddenSelections</key> | 9458 | <key>RenderHiddenSelections</key> |
10109 | <map> | 9459 | <map> |
10110 | <key>Comment</key> | 9460 | <key>Comment</key> |
@@ -10413,17 +9763,6 @@ | |||
10413 | <key>Value</key> | 9763 | <key>Value</key> |
10414 | <integer>0</integer> | 9764 | <integer>0</integer> |
10415 | </map> | 9765 | </map> |
10416 | <key>RenderUIBuffer</key> | ||
10417 | <map> | ||
10418 | <key>Comment</key> | ||
10419 | <string>Cache ui render in a screen aligned buffer.</string> | ||
10420 | <key>Persist</key> | ||
10421 | <integer>1</integer> | ||
10422 | <key>Type</key> | ||
10423 | <string>Boolean</string> | ||
10424 | <key>Value</key> | ||
10425 | <integer>0</integer> | ||
10426 | </map> | ||
10427 | <key>RenderUnloadedAvatar</key> | 9766 | <key>RenderUnloadedAvatar</key> |
10428 | <map> | 9767 | <map> |
10429 | <key>Comment</key> | 9768 | <key>Comment</key> |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index f90d91f..a91e9fa 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl | |||
@@ -13,9 +13,9 @@ uniform sampler2DShadow shadowMap1; | |||
13 | uniform sampler2DShadow shadowMap2; | 13 | uniform sampler2DShadow shadowMap2; |
14 | uniform sampler2DShadow shadowMap3; | 14 | uniform sampler2DShadow shadowMap3; |
15 | uniform sampler2D noiseMap; | 15 | uniform sampler2D noiseMap; |
16 | uniform sampler2DRect depthMap; | 16 | uniform sampler2DRect positionMap; |
17 | 17 | ||
18 | uniform mat4 shadow_matrix[6]; | 18 | uniform mat4 shadow_matrix[4]; |
19 | uniform vec4 shadow_clip; | 19 | uniform vec4 shadow_clip; |
20 | uniform vec2 screen_res; | 20 | uniform vec2 screen_res; |
21 | 21 | ||
@@ -26,31 +26,15 @@ varying vec3 vary_ambient; | |||
26 | varying vec3 vary_directional; | 26 | varying vec3 vary_directional; |
27 | varying vec3 vary_fragcoord; | 27 | varying vec3 vary_fragcoord; |
28 | varying vec3 vary_position; | 28 | varying vec3 vary_position; |
29 | varying vec3 vary_light; | ||
30 | 29 | ||
31 | uniform float alpha_soften; | 30 | uniform float alpha_soften; |
32 | 31 | ||
33 | uniform mat4 inv_proj; | ||
34 | |||
35 | vec4 getPosition(vec2 pos_screen) | ||
36 | { | ||
37 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
38 | vec2 sc = pos_screen.xy*2.0; | ||
39 | sc /= screen_res; | ||
40 | sc -= vec2(1.0,1.0); | ||
41 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
42 | vec4 pos = inv_proj * ndc; | ||
43 | pos /= pos.w; | ||
44 | pos.w = 1.0; | ||
45 | return pos; | ||
46 | } | ||
47 | |||
48 | void main() | 32 | void main() |
49 | { | 33 | { |
50 | vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; | 34 | vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; |
51 | frag *= screen_res; | 35 | frag *= screen_res; |
52 | 36 | ||
53 | vec3 samp_pos = getPosition(frag).xyz; | 37 | vec3 samp_pos = texture2DRect(positionMap, frag).xyz; |
54 | 38 | ||
55 | float shadow = 1.0; | 39 | float shadow = 1.0; |
56 | vec4 pos = vec4(vary_position, 1.0); | 40 | vec4 pos = vec4(vary_position, 1.0); |
@@ -98,7 +82,7 @@ void main() | |||
98 | 82 | ||
99 | //gl_FragColor = gl_Color; | 83 | //gl_FragColor = gl_Color; |
100 | gl_FragColor = color; | 84 | gl_FragColor = color; |
101 | //gl_FragColor = vec4(1,0,1,1)*shadow; | 85 | //gl_FragColor = vec4(1,0,1,1); |
102 | 86 | ||
103 | } | 87 | } |
104 | 88 | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 48baf77..b496bd6 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl | |||
@@ -20,11 +20,8 @@ varying vec3 vary_ambient; | |||
20 | varying vec3 vary_directional; | 20 | varying vec3 vary_directional; |
21 | varying vec3 vary_fragcoord; | 21 | varying vec3 vary_fragcoord; |
22 | varying vec3 vary_position; | 22 | varying vec3 vary_position; |
23 | varying vec3 vary_light; | ||
24 | 23 | ||
25 | uniform float near_clip; | 24 | uniform float near_clip; |
26 | uniform float shadow_offset; | ||
27 | uniform float shadow_bias; | ||
28 | 25 | ||
29 | void main() | 26 | void main() |
30 | { | 27 | { |
@@ -35,9 +32,8 @@ void main() | |||
35 | 32 | ||
36 | vec4 pos = (gl_ModelViewMatrix * gl_Vertex); | 33 | vec4 pos = (gl_ModelViewMatrix * gl_Vertex); |
37 | vec3 norm = normalize(gl_NormalMatrix * gl_Normal); | 34 | vec3 norm = normalize(gl_NormalMatrix * gl_Normal); |
38 | // KL this works around ATI not compiling the shader but maintains shadow offset and bias vec3 not vec4 | 35 | vary_position = pos.xyz; |
39 | vary_position = pos.xyz + norm.xyz * (-pos.z/64.0*shadow_offset+shadow_bias); | 36 | |
40 | |||
41 | calcAtmospherics(pos.xyz); | 37 | calcAtmospherics(pos.xyz); |
42 | 38 | ||
43 | //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); | 39 | //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); |
@@ -58,8 +54,6 @@ void main() | |||
58 | col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz); | 54 | col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz); |
59 | col.rgb = scaleDownLight(col.rgb); | 55 | col.rgb = scaleDownLight(col.rgb); |
60 | 56 | ||
61 | vary_light = gl_LightSource[0].position.xyz; | ||
62 | |||
63 | vary_ambient = col.rgb*gl_Color.rgb; | 57 | vary_ambient = col.rgb*gl_Color.rgb; |
64 | vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); | 58 | vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); |
65 | 59 | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaF.glsl index ff64a6b..6c94f5c 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaF.glsl | |||
@@ -12,7 +12,7 @@ uniform sampler2DShadow shadowMap2; | |||
12 | uniform sampler2DShadow shadowMap3; | 12 | uniform sampler2DShadow shadowMap3; |
13 | uniform sampler2D noiseMap; | 13 | uniform sampler2D noiseMap; |
14 | 14 | ||
15 | uniform mat4 shadow_matrix[6]; | 15 | uniform mat4 shadow_matrix[4]; |
16 | uniform vec4 shadow_clip; | 16 | uniform vec4 shadow_clip; |
17 | 17 | ||
18 | vec3 atmosLighting(vec3 light); | 18 | vec3 atmosLighting(vec3 light); |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl index 4b9cca2..58aa5a9 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl | |||
@@ -8,18 +8,13 @@ | |||
8 | uniform sampler2D diffuseMap; | 8 | uniform sampler2D diffuseMap; |
9 | 9 | ||
10 | varying vec3 vary_normal; | 10 | varying vec3 vary_normal; |
11 | varying vec4 vary_position; | ||
11 | 12 | ||
12 | void main() | 13 | void main() |
13 | { | 14 | { |
14 | vec4 diff = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy); | 15 | gl_FragData[0] = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy); |
15 | // Viewer 2.0 uses 0.2 but for KL's viewer if i want a complete avatar need this to be 0.0 for now. | ||
16 | if (diff.a < 0.0) | ||
17 | { | ||
18 | discard; | ||
19 | } | ||
20 | |||
21 | gl_FragData[0] = vec4(diff.rgb, 1.0); | ||
22 | gl_FragData[1] = vec4(0,0,0,0); | 16 | gl_FragData[1] = vec4(0,0,0,0); |
23 | gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0); | 17 | gl_FragData[2] = vec4(normalize(vary_normal), 0.0); |
18 | gl_FragData[3] = vary_position; | ||
24 | } | 19 | } |
25 | 20 | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl index 00083eb..27c09db 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl | |||
@@ -10,7 +10,6 @@ uniform sampler2D diffuseMap; | |||
10 | 10 | ||
11 | void main() | 11 | void main() |
12 | { | 12 | { |
13 | gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a); | 13 | gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy)); |
14 | //gl_FragColor = vec4(1,1,1,1); | ||
15 | } | 14 | } |
16 | 15 | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl index 8c8489d..14da6b1 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl | |||
@@ -28,7 +28,8 @@ void main() | |||
28 | norm = normalize(norm); | 28 | norm = normalize(norm); |
29 | 29 | ||
30 | pos = gl_ProjectionMatrix * pos; | 30 | pos = gl_ProjectionMatrix * pos; |
31 | pos.z = max(pos.z, -pos.w+0.01); | 31 | //smash geometry against near clip plane |
32 | pos.z = max(pos.z, -1.0); | ||
32 | gl_Position = pos; | 33 | gl_Position = pos; |
33 | 34 | ||
34 | gl_FrontColor = gl_Color; | 35 | gl_FrontColor = gl_Color; |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl index 471a1f0..12a7ff7 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl | |||
@@ -10,6 +10,7 @@ mat4 getSkinnedTransform(); | |||
10 | attribute vec4 weight; | 10 | attribute vec4 weight; |
11 | 11 | ||
12 | varying vec3 vary_normal; | 12 | varying vec3 vary_normal; |
13 | varying vec4 vary_position; | ||
13 | 14 | ||
14 | void main() | 15 | void main() |
15 | { | 16 | { |
@@ -29,6 +30,7 @@ void main() | |||
29 | norm.z = dot(trans[2].xyz, gl_Normal); | 30 | norm.z = dot(trans[2].xyz, gl_Normal); |
30 | norm = normalize(norm); | 31 | norm = normalize(norm); |
31 | 32 | ||
33 | vary_position = pos; | ||
32 | vary_normal = norm; | 34 | vary_normal = norm; |
33 | 35 | ||
34 | gl_Position = gl_ProjectionMatrix * pos; | 36 | gl_Position = gl_ProjectionMatrix * pos; |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index 1713fe9..3c6700a 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl | |||
@@ -7,11 +7,10 @@ | |||
7 | 7 | ||
8 | #extension GL_ARB_texture_rectangle : enable | 8 | #extension GL_ARB_texture_rectangle : enable |
9 | 9 | ||
10 | uniform sampler2DRect depthMap; | 10 | uniform sampler2DRect positionMap; |
11 | uniform sampler2DRect normalMap; | 11 | uniform sampler2DRect normalMap; |
12 | uniform sampler2DRect lightMap; | 12 | uniform sampler2DRect lightMap; |
13 | 13 | ||
14 | uniform float dist_factor; | ||
15 | uniform float blur_size; | 14 | uniform float blur_size; |
16 | uniform vec2 delta; | 15 | uniform vec2 delta; |
17 | uniform vec3 kern[32]; | 16 | uniform vec3 kern[32]; |
@@ -20,52 +19,30 @@ uniform float kern_scale; | |||
20 | 19 | ||
21 | varying vec2 vary_fragcoord; | 20 | varying vec2 vary_fragcoord; |
22 | 21 | ||
23 | uniform mat4 inv_proj; | ||
24 | uniform vec2 screen_res; | ||
25 | |||
26 | vec4 getPosition(vec2 pos_screen) | ||
27 | { | ||
28 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
29 | vec2 sc = pos_screen.xy*2.0; | ||
30 | sc /= screen_res; | ||
31 | sc -= vec2(1.0,1.0); | ||
32 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
33 | vec4 pos = inv_proj * ndc; | ||
34 | pos /= pos.w; | ||
35 | pos.w = 1.0; | ||
36 | return pos; | ||
37 | } | ||
38 | |||
39 | void main() | 22 | void main() |
40 | { | 23 | { |
41 | vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz*2.0-1.0; | 24 | vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz; |
42 | vec3 pos = getPosition(vary_fragcoord.xy).xyz; | 25 | vec3 pos = texture2DRect(positionMap, vary_fragcoord.xy).xyz; |
43 | vec4 ccol = texture2DRect(lightMap, vary_fragcoord.xy).rgba; | 26 | vec2 ccol = texture2DRect(lightMap, vary_fragcoord.xy).rg; |
44 | 27 | ||
45 | vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); | 28 | vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); |
46 | 29 | ||
47 | dlt /= max(-pos.z*dist_factor, 1.0); | ||
48 | |||
49 | vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free' | 30 | vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free' |
50 | vec4 col = defined_weight.xyxx * ccol; | 31 | vec2 col = defined_weight * ccol; |
51 | 32 | ||
52 | for (int i = 1; i < kern_length; i++) | 33 | for (int i = 1; i < kern_length; i++) |
53 | { | 34 | { |
54 | vec2 tc = vary_fragcoord.xy + kern[i].z*dlt; | 35 | vec2 tc = vary_fragcoord.xy + kern[i].z*dlt; |
55 | vec3 samppos = getPosition(tc).xyz; | 36 | vec3 samppos = texture2DRect(positionMap, tc).xyz; |
56 | float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane | 37 | float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane |
57 | if (d*d <= 0.003) | 38 | if (d*d <= 0.003) |
58 | { | 39 | { |
59 | col += texture2DRect(lightMap, tc)*kern[i].xyxx; | 40 | col += texture2DRect(lightMap, tc).rg*kern[i].xy; |
60 | defined_weight += kern[i].xy; | 41 | defined_weight += kern[i].xy; |
61 | } | 42 | } |
62 | } | 43 | } |
63 | 44 | ||
45 | col /= defined_weight; | ||
64 | 46 | ||
65 | 47 | gl_FragColor = vec4(col.r, col.g, 0.0, 1.0); | |
66 | col /= defined_weight.xyxx; | ||
67 | |||
68 | gl_FragColor = col; | ||
69 | |||
70 | //gl_FragColor = ccol; | ||
71 | } | 48 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl index 1c29dae..a8712bc 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl | |||
@@ -11,6 +11,7 @@ uniform sampler2D bumpMap; | |||
11 | varying vec3 vary_mat0; | 11 | varying vec3 vary_mat0; |
12 | varying vec3 vary_mat1; | 12 | varying vec3 vary_mat1; |
13 | varying vec3 vary_mat2; | 13 | varying vec3 vary_mat2; |
14 | varying vec4 vary_position; | ||
14 | 15 | ||
15 | void main() | 16 | void main() |
16 | { | 17 | { |
@@ -21,7 +22,8 @@ void main() | |||
21 | dot(norm,vary_mat1), | 22 | dot(norm,vary_mat1), |
22 | dot(norm,vary_mat2)); | 23 | dot(norm,vary_mat2)); |
23 | 24 | ||
24 | gl_FragData[0] = vec4(gl_Color.rgb*col, 0.0); | 25 | gl_FragData[0].rgb = gl_Color.rgb*col; |
25 | gl_FragData[1] = vec4(col*gl_Color.a, gl_Color.a); | 26 | gl_FragData[1] = vec4(col*(gl_Color.a*1.5), gl_Color.a); |
26 | gl_FragData[2] = vec4(normalize(tnorm)*0.5+0.5, 0.0); | 27 | gl_FragData[2] = vec4(normalize(tnorm), 0.0); |
28 | gl_FragData[3] = vary_position; | ||
27 | } | 29 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl index 9589912..ba18092 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl | |||
@@ -8,6 +8,7 @@ | |||
8 | varying vec3 vary_mat0; | 8 | varying vec3 vary_mat0; |
9 | varying vec3 vary_mat1; | 9 | varying vec3 vary_mat1; |
10 | varying vec3 vary_mat2; | 10 | varying vec3 vary_mat2; |
11 | varying vec4 vary_position; | ||
11 | 12 | ||
12 | void main() | 13 | void main() |
13 | { | 14 | { |
@@ -15,6 +16,8 @@ void main() | |||
15 | gl_Position = ftransform(); | 16 | gl_Position = ftransform(); |
16 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; | 17 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; |
17 | 18 | ||
19 | vary_position = gl_ModelViewMatrix * gl_Vertex; | ||
20 | |||
18 | vec3 n = normalize(gl_NormalMatrix * gl_Normal); | 21 | vec3 n = normalize(gl_NormalMatrix * gl_Normal); |
19 | vec3 b = normalize(gl_NormalMatrix * gl_MultiTexCoord2.xyz); | 22 | vec3 b = normalize(gl_NormalMatrix * gl_MultiTexCoord2.xyz); |
20 | vec3 t = cross(b, n); | 23 | vec3 t = cross(b, n); |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl index 919dd5d..f2ba2df 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl | |||
@@ -8,11 +8,13 @@ | |||
8 | uniform sampler2D diffuseMap; | 8 | uniform sampler2D diffuseMap; |
9 | 9 | ||
10 | varying vec3 vary_normal; | 10 | varying vec3 vary_normal; |
11 | varying vec4 vary_position; | ||
11 | 12 | ||
12 | void main() | 13 | void main() |
13 | { | 14 | { |
14 | vec3 col = texture2D(diffuseMap, gl_TexCoord[0].xy).rgb; | 15 | vec3 col = texture2D(diffuseMap, gl_TexCoord[0].xy).rgb; |
15 | gl_FragData[0] = vec4(gl_Color.rgb*col, 1.0); // KL viewer 2.0 has 0.0 but this is not working right yet besides i like to see my eyes :) | 16 | gl_FragData[0] = vec4(gl_Color.rgb*col, 1.0); |
16 | gl_FragData[1] = vec4(col*(gl_Color.a*1.5), gl_Color.a); | 17 | gl_FragData[1] = vec4(col*(gl_Color.a*1.5), gl_Color.a); |
17 | gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0); | 18 | gl_FragData[2] = vec4(normalize(vary_normal), 0.0); |
19 | gl_FragData[3] = vary_position; | ||
18 | } | 20 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl index 44468cd..3413a7f 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl | |||
@@ -6,13 +6,16 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | varying vec3 vary_normal; | 8 | varying vec3 vary_normal; |
9 | varying vec4 vary_position; | ||
9 | 10 | ||
10 | void main() | 11 | void main() |
11 | { | 12 | { |
12 | //transform vertex | 13 | //transform vertex |
13 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; | 14 | gl_Position = ftransform(); |
14 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; | 15 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; |
15 | 16 | ||
17 | vary_position = gl_ModelViewMatrix * gl_Vertex; | ||
18 | |||
16 | vary_normal = normalize(gl_NormalMatrix * gl_Normal); | 19 | vary_normal = normalize(gl_NormalMatrix * gl_Normal); |
17 | 20 | ||
18 | gl_FrontColor = gl_Color; | 21 | gl_FrontColor = gl_Color; |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index e518bdd..2a811c5 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl | |||
@@ -8,9 +8,14 @@ | |||
8 | #extension GL_ARB_texture_rectangle : enable | 8 | #extension GL_ARB_texture_rectangle : enable |
9 | 9 | ||
10 | uniform sampler2D diffuseMap; | 10 | uniform sampler2D diffuseMap; |
11 | uniform sampler2DRect depthMap; | 11 | uniform sampler2DShadow shadowMap0; |
12 | uniform sampler2DShadow shadowMap1; | ||
13 | uniform sampler2DShadow shadowMap2; | ||
14 | uniform sampler2DShadow shadowMap3; | ||
12 | uniform sampler2D noiseMap; | 15 | uniform sampler2D noiseMap; |
16 | uniform sampler2DRect positionMap; | ||
13 | 17 | ||
18 | uniform mat4 shadow_matrix[4]; | ||
14 | uniform vec4 shadow_clip; | 19 | uniform vec4 shadow_clip; |
15 | uniform vec2 screen_res; | 20 | uniform vec2 screen_res; |
16 | 21 | ||
@@ -25,27 +30,12 @@ varying vec3 vary_fragcoord; | |||
25 | 30 | ||
26 | uniform float alpha_soften; | 31 | uniform float alpha_soften; |
27 | 32 | ||
28 | uniform mat4 inv_proj; | ||
29 | |||
30 | vec4 getPosition(vec2 pos_screen) | ||
31 | { | ||
32 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
33 | vec2 sc = pos_screen.xy*2.0; | ||
34 | sc /= screen_res; | ||
35 | sc -= vec2(1.0,1.0); | ||
36 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
37 | vec4 pos = inv_proj * ndc; | ||
38 | pos /= pos.w; | ||
39 | pos.w = 1.0; | ||
40 | return pos; | ||
41 | } | ||
42 | |||
43 | void main() | 33 | void main() |
44 | { | 34 | { |
45 | vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; | 35 | vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; |
46 | frag *= screen_res; | 36 | frag *= screen_res; |
47 | 37 | ||
48 | vec3 samp_pos = getPosition(frag).xyz; | 38 | vec3 samp_pos = texture2DRect(positionMap, frag).xyz; |
49 | 39 | ||
50 | float shadow = 1.0; | 40 | float shadow = 1.0; |
51 | vec4 pos = vary_position; | 41 | vec4 pos = vary_position; |
@@ -56,10 +46,10 @@ void main() | |||
56 | 46 | ||
57 | color.rgb = fullbrightScaleSoftClip(color.rgb); | 47 | color.rgb = fullbrightScaleSoftClip(color.rgb); |
58 | 48 | ||
59 | if (samp_pos.z != 0.0 && color.a < 1.0) | 49 | if (samp_pos.z != 0.0) |
60 | { | 50 | { |
61 | float dist_factor = alpha_soften; | 51 | float dist_factor = alpha_soften; |
62 | float a = color.a; | 52 | float a = gl_Color.a; |
63 | a *= a; | 53 | a *= a; |
64 | dist_factor *= 1.0/(1.0-a); | 54 | dist_factor *= 1.0/(1.0-a); |
65 | color.a *= min((pos.z-samp_pos.z)*dist_factor, 1.0); | 55 | color.a *= min((pos.z-samp_pos.z)*dist_factor, 1.0); |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl index aff5117..6381a1c 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl | |||
@@ -12,12 +12,12 @@ vec3 atmosAffectDirectionalLight(float lightIntensity); | |||
12 | vec3 scaleDownLight(vec3 light); | 12 | vec3 scaleDownLight(vec3 light); |
13 | vec3 scaleUpLight(vec3 light); | 13 | vec3 scaleUpLight(vec3 light); |
14 | 14 | ||
15 | varying vec4 vary_position; | ||
15 | varying vec3 vary_ambient; | 16 | varying vec3 vary_ambient; |
16 | varying vec3 vary_directional; | 17 | varying vec3 vary_directional; |
17 | varying vec3 vary_normal; | 18 | varying vec3 vary_normal; |
18 | varying vec3 vary_fragcoord; | 19 | varying vec3 vary_fragcoord; |
19 | uniform float near_clip; | 20 | uniform float near_clip; |
20 | varying vec4 vary_position; | ||
21 | 21 | ||
22 | void main() | 22 | void main() |
23 | { | 23 | { |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/giF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/giF.glsl deleted file mode 100644 index b351eec..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/giF.glsl +++ /dev/null | |||
@@ -1,165 +0,0 @@ | |||
1 | /** | ||
2 | * @file giF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2DRect depthMap; | ||
11 | uniform sampler2DRect normalMap; | ||
12 | uniform sampler2D noiseMap; | ||
13 | |||
14 | uniform sampler2D diffuseGIMap; | ||
15 | uniform sampler2D normalGIMap; | ||
16 | uniform sampler2D depthGIMap; | ||
17 | |||
18 | uniform sampler2D lightFunc; | ||
19 | |||
20 | // Inputs | ||
21 | varying vec2 vary_fragcoord; | ||
22 | |||
23 | uniform vec2 screen_res; | ||
24 | |||
25 | uniform mat4 inv_proj; | ||
26 | uniform mat4 gi_mat; //gPipeline.mGIMatrix - eye space to sun space | ||
27 | uniform mat4 gi_mat_proj; //gPipeline.mGIMatrixProj - eye space to projected sun space | ||
28 | uniform mat4 gi_norm_mat; //gPipeline.mGINormalMatrix - eye space normal to sun space normal matrix | ||
29 | uniform mat4 gi_inv_proj; //gPipeline.mGIInvProj - projected sun space to sun space | ||
30 | uniform float gi_radius; | ||
31 | uniform float gi_intensity; | ||
32 | uniform int gi_samples; | ||
33 | uniform vec2 gi_kern[25]; | ||
34 | uniform vec2 gi_scale; | ||
35 | uniform vec3 gi_quad; | ||
36 | uniform vec3 gi_spec; | ||
37 | uniform float gi_direction_weight; | ||
38 | uniform float gi_light_offset; | ||
39 | |||
40 | vec4 getPosition(vec2 pos_screen) | ||
41 | { | ||
42 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
43 | vec2 sc = pos_screen.xy*2.0; | ||
44 | sc /= screen_res; | ||
45 | sc -= vec2(1.0,1.0); | ||
46 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
47 | vec4 pos = inv_proj * ndc; | ||
48 | pos /= pos.w; | ||
49 | pos.w = 1.0; | ||
50 | return pos; | ||
51 | } | ||
52 | |||
53 | vec4 getGIPosition(vec2 gi_tc) | ||
54 | { | ||
55 | float depth = texture2D(depthGIMap, gi_tc).a; | ||
56 | vec2 sc = gi_tc*2.0; | ||
57 | sc -= vec2(1.0, 1.0); | ||
58 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
59 | vec4 pos = gi_inv_proj*ndc; | ||
60 | pos.xyz /= pos.w; | ||
61 | pos.w = 1.0; | ||
62 | return pos; | ||
63 | } | ||
64 | |||
65 | vec3 giAmbient(vec3 pos, vec3 norm) | ||
66 | { | ||
67 | vec4 gi_c = gi_mat_proj * vec4(pos, 1.0); | ||
68 | gi_c.xyz /= gi_c.w; | ||
69 | |||
70 | vec4 gi_pos = gi_mat*vec4(pos,1.0); | ||
71 | vec3 gi_norm = (gi_norm_mat*vec4(norm,1.0)).xyz; | ||
72 | gi_norm = normalize(gi_norm); | ||
73 | |||
74 | vec2 tcx = gi_norm.xy; | ||
75 | vec2 tcy = gi_norm.yx; | ||
76 | |||
77 | vec4 eye_pos = gi_mat*vec4(0,0,0,1.0); | ||
78 | |||
79 | vec3 eye_dir = normalize(gi_pos.xyz-eye_pos.xyz/eye_pos.w); | ||
80 | |||
81 | //vec3 eye_dir = vec3(0,0,-1); | ||
82 | //eye_dir = (gi_norm_mat*vec4(eye_dir, 1.0)).xyz; | ||
83 | //eye_dir = normalize(eye_dir); | ||
84 | |||
85 | //float round_x = gi_scale.x; | ||
86 | //float round_y = gi_scale.y; | ||
87 | |||
88 | vec3 debug = texture2D(normalGIMap, gi_c.xy).rgb*0.5+0.5; | ||
89 | debug.xz = vec2(0.0,0.0); | ||
90 | //debug = fract(debug); | ||
91 | |||
92 | float round_x = 1.0/64.0; | ||
93 | float round_y = 1.0/64.0; | ||
94 | |||
95 | //gi_c.x = floor(gi_c.x/round_x+0.5)*round_x; | ||
96 | //gi_c.y = floor(gi_c.y/round_y+0.5)*round_y; | ||
97 | |||
98 | float fda = 0.0; | ||
99 | vec3 fdiff = vec3(0,0,0); | ||
100 | |||
101 | vec3 rcol = vec3(0,0,0); | ||
102 | |||
103 | float fsa = 0.0; | ||
104 | |||
105 | for (int i = -1; i < 2; i+=2 ) | ||
106 | { | ||
107 | for (int j = -1; j < 2; j+=2) | ||
108 | { | ||
109 | vec2 tc = vec2(i, j)*0.75; | ||
110 | vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0+tc*0.5).xyz; | ||
111 | //tc += gi_norm.xy*nz.z; | ||
112 | tc += nz.xy*2.0; | ||
113 | tc /= gi_samples; | ||
114 | tc += gi_c.xy; | ||
115 | |||
116 | vec3 lnorm = -normalize(texture2D(normalGIMap, tc.xy).xyz*2.0-1.0); | ||
117 | vec3 lpos = getGIPosition(tc.xy).xyz; | ||
118 | |||
119 | vec3 at = lpos-gi_pos.xyz; | ||
120 | float dist = dot(at,at); | ||
121 | float da = clamp(1.0/(gi_spec.x*dist), 0.0, 1.0); | ||
122 | |||
123 | if (da > 0.0) | ||
124 | { | ||
125 | //add angular attenuation | ||
126 | vec3 ldir = at; | ||
127 | float ang_atten = clamp(dot(ldir, gi_norm), 0.0, 1.0); | ||
128 | |||
129 | float ld = -dot(ldir, lnorm); | ||
130 | |||
131 | if (ang_atten > 0.0 && ld < 0.0) | ||
132 | { | ||
133 | vec3 diff = texture2D(diffuseGIMap, tc.xy).xyz; | ||
134 | da = da*ang_atten; | ||
135 | fda += da; | ||
136 | fdiff += diff*da; | ||
137 | } | ||
138 | } | ||
139 | } | ||
140 | } | ||
141 | |||
142 | fdiff /= max(gi_spec.y*fda, gi_quad.z); | ||
143 | fdiff = clamp(fdiff, vec3(0), vec3(1)); | ||
144 | |||
145 | vec3 ret = fda*fdiff; | ||
146 | //ret = ret*ret*gi_quad.x+ret*gi_quad.y+gi_quad.z; | ||
147 | |||
148 | //fda *= nz.z; | ||
149 | |||
150 | //rcol.rgb *= gi_intensity; | ||
151 | //return rcol.rgb+vary_AmblitColor.rgb*0.25; | ||
152 | //return vec4(debug, 0.0); | ||
153 | //return vec4(fda*fdiff, 0.0); | ||
154 | return clamp(ret,vec3(0.0), vec3(1.0)); | ||
155 | //return debug.xyz; | ||
156 | } | ||
157 | |||
158 | void main() | ||
159 | { | ||
160 | vec2 pos_screen = vary_fragcoord.xy; | ||
161 | vec4 pos = getPosition(pos_screen); | ||
162 | vec3 norm = texture2DRect(normalMap, pos_screen).xyz*2.0-1.0; | ||
163 | |||
164 | gl_FragData[0].xyz = giAmbient(pos, norm); | ||
165 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/giV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/giV.glsl deleted file mode 100644 index 71dcea9..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/giV.glsl +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /** | ||
2 | * @file giV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | |||
10 | uniform vec2 screen_res; | ||
11 | |||
12 | void main() | ||
13 | { | ||
14 | //transform vertex | ||
15 | gl_Position = ftransform(); | ||
16 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
17 | vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; | ||
18 | vec4 tex = gl_MultiTexCoord0; | ||
19 | tex.w = 1.0; | ||
20 | |||
21 | gl_FrontColor = gl_Color; | ||
22 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl deleted file mode 100644 index e8b53b0..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /** | ||
2 | * @file luminanceF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect diffuseMap; | ||
9 | |||
10 | varying vec2 vary_fragcoord; | ||
11 | |||
12 | void main() | ||
13 | { | ||
14 | gl_FragColor = texture2DRect(diffuseMap, vary_fragcoord.xy); | ||
15 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl deleted file mode 100644 index db8775f..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /** | ||
2 | * @file giV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | |||
10 | uniform vec2 screen_res; | ||
11 | |||
12 | void main() | ||
13 | { | ||
14 | //transform vertex | ||
15 | gl_Position = ftransform(); | ||
16 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
17 | vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; | ||
18 | |||
19 | gl_FrontColor = gl_Color; | ||
20 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index ce0494c..3689d12 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl | |||
@@ -7,15 +7,13 @@ | |||
7 | 7 | ||
8 | #extension GL_ARB_texture_rectangle : enable | 8 | #extension GL_ARB_texture_rectangle : enable |
9 | 9 | ||
10 | uniform sampler2DRect depthMap; | ||
11 | uniform sampler2DRect diffuseRect; | 10 | uniform sampler2DRect diffuseRect; |
12 | uniform sampler2DRect specularRect; | 11 | uniform sampler2DRect specularRect; |
12 | uniform sampler2DRect positionMap; | ||
13 | uniform sampler2DRect normalMap; | 13 | uniform sampler2DRect normalMap; |
14 | uniform samplerCube environmentMap; | 14 | uniform samplerCube environmentMap; |
15 | uniform sampler2DRect lightMap; | 15 | uniform sampler2DRect lightMap; |
16 | uniform sampler2D noiseMap; | 16 | uniform sampler2D noiseMap; |
17 | uniform sampler2D lightFunc; | ||
18 | |||
19 | 17 | ||
20 | uniform vec3 env_mat[3]; | 18 | uniform vec3 env_mat[3]; |
21 | uniform float sun_wash; | 19 | uniform float sun_wash; |
@@ -25,48 +23,24 @@ uniform int light_count; | |||
25 | uniform vec4 light[16]; | 23 | uniform vec4 light[16]; |
26 | uniform vec4 light_col[16]; | 24 | uniform vec4 light_col[16]; |
27 | 25 | ||
28 | varying vec4 vary_fragcoord; | 26 | varying vec3 vary_fragcoord; |
29 | uniform vec2 screen_res; | 27 | uniform vec2 screen_res; |
30 | 28 | ||
31 | uniform float far_z; | ||
32 | |||
33 | uniform mat4 inv_proj; | ||
34 | |||
35 | vec4 getPosition(vec2 pos_screen) | ||
36 | { | ||
37 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
38 | vec2 sc = pos_screen.xy*2.0; | ||
39 | sc /= screen_res; | ||
40 | sc -= vec2(1.0,1.0); | ||
41 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
42 | vec4 pos = inv_proj * ndc; | ||
43 | pos /= pos.w; | ||
44 | pos.w = 1.0; | ||
45 | return pos; | ||
46 | } | ||
47 | |||
48 | void main() | 29 | void main() |
49 | { | 30 | { |
50 | vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res; | 31 | vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res; |
51 | vec3 pos = getPosition(frag.xy).xyz; | 32 | vec3 pos = texture2DRect(positionMap, frag.xy).xyz; |
52 | if (pos.z < far_z) | 33 | vec3 norm = normalize(texture2DRect(normalMap, frag.xy).xyz); |
53 | { | ||
54 | discard; | ||
55 | } | ||
56 | |||
57 | vec3 norm = normalize(texture2DRect(normalMap, frag.xy).xyz*2.0-1.0); | ||
58 | vec4 spec = texture2DRect(specularRect, frag.xy); | 34 | vec4 spec = texture2DRect(specularRect, frag.xy); |
59 | vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb; | 35 | vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb; |
60 | float noise = texture2D(noiseMap, frag.xy/128.0).b; | 36 | float noise = texture2D(noiseMap, frag.xy/128.0).b; |
61 | vec3 out_col = vec3(0,0,0); | 37 | vec3 out_col = vec3(0,0,0); |
62 | vec3 npos = normalize(-pos); | ||
63 | 38 | ||
64 | for (int i = 0; i < light_count; ++i) | 39 | for (int i = 0; i < light_count; ++i) |
65 | { | 40 | { |
66 | vec3 lv = light[i].xyz-pos; | 41 | vec3 lv = light[i].xyz-pos; |
67 | float dist2 = dot(lv,lv); | 42 | float dist2 = dot(lv,lv); |
68 | dist2 /= light[i].w; | 43 | if (dist2 > light[i].w) |
69 | if (dist2 > 1.0) | ||
70 | { | 44 | { |
71 | continue; | 45 | continue; |
72 | } | 46 | } |
@@ -81,41 +55,29 @@ void main() | |||
81 | da = dot(norm, lv); | 55 | da = dot(norm, lv); |
82 | 56 | ||
83 | float fa = light_col[i].a+1.0; | 57 | float fa = light_col[i].a+1.0; |
84 | float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); | 58 | float dist_atten = clamp(1.0-(dist2-light[i].w*(1.0-fa))/(light[i].w*fa), 0.0, 1.0); |
85 | dist_atten *= noise; | 59 | dist_atten *= noise; |
86 | 60 | ||
87 | float lit = da * dist_atten; | 61 | float lit = da * dist_atten; |
88 | 62 | ||
89 | vec3 col = light_col[i].rgb*lit*diff; | 63 | vec3 col = light_col[i].rgb*lit*diff; |
90 | //vec3 col = vec3(dist2, light_col[i].a, lit); | ||
91 | 64 | ||
92 | if (spec.a > 0.0) | 65 | if (spec.a > 0.0) |
93 | { | 66 | { |
94 | //vec3 ref = dot(pos+lv, norm); | 67 | vec3 ref = reflect(normalize(pos), norm); |
95 | 68 | float sa = dot(ref,lv); | |
96 | float sa = dot(normalize(lv+npos),norm); | 69 | sa = max(sa, 0.0); |
97 | 70 | sa = pow(sa, 128.0 * spec.a*spec.a/dist_atten)*min(dist_atten*4.0, 1.0); | |
98 | if (sa > 0) | 71 | sa *= noise; |
99 | { | 72 | col += da*sa*light_col[i].rgb*spec.rgb; |
100 | sa = texture2D(lightFunc,vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); | ||
101 | sa *= noise; | ||
102 | col += da*sa*light_col[i].rgb*spec.rgb; | ||
103 | } | ||
104 | } | 73 | } |
105 | 74 | ||
106 | out_col += col; | 75 | out_col += col; |
107 | } | 76 | } |
108 | 77 | ||
109 | if (dot(out_col, out_col) <= 0.0) | ||
110 | { | ||
111 | discard; | ||
112 | } | ||
113 | |||
114 | //attenuate point light contribution by SSAO component | 78 | //attenuate point light contribution by SSAO component |
115 | out_col *= texture2DRect(lightMap, frag.xy).g; | 79 | out_col *= texture2DRect(lightMap, frag.xy).g; |
116 | 80 | ||
117 | gl_FragColor.rgb = out_col; | 81 | gl_FragColor.rgb = out_col; |
118 | gl_FragColor.a = 0.0; | 82 | gl_FragColor.a = 0.0; |
119 | |||
120 | //gl_FragColor = vec4(0.1, 0.025, 0.025/4.0, 0.0); | ||
121 | } | 83 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl deleted file mode 100644 index 021e8a2..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ /dev/null | |||
@@ -1,184 +0,0 @@ | |||
1 | /** | ||
2 | * @file multiSpotLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #version 120 | ||
9 | |||
10 | #extension GL_ARB_texture_rectangle : enable | ||
11 | |||
12 | uniform sampler2DRect diffuseRect; | ||
13 | uniform sampler2DRect specularRect; | ||
14 | uniform sampler2DRect depthMap; | ||
15 | uniform sampler2DRect normalMap; | ||
16 | uniform samplerCube environmentMap; | ||
17 | uniform sampler2DRect lightMap; | ||
18 | uniform sampler2D noiseMap; | ||
19 | uniform sampler2D lightFunc; | ||
20 | uniform sampler2D projectionMap; | ||
21 | |||
22 | uniform mat4 proj_mat; //screen space to light space | ||
23 | uniform float proj_near; //near clip for projection | ||
24 | uniform vec3 proj_p; //plane projection is emitting from (in screen space) | ||
25 | uniform vec3 proj_n; | ||
26 | uniform float proj_focus; //distance from plane to begin blurring | ||
27 | uniform float proj_lod; //(number of mips in proj map) | ||
28 | uniform float proj_range; //range between near clip and far clip plane of projection | ||
29 | uniform float proj_ambient_lod; | ||
30 | uniform float proj_ambiance; | ||
31 | uniform float near_clip; | ||
32 | uniform float far_clip; | ||
33 | |||
34 | uniform vec3 proj_origin; //origin of projection to be used for angular attenuation | ||
35 | uniform float sun_wash; | ||
36 | uniform int proj_shadow_idx; | ||
37 | uniform float shadow_fade; | ||
38 | |||
39 | varying vec4 vary_light; | ||
40 | |||
41 | varying vec4 vary_fragcoord; | ||
42 | uniform vec2 screen_res; | ||
43 | |||
44 | uniform mat4 inv_proj; | ||
45 | |||
46 | vec4 getPosition(vec2 pos_screen) | ||
47 | { | ||
48 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
49 | vec2 sc = pos_screen.xy*2.0; | ||
50 | sc /= screen_res; | ||
51 | sc -= vec2(1.0,1.0); | ||
52 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
53 | vec4 pos = inv_proj * ndc; | ||
54 | pos /= pos.w; | ||
55 | pos.w = 1.0; | ||
56 | return pos; | ||
57 | } | ||
58 | |||
59 | void main() | ||
60 | { | ||
61 | vec4 frag = vary_fragcoord; | ||
62 | frag.xyz /= frag.w; | ||
63 | frag.xyz = frag.xyz*0.5+0.5; | ||
64 | frag.xy *= screen_res; | ||
65 | |||
66 | vec3 pos = getPosition(frag.xy).xyz; | ||
67 | vec3 lv = vary_light.xyz-pos.xyz; | ||
68 | float dist2 = dot(lv,lv); | ||
69 | dist2 /= vary_light.w; | ||
70 | if (dist2 > 1.0) | ||
71 | { | ||
72 | discard; | ||
73 | } | ||
74 | |||
75 | float shadow = 1.0; | ||
76 | |||
77 | if (proj_shadow_idx >= 0) | ||
78 | { | ||
79 | vec4 shd = texture2DRect(lightMap, frag.xy); | ||
80 | float sh[2]; | ||
81 | sh[0] = shd.b; | ||
82 | sh[1] = shd.a; | ||
83 | shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); | ||
84 | } | ||
85 | |||
86 | vec3 norm = texture2DRect(normalMap, frag.xy).xyz*2.0-1.0; | ||
87 | |||
88 | norm = normalize(norm); | ||
89 | float l_dist = -dot(lv, proj_n); | ||
90 | |||
91 | vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); | ||
92 | if (proj_tc.z < 0.0) | ||
93 | { | ||
94 | discard; | ||
95 | } | ||
96 | |||
97 | proj_tc.xyz /= proj_tc.w; | ||
98 | |||
99 | float fa = gl_Color.a+1.0; | ||
100 | float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); | ||
101 | |||
102 | lv = proj_origin-pos.xyz; | ||
103 | lv = normalize(lv); | ||
104 | float da = dot(norm, lv); | ||
105 | |||
106 | vec3 col = vec3(0,0,0); | ||
107 | |||
108 | vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; | ||
109 | |||
110 | float noise = texture2D(noiseMap, frag.xy/128.0).b; | ||
111 | if (proj_tc.z > 0.0 && | ||
112 | proj_tc.x < 1.0 && | ||
113 | proj_tc.y < 1.0 && | ||
114 | proj_tc.x > 0.0 && | ||
115 | proj_tc.y > 0.0) | ||
116 | { | ||
117 | float lit = 0.0; | ||
118 | float amb_da = proj_ambiance; | ||
119 | |||
120 | if (da > 0.0) | ||
121 | { | ||
122 | float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); | ||
123 | float lod = diff * proj_lod; | ||
124 | |||
125 | vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod); | ||
126 | |||
127 | vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; | ||
128 | |||
129 | lit = da * dist_atten * noise; | ||
130 | |||
131 | col = lcol*lit*diff_tex*shadow; | ||
132 | amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; | ||
133 | } | ||
134 | |||
135 | //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); | ||
136 | vec4 amb_plcol = texture2DLod(projectionMap, proj_tc.xy, proj_ambient_lod); | ||
137 | |||
138 | amb_da += (da*da*0.5+0.5)*proj_ambiance; | ||
139 | |||
140 | amb_da *= dist_atten * noise; | ||
141 | |||
142 | amb_da = min(amb_da, 1.0-lit); | ||
143 | |||
144 | col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; | ||
145 | } | ||
146 | |||
147 | |||
148 | vec4 spec = texture2DRect(specularRect, frag.xy); | ||
149 | if (spec.a > 0.0) | ||
150 | { | ||
151 | vec3 ref = reflect(normalize(pos), norm); | ||
152 | |||
153 | //project from point pos in direction ref to plane proj_p, proj_n | ||
154 | vec3 pdelta = proj_p-pos; | ||
155 | float ds = dot(ref, proj_n); | ||
156 | |||
157 | if (ds < 0.0) | ||
158 | { | ||
159 | vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; | ||
160 | |||
161 | vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); | ||
162 | |||
163 | if (stc.z > 0.0) | ||
164 | { | ||
165 | stc.xy /= stc.w; | ||
166 | |||
167 | if (stc.x < 1.0 && | ||
168 | stc.y < 1.0 && | ||
169 | stc.x > 0.0 && | ||
170 | stc.y > 0.0) | ||
171 | { | ||
172 | vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); | ||
173 | col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow; | ||
174 | } | ||
175 | } | ||
176 | } | ||
177 | } | ||
178 | |||
179 | //attenuate point light contribution by SSAO component | ||
180 | col *= texture2DRect(lightMap, frag.xy).g; | ||
181 | |||
182 | gl_FragColor.rgb = col; | ||
183 | gl_FragColor.a = 0.0; | ||
184 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index d8ccfd4..52bad1f 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl | |||
@@ -9,54 +9,33 @@ | |||
9 | 9 | ||
10 | uniform sampler2DRect diffuseRect; | 10 | uniform sampler2DRect diffuseRect; |
11 | uniform sampler2DRect specularRect; | 11 | uniform sampler2DRect specularRect; |
12 | uniform sampler2DRect positionMap; | ||
12 | uniform sampler2DRect normalMap; | 13 | uniform sampler2DRect normalMap; |
13 | uniform samplerCube environmentMap; | 14 | uniform samplerCube environmentMap; |
14 | uniform sampler2DRect lightMap; | 15 | uniform sampler2DRect lightMap; |
15 | uniform sampler2D noiseMap; | 16 | uniform sampler2D noiseMap; |
16 | uniform sampler2D lightFunc; | ||
17 | uniform sampler2DRect depthMap; | ||
18 | 17 | ||
19 | uniform vec3 env_mat[3]; | 18 | uniform vec3 env_mat[3]; |
20 | uniform float sun_wash; | 19 | uniform float sun_wash; |
21 | 20 | ||
22 | varying vec4 vary_light; | 21 | varying vec4 vary_light; |
23 | 22 | ||
24 | varying vec4 vary_fragcoord; | 23 | varying vec3 vary_fragcoord; |
25 | uniform vec2 screen_res; | 24 | uniform vec2 screen_res; |
26 | 25 | ||
27 | uniform mat4 inv_proj; | ||
28 | uniform vec4 viewport; | ||
29 | |||
30 | vec4 getPosition(vec2 pos_screen) | ||
31 | { | ||
32 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
33 | vec2 sc = (pos_screen.xy-viewport.xy)*2.0; | ||
34 | sc /= viewport.zw; | ||
35 | sc -= vec2(1.0,1.0); | ||
36 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
37 | vec4 pos = inv_proj * ndc; | ||
38 | pos /= pos.w; | ||
39 | pos.w = 1.0; | ||
40 | return pos; | ||
41 | } | ||
42 | |||
43 | void main() | 26 | void main() |
44 | { | 27 | { |
45 | vec4 frag = vary_fragcoord; | 28 | vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; |
46 | frag.xyz /= frag.w; | 29 | frag *= screen_res; |
47 | frag.xyz = frag.xyz*0.5+0.5; | 30 | vec3 pos = texture2DRect(positionMap, frag).xyz; |
48 | frag.xy *= screen_res; | ||
49 | |||
50 | vec3 pos = getPosition(frag.xy).xyz; | ||
51 | vec3 lv = vary_light.xyz-pos; | 31 | vec3 lv = vary_light.xyz-pos; |
52 | float dist2 = dot(lv,lv); | 32 | float dist2 = dot(lv,lv); |
53 | dist2 /= vary_light.w; | 33 | if (dist2 > vary_light.w) |
54 | if (dist2 > 1.0) | ||
55 | { | 34 | { |
56 | discard; | 35 | discard; |
57 | } | 36 | } |
58 | 37 | ||
59 | vec3 norm = texture2DRect(normalMap, frag.xy).xyz*2.0-1.0; | 38 | vec3 norm = texture2DRect(normalMap, frag).xyz; |
60 | float da = dot(norm, lv); | 39 | float da = dot(norm, lv); |
61 | if (da < 0.0) | 40 | if (da < 0.0) |
62 | { | 41 | { |
@@ -67,30 +46,24 @@ void main() | |||
67 | lv = normalize(lv); | 46 | lv = normalize(lv); |
68 | da = dot(norm, lv); | 47 | da = dot(norm, lv); |
69 | 48 | ||
70 | float noise = texture2D(noiseMap, frag.xy/128.0).b; | 49 | float noise = texture2D(noiseMap, frag/128.0).b; |
71 | 50 | ||
72 | vec3 col = texture2DRect(diffuseRect, frag.xy).rgb; | 51 | vec3 col = texture2DRect(diffuseRect, frag).rgb; |
73 | float fa = gl_Color.a+1.0; | 52 | float fa = gl_Color.a+1.0; |
74 | float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); | 53 | float dist_atten = clamp(1.0-(dist2-vary_light.w*(1.0-fa))/(vary_light.w*fa), 0.0, 1.0); |
75 | float lit = da * dist_atten * noise; | 54 | float lit = da * dist_atten * noise; |
76 | 55 | ||
77 | col = gl_Color.rgb*lit*col; | 56 | col = gl_Color.rgb*lit*col; |
78 | 57 | ||
79 | vec4 spec = texture2DRect(specularRect, frag.xy); | 58 | vec4 spec = texture2DRect(specularRect, frag); |
80 | if (spec.a > 0.0) | 59 | if (spec.a > 0.0) |
81 | { | 60 | { |
82 | float sa = dot(normalize(lv-normalize(pos)),norm); | 61 | vec3 ref = reflect(normalize(pos), norm); |
83 | if (sa > 0.0) | 62 | float sa = dot(ref,lv); |
84 | { | 63 | sa = max(sa, 0.0); |
85 | sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); | 64 | sa = pow(sa, 128.0 * spec.a*spec.a/dist_atten)*min(dist_atten*4.0, 1.0); |
86 | sa *= noise; | 65 | sa *= noise; |
87 | col += da*sa*gl_Color.rgb*spec.rgb; | 66 | col += da*sa*gl_Color.rgb*spec.rgb; |
88 | } | ||
89 | } | ||
90 | |||
91 | if (dot(col, col) <= 0.0) | ||
92 | { | ||
93 | discard; | ||
94 | } | 67 | } |
95 | 68 | ||
96 | //attenuate point light contribution by SSAO component | 69 | //attenuate point light contribution by SSAO component |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl index e815ca2..a4edb88 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl | |||
@@ -6,7 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | varying vec4 vary_light; | 8 | varying vec4 vary_light; |
9 | varying vec4 vary_fragcoord; | 9 | varying vec3 vary_fragcoord; |
10 | 10 | ||
11 | uniform vec2 screen_res; | 11 | uniform vec2 screen_res; |
12 | uniform float near_clip; | 12 | uniform float near_clip; |
@@ -14,10 +14,10 @@ uniform float near_clip; | |||
14 | void main() | 14 | void main() |
15 | { | 15 | { |
16 | //transform vertex | 16 | //transform vertex |
17 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; | 17 | gl_Position = ftransform(); |
18 | 18 | ||
19 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | 19 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; |
20 | vary_fragcoord = pos; | 20 | vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); |
21 | 21 | ||
22 | vec4 tex = gl_MultiTexCoord0; | 22 | vec4 tex = gl_MultiTexCoord0; |
23 | tex.w = 1.0; | 23 | tex.w = 1.0; |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl deleted file mode 100644 index 71de036..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | /** | ||
2 | * @file postDeferredF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2DRect diffuseRect; | ||
11 | uniform sampler2DRect localLightMap; | ||
12 | uniform sampler2DRect sunLightMap; | ||
13 | uniform sampler2DRect giLightMap; | ||
14 | uniform sampler2D luminanceMap; | ||
15 | uniform sampler2DRect lightMap; | ||
16 | |||
17 | uniform vec3 lum_quad; | ||
18 | uniform float lum_lod; | ||
19 | uniform vec4 ambient; | ||
20 | |||
21 | uniform vec3 gi_quad; | ||
22 | |||
23 | uniform vec2 screen_res; | ||
24 | varying vec2 vary_fragcoord; | ||
25 | |||
26 | void main() | ||
27 | { | ||
28 | vec2 tc = vary_fragcoord.xy; | ||
29 | vec3 lum = texture2DLod(luminanceMap, tc/screen_res, lum_lod).rgb; | ||
30 | float luminance = lum.r; | ||
31 | luminance = luminance*lum_quad.y+lum_quad.z; | ||
32 | |||
33 | vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); | ||
34 | |||
35 | float ambocc = texture2DRect(lightMap, vary_fragcoord.xy).g; | ||
36 | |||
37 | vec3 gi_col = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; | ||
38 | gi_col = gi_col*gi_col*gi_quad.x + gi_col*gi_quad.y+gi_quad.z*ambocc*ambient.rgb; | ||
39 | gi_col *= diff; | ||
40 | |||
41 | vec4 sun_col = texture2DRect(sunLightMap, vary_fragcoord.xy); | ||
42 | |||
43 | vec3 local_col = texture2DRect(localLightMap, vary_fragcoord.xy).rgb; | ||
44 | |||
45 | |||
46 | sun_col *= 1.0/min(luminance, 1.0); | ||
47 | gi_col *= 1.0/luminance; | ||
48 | |||
49 | vec3 col = sun_col.rgb+gi_col+local_col; | ||
50 | |||
51 | gl_FragColor.rgb = col.rgb; | ||
52 | col.rgb = max(col.rgb-vec3(1.0,1.0,1.0), vec3(0.0, 0.0, 0.0)); | ||
53 | |||
54 | gl_FragColor.a = 0.0; // max(dot(col.rgb,col.rgb)*lum_quad.x, sun_col.a); | ||
55 | |||
56 | //gl_FragColor.rgb = vec3(lum_lod); | ||
57 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl deleted file mode 100644 index 9819232..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /** | ||
2 | * @file postDeferredV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | uniform vec2 screen_res; | ||
10 | |||
11 | void main() | ||
12 | { | ||
13 | //transform vertex | ||
14 | gl_Position = ftransform(); | ||
15 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
16 | vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; | ||
17 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl deleted file mode 100644 index 3556c7b..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl +++ /dev/null | |||
@@ -1,107 +0,0 @@ | |||
1 | /** | ||
2 | * @file postgiF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2D diffuseGIMap; | ||
9 | uniform sampler2D normalGIMap; | ||
10 | uniform sampler2D depthGIMap; | ||
11 | uniform sampler2D diffuseMap; | ||
12 | |||
13 | uniform sampler2D lastDiffuseGIMap; | ||
14 | uniform sampler2D lastNormalGIMap; | ||
15 | uniform sampler2D lastMinpGIMap; | ||
16 | uniform sampler2D lastMaxpGIMap; | ||
17 | |||
18 | uniform float gi_blend; | ||
19 | |||
20 | uniform mat4 gi_mat; //gPipeline.mGIMatrix - eye space to sun space | ||
21 | uniform mat4 gi_mat_proj; //gPipeline.mGIMatrixProj - eye space to projected sun space | ||
22 | uniform mat4 gi_norm_mat; //gPipeline.mGINormalMatrix - eye space normal to sun space normal matrix | ||
23 | uniform mat4 gi_inv_proj; //gPipeline.mGIInvProj - projected sun space to sun space | ||
24 | uniform float gi_radius; | ||
25 | uniform float gi_intensity; | ||
26 | uniform vec2 gi_kern[16]; | ||
27 | uniform vec2 gi_scale; | ||
28 | |||
29 | |||
30 | vec4 getGIPosition(vec2 gi_tc) | ||
31 | { | ||
32 | float depth = texture2D(depthGIMap, gi_tc).a; | ||
33 | vec2 sc = gi_tc*2.0; | ||
34 | sc -= vec2(1.0, 1.0); | ||
35 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
36 | vec4 pos = gi_inv_proj*ndc; | ||
37 | pos.xyz /= pos.w; | ||
38 | pos.w = 1.0; | ||
39 | return pos; | ||
40 | } | ||
41 | |||
42 | |||
43 | void main() | ||
44 | { | ||
45 | vec2 c_tc = gl_TexCoord[0].xy; | ||
46 | |||
47 | vec3 diff = vec3(0,0,0); | ||
48 | vec3 minp = vec3(1024,1024,1024); | ||
49 | vec3 maxp = vec3(-1024,-1024,-1024); | ||
50 | vec3 norm = vec3(0,0,0); | ||
51 | |||
52 | float dweight = 0.0; | ||
53 | |||
54 | vec3 cnorm = normalize(texture2D(normalGIMap, c_tc).rgb*2.0-1.0); | ||
55 | |||
56 | vec3 cpos = vec3(0,0,0); | ||
57 | float tweight = 0.0; | ||
58 | |||
59 | for (int i = 0; i < 8; ++i) | ||
60 | { | ||
61 | for (int j = 0; j < 8; ++j) | ||
62 | { | ||
63 | vec2 tc = vec2(i-4+0.5, j-4+0.5); | ||
64 | float weight = 1.0-length(tc)/6.0; | ||
65 | tc *= 1.0/(256.0); | ||
66 | tc += c_tc; | ||
67 | |||
68 | vec3 n = texture2D(normalGIMap, tc).rgb*2.0-1.0; | ||
69 | tweight += weight; | ||
70 | |||
71 | diff += weight*texture2D(diffuseGIMap, tc).rgb; | ||
72 | |||
73 | norm += n*weight; | ||
74 | |||
75 | dweight += dot(n, cnorm); | ||
76 | |||
77 | vec3 pos = getGIPosition(tc).xyz; | ||
78 | cpos += pos*weight; | ||
79 | |||
80 | minp = min(pos, minp); | ||
81 | maxp = max(pos, maxp); | ||
82 | } | ||
83 | } | ||
84 | |||
85 | dweight = abs(1.0-dweight/64.0); | ||
86 | float mind = min(sqrt(dweight+0.5), 1.0); | ||
87 | |||
88 | dweight *= dweight; | ||
89 | |||
90 | cpos /= tweight; | ||
91 | |||
92 | diff = clamp(diff/tweight, vec3(1.0/2.2), vec3(1,1,1)); | ||
93 | norm = normalize(norm); | ||
94 | maxp = cpos; | ||
95 | minp = vec3(dweight, mind, cpos.z-minp.z); | ||
96 | |||
97 | //float blend = 1.0; | ||
98 | //diff = mix(texture2D(lastDiffuseGIMap, c_tc).rgb, diff, blend); | ||
99 | //norm = mix(texture2D(lastNormalGIMap, c_tc).rgb, norm, blend); | ||
100 | //maxp = mix(texture2D(lastMaxpGIMap, c_tc).rgb, maxp, blend); | ||
101 | //minp = mix(texture2D(lastMinpGIMap, c_tc).rgb, minp, blend); | ||
102 | |||
103 | gl_FragData[0].rgb = diff; | ||
104 | gl_FragData[2].xyz = normalize(norm); | ||
105 | gl_FragData[1].xyz = maxp; | ||
106 | gl_FragData[3].xyz = minp; | ||
107 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl deleted file mode 100644 index 5a8eb65..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | /** | ||
2 | * @file postgiV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec3 vary_normal; | ||
9 | |||
10 | void main() | ||
11 | { | ||
12 | //transform vertex | ||
13 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
14 | gl_Position = pos; | ||
15 | gl_TexCoord[0].xy = pos.xy*0.5+0.5; | ||
16 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl index b0b31fd..b3758c3 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl | |||
@@ -7,11 +7,8 @@ | |||
7 | 7 | ||
8 | uniform sampler2D diffuseMap; | 8 | uniform sampler2D diffuseMap; |
9 | 9 | ||
10 | varying vec4 post_pos; | ||
11 | 10 | ||
12 | void main() | 11 | void main() |
13 | { | 12 | { |
14 | gl_FragColor = vec4(1,1,1,texture2D(diffuseMap, gl_TexCoord[0].xy).a * gl_Color.a); | 13 | gl_FragColor = vec4(1,1,1,texture2D(diffuseMap, gl_TexCoord[0].xy).a * gl_Color.a); |
15 | |||
16 | gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0); | ||
17 | } | 14 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl index 7214d24..aae1bee 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl | |||
@@ -5,17 +5,13 @@ | |||
5 | * $License$ | 5 | * $License$ |
6 | */ | 6 | */ |
7 | 7 | ||
8 | varying vec4 post_pos; | ||
9 | |||
10 | void main() | 8 | void main() |
11 | { | 9 | { |
12 | //transform vertex | 10 | //transform vertex |
13 | vec4 pos = gl_ModelViewProjectionMatrix*gl_Vertex; | 11 | vec4 pos = gl_ModelViewProjectionMatrix*gl_Vertex; |
14 | 12 | //smash geometry against the near clip plane (great for ortho projections) | |
15 | post_pos = pos; | 13 | pos.z = max(pos.z, -1.0); |
16 | 14 | gl_Position = pos; | |
17 | gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); | ||
18 | |||
19 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; | 15 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; |
20 | gl_FrontColor = gl_Color; | 16 | gl_FrontColor = gl_Color; |
21 | } | 17 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 64e263a..d5671a6 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl | |||
@@ -272,4 +272,8 @@ void main() | |||
272 | 272 | ||
273 | gl_FragColor.rgb = col; | 273 | gl_FragColor.rgb = col; |
274 | gl_FragColor.a = 0.0; | 274 | gl_FragColor.a = 0.0; |
275 | //gl_FragColor.rg = scol_ambocc.rg; | ||
276 | //gl_FragColor.rgb = norm.rgb*0.5+0.5; | ||
277 | //gl_FragColor.rgb = vec3(ambocc); | ||
278 | //gl_FragColor.rgb = vec3(scol); | ||
275 | } | 279 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl deleted file mode 100644 index d653408..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ /dev/null | |||
@@ -1,199 +0,0 @@ | |||
1 | /** | ||
2 | * @file spotLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #version 120 | ||
9 | |||
10 | #extension GL_ARB_texture_rectangle : enable | ||
11 | |||
12 | uniform sampler2DRect diffuseRect; | ||
13 | uniform sampler2DRect specularRect; | ||
14 | uniform sampler2DRect depthMap; | ||
15 | uniform sampler2DRect normalMap; | ||
16 | uniform samplerCube environmentMap; | ||
17 | uniform sampler2DRect lightMap; | ||
18 | uniform sampler2D noiseMap; | ||
19 | uniform sampler2D lightFunc; | ||
20 | uniform sampler2D projectionMap; | ||
21 | |||
22 | uniform mat4 proj_mat; //screen space to light space | ||
23 | uniform float proj_near; //near clip for projection | ||
24 | uniform vec3 proj_p; //plane projection is emitting from (in screen space) | ||
25 | uniform vec3 proj_n; | ||
26 | uniform float proj_focus; //distance from plane to begin blurring | ||
27 | uniform float proj_lod; //(number of mips in proj map) | ||
28 | uniform float proj_range; //range between near clip and far clip plane of projection | ||
29 | uniform float proj_ambiance; | ||
30 | uniform float near_clip; | ||
31 | uniform float far_clip; | ||
32 | |||
33 | uniform vec3 proj_origin; //origin of projection to be used for angular attenuation | ||
34 | uniform float sun_wash; | ||
35 | uniform int proj_shadow_idx; | ||
36 | uniform float shadow_fade; | ||
37 | |||
38 | varying vec4 vary_light; | ||
39 | |||
40 | varying vec4 vary_fragcoord; | ||
41 | uniform vec2 screen_res; | ||
42 | |||
43 | uniform mat4 inv_proj; | ||
44 | |||
45 | vec4 getPosition(vec2 pos_screen) | ||
46 | { | ||
47 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
48 | vec2 sc = pos_screen.xy*2.0; | ||
49 | sc /= screen_res; | ||
50 | sc -= vec2(1.0,1.0); | ||
51 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
52 | vec4 pos = inv_proj * ndc; | ||
53 | pos /= pos.w; | ||
54 | pos.w = 1.0; | ||
55 | return pos; | ||
56 | } | ||
57 | |||
58 | void main() | ||
59 | { | ||
60 | vec4 frag = vary_fragcoord; | ||
61 | frag.xyz /= frag.w; | ||
62 | frag.xyz = frag.xyz*0.5+0.5; | ||
63 | frag.xy *= screen_res; | ||
64 | |||
65 | float shadow = 1.0; | ||
66 | |||
67 | if (proj_shadow_idx >= 0) | ||
68 | { | ||
69 | vec4 shd = texture2DRect(lightMap, frag.xy); | ||
70 | float sh[2]; | ||
71 | sh[0] = shd.b; | ||
72 | sh[1] = shd.a; | ||
73 | shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); | ||
74 | } | ||
75 | |||
76 | vec3 pos = getPosition(frag.xy).xyz; | ||
77 | vec3 lv = vary_light.xyz-pos.xyz; | ||
78 | float dist2 = dot(lv,lv); | ||
79 | dist2 /= vary_light.w; | ||
80 | if (dist2 > 1.0) | ||
81 | { | ||
82 | discard; | ||
83 | } | ||
84 | |||
85 | vec3 norm = texture2DRect(normalMap, frag.xy).xyz*2.0-1.0; | ||
86 | |||
87 | norm = normalize(norm); | ||
88 | float l_dist = -dot(lv, proj_n); | ||
89 | |||
90 | vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); | ||
91 | if (proj_tc.z < 0.0) | ||
92 | { | ||
93 | discard; | ||
94 | } | ||
95 | |||
96 | proj_tc.xyz /= proj_tc.w; | ||
97 | |||
98 | float fa = gl_Color.a+1.0; | ||
99 | float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); | ||
100 | |||
101 | lv = proj_origin-pos.xyz; | ||
102 | lv = normalize(lv); | ||
103 | float da = dot(norm, lv); | ||
104 | |||
105 | vec3 col = vec3(0,0,0); | ||
106 | |||
107 | vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; | ||
108 | |||
109 | float noise = texture2D(noiseMap, frag.xy/128.0).b; | ||
110 | if (proj_tc.z > 0.0 && | ||
111 | proj_tc.x < 1.0 && | ||
112 | proj_tc.y < 1.0 && | ||
113 | proj_tc.x > 0.0 && | ||
114 | proj_tc.y > 0.0) | ||
115 | { | ||
116 | float lit = 0.0; | ||
117 | if (da > 0.0) | ||
118 | { | ||
119 | float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); | ||
120 | float lod = diff * proj_lod; | ||
121 | |||
122 | vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod); | ||
123 | |||
124 | vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; | ||
125 | |||
126 | lit = da * dist_atten * noise; | ||
127 | |||
128 | col = lcol*lit*diff_tex*shadow; | ||
129 | } | ||
130 | |||
131 | float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); | ||
132 | float lod = diff * proj_lod; | ||
133 | vec4 amb_plcol = texture2DLod(projectionMap, proj_tc.xy, lod); | ||
134 | //float amb_da = mix(proj_ambiance, proj_ambiance*max(-da, 0.0), max(da, 0.0)); | ||
135 | float amb_da = proj_ambiance; | ||
136 | if (da > 0.0) | ||
137 | { | ||
138 | amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; | ||
139 | } | ||
140 | |||
141 | amb_da += (da*da*0.5+0.5)*proj_ambiance; | ||
142 | |||
143 | amb_da *= dist_atten * noise; | ||
144 | |||
145 | amb_da = min(amb_da, 1.0-lit); | ||
146 | |||
147 | col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; | ||
148 | } | ||
149 | |||
150 | |||
151 | vec4 spec = texture2DRect(specularRect, frag.xy); | ||
152 | if (spec.a > 0.0) | ||
153 | { | ||
154 | vec3 ref = reflect(normalize(pos), norm); | ||
155 | |||
156 | //project from point pos in direction ref to plane proj_p, proj_n | ||
157 | vec3 pdelta = proj_p-pos; | ||
158 | float ds = dot(ref, proj_n); | ||
159 | |||
160 | if (ds < 0.0) | ||
161 | { | ||
162 | vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; | ||
163 | |||
164 | vec3 stc = (proj_mat * vec4(pfinal.xyz, 1.0)).xyz; | ||
165 | |||
166 | if (stc.z > 0.0) | ||
167 | { | ||
168 | stc.xy /= stc.z+proj_near; | ||
169 | |||
170 | if (stc.x < 1.0 && | ||
171 | stc.y < 1.0 && | ||
172 | stc.x > 0.0 && | ||
173 | stc.y > 0.0) | ||
174 | { | ||
175 | vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); | ||
176 | col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow; | ||
177 | } | ||
178 | } | ||
179 | } | ||
180 | } | ||
181 | |||
182 | /*if (spec.a > 0.0) | ||
183 | { | ||
184 | //vec3 ref = reflect(normalize(pos), norm); | ||
185 | float sa = dot(normalize(lv-normalize(pos)),norm);; | ||
186 | //sa = max(sa, 0.0); | ||
187 | //sa = pow(sa, 128.0 * spec.a*spec.a/dist_atten)*min(dist_atten*4.0, 1.0); | ||
188 | sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); | ||
189 | sa *= noise; | ||
190 | col += da*sa*lcol*spec.rgb; | ||
191 | }*/ | ||
192 | |||
193 | //attenuate point light contribution by SSAO component | ||
194 | col *= texture2DRect(lightMap, frag.xy).g; | ||
195 | |||
196 | |||
197 | gl_FragColor.rgb = col; | ||
198 | gl_FragColor.a = 0.0; | ||
199 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl index 22bdd2c..d43fe6c 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl | |||
@@ -7,21 +7,17 @@ | |||
7 | 7 | ||
8 | #extension GL_ARB_texture_rectangle : enable | 8 | #extension GL_ARB_texture_rectangle : enable |
9 | 9 | ||
10 | uniform sampler2DRect depthMap; | 10 | uniform sampler2DRect positionMap; |
11 | uniform sampler2DRect normalMap; | 11 | uniform sampler2DRect normalMap; |
12 | uniform sampler2DRectShadow shadowMap0; | 12 | uniform sampler2DRect depthMap; |
13 | uniform sampler2DRectShadow shadowMap1; | 13 | uniform sampler2DShadow shadowMap0; |
14 | uniform sampler2DRectShadow shadowMap2; | 14 | uniform sampler2DShadow shadowMap1; |
15 | uniform sampler2DRectShadow shadowMap3; | 15 | uniform sampler2DShadow shadowMap2; |
16 | uniform sampler2DRectShadow shadowMap4; | 16 | uniform sampler2DShadow shadowMap3; |
17 | uniform sampler2DRectShadow shadowMap5; | ||
18 | uniform sampler2D noiseMap; | 17 | uniform sampler2D noiseMap; |
19 | 18 | ||
20 | uniform sampler2D lightFunc; | ||
21 | |||
22 | |||
23 | // Inputs | 19 | // Inputs |
24 | uniform mat4 shadow_matrix[6]; | 20 | uniform mat4 shadow_matrix[4]; |
25 | uniform vec4 shadow_clip; | 21 | uniform vec4 shadow_clip; |
26 | uniform float ssao_radius; | 22 | uniform float ssao_radius; |
27 | uniform float ssao_max_radius; | 23 | uniform float ssao_max_radius; |
@@ -31,25 +27,6 @@ uniform float ssao_factor_inv; | |||
31 | varying vec2 vary_fragcoord; | 27 | varying vec2 vary_fragcoord; |
32 | varying vec4 vary_light; | 28 | varying vec4 vary_light; |
33 | 29 | ||
34 | uniform mat4 inv_proj; | ||
35 | uniform vec2 screen_res; | ||
36 | |||
37 | uniform float shadow_bias; | ||
38 | uniform float shadow_offset; | ||
39 | |||
40 | vec4 getPosition(vec2 pos_screen) | ||
41 | { | ||
42 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
43 | vec2 sc = pos_screen.xy*2.0; | ||
44 | sc /= screen_res; | ||
45 | sc -= vec2(1.0,1.0); | ||
46 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
47 | vec4 pos = inv_proj * ndc; | ||
48 | pos /= pos.w; | ||
49 | pos.w = 1.0; | ||
50 | return pos; | ||
51 | } | ||
52 | |||
53 | //calculate decreases in ambient lighting when crowded out (SSAO) | 30 | //calculate decreases in ambient lighting when crowded out (SSAO) |
54 | float calcAmbientOcclusion(vec4 pos, vec3 norm) | 31 | float calcAmbientOcclusion(vec4 pos, vec3 norm) |
55 | { | 32 | { |
@@ -77,7 +54,7 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm) | |||
77 | for (int i = 0; i < 8; i++) | 54 | for (int i = 0; i < 8; i++) |
78 | { | 55 | { |
79 | vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect); | 56 | vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect); |
80 | vec3 samppos_world = getPosition(samppos_screen).xyz; | 57 | vec3 samppos_world = texture2DRect(positionMap, samppos_screen).xyz; |
81 | 58 | ||
82 | vec3 diff = pos_world - samppos_world; | 59 | vec3 diff = pos_world - samppos_world; |
83 | float dist2 = dot(diff, diff); | 60 | float dist2 = dot(diff, diff); |
@@ -97,18 +74,14 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm) | |||
97 | 74 | ||
98 | angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); | 75 | angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); |
99 | 76 | ||
100 | return (1.0 - (float(points != 0) * angle_hidden)); | 77 | return 1.0 - (float(points != 0) * angle_hidden); |
101 | } | 78 | } |
102 | 79 | ||
103 | void main() | 80 | void main() |
104 | { | 81 | { |
105 | vec2 pos_screen = vary_fragcoord.xy; | 82 | vec2 pos_screen = vary_fragcoord.xy; |
106 | 83 | vec4 pos = vec4(texture2DRect(positionMap, pos_screen).xyz, 1.0); | |
107 | //try doing an unproject here | 84 | vec3 norm = texture2DRect(normalMap, pos_screen).xyz; |
108 | |||
109 | vec4 pos = getPosition(pos_screen); | ||
110 | |||
111 | vec3 norm = texture2DRect(normalMap, pos_screen).xyz*2.0-1.0; | ||
112 | 85 | ||
113 | /*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL | 86 | /*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL |
114 | { | 87 | { |
@@ -117,45 +90,35 @@ void main() | |||
117 | }*/ | 90 | }*/ |
118 | 91 | ||
119 | float shadow = 1.0; | 92 | float shadow = 1.0; |
120 | float dp_directional_light = max(0.0, dot(norm, vary_light.xyz)); | 93 | float dp_directional_light = max(0.0, dot(norm, vary_light.xyz)); |
121 | 94 | ||
122 | vec4 spos = vec4(pos.xyz + norm.xyz * (-pos.z/64.0*shadow_offset+shadow_bias), 1.0); | ||
123 | |||
124 | //vec3 debug = vec3(0,0,0); | ||
125 | |||
126 | if (dp_directional_light == 0.0) | 95 | if (dp_directional_light == 0.0) |
127 | { | 96 | { |
128 | // if we know this point is facing away from the sun then we know it's in shadow without having to do a squirrelly shadow-map lookup | 97 | // if we know this point is facing away from the sun then we know it's in shadow without having to do a squirrelly shadow-map lookup |
129 | shadow = 0.0; | 98 | shadow = 0.0; |
130 | } | 99 | } |
131 | else if (spos.z > -shadow_clip.w) | 100 | else if (pos.z > -shadow_clip.w) |
132 | { | 101 | { |
133 | vec4 lpos; | 102 | if (pos.z < -shadow_clip.z) |
134 | |||
135 | if (spos.z < -shadow_clip.z) | ||
136 | { | 103 | { |
137 | lpos = shadow_matrix[3]*spos; | 104 | vec4 lpos = shadow_matrix[3]*pos; |
138 | lpos.xy *= screen_res; | 105 | shadow = shadow2DProj(shadowMap3, lpos).x; |
139 | shadow = shadow2DRectProj(shadowMap3, lpos).x; | ||
140 | shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); | 106 | shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); |
141 | } | 107 | } |
142 | else if (spos.z < -shadow_clip.y) | 108 | else if (pos.z < -shadow_clip.y) |
143 | { | 109 | { |
144 | lpos = shadow_matrix[2]*spos; | 110 | vec4 lpos = shadow_matrix[2]*pos; |
145 | lpos.xy *= screen_res; | 111 | shadow = shadow2DProj(shadowMap2, lpos).x; |
146 | shadow = shadow2DRectProj(shadowMap2, lpos).x; | ||
147 | } | 112 | } |
148 | else if (spos.z < -shadow_clip.x) | 113 | else if (pos.z < -shadow_clip.x) |
149 | { | 114 | { |
150 | lpos = shadow_matrix[1]*spos; | 115 | vec4 lpos = shadow_matrix[1]*pos; |
151 | lpos.xy *= screen_res; | 116 | shadow = shadow2DProj(shadowMap1, lpos).x; |
152 | shadow = shadow2DRectProj(shadowMap1, lpos).x; | ||
153 | } | 117 | } |
154 | else | 118 | else |
155 | { | 119 | { |
156 | lpos = shadow_matrix[0]*spos; | 120 | vec4 lpos = shadow_matrix[0]*pos; |
157 | lpos.xy *= screen_res; | 121 | shadow = shadow2DProj(shadowMap0, lpos).x; |
158 | shadow = shadow2DRectProj(shadowMap0, lpos).x; | ||
159 | } | 122 | } |
160 | 123 | ||
161 | // take the most-shadowed value out of these two: | 124 | // take the most-shadowed value out of these two: |
@@ -163,17 +126,6 @@ void main() | |||
163 | // * an unblurred dot product between the sun and this norm | 126 | // * an unblurred dot product between the sun and this norm |
164 | // the goal is to err on the side of most-shadow to fill-in shadow holes and reduce artifacting | 127 | // the goal is to err on the side of most-shadow to fill-in shadow holes and reduce artifacting |
165 | shadow = min(shadow, dp_directional_light); | 128 | shadow = min(shadow, dp_directional_light); |
166 | |||
167 | /*debug.r = lpos.y / (lpos.w*screen_res.y); | ||
168 | |||
169 | lpos.xy /= lpos.w*32.0; | ||
170 | if (fract(lpos.x) < 0.1 || fract(lpos.y) < 0.1) | ||
171 | { | ||
172 | debug.gb = vec2(0.5, 0.5); | ||
173 | } | ||
174 | |||
175 | debug += (1.0-shadow)*0.5;*/ | ||
176 | |||
177 | } | 129 | } |
178 | else | 130 | else |
179 | { | 131 | { |
@@ -183,18 +135,5 @@ void main() | |||
183 | 135 | ||
184 | gl_FragColor[0] = shadow; | 136 | gl_FragColor[0] = shadow; |
185 | gl_FragColor[1] = calcAmbientOcclusion(pos, norm); | 137 | gl_FragColor[1] = calcAmbientOcclusion(pos, norm); |
186 | 138 | //gl_FragColor[2] is unused as of August 2008, may be used for debugging | |
187 | //spotlight shadow 1 | ||
188 | vec4 lpos = shadow_matrix[4]*spos; | ||
189 | lpos.xy *= screen_res; | ||
190 | gl_FragColor[2] = shadow2DRectProj(shadowMap4, lpos).x; | ||
191 | |||
192 | //spotlight shadow 2 | ||
193 | lpos = shadow_matrix[5]*spos; | ||
194 | lpos.xy *= screen_res; | ||
195 | gl_FragColor[3] = shadow2DRectProj(shadowMap5, lpos).x; | ||
196 | |||
197 | //gl_FragColor.rgb = pos.xyz; | ||
198 | //gl_FragColor.b = shadow; | ||
199 | //gl_FragColor.rgb = debug; | ||
200 | } | 139 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl index 308b9b1..211b2e0 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl | |||
@@ -12,6 +12,7 @@ uniform sampler2D detail_3; | |||
12 | uniform sampler2D alpha_ramp; | 12 | uniform sampler2D alpha_ramp; |
13 | 13 | ||
14 | varying vec3 vary_normal; | 14 | varying vec3 vary_normal; |
15 | varying vec4 vary_position; | ||
15 | 16 | ||
16 | void main() | 17 | void main() |
17 | { | 18 | { |
@@ -27,8 +28,9 @@ void main() | |||
27 | float alphaFinal = texture2D(alpha_ramp, gl_TexCoord[1].zw).a; | 28 | float alphaFinal = texture2D(alpha_ramp, gl_TexCoord[1].zw).a; |
28 | vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); | 29 | vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); |
29 | 30 | ||
30 | gl_FragData[0] = vec4(outColor.rgb, 0.0); // Kl 0.0 looks fine atm however check grass above waterline when GI enabled in future releases! | 31 | gl_FragData[0] = vec4(outColor.rgb, 1.0); |
31 | gl_FragData[1] = vec4(outColor.rgb*0.2, 0.2); | 32 | gl_FragData[1] = vec4(outColor.rgb*0.2, 0.2); |
32 | gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0); | 33 | gl_FragData[2] = vec4(normalize(vary_normal), 0.0); |
34 | gl_FragData[3] = vary_position; | ||
33 | } | 35 | } |
34 | 36 | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl index 3038b14..e9d6dca 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl | |||
@@ -6,6 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | varying vec3 vary_normal; | 8 | varying vec3 vary_normal; |
9 | varying vec4 vary_position; | ||
9 | 10 | ||
10 | vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1) | 11 | vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1) |
11 | { | 12 | { |
@@ -26,6 +27,7 @@ void main() | |||
26 | //transform vertex | 27 | //transform vertex |
27 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; | 28 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; |
28 | 29 | ||
30 | vary_position = gl_ModelViewMatrix * gl_Vertex; | ||
29 | vary_normal = normalize(gl_NormalMatrix * gl_Normal); | 31 | vary_normal = normalize(gl_NormalMatrix * gl_Normal); |
30 | 32 | ||
31 | // Transform and pass tex coords | 33 | // Transform and pass tex coords |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl index 49c65f1..bc2c981 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl | |||
@@ -8,11 +8,13 @@ | |||
8 | uniform sampler2D diffuseMap; | 8 | uniform sampler2D diffuseMap; |
9 | 9 | ||
10 | varying vec3 vary_normal; | 10 | varying vec3 vary_normal; |
11 | varying vec4 vary_position; | ||
11 | 12 | ||
12 | void main() | 13 | void main() |
13 | { | 14 | { |
14 | vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); | 15 | vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); |
15 | gl_FragData[0] = gl_Color*col; | 16 | gl_FragData[0] = gl_Color*col; |
16 | gl_FragData[1] = vec4(0,0,0,0); | 17 | gl_FragData[1] = vec4(0,0,0,0); |
17 | gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0); | 18 | gl_FragData[2] = vec4(normalize(vary_normal), 0.0); |
19 | gl_FragData[3] = vary_position; | ||
18 | } | 20 | } |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl index 6b9dc2d..9131d7c 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl | |||
@@ -6,6 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | varying vec3 vary_normal; | 8 | varying vec3 vary_normal; |
9 | varying vec4 vary_position; | ||
9 | 10 | ||
10 | void main() | 11 | void main() |
11 | { | 12 | { |
@@ -13,6 +14,8 @@ void main() | |||
13 | gl_Position = ftransform(); | 14 | gl_Position = ftransform(); |
14 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; | 15 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; |
15 | 16 | ||
17 | vary_position = gl_ModelViewMatrix * gl_Vertex; | ||
18 | |||
16 | vary_normal = normalize(gl_NormalMatrix * gl_Normal); | 19 | vary_normal = normalize(gl_NormalMatrix * gl_Normal); |
17 | 20 | ||
18 | gl_FrontColor = gl_Color; | 21 | gl_FrontColor = gl_Color; |
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl index 6eea656..0a1f019 100644 --- a/linden/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl +++ b/linden/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl | |||
@@ -17,7 +17,7 @@ uniform sampler2DShadow shadowMap2; | |||
17 | uniform sampler2DShadow shadowMap3; | 17 | uniform sampler2DShadow shadowMap3; |
18 | uniform sampler2D noiseMap; | 18 | uniform sampler2D noiseMap; |
19 | 19 | ||
20 | uniform mat4 shadow_matrix[6]; | 20 | uniform mat4 shadow_matrix[4]; |
21 | uniform vec4 shadow_clip; | 21 | uniform vec4 shadow_clip; |
22 | 22 | ||
23 | uniform float sunAngle; | 23 | uniform float sunAngle; |
diff --git a/linden/indra/newview/app_settings/shaders/class1/effects/colorFilterF.glsl b/linden/indra/newview/app_settings/shaders/class1/effects/colorFilterF.glsl deleted file mode 100644 index 623ef7a..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/effects/colorFilterF.glsl +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /** | ||
2 | * @file colorFilterF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | uniform float brightness; | ||
10 | uniform float contrast; | ||
11 | uniform vec3 contrastBase; | ||
12 | uniform float saturation; | ||
13 | uniform vec3 lumWeights; | ||
14 | |||
15 | const float gamma = 2.0; | ||
16 | |||
17 | void main(void) | ||
18 | { | ||
19 | vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); | ||
20 | |||
21 | /// Modulate brightness | ||
22 | color *= brightness; | ||
23 | |||
24 | /// Modulate contrast | ||
25 | color = mix(contrastBase, color, contrast); | ||
26 | |||
27 | /// Modulate saturation | ||
28 | color = mix(vec3(dot(color, lumWeights)), color, saturation); | ||
29 | |||
30 | gl_FragColor = vec4(color, 1.0); | ||
31 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/effects/drawQuadV.glsl b/linden/indra/newview/app_settings/shaders/class1/effects/drawQuadV.glsl deleted file mode 100644 index 29c2a09..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/effects/drawQuadV.glsl +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /** | ||
2 | * @file drawQuadV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | void main(void) | ||
9 | { | ||
10 | //transform vertex | ||
11 | gl_Position = ftransform(); | ||
12 | gl_TexCoord[0] = gl_MultiTexCoord0; | ||
13 | gl_TexCoord[1] = gl_MultiTexCoord1; | ||
14 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class1/effects/nightVisionF.glsl b/linden/indra/newview/app_settings/shaders/class1/effects/nightVisionF.glsl deleted file mode 100644 index 271d5cf..0000000 --- a/linden/indra/newview/app_settings/shaders/class1/effects/nightVisionF.glsl +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /** | ||
2 | * @file nightVisionF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | uniform sampler2D NoiseTexture; | ||
10 | uniform float brightMult; | ||
11 | uniform float noiseStrength; | ||
12 | |||
13 | float luminance(vec3 color) | ||
14 | { | ||
15 | /// CALCULATING LUMINANCE (Using NTSC lum weights) | ||
16 | /// http://en.wikipedia.org/wiki/Luma_%28video%29 | ||
17 | return dot(color, vec3(0.299, 0.587, 0.114)); | ||
18 | } | ||
19 | |||
20 | void main(void) | ||
21 | { | ||
22 | /// Get scene color | ||
23 | vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); | ||
24 | |||
25 | /// Extract luminance and scale up by night vision brightness | ||
26 | float lum = luminance(color) * brightMult; | ||
27 | |||
28 | /// Convert into night vision color space | ||
29 | /// Newer NVG colors (crisper and more saturated) | ||
30 | vec3 outColor = (lum * vec3(0.91, 1.21, 0.9)) + vec3(-0.07, 0.1, -0.12); | ||
31 | |||
32 | /// Add noise | ||
33 | float noiseValue = texture2D(NoiseTexture, gl_TexCoord[1].st).r; | ||
34 | noiseValue = (noiseValue - 0.5) * noiseStrength; | ||
35 | |||
36 | /// Older NVG colors (more muted) | ||
37 | // vec3 outColor = (lum * vec3(0.82, 0.75, 0.83)) + vec3(0.05, 0.32, -0.11); | ||
38 | |||
39 | outColor += noiseValue; | ||
40 | |||
41 | gl_FragColor = vec4(outColor, 1.0); | ||
42 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl deleted file mode 100644 index 0055a73..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | /** | ||
2 | * @file alphaF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2D diffuseMap; | ||
11 | uniform sampler2DRectShadow shadowMap0; | ||
12 | uniform sampler2DRectShadow shadowMap1; | ||
13 | uniform sampler2DRectShadow shadowMap2; | ||
14 | uniform sampler2DRectShadow shadowMap3; | ||
15 | uniform sampler2D noiseMap; | ||
16 | uniform sampler2DRect depthMap; | ||
17 | |||
18 | uniform mat4 shadow_matrix[6]; | ||
19 | uniform vec4 shadow_clip; | ||
20 | uniform vec2 screen_res; | ||
21 | |||
22 | vec3 atmosLighting(vec3 light); | ||
23 | vec3 scaleSoftClip(vec3 light); | ||
24 | |||
25 | varying vec3 vary_ambient; | ||
26 | varying vec3 vary_directional; | ||
27 | varying vec3 vary_fragcoord; | ||
28 | varying vec3 vary_position; | ||
29 | varying vec3 vary_light; | ||
30 | |||
31 | uniform float alpha_soften; | ||
32 | |||
33 | uniform mat4 inv_proj; | ||
34 | |||
35 | vec4 getPosition(vec2 pos_screen) | ||
36 | { | ||
37 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
38 | vec2 sc = pos_screen.xy*2.0; | ||
39 | sc /= screen_res; | ||
40 | sc -= vec2(1.0,1.0); | ||
41 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
42 | vec4 pos = inv_proj * ndc; | ||
43 | pos /= pos.w; | ||
44 | pos.w = 1.0; | ||
45 | return pos; | ||
46 | } | ||
47 | |||
48 | void main() | ||
49 | { | ||
50 | vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; | ||
51 | frag *= screen_res; | ||
52 | |||
53 | vec3 samp_pos = getPosition(frag).xyz; | ||
54 | |||
55 | float shadow = 1.0; | ||
56 | vec4 pos = vec4(vary_position, 1.0); | ||
57 | |||
58 | vec4 spos = pos; | ||
59 | |||
60 | if (spos.z > -shadow_clip.w) | ||
61 | { | ||
62 | vec4 lpos; | ||
63 | |||
64 | if (spos.z < -shadow_clip.z) | ||
65 | { | ||
66 | lpos = shadow_matrix[3]*spos; | ||
67 | lpos.xy *= screen_res; | ||
68 | shadow = shadow2DRectProj(shadowMap3, lpos).x; | ||
69 | shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); | ||
70 | } | ||
71 | else if (spos.z < -shadow_clip.y) | ||
72 | { | ||
73 | lpos = shadow_matrix[2]*spos; | ||
74 | lpos.xy *= screen_res; | ||
75 | shadow = shadow2DRectProj(shadowMap2, lpos).x; | ||
76 | } | ||
77 | else if (spos.z < -shadow_clip.x) | ||
78 | { | ||
79 | lpos = shadow_matrix[1]*spos; | ||
80 | lpos.xy *= screen_res; | ||
81 | shadow = shadow2DRectProj(shadowMap1, lpos).x; | ||
82 | } | ||
83 | else | ||
84 | { | ||
85 | lpos = shadow_matrix[0]*spos; | ||
86 | lpos.xy *= screen_res; | ||
87 | shadow = shadow2DRectProj(shadowMap0, lpos).x; | ||
88 | } | ||
89 | } | ||
90 | |||
91 | vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, gl_Color.a); | ||
92 | vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * col; | ||
93 | |||
94 | color.rgb = atmosLighting(color.rgb); | ||
95 | |||
96 | color.rgb = scaleSoftClip(color.rgb); | ||
97 | |||
98 | if (samp_pos.z != 0.0) | ||
99 | { | ||
100 | float dist_factor = alpha_soften; | ||
101 | float a = gl_Color.a; | ||
102 | a *= a; | ||
103 | dist_factor *= 1.0/(1.0-a); | ||
104 | color.a *= min((pos.z-samp_pos.z)*dist_factor, 1.0); | ||
105 | } | ||
106 | |||
107 | //gl_FragColor = gl_Color; | ||
108 | gl_FragColor = color; | ||
109 | //gl_FragColor = vec4(1,0,1,1)*shadow; | ||
110 | |||
111 | } | ||
112 | |||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl deleted file mode 100644 index ab60b65..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | /** | ||
2 | * @file alphaV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); | ||
9 | void calcAtmospherics(vec3 inPositionEye); | ||
10 | |||
11 | float calcDirectionalLight(vec3 n, vec3 l); | ||
12 | float calcPointLight(vec3 v, vec3 n, vec4 lp, float la); | ||
13 | |||
14 | vec3 atmosAmbient(vec3 light); | ||
15 | vec3 atmosAffectDirectionalLight(float lightIntensity); | ||
16 | vec3 scaleDownLight(vec3 light); | ||
17 | vec3 scaleUpLight(vec3 light); | ||
18 | |||
19 | varying vec3 vary_ambient; | ||
20 | varying vec3 vary_directional; | ||
21 | varying vec3 vary_fragcoord; | ||
22 | varying vec3 vary_position; | ||
23 | varying vec3 vary_light; | ||
24 | |||
25 | uniform float near_clip; | ||
26 | uniform float shadow_offset; | ||
27 | uniform float shadow_bias; | ||
28 | |||
29 | void main() | ||
30 | { | ||
31 | //transform vertex | ||
32 | gl_Position = ftransform(); | ||
33 | |||
34 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; | ||
35 | |||
36 | vec4 pos = (gl_ModelViewMatrix * gl_Vertex); | ||
37 | vec3 norm = normalize(gl_NormalMatrix * gl_Normal); | ||
38 | |||
39 | vary_position = vec4(pos.xyz + norm.xyz * (-pos.z/64.0*shadow_offset+shadow_bias), 1.0); | ||
40 | |||
41 | calcAtmospherics(pos.xyz); | ||
42 | |||
43 | //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); | ||
44 | vec4 col; | ||
45 | col.a = gl_Color.a; | ||
46 | |||
47 | // Add windlight lights | ||
48 | col.rgb = atmosAmbient(vec3(0.)); | ||
49 | col.rgb = scaleUpLight(col.rgb); | ||
50 | |||
51 | // Collect normal lights (need to be divided by two, as we later multiply by 2) | ||
52 | col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].linearAttenuation); | ||
53 | col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].linearAttenuation); | ||
54 | col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].linearAttenuation); | ||
55 | col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].linearAttenuation); | ||
56 | col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].linearAttenuation); | ||
57 | col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].linearAttenuation); | ||
58 | col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz); | ||
59 | col.rgb = scaleDownLight(col.rgb); | ||
60 | |||
61 | vary_light = gl_LightSource[0].position.xyz; | ||
62 | |||
63 | vary_ambient = col.rgb*gl_Color.rgb; | ||
64 | vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); | ||
65 | |||
66 | col.rgb = min(col.rgb*gl_Color.rgb, 1.0); | ||
67 | |||
68 | gl_FrontColor = col; | ||
69 | |||
70 | gl_FogFragCoord = pos.z; | ||
71 | |||
72 | pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
73 | vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); | ||
74 | |||
75 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaF.glsl deleted file mode 100644 index fe83c3c..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaF.glsl +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | /** | ||
2 | * @file avatarAlphaF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2D diffuseMap; | ||
9 | uniform sampler2DRectShadow shadowMap0; | ||
10 | uniform sampler2DRectShadow shadowMap1; | ||
11 | uniform sampler2DRectShadow shadowMap2; | ||
12 | uniform sampler2DRectShadow shadowMap3; | ||
13 | uniform sampler2D noiseMap; | ||
14 | |||
15 | uniform mat4 shadow_matrix[6]; | ||
16 | uniform vec4 shadow_clip; | ||
17 | uniform vec2 screen_res; | ||
18 | |||
19 | vec3 atmosLighting(vec3 light); | ||
20 | vec3 scaleSoftClip(vec3 light); | ||
21 | |||
22 | varying vec3 vary_ambient; | ||
23 | varying vec3 vary_directional; | ||
24 | varying vec4 vary_position; | ||
25 | varying vec3 vary_normal; | ||
26 | |||
27 | void main() | ||
28 | { | ||
29 | float shadow = 1.0; | ||
30 | vec4 pos = vary_position; | ||
31 | vec3 norm = normalize(vary_normal); | ||
32 | |||
33 | vec3 nz = texture2D(noiseMap, gl_FragCoord.xy/128.0).xyz; | ||
34 | |||
35 | vec4 spos = pos; | ||
36 | |||
37 | if (spos.z > -shadow_clip.w) | ||
38 | { | ||
39 | vec4 lpos; | ||
40 | |||
41 | if (spos.z < -shadow_clip.z) | ||
42 | { | ||
43 | lpos = shadow_matrix[3]*spos; | ||
44 | lpos.xy *= screen_res; | ||
45 | shadow = shadow2DRectProj(shadowMap3, lpos).x; | ||
46 | shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); | ||
47 | } | ||
48 | else if (spos.z < -shadow_clip.y) | ||
49 | { | ||
50 | lpos = shadow_matrix[2]*spos; | ||
51 | lpos.xy *= screen_res; | ||
52 | shadow = shadow2DRectProj(shadowMap2, lpos).x; | ||
53 | } | ||
54 | else if (spos.z < -shadow_clip.x) | ||
55 | { | ||
56 | lpos = shadow_matrix[1]*spos; | ||
57 | lpos.xy *= screen_res; | ||
58 | shadow = shadow2DRectProj(shadowMap1, lpos).x; | ||
59 | } | ||
60 | else | ||
61 | { | ||
62 | lpos = shadow_matrix[0]*spos; | ||
63 | lpos.xy *= screen_res; | ||
64 | shadow = shadow2DRectProj(shadowMap0, lpos).x; | ||
65 | } | ||
66 | } | ||
67 | |||
68 | |||
69 | vec4 col = vec4(vary_ambient + vary_directional*shadow, gl_Color.a); | ||
70 | vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * col; | ||
71 | |||
72 | color.rgb = atmosLighting(color.rgb); | ||
73 | |||
74 | color.rgb = scaleSoftClip(color.rgb); | ||
75 | |||
76 | gl_FragColor = color; | ||
77 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl deleted file mode 100644 index c1988d3..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | /** | ||
2 | * @file avatarAlphaV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); | ||
9 | mat4 getSkinnedTransform(); | ||
10 | void calcAtmospherics(vec3 inPositionEye); | ||
11 | |||
12 | float calcDirectionalLight(vec3 n, vec3 l); | ||
13 | float calcPointLight(vec3 v, vec3 n, vec4 lp, float la); | ||
14 | |||
15 | vec3 atmosAmbient(vec3 light); | ||
16 | vec3 atmosAffectDirectionalLight(float lightIntensity); | ||
17 | vec3 scaleDownLight(vec3 light); | ||
18 | vec3 scaleUpLight(vec3 light); | ||
19 | |||
20 | varying vec4 vary_position; | ||
21 | varying vec3 vary_ambient; | ||
22 | varying vec3 vary_directional; | ||
23 | varying vec3 vary_normal; | ||
24 | |||
25 | void main() | ||
26 | { | ||
27 | gl_TexCoord[0] = gl_MultiTexCoord0; | ||
28 | |||
29 | vec4 pos; | ||
30 | vec3 norm; | ||
31 | |||
32 | mat4 trans = getSkinnedTransform(); | ||
33 | pos.x = dot(trans[0], gl_Vertex); | ||
34 | pos.y = dot(trans[1], gl_Vertex); | ||
35 | pos.z = dot(trans[2], gl_Vertex); | ||
36 | pos.w = 1.0; | ||
37 | |||
38 | norm.x = dot(trans[0].xyz, gl_Normal); | ||
39 | norm.y = dot(trans[1].xyz, gl_Normal); | ||
40 | norm.z = dot(trans[2].xyz, gl_Normal); | ||
41 | norm = normalize(norm); | ||
42 | |||
43 | gl_Position = gl_ProjectionMatrix * pos; | ||
44 | vary_position = pos; | ||
45 | vary_normal = norm; | ||
46 | |||
47 | calcAtmospherics(pos.xyz); | ||
48 | |||
49 | //vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); | ||
50 | vec4 col; | ||
51 | col.a = gl_Color.a; | ||
52 | |||
53 | // Add windlight lights | ||
54 | col.rgb = atmosAmbient(vec3(0.)); | ||
55 | col.rgb = scaleUpLight(col.rgb); | ||
56 | |||
57 | // Collect normal lights (need to be divided by two, as we later multiply by 2) | ||
58 | col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].linearAttenuation); | ||
59 | col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].linearAttenuation); | ||
60 | col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].linearAttenuation); | ||
61 | col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].linearAttenuation); | ||
62 | col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].linearAttenuation); | ||
63 | col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].linearAttenuation); | ||
64 | col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz); | ||
65 | col.rgb = scaleDownLight(col.rgb); | ||
66 | |||
67 | vary_ambient = col.rgb*gl_Color.rgb; | ||
68 | vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); | ||
69 | |||
70 | col.rgb = min(col.rgb*gl_Color.rgb, 1.0); | ||
71 | |||
72 | gl_FrontColor = col; | ||
73 | |||
74 | gl_FogFragCoord = pos.z; | ||
75 | |||
76 | } | ||
77 | |||
78 | |||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl deleted file mode 100644 index 1713fe9..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | /** | ||
2 | * @file blurLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2DRect depthMap; | ||
11 | uniform sampler2DRect normalMap; | ||
12 | uniform sampler2DRect lightMap; | ||
13 | |||
14 | uniform float dist_factor; | ||
15 | uniform float blur_size; | ||
16 | uniform vec2 delta; | ||
17 | uniform vec3 kern[32]; | ||
18 | uniform int kern_length; | ||
19 | uniform float kern_scale; | ||
20 | |||
21 | varying vec2 vary_fragcoord; | ||
22 | |||
23 | uniform mat4 inv_proj; | ||
24 | uniform vec2 screen_res; | ||
25 | |||
26 | vec4 getPosition(vec2 pos_screen) | ||
27 | { | ||
28 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
29 | vec2 sc = pos_screen.xy*2.0; | ||
30 | sc /= screen_res; | ||
31 | sc -= vec2(1.0,1.0); | ||
32 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
33 | vec4 pos = inv_proj * ndc; | ||
34 | pos /= pos.w; | ||
35 | pos.w = 1.0; | ||
36 | return pos; | ||
37 | } | ||
38 | |||
39 | void main() | ||
40 | { | ||
41 | vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz*2.0-1.0; | ||
42 | vec3 pos = getPosition(vary_fragcoord.xy).xyz; | ||
43 | vec4 ccol = texture2DRect(lightMap, vary_fragcoord.xy).rgba; | ||
44 | |||
45 | vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); | ||
46 | |||
47 | dlt /= max(-pos.z*dist_factor, 1.0); | ||
48 | |||
49 | vec2 defined_weight = kern[0].xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free' | ||
50 | vec4 col = defined_weight.xyxx * ccol; | ||
51 | |||
52 | for (int i = 1; i < kern_length; i++) | ||
53 | { | ||
54 | vec2 tc = vary_fragcoord.xy + kern[i].z*dlt; | ||
55 | vec3 samppos = getPosition(tc).xyz; | ||
56 | float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane | ||
57 | if (d*d <= 0.003) | ||
58 | { | ||
59 | col += texture2DRect(lightMap, tc)*kern[i].xyxx; | ||
60 | defined_weight += kern[i].xy; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | |||
65 | |||
66 | col /= defined_weight.xyxx; | ||
67 | |||
68 | gl_FragColor = col; | ||
69 | |||
70 | //gl_FragColor = ccol; | ||
71 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/blurLightV.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/blurLightV.glsl deleted file mode 100644 index b7f07e5..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/blurLightV.glsl +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /** | ||
2 | * @file blurLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | uniform vec2 screen_res; | ||
10 | |||
11 | void main() | ||
12 | { | ||
13 | //transform vertex | ||
14 | gl_Position = ftransform(); | ||
15 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
16 | vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; | ||
17 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl deleted file mode 100644 index 6519594..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ /dev/null | |||
@@ -1,188 +0,0 @@ | |||
1 | /** | ||
2 | * @file multiSpotLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #version 120 | ||
9 | |||
10 | #extension GL_ARB_texture_rectangle : enable | ||
11 | |||
12 | uniform sampler2DRect diffuseRect; | ||
13 | uniform sampler2DRect specularRect; | ||
14 | uniform sampler2DRect depthMap; | ||
15 | uniform sampler2DRect normalMap; | ||
16 | uniform samplerCube environmentMap; | ||
17 | uniform sampler2DRect lightMap; | ||
18 | uniform sampler2D noiseMap; | ||
19 | uniform sampler2D lightFunc; | ||
20 | uniform sampler2D projectionMap; | ||
21 | |||
22 | uniform mat4 proj_mat; //screen space to light space | ||
23 | uniform float proj_near; //near clip for projection | ||
24 | uniform vec3 proj_p; //plane projection is emitting from (in screen space) | ||
25 | uniform vec3 proj_n; | ||
26 | uniform float proj_focus; //distance from plane to begin blurring | ||
27 | uniform float proj_lod; //(number of mips in proj map) | ||
28 | uniform float proj_range; //range between near clip and far clip plane of projection | ||
29 | uniform float proj_ambient_lod; | ||
30 | uniform float proj_ambiance; | ||
31 | uniform float near_clip; | ||
32 | uniform float far_clip; | ||
33 | |||
34 | uniform vec3 proj_origin; //origin of projection to be used for angular attenuation | ||
35 | uniform float sun_wash; | ||
36 | uniform int proj_shadow_idx; | ||
37 | uniform float shadow_fade; | ||
38 | |||
39 | varying vec4 vary_light; | ||
40 | |||
41 | varying vec4 vary_fragcoord; | ||
42 | uniform vec2 screen_res; | ||
43 | |||
44 | uniform mat4 inv_proj; | ||
45 | |||
46 | vec4 getPosition(vec2 pos_screen) | ||
47 | { | ||
48 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
49 | vec2 sc = pos_screen.xy*2.0; | ||
50 | sc /= screen_res; | ||
51 | sc -= vec2(1.0,1.0); | ||
52 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
53 | vec4 pos = inv_proj * ndc; | ||
54 | pos /= pos.w; | ||
55 | pos.w = 1.0; | ||
56 | return pos; | ||
57 | } | ||
58 | |||
59 | void main() | ||
60 | { | ||
61 | vec4 frag = vary_fragcoord; | ||
62 | frag.xyz /= frag.w; | ||
63 | frag.xyz = frag.xyz*0.5+0.5; | ||
64 | frag.xy *= screen_res; | ||
65 | |||
66 | vec3 pos = getPosition(frag.xy).xyz; | ||
67 | vec3 lv = vary_light.xyz-pos.xyz; | ||
68 | float dist2 = dot(lv,lv); | ||
69 | dist2 /= vary_light.w; | ||
70 | if (dist2 > 1.0) | ||
71 | { | ||
72 | discard; | ||
73 | } | ||
74 | |||
75 | float shadow = 1.0; | ||
76 | |||
77 | if (proj_shadow_idx >= 0) | ||
78 | { | ||
79 | vec4 shd = texture2DRect(lightMap, frag.xy); | ||
80 | float sh[2]; | ||
81 | sh[0] = shd.b; | ||
82 | sh[1] = shd.a; | ||
83 | shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); | ||
84 | } | ||
85 | |||
86 | vec3 norm = texture2DRect(normalMap, frag.xy).xyz*2.0-1.0; | ||
87 | |||
88 | norm = normalize(norm); | ||
89 | float l_dist = -dot(lv, proj_n); | ||
90 | |||
91 | vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); | ||
92 | if (proj_tc.z < 0.0) | ||
93 | { | ||
94 | discard; | ||
95 | } | ||
96 | |||
97 | proj_tc.xyz /= proj_tc.w; | ||
98 | |||
99 | float fa = gl_Color.a+1.0; | ||
100 | float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); | ||
101 | if (dist_atten <= 0.0) | ||
102 | { | ||
103 | discard; | ||
104 | } | ||
105 | |||
106 | lv = proj_origin-pos.xyz; | ||
107 | lv = normalize(lv); | ||
108 | float da = dot(norm, lv); | ||
109 | |||
110 | vec3 col = vec3(0,0,0); | ||
111 | |||
112 | vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; | ||
113 | |||
114 | float noise = texture2D(noiseMap, frag.xy/128.0).b; | ||
115 | if (proj_tc.z > 0.0 && | ||
116 | proj_tc.x < 1.0 && | ||
117 | proj_tc.y < 1.0 && | ||
118 | proj_tc.x > 0.0 && | ||
119 | proj_tc.y > 0.0) | ||
120 | { | ||
121 | float lit = 0.0; | ||
122 | float amb_da = proj_ambiance; | ||
123 | |||
124 | if (da > 0.0) | ||
125 | { | ||
126 | float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); | ||
127 | float lod = diff * proj_lod; | ||
128 | |||
129 | vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod); | ||
130 | |||
131 | vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; | ||
132 | |||
133 | lit = da * dist_atten * noise; | ||
134 | |||
135 | col = lcol*lit*diff_tex*shadow; | ||
136 | amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; | ||
137 | } | ||
138 | |||
139 | //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); | ||
140 | vec4 amb_plcol = texture2DLod(projectionMap, proj_tc.xy, proj_ambient_lod); | ||
141 | |||
142 | amb_da += (da*da*0.5+0.5)*proj_ambiance; | ||
143 | |||
144 | amb_da *= dist_atten * noise; | ||
145 | |||
146 | amb_da = min(amb_da, 1.0-lit); | ||
147 | |||
148 | col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; | ||
149 | } | ||
150 | |||
151 | |||
152 | vec4 spec = texture2DRect(specularRect, frag.xy); | ||
153 | if (spec.a > 0.0) | ||
154 | { | ||
155 | vec3 ref = reflect(normalize(pos), norm); | ||
156 | |||
157 | //project from point pos in direction ref to plane proj_p, proj_n | ||
158 | vec3 pdelta = proj_p-pos; | ||
159 | float ds = dot(ref, proj_n); | ||
160 | |||
161 | if (ds < 0.0) | ||
162 | { | ||
163 | vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; | ||
164 | |||
165 | vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); | ||
166 | |||
167 | if (stc.z > 0.0) | ||
168 | { | ||
169 | stc.xy /= stc.w; | ||
170 | |||
171 | if (stc.x < 1.0 && | ||
172 | stc.y < 1.0 && | ||
173 | stc.x > 0.0 && | ||
174 | stc.y > 0.0) | ||
175 | { | ||
176 | vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); | ||
177 | col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow; | ||
178 | } | ||
179 | } | ||
180 | } | ||
181 | } | ||
182 | |||
183 | //attenuate point light contribution by SSAO component | ||
184 | col *= texture2DRect(lightMap, frag.xy).g; | ||
185 | |||
186 | gl_FragColor.rgb = col; | ||
187 | gl_FragColor.a = 0.0; | ||
188 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/postDeferredF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/postDeferredF.glsl deleted file mode 100644 index ee0e9d6..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/postDeferredF.glsl +++ /dev/null | |||
@@ -1,59 +0,0 @@ | |||
1 | /** | ||
2 | * @file postDeferredF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect diffuseRect; | ||
9 | uniform sampler2DRect localLightMap; | ||
10 | uniform sampler2DRect sunLightMap; | ||
11 | uniform sampler2DRect giLightMap; | ||
12 | uniform sampler2D luminanceMap; | ||
13 | uniform sampler2DRect lightMap; | ||
14 | |||
15 | uniform vec3 gi_lum_quad; | ||
16 | uniform vec3 sun_lum_quad; | ||
17 | uniform vec3 lum_quad; | ||
18 | uniform float lum_lod; | ||
19 | uniform vec4 ambient; | ||
20 | |||
21 | uniform vec3 gi_quad; | ||
22 | |||
23 | uniform vec2 screen_res; | ||
24 | varying vec2 vary_fragcoord; | ||
25 | |||
26 | void main() | ||
27 | { | ||
28 | vec2 tc = vary_fragcoord.xy; | ||
29 | vec3 lcol = texture2DLod(luminanceMap, tc/screen_res, lum_lod).rgb; | ||
30 | |||
31 | float lum = sqrt(lcol.r)*lum_quad.x+lcol.r*lcol.r*lum_quad.y+lcol.r*lum_quad.z; | ||
32 | |||
33 | vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); | ||
34 | |||
35 | float ambocc = texture2DRect(lightMap, vary_fragcoord.xy).g; | ||
36 | |||
37 | vec3 gi_col = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; | ||
38 | gi_col = gi_col*gi_col*gi_quad.x + gi_col*gi_quad.y+gi_quad.z*ambocc*ambient.rgb; | ||
39 | gi_col *= diff; | ||
40 | |||
41 | vec4 sun_col = texture2DRect(sunLightMap, vary_fragcoord.xy); | ||
42 | |||
43 | vec3 local_col = texture2DRect(localLightMap, vary_fragcoord.xy).rgb; | ||
44 | |||
45 | |||
46 | float sun_lum = 1.0-lum; | ||
47 | sun_lum = sun_lum*sun_lum*sun_lum_quad.x + sun_lum*sun_lum_quad.y+sun_lum_quad.z; | ||
48 | |||
49 | float gi_lum = lum; | ||
50 | gi_lum = gi_lum*gi_lum*gi_lum_quad.x+gi_lum*gi_lum_quad.y+gi_lum_quad.z; | ||
51 | gi_col *= 1.0/gi_lum; | ||
52 | |||
53 | vec3 col = sun_col.rgb*(1.0+max(sun_lum,0.0))+gi_col+local_col; | ||
54 | |||
55 | gl_FragColor.rgb = col.rgb; | ||
56 | gl_FragColor.a = max(sun_lum*min(sun_col.r+sun_col.g+sun_col.b, 1.0), sun_col.a); | ||
57 | |||
58 | //gl_FragColor.rgb = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; | ||
59 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/postDeferredV.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/postDeferredV.glsl deleted file mode 100644 index 9819232..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/postDeferredV.glsl +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /** | ||
2 | * @file postDeferredV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | uniform vec2 screen_res; | ||
10 | |||
11 | void main() | ||
12 | { | ||
13 | //transform vertex | ||
14 | gl_Position = ftransform(); | ||
15 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
16 | vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; | ||
17 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl deleted file mode 100644 index 52b79e3..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ /dev/null | |||
@@ -1,294 +0,0 @@ | |||
1 | /** | ||
2 | * @file softenLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2DRect diffuseRect; | ||
11 | uniform sampler2DRect specularRect; | ||
12 | uniform sampler2DRect normalMap; | ||
13 | uniform sampler2DRect lightMap; | ||
14 | uniform sampler2D noiseMap; | ||
15 | uniform samplerCube environmentMap; | ||
16 | uniform sampler2D lightFunc; | ||
17 | uniform vec3 gi_quad; | ||
18 | |||
19 | uniform float blur_size; | ||
20 | uniform float blur_fidelity; | ||
21 | |||
22 | // Inputs | ||
23 | uniform vec4 morphFactor; | ||
24 | uniform vec3 camPosLocal; | ||
25 | //uniform vec4 camPosWorld; | ||
26 | uniform vec4 gamma; | ||
27 | uniform vec4 lightnorm; | ||
28 | uniform vec4 sunlight_color; | ||
29 | uniform vec4 ambient; | ||
30 | uniform vec4 blue_horizon; | ||
31 | uniform vec4 blue_density; | ||
32 | uniform vec4 haze_horizon; | ||
33 | uniform vec4 haze_density; | ||
34 | uniform vec4 cloud_shadow; | ||
35 | uniform vec4 density_multiplier; | ||
36 | uniform vec4 distance_multiplier; | ||
37 | uniform vec4 max_y; | ||
38 | uniform vec4 glow; | ||
39 | uniform float scene_light_strength; | ||
40 | uniform vec3 env_mat[3]; | ||
41 | uniform vec4 shadow_clip; | ||
42 | uniform mat3 ssao_effect_mat; | ||
43 | |||
44 | uniform sampler2DRect depthMap; | ||
45 | uniform mat4 inv_proj; | ||
46 | uniform vec2 screen_res; | ||
47 | |||
48 | varying vec4 vary_light; | ||
49 | varying vec2 vary_fragcoord; | ||
50 | |||
51 | vec3 vary_PositionEye; | ||
52 | |||
53 | vec3 vary_SunlitColor; | ||
54 | vec3 vary_AmblitColor; | ||
55 | vec3 vary_AdditiveColor; | ||
56 | vec3 vary_AtmosAttenuation; | ||
57 | |||
58 | vec4 getPosition(vec2 pos_screen) | ||
59 | { //get position in screen space (world units) given window coordinate and depth map | ||
60 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
61 | vec2 sc = pos_screen.xy*2.0; | ||
62 | sc /= screen_res; | ||
63 | sc -= vec2(1.0,1.0); | ||
64 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
65 | vec4 pos = inv_proj * ndc; | ||
66 | pos /= pos.w; | ||
67 | pos.w = 1.0; | ||
68 | return pos; | ||
69 | } | ||
70 | |||
71 | vec3 getPositionEye() | ||
72 | { | ||
73 | return vary_PositionEye; | ||
74 | } | ||
75 | vec3 getSunlitColor() | ||
76 | { | ||
77 | return vary_SunlitColor; | ||
78 | } | ||
79 | vec3 getAmblitColor() | ||
80 | { | ||
81 | return vary_AmblitColor; | ||
82 | } | ||
83 | vec3 getAdditiveColor() | ||
84 | { | ||
85 | return vary_AdditiveColor; | ||
86 | } | ||
87 | vec3 getAtmosAttenuation() | ||
88 | { | ||
89 | return vary_AtmosAttenuation; | ||
90 | } | ||
91 | |||
92 | |||
93 | void setPositionEye(vec3 v) | ||
94 | { | ||
95 | vary_PositionEye = v; | ||
96 | } | ||
97 | |||
98 | void setSunlitColor(vec3 v) | ||
99 | { | ||
100 | vary_SunlitColor = v; | ||
101 | } | ||
102 | |||
103 | void setAmblitColor(vec3 v) | ||
104 | { | ||
105 | vary_AmblitColor = v; | ||
106 | } | ||
107 | |||
108 | void setAdditiveColor(vec3 v) | ||
109 | { | ||
110 | vary_AdditiveColor = v; | ||
111 | } | ||
112 | |||
113 | void setAtmosAttenuation(vec3 v) | ||
114 | { | ||
115 | vary_AtmosAttenuation = v; | ||
116 | } | ||
117 | |||
118 | void calcAtmospherics(vec3 inPositionEye, float ambFactor) { | ||
119 | |||
120 | vec3 P = inPositionEye; | ||
121 | setPositionEye(P); | ||
122 | |||
123 | //(TERRAIN) limit altitude | ||
124 | if (P.y > max_y.x) P *= (max_y.x / P.y); | ||
125 | if (P.y < -max_y.x) P *= (-max_y.x / P.y); | ||
126 | |||
127 | vec3 tmpLightnorm = lightnorm.xyz; | ||
128 | |||
129 | vec3 Pn = normalize(P); | ||
130 | float Plen = length(P); | ||
131 | |||
132 | vec4 temp1 = vec4(0); | ||
133 | vec3 temp2 = vec3(0); | ||
134 | vec4 blue_weight; | ||
135 | vec4 haze_weight; | ||
136 | vec4 sunlight = sunlight_color; | ||
137 | vec4 light_atten; | ||
138 | |||
139 | //sunlight attenuation effect (hue and brightness) due to atmosphere | ||
140 | //this is used later for sunlight modulation at various altitudes | ||
141 | light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x); | ||
142 | //I had thought blue_density and haze_density should have equal weighting, | ||
143 | //but attenuation due to haze_density tends to seem too strong | ||
144 | |||
145 | temp1 = blue_density + vec4(haze_density.r); | ||
146 | blue_weight = blue_density / temp1; | ||
147 | haze_weight = vec4(haze_density.r) / temp1; | ||
148 | |||
149 | //(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain) | ||
150 | temp2.y = max(0.0, tmpLightnorm.y); | ||
151 | temp2.y = 1. / temp2.y; | ||
152 | sunlight *= exp( - light_atten * temp2.y); | ||
153 | |||
154 | // main atmospheric scattering line integral | ||
155 | temp2.z = Plen * density_multiplier.x; | ||
156 | |||
157 | // Transparency (-> temp1) | ||
158 | // ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati | ||
159 | // compiler gets confused. | ||
160 | temp1 = exp(-temp1 * temp2.z * distance_multiplier.x); | ||
161 | |||
162 | //final atmosphere attenuation factor | ||
163 | setAtmosAttenuation(temp1.rgb); | ||
164 | |||
165 | //compute haze glow | ||
166 | //(can use temp2.x as temp because we haven't used it yet) | ||
167 | temp2.x = dot(Pn, tmpLightnorm.xyz); | ||
168 | temp2.x = 1. - temp2.x; | ||
169 | //temp2.x is 0 at the sun and increases away from sun | ||
170 | temp2.x = max(temp2.x, .03); //was glow.y | ||
171 | //set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) | ||
172 | temp2.x *= glow.x; | ||
173 | //higher glow.x gives dimmer glow (because next step is 1 / "angle") | ||
174 | temp2.x = pow(temp2.x, glow.z); | ||
175 | //glow.z should be negative, so we're doing a sort of (1 / "angle") function | ||
176 | |||
177 | //add "minimum anti-solar illumination" | ||
178 | temp2.x += .25; | ||
179 | |||
180 | //increase ambient when there are more clouds | ||
181 | vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5; | ||
182 | |||
183 | /* decrease value and saturation (that in HSV, not HSL) for occluded areas | ||
184 | * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html | ||
185 | * // The following line of code performs the equivalent of: | ||
186 | * float ambAlpha = tmpAmbient.a; | ||
187 | * float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis | ||
188 | * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue); | ||
189 | * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha); | ||
190 | */ | ||
191 | tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a); | ||
192 | |||
193 | //haze color | ||
194 | setAdditiveColor( | ||
195 | vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient) | ||
196 | + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x | ||
197 | + tmpAmbient))); | ||
198 | |||
199 | //brightness of surface both sunlight and ambient | ||
200 | setSunlitColor(vec3(sunlight * .5)); | ||
201 | setAmblitColor(vec3(tmpAmbient * .25)); | ||
202 | setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1)); | ||
203 | } | ||
204 | |||
205 | vec3 atmosLighting(vec3 light) | ||
206 | { | ||
207 | light *= getAtmosAttenuation().r; | ||
208 | light += getAdditiveColor(); | ||
209 | return (2.0 * light); | ||
210 | } | ||
211 | |||
212 | vec3 atmosTransport(vec3 light) { | ||
213 | light *= getAtmosAttenuation().r; | ||
214 | light += getAdditiveColor() * 2.0; | ||
215 | return light; | ||
216 | } | ||
217 | vec3 atmosGetDiffuseSunlightColor() | ||
218 | { | ||
219 | return getSunlitColor(); | ||
220 | } | ||
221 | |||
222 | vec3 scaleDownLight(vec3 light) | ||
223 | { | ||
224 | return (light / scene_light_strength ); | ||
225 | } | ||
226 | |||
227 | vec3 scaleUpLight(vec3 light) | ||
228 | { | ||
229 | return (light * scene_light_strength); | ||
230 | } | ||
231 | |||
232 | vec3 atmosAmbient(vec3 light) | ||
233 | { | ||
234 | return getAmblitColor() + light / 2.0; | ||
235 | } | ||
236 | |||
237 | vec3 atmosAffectDirectionalLight(float lightIntensity) | ||
238 | { | ||
239 | return getSunlitColor() * lightIntensity; | ||
240 | } | ||
241 | |||
242 | vec3 scaleSoftClip(vec3 light) | ||
243 | { | ||
244 | //soft clip effect: | ||
245 | light = 1. - clamp(light, vec3(0.), vec3(1.)); | ||
246 | light = 1. - pow(light, gamma.xxx); | ||
247 | |||
248 | return light; | ||
249 | } | ||
250 | |||
251 | void main() | ||
252 | { | ||
253 | vec2 tc = vary_fragcoord.xy; | ||
254 | vec3 pos = getPosition(tc).xyz; | ||
255 | vec3 norm = texture2DRect(normalMap, tc).xyz*2.0-1.0; | ||
256 | vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz; | ||
257 | |||
258 | float da = max(dot(norm.xyz, vary_light.xyz), 0.0); | ||
259 | |||
260 | vec4 diffuse = texture2DRect(diffuseRect, tc); | ||
261 | vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); | ||
262 | |||
263 | vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; | ||
264 | float scol = max(scol_ambocc.r, diffuse.a); | ||
265 | float ambocc = scol_ambocc.g; | ||
266 | |||
267 | calcAtmospherics(pos.xyz, ambocc); | ||
268 | |||
269 | vec3 col = atmosAmbient(vec3(0)); | ||
270 | col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a)); | ||
271 | |||
272 | col *= diffuse.rgb; | ||
273 | |||
274 | if (spec.a > 0.0) | ||
275 | { | ||
276 | vec3 ref = normalize(reflect(pos.xyz, norm.xyz)); | ||
277 | float sa = dot(ref, vary_light.xyz); | ||
278 | col.rgb += vary_SunlitColor*scol*spec.rgb*texture2D(lightFunc, vec2(sa, spec.a)).a; | ||
279 | } | ||
280 | |||
281 | col = atmosLighting(col); | ||
282 | col = scaleSoftClip(col); | ||
283 | |||
284 | gl_FragColor.rgb = col; | ||
285 | |||
286 | //gl_FragColor.rgb = gi_col.rgb; | ||
287 | gl_FragColor.a = 0.0; | ||
288 | |||
289 | //gl_FragColor.rg = scol_ambocc.rg; | ||
290 | //gl_FragColor.rgb = texture2DRect(lightMap, vary_fragcoord.xy).rgb; | ||
291 | //gl_FragColor.rgb = norm.rgb*0.5+0.5; | ||
292 | //gl_FragColor.rgb = vec3(ambocc); | ||
293 | //gl_FragColor.rgb = vec3(scol); | ||
294 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl deleted file mode 100644 index ad8af47..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /** | ||
2 | * @file softenLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform vec2 screen_res; | ||
9 | |||
10 | varying vec4 vary_light; | ||
11 | varying vec2 vary_fragcoord; | ||
12 | void main() | ||
13 | { | ||
14 | //transform vertex | ||
15 | gl_Position = ftransform(); | ||
16 | |||
17 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
18 | vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; | ||
19 | |||
20 | vec4 tex = gl_MultiTexCoord0; | ||
21 | tex.w = 1.0; | ||
22 | |||
23 | vary_light = gl_MultiTexCoord0; | ||
24 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl deleted file mode 100644 index d653408..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ /dev/null | |||
@@ -1,199 +0,0 @@ | |||
1 | /** | ||
2 | * @file spotLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #version 120 | ||
9 | |||
10 | #extension GL_ARB_texture_rectangle : enable | ||
11 | |||
12 | uniform sampler2DRect diffuseRect; | ||
13 | uniform sampler2DRect specularRect; | ||
14 | uniform sampler2DRect depthMap; | ||
15 | uniform sampler2DRect normalMap; | ||
16 | uniform samplerCube environmentMap; | ||
17 | uniform sampler2DRect lightMap; | ||
18 | uniform sampler2D noiseMap; | ||
19 | uniform sampler2D lightFunc; | ||
20 | uniform sampler2D projectionMap; | ||
21 | |||
22 | uniform mat4 proj_mat; //screen space to light space | ||
23 | uniform float proj_near; //near clip for projection | ||
24 | uniform vec3 proj_p; //plane projection is emitting from (in screen space) | ||
25 | uniform vec3 proj_n; | ||
26 | uniform float proj_focus; //distance from plane to begin blurring | ||
27 | uniform float proj_lod; //(number of mips in proj map) | ||
28 | uniform float proj_range; //range between near clip and far clip plane of projection | ||
29 | uniform float proj_ambiance; | ||
30 | uniform float near_clip; | ||
31 | uniform float far_clip; | ||
32 | |||
33 | uniform vec3 proj_origin; //origin of projection to be used for angular attenuation | ||
34 | uniform float sun_wash; | ||
35 | uniform int proj_shadow_idx; | ||
36 | uniform float shadow_fade; | ||
37 | |||
38 | varying vec4 vary_light; | ||
39 | |||
40 | varying vec4 vary_fragcoord; | ||
41 | uniform vec2 screen_res; | ||
42 | |||
43 | uniform mat4 inv_proj; | ||
44 | |||
45 | vec4 getPosition(vec2 pos_screen) | ||
46 | { | ||
47 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
48 | vec2 sc = pos_screen.xy*2.0; | ||
49 | sc /= screen_res; | ||
50 | sc -= vec2(1.0,1.0); | ||
51 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
52 | vec4 pos = inv_proj * ndc; | ||
53 | pos /= pos.w; | ||
54 | pos.w = 1.0; | ||
55 | return pos; | ||
56 | } | ||
57 | |||
58 | void main() | ||
59 | { | ||
60 | vec4 frag = vary_fragcoord; | ||
61 | frag.xyz /= frag.w; | ||
62 | frag.xyz = frag.xyz*0.5+0.5; | ||
63 | frag.xy *= screen_res; | ||
64 | |||
65 | float shadow = 1.0; | ||
66 | |||
67 | if (proj_shadow_idx >= 0) | ||
68 | { | ||
69 | vec4 shd = texture2DRect(lightMap, frag.xy); | ||
70 | float sh[2]; | ||
71 | sh[0] = shd.b; | ||
72 | sh[1] = shd.a; | ||
73 | shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0); | ||
74 | } | ||
75 | |||
76 | vec3 pos = getPosition(frag.xy).xyz; | ||
77 | vec3 lv = vary_light.xyz-pos.xyz; | ||
78 | float dist2 = dot(lv,lv); | ||
79 | dist2 /= vary_light.w; | ||
80 | if (dist2 > 1.0) | ||
81 | { | ||
82 | discard; | ||
83 | } | ||
84 | |||
85 | vec3 norm = texture2DRect(normalMap, frag.xy).xyz*2.0-1.0; | ||
86 | |||
87 | norm = normalize(norm); | ||
88 | float l_dist = -dot(lv, proj_n); | ||
89 | |||
90 | vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); | ||
91 | if (proj_tc.z < 0.0) | ||
92 | { | ||
93 | discard; | ||
94 | } | ||
95 | |||
96 | proj_tc.xyz /= proj_tc.w; | ||
97 | |||
98 | float fa = gl_Color.a+1.0; | ||
99 | float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); | ||
100 | |||
101 | lv = proj_origin-pos.xyz; | ||
102 | lv = normalize(lv); | ||
103 | float da = dot(norm, lv); | ||
104 | |||
105 | vec3 col = vec3(0,0,0); | ||
106 | |||
107 | vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; | ||
108 | |||
109 | float noise = texture2D(noiseMap, frag.xy/128.0).b; | ||
110 | if (proj_tc.z > 0.0 && | ||
111 | proj_tc.x < 1.0 && | ||
112 | proj_tc.y < 1.0 && | ||
113 | proj_tc.x > 0.0 && | ||
114 | proj_tc.y > 0.0) | ||
115 | { | ||
116 | float lit = 0.0; | ||
117 | if (da > 0.0) | ||
118 | { | ||
119 | float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); | ||
120 | float lod = diff * proj_lod; | ||
121 | |||
122 | vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod); | ||
123 | |||
124 | vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; | ||
125 | |||
126 | lit = da * dist_atten * noise; | ||
127 | |||
128 | col = lcol*lit*diff_tex*shadow; | ||
129 | } | ||
130 | |||
131 | float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); | ||
132 | float lod = diff * proj_lod; | ||
133 | vec4 amb_plcol = texture2DLod(projectionMap, proj_tc.xy, lod); | ||
134 | //float amb_da = mix(proj_ambiance, proj_ambiance*max(-da, 0.0), max(da, 0.0)); | ||
135 | float amb_da = proj_ambiance; | ||
136 | if (da > 0.0) | ||
137 | { | ||
138 | amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; | ||
139 | } | ||
140 | |||
141 | amb_da += (da*da*0.5+0.5)*proj_ambiance; | ||
142 | |||
143 | amb_da *= dist_atten * noise; | ||
144 | |||
145 | amb_da = min(amb_da, 1.0-lit); | ||
146 | |||
147 | col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; | ||
148 | } | ||
149 | |||
150 | |||
151 | vec4 spec = texture2DRect(specularRect, frag.xy); | ||
152 | if (spec.a > 0.0) | ||
153 | { | ||
154 | vec3 ref = reflect(normalize(pos), norm); | ||
155 | |||
156 | //project from point pos in direction ref to plane proj_p, proj_n | ||
157 | vec3 pdelta = proj_p-pos; | ||
158 | float ds = dot(ref, proj_n); | ||
159 | |||
160 | if (ds < 0.0) | ||
161 | { | ||
162 | vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; | ||
163 | |||
164 | vec3 stc = (proj_mat * vec4(pfinal.xyz, 1.0)).xyz; | ||
165 | |||
166 | if (stc.z > 0.0) | ||
167 | { | ||
168 | stc.xy /= stc.z+proj_near; | ||
169 | |||
170 | if (stc.x < 1.0 && | ||
171 | stc.y < 1.0 && | ||
172 | stc.x > 0.0 && | ||
173 | stc.y > 0.0) | ||
174 | { | ||
175 | vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); | ||
176 | col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow; | ||
177 | } | ||
178 | } | ||
179 | } | ||
180 | } | ||
181 | |||
182 | /*if (spec.a > 0.0) | ||
183 | { | ||
184 | //vec3 ref = reflect(normalize(pos), norm); | ||
185 | float sa = dot(normalize(lv-normalize(pos)),norm);; | ||
186 | //sa = max(sa, 0.0); | ||
187 | //sa = pow(sa, 128.0 * spec.a*spec.a/dist_atten)*min(dist_atten*4.0, 1.0); | ||
188 | sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0); | ||
189 | sa *= noise; | ||
190 | col += da*sa*lcol*spec.rgb; | ||
191 | }*/ | ||
192 | |||
193 | //attenuate point light contribution by SSAO component | ||
194 | col *= texture2DRect(lightMap, frag.xy).g; | ||
195 | |||
196 | |||
197 | gl_FragColor.rgb = col; | ||
198 | gl_FragColor.a = 0.0; | ||
199 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl deleted file mode 100644 index 8ced94e..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ /dev/null | |||
@@ -1,203 +0,0 @@ | |||
1 | /** | ||
2 | * @file sunLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2DRect depthMap; | ||
11 | uniform sampler2DRect normalMap; | ||
12 | uniform sampler2DRectShadow shadowMap0; | ||
13 | uniform sampler2DRectShadow shadowMap1; | ||
14 | uniform sampler2DRectShadow shadowMap2; | ||
15 | uniform sampler2DRectShadow shadowMap3; | ||
16 | uniform sampler2DRectShadow shadowMap4; | ||
17 | uniform sampler2DRectShadow shadowMap5; | ||
18 | uniform sampler2D noiseMap; | ||
19 | |||
20 | uniform sampler2D lightFunc; | ||
21 | |||
22 | |||
23 | // Inputs | ||
24 | uniform mat4 shadow_matrix[6]; | ||
25 | uniform vec4 shadow_clip; | ||
26 | uniform float ssao_radius; | ||
27 | uniform float ssao_max_radius; | ||
28 | uniform float ssao_factor; | ||
29 | uniform float ssao_factor_inv; | ||
30 | |||
31 | varying vec2 vary_fragcoord; | ||
32 | varying vec4 vary_light; | ||
33 | |||
34 | uniform mat4 inv_proj; | ||
35 | uniform vec2 screen_res; | ||
36 | |||
37 | uniform float shadow_bias; | ||
38 | uniform float shadow_offset; | ||
39 | |||
40 | vec4 getPosition(vec2 pos_screen) | ||
41 | { | ||
42 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
43 | vec2 sc = pos_screen.xy*2.0; | ||
44 | sc /= screen_res; | ||
45 | sc -= vec2(1.0,1.0); | ||
46 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
47 | vec4 pos = inv_proj * ndc; | ||
48 | pos /= pos.w; | ||
49 | pos.w = 1.0; | ||
50 | return pos; | ||
51 | } | ||
52 | |||
53 | //calculate decreases in ambient lighting when crowded out (SSAO) | ||
54 | float calcAmbientOcclusion(vec4 pos, vec3 norm) | ||
55 | { | ||
56 | vec2 kern[8]; | ||
57 | // exponentially (^2) distant occlusion samples spread around origin | ||
58 | kern[0] = vec2(-1.0, 0.0) * 0.125*0.125; | ||
59 | kern[1] = vec2(1.0, 0.0) * 0.250*0.250; | ||
60 | kern[2] = vec2(0.0, 1.0) * 0.375*0.375; | ||
61 | kern[3] = vec2(0.0, -1.0) * 0.500*0.500; | ||
62 | kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625; | ||
63 | kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; | ||
64 | kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; | ||
65 | kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; | ||
66 | |||
67 | vec2 pos_screen = vary_fragcoord.xy; | ||
68 | vec3 pos_world = pos.xyz; | ||
69 | vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy; | ||
70 | |||
71 | float angle_hidden = 0.0; | ||
72 | int points = 0; | ||
73 | |||
74 | float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); | ||
75 | |||
76 | // it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?) | ||
77 | for (int i = 0; i < 8; i++) | ||
78 | { | ||
79 | vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect); | ||
80 | vec3 samppos_world = getPosition(samppos_screen).xyz; | ||
81 | |||
82 | vec3 diff = pos_world - samppos_world; | ||
83 | float dist2 = dot(diff, diff); | ||
84 | |||
85 | // assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area | ||
86 | // --> solid angle shrinking by the square of distance | ||
87 | //radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 | ||
88 | //(k should vary inversely with # of samples, but this is taken care of later) | ||
89 | |||
90 | //if (dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) // -0.05*norm to shift sample point back slightly for flat surfaces | ||
91 | // angle_hidden += min(1.0/dist2, ssao_factor_inv); // dist != 0 follows from conditional. max of 1.0 (= ssao_factor_inv * ssao_factor) | ||
92 | angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv); | ||
93 | |||
94 | // 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion" | ||
95 | points = points + int(diff.z > -1.0); | ||
96 | } | ||
97 | |||
98 | angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); | ||
99 | |||
100 | return (1.0 - (float(points != 0) * angle_hidden)); | ||
101 | } | ||
102 | |||
103 | void main() | ||
104 | { | ||
105 | vec2 pos_screen = vary_fragcoord.xy; | ||
106 | |||
107 | //try doing an unproject here | ||
108 | |||
109 | vec4 pos = getPosition(pos_screen); | ||
110 | |||
111 | vec3 norm = texture2DRect(normalMap, pos_screen).xyz*2.0-1.0; | ||
112 | |||
113 | /*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL | ||
114 | { | ||
115 | gl_FragColor = vec4(0.0); // doesn't matter | ||
116 | return; | ||
117 | }*/ | ||
118 | |||
119 | float shadow = 1.0; | ||
120 | float dp_directional_light = max(0.0, dot(norm, vary_light.xyz)); | ||
121 | |||
122 | vec4 spos = vec4(pos.xyz + norm.xyz * (-pos.z/64.0*shadow_offset+shadow_bias), 1.0); | ||
123 | |||
124 | //vec3 debug = vec3(0,0,0); | ||
125 | |||
126 | if (spos.z > -shadow_clip.w) | ||
127 | { | ||
128 | if (dp_directional_light == 0.0) | ||
129 | { | ||
130 | // if we know this point is facing away from the sun then we know it's in shadow without having to do a squirrelly shadow-map lookup | ||
131 | shadow = 0.0; | ||
132 | } | ||
133 | else | ||
134 | { | ||
135 | vec4 lpos; | ||
136 | |||
137 | if (spos.z < -shadow_clip.z) | ||
138 | { | ||
139 | lpos = shadow_matrix[3]*spos; | ||
140 | lpos.xy *= screen_res; | ||
141 | shadow = shadow2DRectProj(shadowMap3, lpos).x; | ||
142 | shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0); | ||
143 | } | ||
144 | else if (spos.z < -shadow_clip.y) | ||
145 | { | ||
146 | lpos = shadow_matrix[2]*spos; | ||
147 | lpos.xy *= screen_res; | ||
148 | shadow = shadow2DRectProj(shadowMap2, lpos).x; | ||
149 | } | ||
150 | else if (spos.z < -shadow_clip.x) | ||
151 | { | ||
152 | lpos = shadow_matrix[1]*spos; | ||
153 | lpos.xy *= screen_res; | ||
154 | shadow = shadow2DRectProj(shadowMap1, lpos).x; | ||
155 | } | ||
156 | else | ||
157 | { | ||
158 | lpos = shadow_matrix[0]*spos; | ||
159 | lpos.xy *= screen_res; | ||
160 | shadow = shadow2DRectProj(shadowMap0, lpos).x; | ||
161 | } | ||
162 | |||
163 | // take the most-shadowed value out of these two: | ||
164 | // * the blurred sun shadow in the light (shadow) map | ||
165 | // * an unblurred dot product between the sun and this norm | ||
166 | // the goal is to err on the side of most-shadow to fill-in shadow holes and reduce artifacting | ||
167 | shadow = min(shadow, dp_directional_light); | ||
168 | } | ||
169 | |||
170 | /*debug.r = lpos.y / (lpos.w*screen_res.y); | ||
171 | |||
172 | lpos.xy /= lpos.w*32.0; | ||
173 | if (fract(lpos.x) < 0.1 || fract(lpos.y) < 0.1) | ||
174 | { | ||
175 | debug.gb = vec2(0.5, 0.5); | ||
176 | } | ||
177 | |||
178 | debug += (1.0-shadow)*0.5;*/ | ||
179 | |||
180 | } | ||
181 | else | ||
182 | { | ||
183 | // more distant than the shadow map covers | ||
184 | shadow = 1.0; | ||
185 | } | ||
186 | |||
187 | gl_FragColor[0] = shadow; | ||
188 | gl_FragColor[1] = calcAmbientOcclusion(pos, norm); | ||
189 | |||
190 | //spotlight shadow 1 | ||
191 | vec4 lpos = shadow_matrix[4]*spos; | ||
192 | lpos.xy *= screen_res; | ||
193 | gl_FragColor[2] = shadow2DRectProj(shadowMap4, lpos).x; | ||
194 | |||
195 | //spotlight shadow 2 | ||
196 | lpos = shadow_matrix[5]*spos; | ||
197 | lpos.xy *= screen_res; | ||
198 | gl_FragColor[3] = shadow2DRectProj(shadowMap5, lpos).x; | ||
199 | |||
200 | //gl_FragColor.rgb = pos.xyz; | ||
201 | //gl_FragColor.b = shadow; | ||
202 | //gl_FragColor.rgb = debug; | ||
203 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl deleted file mode 100644 index 5081485..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | /** | ||
2 | * @file sunLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec4 vary_light; | ||
9 | varying vec2 vary_fragcoord; | ||
10 | |||
11 | uniform vec2 screen_res; | ||
12 | |||
13 | void main() | ||
14 | { | ||
15 | //transform vertex | ||
16 | gl_Position = ftransform(); | ||
17 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
18 | vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; | ||
19 | vec4 tex = gl_MultiTexCoord0; | ||
20 | tex.w = 1.0; | ||
21 | |||
22 | vary_light = gl_MultiTexCoord0; | ||
23 | |||
24 | gl_FrontColor = gl_Color; | ||
25 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/waterF.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/waterF.glsl deleted file mode 100644 index 7342186..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/waterF.glsl +++ /dev/null | |||
@@ -1,139 +0,0 @@ | |||
1 | /** | ||
2 | * @file waterF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | vec3 scaleSoftClip(vec3 inColor); | ||
9 | vec3 atmosTransport(vec3 inColor); | ||
10 | |||
11 | uniform sampler2D bumpMap; | ||
12 | uniform sampler2D screenTex; | ||
13 | uniform sampler2D refTex; | ||
14 | uniform sampler2DRectShadow shadowMap0; | ||
15 | uniform sampler2DRectShadow shadowMap1; | ||
16 | uniform sampler2DRectShadow shadowMap2; | ||
17 | uniform sampler2DRectShadow shadowMap3; | ||
18 | uniform sampler2D noiseMap; | ||
19 | |||
20 | uniform mat4 shadow_matrix[6]; | ||
21 | uniform vec4 shadow_clip; | ||
22 | |||
23 | uniform float sunAngle; | ||
24 | uniform float sunAngle2; | ||
25 | uniform vec3 lightDir; | ||
26 | uniform vec3 specular; | ||
27 | uniform float lightExp; | ||
28 | uniform float refScale; | ||
29 | uniform float kd; | ||
30 | uniform vec2 screenRes; | ||
31 | uniform vec3 normScale; | ||
32 | uniform float fresnelScale; | ||
33 | uniform float fresnelOffset; | ||
34 | uniform float blurMultiplier; | ||
35 | uniform vec2 screen_res; | ||
36 | uniform mat4 norm_mat; //region space to screen space | ||
37 | |||
38 | //bigWave is (refCoord.w, view.w); | ||
39 | varying vec4 refCoord; | ||
40 | varying vec4 littleWave; | ||
41 | varying vec4 view; | ||
42 | varying vec4 vary_position; | ||
43 | |||
44 | void main() | ||
45 | { | ||
46 | vec4 color; | ||
47 | float dist = length(view.xy); | ||
48 | |||
49 | //normalize view vector | ||
50 | vec3 viewVec = normalize(view.xyz); | ||
51 | |||
52 | //get wave normals | ||
53 | vec3 wave1 = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0; | ||
54 | vec3 wave2 = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0; | ||
55 | vec3 wave3 = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0; | ||
56 | //get base fresnel components | ||
57 | |||
58 | vec3 df = vec3( | ||
59 | dot(viewVec, wave1), | ||
60 | dot(viewVec, (wave2 + wave3) * 0.5), | ||
61 | dot(viewVec, wave3) | ||
62 | ) * fresnelScale + fresnelOffset; | ||
63 | df *= df; | ||
64 | |||
65 | vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5; | ||
66 | |||
67 | float dist2 = dist; | ||
68 | dist = max(dist, 5.0); | ||
69 | |||
70 | float dmod = sqrt(dist); | ||
71 | |||
72 | vec2 dmod_scale = vec2(dmod*dmod, dmod); | ||
73 | |||
74 | //get reflected color | ||
75 | vec2 refdistort1 = wave1.xy*normScale.x; | ||
76 | vec2 refvec1 = distort+refdistort1/dmod_scale; | ||
77 | vec4 refcol1 = texture2D(refTex, refvec1); | ||
78 | |||
79 | vec2 refdistort2 = wave2.xy*normScale.y; | ||
80 | vec2 refvec2 = distort+refdistort2/dmod_scale; | ||
81 | vec4 refcol2 = texture2D(refTex, refvec2); | ||
82 | |||
83 | vec2 refdistort3 = wave3.xy*normScale.z; | ||
84 | vec2 refvec3 = distort+refdistort3/dmod_scale; | ||
85 | vec4 refcol3 = texture2D(refTex, refvec3); | ||
86 | |||
87 | vec4 refcol = refcol1 + refcol2 + refcol3; | ||
88 | float df1 = df.x + df.y + df.z; | ||
89 | refcol *= df1 * 0.333; | ||
90 | |||
91 | vec3 wavef = (wave1 + wave2 * 0.4 + wave3 * 0.6) * 0.5; | ||
92 | //wavef.z *= max(-viewVec.z, 0.1); | ||
93 | wavef = normalize(wavef); | ||
94 | |||
95 | float df2 = dot(viewVec, wavef) * fresnelScale+fresnelOffset; | ||
96 | |||
97 | vec2 refdistort4 = wavef.xy*0.125; | ||
98 | refdistort4.y -= abs(refdistort4.y); | ||
99 | vec2 refvec4 = distort+refdistort4/dmod; | ||
100 | float dweight = min(dist2*blurMultiplier, 1.0); | ||
101 | vec4 baseCol = texture2D(refTex, refvec4); | ||
102 | refcol = mix(baseCol*df2, refcol, dweight); | ||
103 | |||
104 | //get specular component | ||
105 | //float spec = clamp(dot(lightDir, (reflect(viewVec,wavef))),0.0,1.0); | ||
106 | |||
107 | //harden specular | ||
108 | //spec = pow(spec, 128.0); | ||
109 | |||
110 | //figure out distortion vector (ripply) | ||
111 | vec2 distort2 = distort+wavef.xy*refScale/max(dmod*df1, 1.0); | ||
112 | |||
113 | vec4 fb = texture2D(screenTex, distort2); | ||
114 | |||
115 | //mix with reflection | ||
116 | // Note we actually want to use just df1, but multiplying by 0.999999 gets around and nvidia compiler bug | ||
117 | color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.99999); | ||
118 | |||
119 | float shadow = 1.0; | ||
120 | vec4 pos = vary_position; | ||
121 | |||
122 | vec3 nz = texture2D(noiseMap, gl_FragCoord.xy/128.0).xyz; | ||
123 | vec4 spos = pos; | ||
124 | |||
125 | //spec *= shadow; | ||
126 | //color.rgb += spec * specular; | ||
127 | |||
128 | //color.rgb = atmosTransport(color.rgb); | ||
129 | //color.rgb = scaleSoftClip(color.rgb); | ||
130 | //color.a = spec * sunAngle2; | ||
131 | |||
132 | //wavef.z *= 0.1f; | ||
133 | wavef = normalize(wavef); | ||
134 | wavef = (norm_mat*vec4(wavef, 1.0)).xyz; | ||
135 | |||
136 | gl_FragData[0] = vec4(color.rgb, 0.75); | ||
137 | gl_FragData[1] = vec4(1,1,1, 0.8); | ||
138 | gl_FragData[2] = vec4(wavef*0.5+0.5, 0.f); | ||
139 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class2/deferred/waterV.glsl b/linden/indra/newview/app_settings/shaders/class2/deferred/waterV.glsl deleted file mode 100644 index b45e5c5..0000000 --- a/linden/indra/newview/app_settings/shaders/class2/deferred/waterV.glsl +++ /dev/null | |||
@@ -1,76 +0,0 @@ | |||
1 | /** | ||
2 | * @file waterV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | void calcAtmospherics(vec3 inPositionEye); | ||
9 | |||
10 | uniform vec2 d1; | ||
11 | uniform vec2 d2; | ||
12 | uniform float time; | ||
13 | uniform vec3 eyeVec; | ||
14 | uniform float waterHeight; | ||
15 | |||
16 | varying vec4 refCoord; | ||
17 | varying vec4 littleWave; | ||
18 | varying vec4 view; | ||
19 | |||
20 | varying vec4 vary_position; | ||
21 | |||
22 | float wave(vec2 v, float t, float f, vec2 d, float s) | ||
23 | { | ||
24 | return (dot(d, v)*f + t*s)*f; | ||
25 | } | ||
26 | |||
27 | void main() | ||
28 | { | ||
29 | //transform vertex | ||
30 | vec4 position = gl_Vertex; | ||
31 | mat4 modelViewProj = gl_ModelViewProjectionMatrix; | ||
32 | |||
33 | vec4 oPosition; | ||
34 | |||
35 | //get view vector | ||
36 | vec3 oEyeVec; | ||
37 | oEyeVec.xyz = position.xyz-eyeVec; | ||
38 | |||
39 | float d = length(oEyeVec.xy); | ||
40 | float ld = min(d, 2560.0); | ||
41 | |||
42 | position.xy = eyeVec.xy + oEyeVec.xy/d*ld; | ||
43 | view.xyz = oEyeVec; | ||
44 | |||
45 | d = clamp(ld/1536.0-0.5, 0.0, 1.0); | ||
46 | d *= d; | ||
47 | |||
48 | oPosition = position; | ||
49 | oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); | ||
50 | vary_position = gl_ModelViewMatrix * oPosition; | ||
51 | oPosition = modelViewProj * oPosition; | ||
52 | |||
53 | refCoord.xyz = oPosition.xyz + vec3(0,0,0.2); | ||
54 | |||
55 | //get wave position parameter (create sweeping horizontal waves) | ||
56 | vec3 v = position.xyz; | ||
57 | v.x += (cos(v.x*0.08/*+time*0.01*/)+sin(v.y*0.02))*6.0; | ||
58 | |||
59 | //push position for further horizon effect. | ||
60 | position.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z); | ||
61 | position.w = 1.0; | ||
62 | position = position*gl_ModelViewMatrix; | ||
63 | |||
64 | calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz); | ||
65 | |||
66 | |||
67 | //pass wave parameters to pixel shader | ||
68 | vec2 bigWave = (v.xy) * vec2(0.04,0.04) + d1 * time * 0.055; | ||
69 | //get two normal map (detail map) texture coordinates | ||
70 | littleWave.xy = (v.xy) * vec2(0.45, 0.9) + d2 * time * 0.13; | ||
71 | littleWave.zw = (v.xy) * vec2(0.1, 0.2) + d1 * time * 0.1; | ||
72 | view.w = bigWave.y; | ||
73 | refCoord.w = bigWave.x; | ||
74 | |||
75 | gl_Position = oPosition; | ||
76 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/avatarF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/avatarF.glsl deleted file mode 100644 index 9cc71a7..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/avatarF.glsl +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | /** | ||
2 | * @file avatarF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2D diffuseMap; | ||
9 | |||
10 | varying vec3 vary_normal; | ||
11 | |||
12 | void main() | ||
13 | { | ||
14 | gl_FragData[0] = vec4(gl_Color.rgb * texture2D(diffuseMap, gl_TexCoord[0].xy).rgb, 0.0); | ||
15 | gl_FragData[1] = vec4(0,0,0,0); | ||
16 | gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0); | ||
17 | } | ||
18 | |||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/bumpF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/bumpF.glsl deleted file mode 100644 index 6eb4a51..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/bumpF.glsl +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | /** | ||
2 | * @file bumpF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2D diffuseMap; | ||
9 | uniform sampler2D bumpMap; | ||
10 | |||
11 | varying vec3 vary_mat0; | ||
12 | varying vec3 vary_mat1; | ||
13 | varying vec3 vary_mat2; | ||
14 | |||
15 | void main() | ||
16 | { | ||
17 | vec3 col = texture2D(diffuseMap, gl_TexCoord[0].xy).rgb; | ||
18 | vec3 norm = texture2D(bumpMap, gl_TexCoord[0].xy).rgb * 2.0 - 1.0; | ||
19 | |||
20 | vec3 tnorm = vec3(dot(norm,vary_mat0), | ||
21 | dot(norm,vary_mat1), | ||
22 | dot(norm,vary_mat2)); | ||
23 | |||
24 | gl_FragData[0] = vec4(gl_Color.rgb*col, 0.0); | ||
25 | gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); | ||
26 | gl_FragData[2] = vec4(normalize(tnorm)*0.5+0.5, 0.0); | ||
27 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/diffuseF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/diffuseF.glsl deleted file mode 100644 index c9f75f7..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/diffuseF.glsl +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | /** | ||
2 | * @file diffuseF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2D diffuseMap; | ||
9 | |||
10 | varying vec3 vary_normal; | ||
11 | |||
12 | void main() | ||
13 | { | ||
14 | vec3 col = texture2D(diffuseMap, gl_TexCoord[0].xy).rgb; | ||
15 | gl_FragData[0] = vec4(gl_Color.rgb*col, 0.0); | ||
16 | gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); | ||
17 | gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0); | ||
18 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl deleted file mode 100644 index 7325825..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl +++ /dev/null | |||
@@ -1,84 +0,0 @@ | |||
1 | /** | ||
2 | * @file giDownsampleF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect giLightMap; | ||
9 | |||
10 | uniform vec2 kern[32]; | ||
11 | uniform float dist_factor; | ||
12 | uniform float blur_size; | ||
13 | uniform vec2 delta; | ||
14 | uniform int kern_length; | ||
15 | uniform float kern_scale; | ||
16 | uniform vec3 blur_quad; | ||
17 | |||
18 | varying vec2 vary_fragcoord; | ||
19 | |||
20 | uniform mat4 inv_proj; | ||
21 | uniform vec2 screen_res; | ||
22 | |||
23 | vec4 getPosition(vec2 pos_screen) | ||
24 | { | ||
25 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
26 | vec2 sc = pos_screen.xy*2.0; | ||
27 | sc /= screen_res; | ||
28 | sc -= vec2(1.0,1.0); | ||
29 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
30 | vec4 pos = inv_proj * ndc; | ||
31 | pos /= pos.w; | ||
32 | pos.w = 1.0; | ||
33 | return pos; | ||
34 | } | ||
35 | |||
36 | float getDepth(vec2 pos_screen) | ||
37 | { | ||
38 | float z = texture2DRect(depthMap, pos_screen.xy).a; | ||
39 | z = z*2.0-1.0; | ||
40 | vec4 ndc = vec4(0.0, 0.0, z, 1.0); | ||
41 | vec4 p = inv_proj*ndc; | ||
42 | return p.z/p.w; | ||
43 | } | ||
44 | |||
45 | void main() | ||
46 | { | ||
47 | vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz*2.0-1.0; | ||
48 | float depth = getDepth(vary_fragcoord.xy); | ||
49 | |||
50 | vec3 ccol = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; | ||
51 | vec2 dlt = kern_scale * delta/(vec2(1.0,1.0)+norm.xy*norm.xy); | ||
52 | dlt /= clamp(-depth*blur_quad.x, 1.0, 3.0); | ||
53 | float defined_weight = kern[0].x; | ||
54 | vec3 col = ccol*kern[0].x; | ||
55 | |||
56 | for (int i = 0; i < kern_length; i++) | ||
57 | { | ||
58 | vec2 tc = vary_fragcoord.xy + kern[i].y*dlt; | ||
59 | vec3 sampNorm = texture2DRect(normalMap, tc.xy).xyz*2.0-1.0; | ||
60 | |||
61 | float d = dot(norm.xyz, sampNorm); | ||
62 | |||
63 | if (d > 0.5) | ||
64 | { | ||
65 | float sampdepth = getDepth(tc.xy); | ||
66 | sampdepth -= depth; | ||
67 | if (sampdepth*sampdepth < blur_quad.z) | ||
68 | { | ||
69 | col += texture2DRect(giLightMap, tc).rgb*kern[i].x; | ||
70 | defined_weight += kern[i].x; | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | |||
75 | col /= defined_weight; | ||
76 | |||
77 | //col = ccol; | ||
78 | |||
79 | col = col*blur_quad.y; | ||
80 | |||
81 | gl_FragData[0].xyz = col; | ||
82 | |||
83 | //gl_FragColor = ccol; | ||
84 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl deleted file mode 100644 index 6adcda8..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /** | ||
2 | * @file postgiV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | uniform vec2 screen_res; | ||
10 | |||
11 | void main() | ||
12 | { | ||
13 | //transform vertex | ||
14 | gl_Position = ftransform(); | ||
15 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
16 | vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; | ||
17 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/giF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/giF.glsl deleted file mode 100644 index 43da836..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/giF.glsl +++ /dev/null | |||
@@ -1,219 +0,0 @@ | |||
1 | /** | ||
2 | * @file giF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2DRect depthMap; | ||
11 | uniform sampler2DRect normalMap; | ||
12 | uniform sampler2DRect lightMap; | ||
13 | uniform sampler2DRect specularRect; | ||
14 | |||
15 | uniform sampler2D noiseMap; | ||
16 | |||
17 | uniform sampler2D diffuseGIMap; | ||
18 | uniform sampler2D specularGIMap; | ||
19 | uniform sampler2D normalGIMap; | ||
20 | uniform sampler2D depthGIMap; | ||
21 | |||
22 | uniform sampler2D lightFunc; | ||
23 | |||
24 | // Inputs | ||
25 | varying vec2 vary_fragcoord; | ||
26 | |||
27 | uniform vec2 screen_res; | ||
28 | |||
29 | uniform vec4 sunlight_color; | ||
30 | |||
31 | uniform mat4 inv_proj; | ||
32 | uniform mat4 gi_mat; //gPipeline.mGIMatrix - eye space to sun space | ||
33 | uniform mat4 gi_mat_proj; //gPipeline.mGIMatrixProj - eye space to projected sun space | ||
34 | uniform mat4 gi_norm_mat; //gPipeline.mGINormalMatrix - eye space normal to sun space normal matrix | ||
35 | uniform mat4 gi_inv_proj; //gPipeline.mGIInvProj - projected sun space to sun space | ||
36 | uniform float gi_radius; | ||
37 | uniform float gi_intensity; | ||
38 | uniform int gi_samples; | ||
39 | uniform vec2 gi_kern[25]; | ||
40 | uniform vec2 gi_scale; | ||
41 | uniform vec3 gi_quad; | ||
42 | uniform vec3 gi_spec; | ||
43 | uniform float gi_direction_weight; | ||
44 | uniform float gi_light_offset; | ||
45 | uniform float gi_range; | ||
46 | |||
47 | vec4 getPosition(vec2 pos_screen) | ||
48 | { | ||
49 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
50 | vec2 sc = pos_screen.xy*2.0; | ||
51 | sc /= screen_res; | ||
52 | sc -= vec2(1.0,1.0); | ||
53 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
54 | vec4 pos = inv_proj * ndc; | ||
55 | pos /= pos.w; | ||
56 | pos.w = 1.0; | ||
57 | return pos; | ||
58 | } | ||
59 | |||
60 | vec4 getGIPosition(vec2 gi_tc) | ||
61 | { | ||
62 | float depth = texture2D(depthGIMap, gi_tc).a; | ||
63 | vec2 sc = gi_tc*2.0; | ||
64 | sc -= vec2(1.0, 1.0); | ||
65 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
66 | vec4 pos = gi_inv_proj*ndc; | ||
67 | pos.xyz /= pos.w; | ||
68 | pos.w = 1.0; | ||
69 | return pos; | ||
70 | } | ||
71 | |||
72 | vec3 giAmbient(vec3 pos, vec3 norm) | ||
73 | { | ||
74 | vec4 gi_c = gi_mat_proj * vec4(pos, 1.0); | ||
75 | gi_c.xyz /= gi_c.w; | ||
76 | |||
77 | vec4 gi_pos = gi_mat*vec4(pos,1.0); | ||
78 | vec3 gi_norm = (gi_norm_mat*vec4(norm,1.0)).xyz; | ||
79 | gi_norm = normalize(gi_norm); | ||
80 | |||
81 | vec4 c_spec = texture2DRect(specularRect, vary_fragcoord.xy); | ||
82 | gi_pos.xyz += (texture2D(noiseMap, vary_fragcoord.xy/128.0).x)*gi_spec.z*gi_norm.xyz; | ||
83 | vec2 tcx = gi_norm.xy; | ||
84 | vec2 tcy = gi_norm.yx; | ||
85 | |||
86 | vec4 eye_pos = gi_mat*vec4(0,0,0,1.0); | ||
87 | |||
88 | vec3 eye_dir = normalize(gi_pos.xyz-eye_pos.xyz); | ||
89 | vec3 eye_ref = reflect(eye_dir, gi_norm); | ||
90 | |||
91 | //vec3 eye_dir = vec3(0,0,-1); | ||
92 | //eye_dir = (gi_norm_mat*vec4(eye_dir, 1.0)).xyz; | ||
93 | //eye_dir = normalize(eye_dir); | ||
94 | |||
95 | //float round_x = gi_scale.x; | ||
96 | //float round_y = gi_scale.y; | ||
97 | |||
98 | vec3 debug = texture2D(normalGIMap, gi_c.xy).rgb; | ||
99 | //debug.xz = vec2(0.0,0.0); | ||
100 | //debug = fract(debug); | ||
101 | |||
102 | float round_x = 1.0/64.0; | ||
103 | float round_y = 1.0/64.0; | ||
104 | |||
105 | //gi_c.x = floor(gi_c.x/round_x+0.5)*round_x; | ||
106 | //gi_c.y = floor(gi_c.y/round_y+0.5)*round_y; | ||
107 | |||
108 | float da = texture2DRect(lightMap, vary_fragcoord.xy).r; | ||
109 | |||
110 | vec3 fdiff = vec3(da); | ||
111 | |||
112 | if (da > 0.0) | ||
113 | { | ||
114 | vec3 ha = -eye_dir; | ||
115 | ha.z += 1.0; | ||
116 | ha = normalize(ha); | ||
117 | |||
118 | float sa = dot(ha,gi_norm); | ||
119 | da = min(da, texture2D(lightFunc, vec2(sa, c_spec.a)).a); | ||
120 | fdiff += da*(c_spec.rgb*c_spec.a*2.0); | ||
121 | } | ||
122 | |||
123 | float fda = da; | ||
124 | |||
125 | vec3 rcol = vec3(0,0,0); | ||
126 | |||
127 | float fsa = 0.0; | ||
128 | |||
129 | |||
130 | for (int i = -1; i <= 1; i += 1 ) | ||
131 | { | ||
132 | for (int j = -1; j <= 1; j+= 1) | ||
133 | { | ||
134 | vec2 tc = vec2(i, j)*0.75+gi_norm.xy; | ||
135 | vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0+tc*0.5).xyz; | ||
136 | tc += gi_norm.xy*nz.z; | ||
137 | tc += nz.xy*2.0; | ||
138 | tc /= gi_samples; | ||
139 | tc += gi_c.xy; | ||
140 | |||
141 | vec3 lnorm = -normalize(texture2D(normalGIMap, tc.xy).xyz*2.0-1.0); | ||
142 | vec3 lpos = getGIPosition(tc.xy).xyz; | ||
143 | |||
144 | vec3 at = lpos-gi_pos.xyz; | ||
145 | float dist = dot(at,at); | ||
146 | float da = clamp(1.0/(gi_spec.x*dist), 0.0, 1.0); | ||
147 | |||
148 | |||
149 | if (da > 0.01) | ||
150 | { //possible contribution of indirect light to this surface | ||
151 | vec3 ldir = at; | ||
152 | |||
153 | float ld = -dot(ldir, lnorm); | ||
154 | |||
155 | if (ld < 0.0) | ||
156 | { | ||
157 | float ang_atten = dot(ldir, gi_norm); | ||
158 | |||
159 | if (ang_atten > 0.0) | ||
160 | { | ||
161 | vec4 spec = texture2D(specularGIMap, tc.xy); | ||
162 | at = normalize(at); | ||
163 | vec3 diff; | ||
164 | |||
165 | { //contribution from indirect source to visible pixel | ||
166 | vec3 ha = at; | ||
167 | ha.z -= 1.0; | ||
168 | ha = normalize(ha); | ||
169 | float sa = dot(ha,lnorm); | ||
170 | da = min(da, texture2D(lightFunc, vec2(sa, spec.a)).a); | ||
171 | |||
172 | diff = texture2D(diffuseGIMap, tc.xy).rgb+spec.rgb*spec.a*2.0; | ||
173 | } | ||
174 | |||
175 | if (da > 0.0) | ||
176 | { //contribution from visible pixel to eye | ||
177 | vec3 ha = normalize(at-eye_dir); | ||
178 | float sa = dot(ha, gi_norm); | ||
179 | da = min(da, texture2D(lightFunc, vec2(sa, c_spec.a)).a); | ||
180 | fda += da; | ||
181 | fdiff += da*(c_spec.rgb*c_spec.a*2.0+vec3(1,1,1))*diff.rgb; | ||
182 | } | ||
183 | } | ||
184 | } | ||
185 | } | ||
186 | } | ||
187 | } | ||
188 | |||
189 | //fdiff /= max(gi_spec.y*fda, gi_quad.z); | ||
190 | //fdiff = clamp(fdiff, vec3(0), vec3(1)); | ||
191 | fdiff *= 64.0; | ||
192 | fdiff *= sunlight_color.rgb; | ||
193 | |||
194 | vec3 ret = fda*fdiff; | ||
195 | //ret = ret*ret*gi_quad.x+ret*gi_quad.y+gi_quad.z; | ||
196 | |||
197 | //fda *= nz.z; | ||
198 | |||
199 | //rcol.rgb *= gi_intensity; | ||
200 | //return rcol.rgb+vary_AmblitColor.rgb*0.25; | ||
201 | //return vec4(debug, 0.0); | ||
202 | //return vec4(fda*fdiff, 0.0); | ||
203 | return clamp(ret,vec3(0.0), vec3(1.0)); | ||
204 | //return debug.xyz; | ||
205 | } | ||
206 | |||
207 | void main() | ||
208 | { | ||
209 | vec2 pos_screen = vary_fragcoord.xy; | ||
210 | vec4 pos = getPosition(pos_screen); | ||
211 | |||
212 | float rad = gi_range*0.5; | ||
213 | |||
214 | vec3 norm = texture2DRect(normalMap, pos_screen).xyz*2.0-1.0; | ||
215 | float dist = max(length(pos.xyz)-rad, 0.0); | ||
216 | |||
217 | float da = clamp(1.0-dist/rad, 0.0, 1.0); | ||
218 | gl_FragData[0].xyz = da > 0.0 ? giAmbient(pos, norm)*da : vec3(0,0,0); | ||
219 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/giV.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/giV.glsl deleted file mode 100644 index 71dcea9..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/giV.glsl +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /** | ||
2 | * @file giV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | |||
10 | uniform vec2 screen_res; | ||
11 | |||
12 | void main() | ||
13 | { | ||
14 | //transform vertex | ||
15 | gl_Position = ftransform(); | ||
16 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
17 | vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; | ||
18 | vec4 tex = gl_MultiTexCoord0; | ||
19 | tex.w = 1.0; | ||
20 | |||
21 | gl_FrontColor = gl_Color; | ||
22 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl deleted file mode 100644 index 0de0d11..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | /** | ||
2 | * @file luminanceF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect diffuseMap; | ||
9 | |||
10 | varying vec2 vary_fragcoord; | ||
11 | uniform float fade; | ||
12 | void main() | ||
13 | { | ||
14 | gl_FragColor.rgb = texture2DRect(diffuseMap, vary_fragcoord.xy).rgb; | ||
15 | gl_FragColor.a = fade; | ||
16 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl deleted file mode 100644 index db8775f..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /** | ||
2 | * @file giV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | |||
10 | uniform vec2 screen_res; | ||
11 | |||
12 | void main() | ||
13 | { | ||
14 | //transform vertex | ||
15 | gl_Position = ftransform(); | ||
16 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
17 | vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; | ||
18 | |||
19 | gl_FrontColor = gl_Color; | ||
20 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl deleted file mode 100644 index 609fb1d..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl +++ /dev/null | |||
@@ -1,76 +0,0 @@ | |||
1 | /** | ||
2 | * @file postDeferredF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect diffuseRect; | ||
9 | uniform sampler2DRect specularRect; | ||
10 | uniform sampler2DRect localLightMap; | ||
11 | uniform sampler2DRect sunLightMap; | ||
12 | uniform sampler2DRect giLightMap; | ||
13 | uniform sampler2D luminanceMap; | ||
14 | uniform sampler2DRect lightMap; | ||
15 | uniform sampler2D lightFunc; | ||
16 | |||
17 | |||
18 | uniform vec3 gi_lum_quad; | ||
19 | uniform vec3 sun_lum_quad; | ||
20 | uniform vec3 lum_quad; | ||
21 | uniform float lum_lod; | ||
22 | uniform vec4 ambient; | ||
23 | |||
24 | uniform vec3 gi_quad; | ||
25 | |||
26 | uniform vec2 screen_res; | ||
27 | varying vec2 vary_fragcoord; | ||
28 | |||
29 | void main() | ||
30 | { | ||
31 | vec2 tc = vary_fragcoord.xy; | ||
32 | vec3 lcol = texture2DLod(luminanceMap, tc/screen_res, lum_lod).rgb; | ||
33 | |||
34 | float lum = sqrt(lcol.r)*lum_quad.x+lcol.r*lcol.r*lum_quad.y+lcol.r*lum_quad.z; | ||
35 | |||
36 | vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); | ||
37 | vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); | ||
38 | |||
39 | float ambocc = texture2DRect(lightMap, vary_fragcoord.xy).g; | ||
40 | |||
41 | vec3 ccol = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; | ||
42 | vec3 gi_col = ccol; | ||
43 | /*for (int i = -1; i <= 1; i+=1) | ||
44 | { | ||
45 | for (int j = -1; j <= 1; j+=1) | ||
46 | { | ||
47 | vec2 tc = vec2(i,j); | ||
48 | float wght = 1.0/(length(tc)+1.0); | ||
49 | gi_col += texture2DRect(giLightMap, vary_fragcoord.xy+vec2(i,j)).rgb * wght; | ||
50 | } | ||
51 | }*/ | ||
52 | |||
53 | //gi_col *= 1.0+spec.a*4.0; | ||
54 | gi_col = (sqrt(gi_col)*gi_quad.x + gi_col*gi_quad.y)*(diff.rgb+spec.rgb*spec.a)+gi_quad.z*ambocc*ambient.rgb*diff.rgb; | ||
55 | |||
56 | vec4 sun_col = texture2DRect(sunLightMap, vary_fragcoord.xy); | ||
57 | |||
58 | vec3 local_col = texture2DRect(localLightMap, vary_fragcoord.xy).rgb; | ||
59 | |||
60 | |||
61 | float sun_lum = 1.0-lum; | ||
62 | sun_lum = sun_lum*sun_lum*sun_lum_quad.x + sun_lum*sun_lum_quad.y+sun_lum_quad.z; | ||
63 | |||
64 | float gi_lum = lum; | ||
65 | gi_lum = gi_lum*gi_lum*gi_lum_quad.x+gi_lum*gi_lum_quad.y+gi_lum_quad.z; | ||
66 | gi_col *= 1.0/gi_lum; | ||
67 | |||
68 | |||
69 | vec3 col = sun_col.rgb*(1.0+max(sun_lum,0.0))+gi_col+local_col; | ||
70 | |||
71 | gl_FragColor.rgb = col.rgb; | ||
72 | gl_FragColor.a = max(sun_lum*min(sun_col.r+sun_col.g+sun_col.b, 1.0), sun_col.a); | ||
73 | |||
74 | //gl_FragColor.rgb = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; | ||
75 | //gl_FragColor.rgb = vec3(texture2D(lightFunc, vary_fragcoord.xy/512.0-vec2(0.5, 0.5)).a); | ||
76 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl deleted file mode 100644 index 9819232..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /** | ||
2 | * @file postDeferredV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | uniform vec2 screen_res; | ||
10 | |||
11 | void main() | ||
12 | { | ||
13 | //transform vertex | ||
14 | gl_Position = ftransform(); | ||
15 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
16 | vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; | ||
17 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl deleted file mode 100644 index 12a5f39..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | /** | ||
2 | * @file postgiF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect depthMap; | ||
9 | uniform sampler2DRect normalMap; | ||
10 | uniform sampler2DRect giLightMap; | ||
11 | uniform sampler2D noiseMap; | ||
12 | |||
13 | uniform vec2 kern[32]; | ||
14 | uniform float dist_factor; | ||
15 | uniform float blur_size; | ||
16 | uniform vec2 delta; | ||
17 | uniform int kern_length; | ||
18 | uniform float kern_scale; | ||
19 | uniform vec3 blur_quad; | ||
20 | |||
21 | varying vec2 vary_fragcoord; | ||
22 | |||
23 | uniform mat4 inv_proj; | ||
24 | uniform vec2 screen_res; | ||
25 | |||
26 | vec4 getPosition(vec2 pos_screen) | ||
27 | { | ||
28 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
29 | vec2 sc = pos_screen.xy*2.0; | ||
30 | sc /= screen_res; | ||
31 | sc -= vec2(1.0,1.0); | ||
32 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
33 | vec4 pos = inv_proj * ndc; | ||
34 | pos /= pos.w; | ||
35 | pos.w = 1.0; | ||
36 | return pos; | ||
37 | } | ||
38 | |||
39 | float getDepth(vec2 pos_screen) | ||
40 | { | ||
41 | float z = texture2DRect(depthMap, pos_screen.xy).a; | ||
42 | z = z*2.0-1.0; | ||
43 | vec4 ndc = vec4(0.0, 0.0, z, 1.0); | ||
44 | vec4 p = inv_proj*ndc; | ||
45 | return p.z/p.w; | ||
46 | } | ||
47 | |||
48 | void main() | ||
49 | { | ||
50 | vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz*2.0-1.0; | ||
51 | float depth = getDepth(vary_fragcoord.xy); | ||
52 | |||
53 | vec3 ccol = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; | ||
54 | vec2 dlt = kern_scale * delta/(vec2(1.0,1.0)+norm.xy*norm.xy); | ||
55 | dlt /= clamp(-depth*blur_quad.x, 1.0, 3.0); | ||
56 | float defined_weight = kern[0].x; | ||
57 | vec3 col = ccol*kern[0].x; | ||
58 | |||
59 | for (int i = 0; i < kern_length; i++) | ||
60 | { | ||
61 | vec2 tc = vary_fragcoord.xy + kern[i].y*dlt; | ||
62 | vec3 sampNorm = texture2DRect(normalMap, tc.xy).xyz*2.0-1.0; | ||
63 | |||
64 | float d = dot(norm.xyz, sampNorm); | ||
65 | |||
66 | if (d > 0.5) | ||
67 | { | ||
68 | float sampdepth = getDepth(tc.xy); | ||
69 | sampdepth -= depth; | ||
70 | if (sampdepth*sampdepth < blur_quad.z) | ||
71 | { | ||
72 | col += texture2DRect(giLightMap, tc).rgb*kern[i].x; | ||
73 | defined_weight += kern[i].x; | ||
74 | } | ||
75 | } | ||
76 | } | ||
77 | |||
78 | col /= defined_weight; | ||
79 | |||
80 | //col = ccol; | ||
81 | |||
82 | col = col*blur_quad.y; | ||
83 | |||
84 | gl_FragData[0].xyz = col; | ||
85 | |||
86 | //gl_FragColor = ccol; | ||
87 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl deleted file mode 100644 index 6adcda8..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /** | ||
2 | * @file postgiV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | varying vec2 vary_fragcoord; | ||
9 | uniform vec2 screen_res; | ||
10 | |||
11 | void main() | ||
12 | { | ||
13 | //transform vertex | ||
14 | gl_Position = ftransform(); | ||
15 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
16 | vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; | ||
17 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl deleted file mode 100644 index 654b182..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ /dev/null | |||
@@ -1,312 +0,0 @@ | |||
1 | /** | ||
2 | * @file softenLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2DRect diffuseRect; | ||
11 | uniform sampler2DRect specularRect; | ||
12 | uniform sampler2DRect normalMap; | ||
13 | uniform sampler2DRect lightMap; | ||
14 | uniform sampler2DRect giLightMap; | ||
15 | uniform sampler2D noiseMap; | ||
16 | uniform samplerCube environmentMap; | ||
17 | uniform sampler2D lightFunc; | ||
18 | uniform sampler2D luminanceMap; | ||
19 | |||
20 | uniform vec3 gi_quad; | ||
21 | uniform vec3 lum_quad; | ||
22 | uniform float lum_lod; | ||
23 | |||
24 | uniform float blur_size; | ||
25 | uniform float blur_fidelity; | ||
26 | |||
27 | // Inputs | ||
28 | uniform vec4 morphFactor; | ||
29 | uniform vec3 camPosLocal; | ||
30 | //uniform vec4 camPosWorld; | ||
31 | uniform vec4 gamma; | ||
32 | uniform vec4 lightnorm; | ||
33 | uniform vec4 sunlight_color; | ||
34 | uniform vec4 ambient; | ||
35 | uniform vec4 blue_horizon; | ||
36 | uniform vec4 blue_density; | ||
37 | uniform vec4 haze_horizon; | ||
38 | uniform vec4 haze_density; | ||
39 | uniform vec4 cloud_shadow; | ||
40 | uniform vec4 density_multiplier; | ||
41 | uniform vec4 distance_multiplier; | ||
42 | uniform vec4 max_y; | ||
43 | uniform vec4 glow; | ||
44 | uniform float scene_light_strength; | ||
45 | uniform vec3 env_mat[3]; | ||
46 | uniform vec4 shadow_clip; | ||
47 | uniform mat3 ssao_effect_mat; | ||
48 | |||
49 | uniform sampler2DRect depthMap; | ||
50 | uniform mat4 inv_proj; | ||
51 | uniform vec2 screen_res; | ||
52 | |||
53 | varying vec4 vary_light; | ||
54 | varying vec2 vary_fragcoord; | ||
55 | |||
56 | vec3 vary_PositionEye; | ||
57 | |||
58 | vec3 vary_SunlitColor; | ||
59 | vec3 vary_AmblitColor; | ||
60 | vec3 vary_AdditiveColor; | ||
61 | vec3 vary_AtmosAttenuation; | ||
62 | |||
63 | vec4 getPosition(vec2 pos_screen) | ||
64 | { //get position in screen space (world units) given window coordinate and depth map | ||
65 | float depth = texture2DRect(depthMap, pos_screen.xy).a; | ||
66 | vec2 sc = pos_screen.xy*2.0; | ||
67 | sc /= screen_res; | ||
68 | sc -= vec2(1.0,1.0); | ||
69 | vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); | ||
70 | vec4 pos = inv_proj * ndc; | ||
71 | pos /= pos.w; | ||
72 | pos.w = 1.0; | ||
73 | return pos; | ||
74 | } | ||
75 | |||
76 | vec3 getPositionEye() | ||
77 | { | ||
78 | return vary_PositionEye; | ||
79 | } | ||
80 | vec3 getSunlitColor() | ||
81 | { | ||
82 | return vary_SunlitColor; | ||
83 | } | ||
84 | vec3 getAmblitColor() | ||
85 | { | ||
86 | return vary_AmblitColor; | ||
87 | } | ||
88 | vec3 getAdditiveColor() | ||
89 | { | ||
90 | return vary_AdditiveColor; | ||
91 | } | ||
92 | vec3 getAtmosAttenuation() | ||
93 | { | ||
94 | return vary_AtmosAttenuation; | ||
95 | } | ||
96 | |||
97 | |||
98 | void setPositionEye(vec3 v) | ||
99 | { | ||
100 | vary_PositionEye = v; | ||
101 | } | ||
102 | |||
103 | void setSunlitColor(vec3 v) | ||
104 | { | ||
105 | vary_SunlitColor = v; | ||
106 | } | ||
107 | |||
108 | void setAmblitColor(vec3 v) | ||
109 | { | ||
110 | vary_AmblitColor = v; | ||
111 | } | ||
112 | |||
113 | void setAdditiveColor(vec3 v) | ||
114 | { | ||
115 | vary_AdditiveColor = v; | ||
116 | } | ||
117 | |||
118 | void setAtmosAttenuation(vec3 v) | ||
119 | { | ||
120 | vary_AtmosAttenuation = v; | ||
121 | } | ||
122 | |||
123 | void calcAtmospherics(vec3 inPositionEye, float ambFactor) { | ||
124 | |||
125 | vec3 P = inPositionEye; | ||
126 | setPositionEye(P); | ||
127 | |||
128 | //(TERRAIN) limit altitude | ||
129 | if (P.y > max_y.x) P *= (max_y.x / P.y); | ||
130 | if (P.y < -max_y.x) P *= (-max_y.x / P.y); | ||
131 | |||
132 | vec3 tmpLightnorm = lightnorm.xyz; | ||
133 | |||
134 | vec3 Pn = normalize(P); | ||
135 | float Plen = length(P); | ||
136 | |||
137 | vec4 temp1 = vec4(0); | ||
138 | vec3 temp2 = vec3(0); | ||
139 | vec4 blue_weight; | ||
140 | vec4 haze_weight; | ||
141 | vec4 sunlight = sunlight_color; | ||
142 | vec4 light_atten; | ||
143 | |||
144 | //sunlight attenuation effect (hue and brightness) due to atmosphere | ||
145 | //this is used later for sunlight modulation at various altitudes | ||
146 | light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x); | ||
147 | //I had thought blue_density and haze_density should have equal weighting, | ||
148 | //but attenuation due to haze_density tends to seem too strong | ||
149 | |||
150 | temp1 = blue_density + vec4(haze_density.r); | ||
151 | blue_weight = blue_density / temp1; | ||
152 | haze_weight = vec4(haze_density.r) / temp1; | ||
153 | |||
154 | //(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain) | ||
155 | temp2.y = max(0.0, tmpLightnorm.y); | ||
156 | temp2.y = 1. / temp2.y; | ||
157 | sunlight *= exp( - light_atten * temp2.y); | ||
158 | |||
159 | // main atmospheric scattering line integral | ||
160 | temp2.z = Plen * density_multiplier.x; | ||
161 | |||
162 | // Transparency (-> temp1) | ||
163 | // ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati | ||
164 | // compiler gets confused. | ||
165 | temp1 = exp(-temp1 * temp2.z * distance_multiplier.x); | ||
166 | |||
167 | //final atmosphere attenuation factor | ||
168 | setAtmosAttenuation(temp1.rgb); | ||
169 | |||
170 | //compute haze glow | ||
171 | //(can use temp2.x as temp because we haven't used it yet) | ||
172 | temp2.x = dot(Pn, tmpLightnorm.xyz); | ||
173 | temp2.x = 1. - temp2.x; | ||
174 | //temp2.x is 0 at the sun and increases away from sun | ||
175 | temp2.x = max(temp2.x, .03); //was glow.y | ||
176 | //set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) | ||
177 | temp2.x *= glow.x; | ||
178 | //higher glow.x gives dimmer glow (because next step is 1 / "angle") | ||
179 | temp2.x = pow(temp2.x, glow.z); | ||
180 | //glow.z should be negative, so we're doing a sort of (1 / "angle") function | ||
181 | |||
182 | //add "minimum anti-solar illumination" | ||
183 | temp2.x += .25; | ||
184 | |||
185 | //increase ambient when there are more clouds | ||
186 | vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5; | ||
187 | |||
188 | /* decrease value and saturation (that in HSV, not HSL) for occluded areas | ||
189 | * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html | ||
190 | * // The following line of code performs the equivalent of: | ||
191 | * float ambAlpha = tmpAmbient.a; | ||
192 | * float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis | ||
193 | * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue); | ||
194 | * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha); | ||
195 | */ | ||
196 | tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a); | ||
197 | |||
198 | //haze color | ||
199 | setAdditiveColor( | ||
200 | vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient) | ||
201 | + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x | ||
202 | + tmpAmbient))); | ||
203 | |||
204 | //brightness of surface both sunlight and ambient | ||
205 | setSunlitColor(vec3(sunlight * .5)); | ||
206 | setAmblitColor(vec3(tmpAmbient * .25)); | ||
207 | setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1)); | ||
208 | } | ||
209 | |||
210 | vec3 atmosLighting(vec3 light) | ||
211 | { | ||
212 | light *= getAtmosAttenuation().r; | ||
213 | light += getAdditiveColor(); | ||
214 | return (2.0 * light); | ||
215 | } | ||
216 | |||
217 | vec3 atmosTransport(vec3 light) { | ||
218 | light *= getAtmosAttenuation().r; | ||
219 | light += getAdditiveColor() * 2.0; | ||
220 | return light; | ||
221 | } | ||
222 | vec3 atmosGetDiffuseSunlightColor() | ||
223 | { | ||
224 | return getSunlitColor(); | ||
225 | } | ||
226 | |||
227 | vec3 scaleDownLight(vec3 light) | ||
228 | { | ||
229 | return (light / scene_light_strength ); | ||
230 | } | ||
231 | |||
232 | vec3 scaleUpLight(vec3 light) | ||
233 | { | ||
234 | return (light * scene_light_strength); | ||
235 | } | ||
236 | |||
237 | vec3 atmosAmbient(vec3 light) | ||
238 | { | ||
239 | return getAmblitColor() + light / 2.0; | ||
240 | } | ||
241 | |||
242 | vec3 atmosAffectDirectionalLight(float lightIntensity) | ||
243 | { | ||
244 | return getSunlitColor() * lightIntensity; | ||
245 | } | ||
246 | |||
247 | vec3 scaleSoftClip(vec3 light) | ||
248 | { | ||
249 | //soft clip effect: | ||
250 | light = 1. - clamp(light, vec3(0.), vec3(1.)); | ||
251 | light = 1. - pow(light, gamma.xxx); | ||
252 | |||
253 | return light; | ||
254 | } | ||
255 | |||
256 | void main() | ||
257 | { | ||
258 | vec2 tc = vary_fragcoord.xy; | ||
259 | vec3 pos = getPosition(tc).xyz; | ||
260 | vec3 norm = texture2DRect(normalMap, tc).xyz*2.0-1.0; | ||
261 | vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz; | ||
262 | |||
263 | vec3 at = normalize(pos); | ||
264 | |||
265 | vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); | ||
266 | |||
267 | vec3 lum = texture2DLod(luminanceMap, tc/screen_res, lum_lod).rgb; | ||
268 | |||
269 | vec3 ha = normalize(vary_light.xyz-at); | ||
270 | |||
271 | float da = dot(ha, norm.xyz); | ||
272 | da = texture2D(lightFunc, vec2(da, spec.a)).a; | ||
273 | |||
274 | vec4 diffuse = texture2DRect(diffuseRect, tc); | ||
275 | |||
276 | vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; | ||
277 | float scol = max(scol_ambocc.r, diffuse.a); | ||
278 | float ambocc = scol_ambocc.g; | ||
279 | |||
280 | calcAtmospherics(pos.xyz, ambocc); | ||
281 | |||
282 | vec3 col = vec3(0,0,0); | ||
283 | |||
284 | col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a)*(1.0+spec.a)); | ||
285 | |||
286 | col *= diffuse.rgb; | ||
287 | |||
288 | col += da*spec.rgb*spec.a*vary_SunlitColor*scol_ambocc.r; | ||
289 | |||
290 | /*if (spec.a > 0.0) | ||
291 | { | ||
292 | vec3 ref = normalize(reflect(pos.xyz, norm.xyz)); | ||
293 | float sa = dot(ref, vary_light.xyz); | ||
294 | col.rgb += vary_SunlitColor*scol*spec.rgb*texture2D(lightFunc, vec2(sa, spec.a)).a; | ||
295 | }*/ | ||
296 | |||
297 | col = atmosLighting(col); | ||
298 | col = scaleSoftClip(col); | ||
299 | |||
300 | col = col*vec3(1.0+1.0/2.2); | ||
301 | |||
302 | gl_FragColor.rgb = col; | ||
303 | //gl_FragColor.rgb = lum; | ||
304 | |||
305 | gl_FragColor.a = 0.0; | ||
306 | |||
307 | //gl_FragColor.rg = scol_ambocc.rg; | ||
308 | //gl_FragColor.rgb = texture2DRect(lightMap, vary_fragcoord.xy).rgb; | ||
309 | //gl_FragColor.rgb = norm.rgb*0.5+0.5; | ||
310 | //gl_FragColor.rgb = vec3(ambocc); | ||
311 | //gl_FragColor.rgb = vec3(scol); | ||
312 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl deleted file mode 100644 index ad8af47..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | /** | ||
2 | * @file softenLightF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform vec2 screen_res; | ||
9 | |||
10 | varying vec4 vary_light; | ||
11 | varying vec2 vary_fragcoord; | ||
12 | void main() | ||
13 | { | ||
14 | //transform vertex | ||
15 | gl_Position = ftransform(); | ||
16 | |||
17 | vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
18 | vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; | ||
19 | |||
20 | vec4 tex = gl_MultiTexCoord0; | ||
21 | tex.w = 1.0; | ||
22 | |||
23 | vary_light = gl_MultiTexCoord0; | ||
24 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl deleted file mode 100644 index 258acee..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | /** | ||
2 | * @file treeF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2D diffuseMap; | ||
9 | |||
10 | varying vec3 vary_normal; | ||
11 | |||
12 | void main() | ||
13 | { | ||
14 | vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); | ||
15 | gl_FragData[0] = vec4(gl_Color.rgb*col.rgb, col.a <= 0.5 ? 0.0 : 0.005); | ||
16 | gl_FragData[1] = vec4(0,0,0,0); | ||
17 | gl_FragData[2] = vec4(normalize(vary_normal)*0.5+0.5, 0.0); | ||
18 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/deferred/waterF.glsl b/linden/indra/newview/app_settings/shaders/class3/deferred/waterF.glsl deleted file mode 100644 index bea1515..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/deferred/waterF.glsl +++ /dev/null | |||
@@ -1,139 +0,0 @@ | |||
1 | /** | ||
2 | * @file waterF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | vec3 scaleSoftClip(vec3 inColor); | ||
9 | vec3 atmosTransport(vec3 inColor); | ||
10 | |||
11 | uniform sampler2D bumpMap; | ||
12 | uniform sampler2D screenTex; | ||
13 | uniform sampler2D refTex; | ||
14 | uniform sampler2DRectShadow shadowMap0; | ||
15 | uniform sampler2DRectShadow shadowMap1; | ||
16 | uniform sampler2DRectShadow shadowMap2; | ||
17 | uniform sampler2DRectShadow shadowMap3; | ||
18 | uniform sampler2D noiseMap; | ||
19 | |||
20 | uniform mat4 shadow_matrix[6]; | ||
21 | uniform vec4 shadow_clip; | ||
22 | |||
23 | uniform float sunAngle; | ||
24 | uniform float sunAngle2; | ||
25 | uniform vec3 lightDir; | ||
26 | uniform vec3 specular; | ||
27 | uniform float lightExp; | ||
28 | uniform float refScale; | ||
29 | uniform float kd; | ||
30 | uniform vec2 screenRes; | ||
31 | uniform vec3 normScale; | ||
32 | uniform float fresnelScale; | ||
33 | uniform float fresnelOffset; | ||
34 | uniform float blurMultiplier; | ||
35 | uniform vec2 screen_res; | ||
36 | uniform mat4 norm_mat; //region space to screen space | ||
37 | |||
38 | //bigWave is (refCoord.w, view.w); | ||
39 | varying vec4 refCoord; | ||
40 | varying vec4 littleWave; | ||
41 | varying vec4 view; | ||
42 | varying vec4 vary_position; | ||
43 | |||
44 | void main() | ||
45 | { | ||
46 | vec4 color; | ||
47 | float dist = length(view.xy); | ||
48 | |||
49 | //normalize view vector | ||
50 | vec3 viewVec = normalize(view.xyz); | ||
51 | |||
52 | //get wave normals | ||
53 | vec3 wave1 = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0; | ||
54 | vec3 wave2 = texture2D(bumpMap, littleWave.xy).xyz*2.0-1.0; | ||
55 | vec3 wave3 = texture2D(bumpMap, littleWave.zw).xyz*2.0-1.0; | ||
56 | //get base fresnel components | ||
57 | |||
58 | vec3 df = vec3( | ||
59 | dot(viewVec, wave1), | ||
60 | dot(viewVec, (wave2 + wave3) * 0.5), | ||
61 | dot(viewVec, wave3) | ||
62 | ) * fresnelScale + fresnelOffset; | ||
63 | df *= df; | ||
64 | |||
65 | vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5; | ||
66 | |||
67 | float dist2 = dist; | ||
68 | dist = max(dist, 5.0); | ||
69 | |||
70 | float dmod = sqrt(dist); | ||
71 | |||
72 | vec2 dmod_scale = vec2(dmod*dmod, dmod); | ||
73 | |||
74 | //get reflected color | ||
75 | vec2 refdistort1 = wave1.xy*normScale.x; | ||
76 | vec2 refvec1 = distort+refdistort1/dmod_scale; | ||
77 | vec4 refcol1 = texture2D(refTex, refvec1); | ||
78 | |||
79 | vec2 refdistort2 = wave2.xy*normScale.y; | ||
80 | vec2 refvec2 = distort+refdistort2/dmod_scale; | ||
81 | vec4 refcol2 = texture2D(refTex, refvec2); | ||
82 | |||
83 | vec2 refdistort3 = wave3.xy*normScale.z; | ||
84 | vec2 refvec3 = distort+refdistort3/dmod_scale; | ||
85 | vec4 refcol3 = texture2D(refTex, refvec3); | ||
86 | |||
87 | vec4 refcol = refcol1 + refcol2 + refcol3; | ||
88 | float df1 = df.x + df.y + df.z; | ||
89 | refcol *= df1 * 0.333; | ||
90 | |||
91 | vec3 wavef = (wave1 + wave2 * 0.4 + wave3 * 0.6) * 0.5; | ||
92 | //wavef.z *= max(-viewVec.z, 0.1); | ||
93 | wavef = normalize(wavef); | ||
94 | |||
95 | float df2 = dot(viewVec, wavef) * fresnelScale+fresnelOffset; | ||
96 | |||
97 | vec2 refdistort4 = wavef.xy*0.125; | ||
98 | refdistort4.y -= abs(refdistort4.y); | ||
99 | vec2 refvec4 = distort+refdistort4/dmod; | ||
100 | float dweight = min(dist2*blurMultiplier, 1.0); | ||
101 | vec4 baseCol = texture2D(refTex, refvec4); | ||
102 | refcol = mix(baseCol*df2, refcol, dweight); | ||
103 | |||
104 | //get specular component | ||
105 | //float spec = clamp(dot(lightDir, (reflect(viewVec,wavef))),0.0,1.0); | ||
106 | |||
107 | //harden specular | ||
108 | //spec = pow(spec, 128.0); | ||
109 | |||
110 | //figure out distortion vector (ripply) | ||
111 | vec2 distort2 = distort+wavef.xy*refScale/max(dmod*df1, 1.0); | ||
112 | |||
113 | vec4 fb = texture2D(screenTex, distort2); | ||
114 | |||
115 | //mix with reflection | ||
116 | // Note we actually want to use just df1, but multiplying by 0.999999 gets around and nvidia compiler bug | ||
117 | color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.99999); | ||
118 | |||
119 | float shadow = 1.0; | ||
120 | vec4 pos = vary_position; | ||
121 | |||
122 | vec3 nz = texture2D(noiseMap, gl_FragCoord.xy/128.0).xyz; | ||
123 | vec4 spos = pos; | ||
124 | |||
125 | //spec *= shadow; | ||
126 | //color.rgb += spec * specular; | ||
127 | |||
128 | //color.rgb = atmosTransport(color.rgb); | ||
129 | //color.rgb = scaleSoftClip(color.rgb); | ||
130 | //color.a = spec * sunAngle2; | ||
131 | |||
132 | //wavef.z *= 0.1f; | ||
133 | wavef = normalize(wavef); | ||
134 | wavef = (norm_mat*vec4(wavef, 1.0)).xyz; | ||
135 | |||
136 | gl_FragData[0] = vec4(color.rgb, 0.5); | ||
137 | gl_FragData[1] = vec4(0.5,0.5,0.5, 0.95); | ||
138 | gl_FragData[2] = vec4(wavef*0.5+0.5, 0.f); | ||
139 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/blurF.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/blurF.glsl deleted file mode 100644 index 9443320..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/effects/blurF.glsl +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /** | ||
2 | * @file blurf.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | uniform float bloomStrength; | ||
10 | |||
11 | varying vec4 gl_TexCoord[gl_MaxTextureCoords]; | ||
12 | void main(void) | ||
13 | { | ||
14 | float blurWeights[7]; | ||
15 | blurWeights[0] = 0.05; | ||
16 | blurWeights[1] = 0.1; | ||
17 | blurWeights[2] = 0.2; | ||
18 | blurWeights[3] = 0.3; | ||
19 | blurWeights[4] = 0.2; | ||
20 | blurWeights[5] = 0.1; | ||
21 | blurWeights[6] = 0.05; | ||
22 | |||
23 | vec3 color = vec3(0,0,0); | ||
24 | for (int i = 0; i < 7; i++){ | ||
25 | color += vec3(texture2DRect(RenderTexture, gl_TexCoord[i].st)) * blurWeights[i]; | ||
26 | } | ||
27 | |||
28 | color *= bloomStrength; | ||
29 | |||
30 | gl_FragColor = vec4(color, 1.0); | ||
31 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/blurV.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/blurV.glsl deleted file mode 100644 index ba65b16..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/effects/blurV.glsl +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /** | ||
2 | * @file blurV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform vec2 texelSize; | ||
9 | uniform vec2 blurDirection; | ||
10 | uniform float blurWidth; | ||
11 | |||
12 | void main(void) | ||
13 | { | ||
14 | // Transform vertex | ||
15 | gl_Position = ftransform(); | ||
16 | |||
17 | vec2 blurDelta = texelSize * blurDirection * vec2(blurWidth, blurWidth); | ||
18 | vec2 s = gl_MultiTexCoord0.st - (blurDelta * 3.0); | ||
19 | |||
20 | // for (int i = 0; i < 7; i++) { | ||
21 | // gl_TexCoord[i].st = s + (i * blurDelta); | ||
22 | // } | ||
23 | |||
24 | // MANUALLY UNROLL | ||
25 | gl_TexCoord[0].st = s; | ||
26 | gl_TexCoord[1].st = s + blurDelta; | ||
27 | gl_TexCoord[2].st = s + (2. * blurDelta); | ||
28 | gl_TexCoord[3].st = s + (3. * blurDelta); | ||
29 | gl_TexCoord[4].st = s + (4. * blurDelta); | ||
30 | gl_TexCoord[5].st = s + (5. * blurDelta); | ||
31 | gl_TexCoord[6].st = s + (6. * blurDelta); | ||
32 | |||
33 | // gl_TexCoord[0].st = s; | ||
34 | // gl_TexCoord[1].st = blurDelta; | ||
35 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/colorFilterF.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/colorFilterF.glsl deleted file mode 100644 index 623ef7a..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/effects/colorFilterF.glsl +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /** | ||
2 | * @file colorFilterF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | uniform float brightness; | ||
10 | uniform float contrast; | ||
11 | uniform vec3 contrastBase; | ||
12 | uniform float saturation; | ||
13 | uniform vec3 lumWeights; | ||
14 | |||
15 | const float gamma = 2.0; | ||
16 | |||
17 | void main(void) | ||
18 | { | ||
19 | vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); | ||
20 | |||
21 | /// Modulate brightness | ||
22 | color *= brightness; | ||
23 | |||
24 | /// Modulate contrast | ||
25 | color = mix(contrastBase, color, contrast); | ||
26 | |||
27 | /// Modulate saturation | ||
28 | color = mix(vec3(dot(color, lumWeights)), color, saturation); | ||
29 | |||
30 | gl_FragColor = vec4(color, 1.0); | ||
31 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/drawQuadV.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/drawQuadV.glsl deleted file mode 100644 index 29c2a09..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/effects/drawQuadV.glsl +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /** | ||
2 | * @file drawQuadV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | void main(void) | ||
9 | { | ||
10 | //transform vertex | ||
11 | gl_Position = ftransform(); | ||
12 | gl_TexCoord[0] = gl_MultiTexCoord0; | ||
13 | gl_TexCoord[1] = gl_MultiTexCoord1; | ||
14 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/extractF.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/extractF.glsl deleted file mode 100644 index a1583b1..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/effects/extractF.glsl +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | /** | ||
2 | * @file extractF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | uniform float extractLow; | ||
10 | uniform float extractHigh; | ||
11 | uniform vec3 lumWeights; | ||
12 | |||
13 | void main(void) | ||
14 | { | ||
15 | /// Get scene color | ||
16 | vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); | ||
17 | |||
18 | /// Extract luminance and scale up by night vision brightness | ||
19 | float lum = smoothstep(extractLow, extractHigh, dot(color, lumWeights)); | ||
20 | |||
21 | gl_FragColor = vec4(vec3(lum), 1.0); | ||
22 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/nightVisionF.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/nightVisionF.glsl deleted file mode 100644 index 271d5cf..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/effects/nightVisionF.glsl +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /** | ||
2 | * @file nightVisionF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | uniform sampler2D NoiseTexture; | ||
10 | uniform float brightMult; | ||
11 | uniform float noiseStrength; | ||
12 | |||
13 | float luminance(vec3 color) | ||
14 | { | ||
15 | /// CALCULATING LUMINANCE (Using NTSC lum weights) | ||
16 | /// http://en.wikipedia.org/wiki/Luma_%28video%29 | ||
17 | return dot(color, vec3(0.299, 0.587, 0.114)); | ||
18 | } | ||
19 | |||
20 | void main(void) | ||
21 | { | ||
22 | /// Get scene color | ||
23 | vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); | ||
24 | |||
25 | /// Extract luminance and scale up by night vision brightness | ||
26 | float lum = luminance(color) * brightMult; | ||
27 | |||
28 | /// Convert into night vision color space | ||
29 | /// Newer NVG colors (crisper and more saturated) | ||
30 | vec3 outColor = (lum * vec3(0.91, 1.21, 0.9)) + vec3(-0.07, 0.1, -0.12); | ||
31 | |||
32 | /// Add noise | ||
33 | float noiseValue = texture2D(NoiseTexture, gl_TexCoord[1].st).r; | ||
34 | noiseValue = (noiseValue - 0.5) * noiseStrength; | ||
35 | |||
36 | /// Older NVG colors (more muted) | ||
37 | // vec3 outColor = (lum * vec3(0.82, 0.75, 0.83)) + vec3(0.05, 0.32, -0.11); | ||
38 | |||
39 | outColor += noiseValue; | ||
40 | |||
41 | gl_FragColor = vec4(outColor, 1.0); | ||
42 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/simpleF.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/simpleF.glsl deleted file mode 100644 index e55d278..0000000 --- a/linden/indra/newview/app_settings/shaders/class3/effects/simpleF.glsl +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /** | ||
2 | * @file simpleF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | |||
10 | void main(void) | ||
11 | { | ||
12 | vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); | ||
13 | gl_FragColor = vec4(1.0 - color, 1.0); | ||
14 | } | ||
diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp index bfaa4ad..1b2c8e1 100644 --- a/linden/indra/newview/llagent.cpp +++ b/linden/indra/newview/llagent.cpp | |||
@@ -223,7 +223,6 @@ LLAgent gAgent; | |||
223 | // Statics | 223 | // Statics |
224 | // | 224 | // |
225 | BOOL LLAgent::sPhantom = FALSE; | 225 | BOOL LLAgent::sPhantom = FALSE; |
226 | BOOL LLAgent::sDebugDisplayTarget = FALSE; | ||
227 | 226 | ||
228 | const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f; | 227 | const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f; |
229 | 228 | ||
@@ -6624,7 +6623,7 @@ void LLAgent::saveWearable( EWearableType type, BOOL send_update ) | |||
6624 | return; | 6623 | return; |
6625 | } | 6624 | } |
6626 | 6625 | ||
6627 | // getAvatarObject()->wearableUpdated( type ); | 6626 | getAvatarObject()->wearableUpdated( type ); |
6628 | 6627 | ||
6629 | if( send_update ) | 6628 | if( send_update ) |
6630 | { | 6629 | { |
diff --git a/linden/indra/newview/llagent.h b/linden/indra/newview/llagent.h index 22851c1..f1cad9c 100644 --- a/linden/indra/newview/llagent.h +++ b/linden/indra/newview/llagent.h | |||
@@ -771,7 +771,6 @@ public: | |||
771 | 771 | ||
772 | BOOL mInitialized; | 772 | BOOL mInitialized; |
773 | 773 | ||
774 | static BOOL sDebugDisplayTarget; | ||
775 | S32 mNumPendingQueries; | 774 | S32 mNumPendingQueries; |
776 | S32* mActiveCacheQueries; | 775 | S32* mActiveCacheQueries; |
777 | 776 | ||
diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp index 3a3f51b..9fad9f1 100644 --- a/linden/indra/newview/llappviewer.cpp +++ b/linden/indra/newview/llappviewer.cpp | |||
@@ -448,7 +448,7 @@ static void settings_modify() | |||
448 | LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; //square lod factor to get exponential range of [1,4] | 448 | LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; //square lod factor to get exponential range of [1,4] |
449 | gDebugGL = gSavedSettings.getBOOL("RenderDebugGL"); | 449 | gDebugGL = gSavedSettings.getBOOL("RenderDebugGL"); |
450 | gDebugPipeline = gSavedSettings.getBOOL("RenderDebugPipeline"); | 450 | gDebugPipeline = gSavedSettings.getBOOL("RenderDebugPipeline"); |
451 | // gAuditTexture = gSavedSettings.getBOOL("AuditTexture"); | 451 | gAuditTexture = gSavedSettings.getBOOL("AuditTexture"); |
452 | #if LL_VECTORIZE | 452 | #if LL_VECTORIZE |
453 | if (gSysCPU.hasAltivec()) | 453 | if (gSysCPU.hasAltivec()) |
454 | { | 454 | { |
diff --git a/linden/indra/newview/llcolorswatch.cpp b/linden/indra/newview/llcolorswatch.cpp index 3222c0d..5905bb0 100644 --- a/linden/indra/newview/llcolorswatch.cpp +++ b/linden/indra/newview/llcolorswatch.cpp | |||
@@ -219,12 +219,11 @@ void LLColorSwatchCtrl::draw() | |||
219 | gl_rect_2d(interior, mColor, TRUE); | 219 | gl_rect_2d(interior, mColor, TRUE); |
220 | LLColor4 opaque_color = mColor; | 220 | LLColor4 opaque_color = mColor; |
221 | opaque_color.mV[VALPHA] = 1.f; | 221 | opaque_color.mV[VALPHA] = 1.f; |
222 | gGL.color4fv(opaque_color.mV); | ||
223 | if (mAlphaGradientImage.notNull()) | 222 | if (mAlphaGradientImage.notNull()) |
224 | { | 223 | { |
225 | gGL.pushMatrix(); | 224 | gGL.pushMatrix(); |
226 | { | 225 | { |
227 | mAlphaGradientImage->draw(interior, mColor); | 226 | mAlphaGradientImage->draw(interior, opaque_color); |
228 | } | 227 | } |
229 | gGL.popMatrix(); | 228 | gGL.popMatrix(); |
230 | } | 229 | } |
diff --git a/linden/indra/newview/llcompilequeue.cpp b/linden/indra/newview/llcompilequeue.cpp index a81972d..ed18a10 100644 --- a/linden/indra/newview/llcompilequeue.cpp +++ b/linden/indra/newview/llcompilequeue.cpp | |||
@@ -58,6 +58,7 @@ | |||
58 | #include "llfloaterchat.h" | 58 | #include "llfloaterchat.h" |
59 | #include "llviewerstats.h" | 59 | #include "llviewerstats.h" |
60 | #include "lluictrlfactory.h" | 60 | #include "lluictrlfactory.h" |
61 | #include "llselectmgr.h" | ||
61 | 62 | ||
62 | ///---------------------------------------------------------------------------- | 63 | ///---------------------------------------------------------------------------- |
63 | /// Local function declarations, constants, enums, and typedefs | 64 | /// Local function declarations, constants, enums, and typedefs |
diff --git a/linden/indra/newview/llconsole.cpp b/linden/indra/newview/llconsole.cpp index a8554a0..2379da3 100644 --- a/linden/indra/newview/llconsole.cpp +++ b/linden/indra/newview/llconsole.cpp | |||
@@ -63,25 +63,17 @@ const S32 CONSOLE_GUTTER_LEFT = 14; | |||
63 | const S32 CONSOLE_GUTTER_RIGHT = 15; | 63 | const S32 CONSOLE_GUTTER_RIGHT = 15; |
64 | 64 | ||
65 | 65 | ||
66 | LLConsole::LLConsole(const std::string& name, const LLRect &rect, | 66 | LLConsole::LLConsole(const std::string& name, const U32 max_lines, const LLRect &rect, |
67 | S32 font_size_index, F32 persist_time ) | 67 | S32 font_size_index, F32 persist_time ) |
68 | : LLFixedBuffer(), | 68 | : |
69 | LLView(name, rect, FALSE), | 69 | LLFixedBuffer(max_lines), |
70 | mLinePersistTime(persist_time), | 70 | LLView(name, rect, FALSE) |
71 | mFadeTime(persist_time - FADE_DURATION), | ||
72 | mFont(LLFontGL::getFontSansSerif()), | ||
73 | mConsoleWidth(0), | ||
74 | mConsoleHeight(0), | ||
75 | mQueueMutex(NULL) | ||
76 | { | 71 | { |
77 | mTimer.reset(); | 72 | mLinePersistTime = persist_time; // seconds |
73 | mFadeTime = persist_time - FADE_DURATION; | ||
78 | 74 | ||
79 | setFontSize( font_size_index ); | 75 | setFontSize( font_size_index ); |
80 | } | 76 | setMaxLines(gSavedSettings.getS32("ConsoleMaxLines")); |
81 | |||
82 | LLConsole::~LLConsole() | ||
83 | { | ||
84 | clear(); | ||
85 | } | 77 | } |
86 | 78 | ||
87 | void LLConsole::setLinePersistTime(F32 seconds) | 79 | void LLConsole::setLinePersistTime(F32 seconds) |
@@ -106,10 +98,10 @@ void LLConsole::reshape(S32 width, S32 height, BOOL called_from_parent) | |||
106 | mConsoleHeight= new_height; | 98 | mConsoleHeight= new_height; |
107 | 99 | ||
108 | LLView::reshape(new_width, new_height, called_from_parent); | 100 | LLView::reshape(new_width, new_height, called_from_parent); |
109 | 101 | ||
110 | for(paragraph_t::iterator paragraph_it = mParagraphs.begin(); paragraph_it != mParagraphs.end(); paragraph_it++) | 102 | for(paragraph_t::iterator paragraph_it = mParagraphs.begin(); paragraph_it != mParagraphs.end(); paragraph_it++) |
111 | { | 103 | { |
112 | (*paragraph_it)->updateLines((F32)getRect().getWidth(), mFont, true); | 104 | (*paragraph_it).updateLines((F32)getRect().getWidth(), mFont, true); |
113 | } | 105 | } |
114 | } | 106 | } |
115 | 107 | ||
@@ -134,7 +126,7 @@ void LLConsole::setFontSize(S32 size_index) | |||
134 | 126 | ||
135 | for(paragraph_t::iterator paragraph_it = mParagraphs.begin(); paragraph_it != mParagraphs.end(); paragraph_it++) | 127 | for(paragraph_t::iterator paragraph_it = mParagraphs.begin(); paragraph_it != mParagraphs.end(); paragraph_it++) |
136 | { | 128 | { |
137 | (*paragraph_it)->updateLines((F32)getRect().getWidth(), mFont, true); | 129 | (*paragraph_it).updateLines((F32)getRect().getWidth(), mFont, true); |
138 | } | 130 | } |
139 | } | 131 | } |
140 | 132 | ||
@@ -142,49 +134,35 @@ void LLConsole::draw() | |||
142 | { | 134 | { |
143 | LLGLSUIDefault gls_ui; | 135 | LLGLSUIDefault gls_ui; |
144 | 136 | ||
145 | { | ||
146 | LLMutexLock lock(&mQueueMutex); | ||
147 | for(paragraph_t::iterator paragraph_it = mNewParagraphs.begin(); paragraph_it != mNewParagraphs.end(); paragraph_it++) | ||
148 | { | ||
149 | Paragraph* paragraph = *paragraph_it; | ||
150 | mParagraphs.push_back(paragraph); | ||
151 | paragraph->updateLines((F32)getRect().getWidth(), mFont); | ||
152 | } | ||
153 | mNewParagraphs.clear(); | ||
154 | } | ||
155 | |||
156 | if (mParagraphs.empty()) //No text to draw. | ||
157 | { | ||
158 | return; | ||
159 | } | ||
160 | |||
161 | // skip lines added more than mLinePersistTime ago | 137 | // skip lines added more than mLinePersistTime ago |
162 | F32 cur_time = mTimer.getElapsedTimeF32(); | 138 | F32 cur_time = mTimer.getElapsedTimeF32(); |
163 | 139 | ||
164 | F32 skip_time = cur_time - mLinePersistTime; | 140 | F32 skip_time = cur_time - mLinePersistTime; |
165 | F32 fade_time = cur_time - mFadeTime; | 141 | F32 fade_time = cur_time - mFadeTime; |
166 | 142 | ||
167 | U32 max_lines = gSavedSettings.getS32("ConsoleMaxLines"); | 143 | updateBuffer() ; |
144 | |||
145 | if (mParagraphs.empty()) //No text to draw. | ||
146 | { | ||
147 | return; | ||
148 | } | ||
149 | |||
168 | U32 num_lines=0; | 150 | U32 num_lines=0; |
169 | 151 | ||
170 | paragraph_t::reverse_iterator paragraph_it; | 152 | paragraph_t::reverse_iterator paragraph_it; |
171 | paragraph_it = mParagraphs.rbegin(); | 153 | paragraph_it = mParagraphs.rbegin(); |
172 | U32 paragraph_num=mParagraphs.size(); | 154 | U32 paragraph_num=mParagraphs.size(); |
173 | 155 | ||
174 | while (!mParagraphs.empty() && paragraph_it != mParagraphs.rend()) | 156 | while (!mParagraphs.empty() && paragraph_it != mParagraphs.rend()) |
175 | { | 157 | { |
176 | num_lines += (*paragraph_it)->mLines.size(); | 158 | num_lines += (*paragraph_it).mLines.size(); |
177 | if(num_lines > max_lines | 159 | if(num_lines > mMaxLines |
178 | || ( (mLinePersistTime > (F32)0.f) && ((*paragraph_it)->mAddTime - skip_time)/(mLinePersistTime - mFadeTime) <= (F32)0.f)) | 160 | || ( (mLinePersistTime > (F32)0.f) && ((*paragraph_it).mAddTime - skip_time)/(mLinePersistTime - mFadeTime) <= (F32)0.f)) |
179 | { //All lines above here are done. Lose them. | 161 | { //All lines above here are done. Lose them. |
180 | for (U32 i=0;i<paragraph_num;i++) | 162 | for (U32 i=0;i<paragraph_num;i++) |
181 | { | 163 | { |
182 | if (!mParagraphs.empty()) | 164 | if (!mParagraphs.empty()) |
183 | { | ||
184 | Paragraph* paragraph = mParagraphs.front(); | ||
185 | mParagraphs.pop_front(); | 165 | mParagraphs.pop_front(); |
186 | delete paragraph; | ||
187 | } | ||
188 | } | 166 | } |
189 | break; | 167 | break; |
190 | } | 168 | } |
@@ -215,8 +193,8 @@ void LLConsole::draw() | |||
215 | S32 bkg_width=0; | 193 | S32 bkg_width=0; |
216 | for(paragraph_it = mParagraphs.rbegin(); paragraph_it != mParagraphs.rend(); paragraph_it++) | 194 | for(paragraph_it = mParagraphs.rbegin(); paragraph_it != mParagraphs.rend(); paragraph_it++) |
217 | { | 195 | { |
218 | S32 target_height = llfloor( (*paragraph_it)->mLines.size() * line_height + message_spacing); | 196 | S32 target_height = llfloor( (*paragraph_it).mLines.size() * line_height + message_spacing); |
219 | S32 target_width = llfloor( (*paragraph_it)->mMaxWidth + CONSOLE_GUTTER_RIGHT); | 197 | S32 target_width = llfloor( (*paragraph_it).mMaxWidth + CONSOLE_GUTTER_RIGHT); |
220 | 198 | ||
221 | bkg_height+= target_height; | 199 | bkg_height+= target_height; |
222 | if (target_width > bkg_width) | 200 | if (target_width > bkg_width) |
@@ -225,7 +203,7 @@ void LLConsole::draw() | |||
225 | } | 203 | } |
226 | 204 | ||
227 | // Why is this not using llfloor as above? | 205 | // Why is this not using llfloor as above? |
228 | y_pos += ((*paragraph_it)->mLines.size()) * line_height; | 206 | y_pos += ((*paragraph_it).mLines.size()) * line_height; |
229 | y_pos += message_spacing; //Extra spacing between messages. | 207 | y_pos += message_spacing; //Extra spacing between messages. |
230 | } | 208 | } |
231 | imagep->drawSolid(-CONSOLE_GUTTER_LEFT, (S32)(y_pos + line_height - bkg_height - message_spacing), bkg_width, bkg_height, color); | 209 | imagep->drawSolid(-CONSOLE_GUTTER_LEFT, (S32)(y_pos + line_height - bkg_height - message_spacing), bkg_width, bkg_height, color); |
@@ -235,10 +213,10 @@ void LLConsole::draw() | |||
235 | for(paragraph_it = mParagraphs.rbegin(); paragraph_it != mParagraphs.rend(); paragraph_it++) | 213 | for(paragraph_it = mParagraphs.rbegin(); paragraph_it != mParagraphs.rend(); paragraph_it++) |
236 | { | 214 | { |
237 | //080813 Spatters: Dainty per-message block boxes | 215 | //080813 Spatters: Dainty per-message block boxes |
238 | // S32 target_height = llfloor( (*paragraph_it)->mLines.size() * line_height + 8); | 216 | // S32 target_height = llfloor( (*paragraph_it).mLines.size() * line_height + 8); |
239 | S32 target_width = llfloor( (*paragraph_it)->mMaxWidth + CONSOLE_GUTTER_RIGHT); | 217 | S32 target_width = llfloor( (*paragraph_it).mMaxWidth + CONSOLE_GUTTER_RIGHT); |
240 | 218 | ||
241 | y_pos += ((*paragraph_it)->mLines.size()) * line_height; | 219 | y_pos += ((*paragraph_it).mLines.size()) * line_height; |
242 | //080813 Spatters: Dainty per-message block boxes | 220 | //080813 Spatters: Dainty per-message block boxes |
243 | // imagep->drawSolid(-14, (S32)(y_pos + line_height - target_height), target_width, target_height, color); | 221 | // imagep->drawSolid(-14, (S32)(y_pos + line_height - target_height), target_width, target_height, color); |
244 | 222 | ||
@@ -246,9 +224,9 @@ void LLConsole::draw() | |||
246 | 224 | ||
247 | F32 alpha; | 225 | F32 alpha; |
248 | 226 | ||
249 | if ((mLinePersistTime > 0.f) && ((*paragraph_it)->mAddTime < fade_time)) | 227 | if ((mLinePersistTime > 0.f) && ((*paragraph_it).mAddTime < fade_time)) |
250 | { | 228 | { |
251 | alpha = ((*paragraph_it)->mAddTime - skip_time)/(mLinePersistTime - mFadeTime); | 229 | alpha = ((*paragraph_it).mAddTime - skip_time)/(mLinePersistTime - mFadeTime); |
252 | } | 230 | } |
253 | else | 231 | else |
254 | { | 232 | { |
@@ -257,12 +235,12 @@ void LLConsole::draw() | |||
257 | 235 | ||
258 | if( alpha > 0.f ) | 236 | if( alpha > 0.f ) |
259 | { | 237 | { |
260 | for (lines_t::iterator line_it=(*paragraph_it)->mLines.begin(); | 238 | for (lines_t::iterator line_it=(*paragraph_it).mLines.begin(); |
261 | line_it != (*paragraph_it)->mLines.end(); | 239 | line_it != (*paragraph_it).mLines.end(); |
262 | line_it ++) | 240 | line_it ++) |
263 | { | 241 | { |
264 | for (line_color_segments_t::iterator seg_it = (*line_it).begin(); | 242 | for (line_color_segments_t::iterator seg_it = (*line_it).mLineColorSegments.begin(); |
265 | seg_it != (*line_it).end(); | 243 | seg_it != (*line_it).mLineColorSegments.end(); |
266 | seg_it++) | 244 | seg_it++) |
267 | { | 245 | { |
268 | mFont->render((*seg_it).mText, 0, (*seg_it).mXPosition - 8, y_pos - y_off, | 246 | mFont->render((*seg_it).mText, 0, (*seg_it).mXPosition - 8, y_pos - y_off, |
@@ -285,34 +263,21 @@ void LLConsole::draw() | |||
285 | } | 263 | } |
286 | } | 264 | } |
287 | 265 | ||
288 | //virtual | 266 | void LLConsole::addLine(const std::string& utf8line) |
289 | void LLConsole::clear() | ||
290 | { | 267 | { |
291 | mTimer.reset(); | 268 | LLWString wline = utf8str_to_wstring(utf8line); |
292 | LLMutexLock lock(&mQueueMutex); | 269 | addLine(wline, 0.f, LLColor4(1.f, 1.f, 1.f, 1.f)); |
293 | std::for_each(mParagraphs.begin(), mParagraphs.end(), DeletePointer()); | ||
294 | mParagraphs.clear(); | ||
295 | std::for_each(mNewParagraphs.begin(), mNewParagraphs.end(), DeletePointer()); | ||
296 | mNewParagraphs.clear(); | ||
297 | } | 270 | } |
298 | 271 | ||
299 | //virtual | 272 | void LLConsole::addLine(const LLWString& wline) |
300 | void LLConsole::addLine(const std::string& utf8line) | ||
301 | { | 273 | { |
302 | addConsoleLine(utf8line, LLColor4(1.f, 1.f, 1.f, 1.f)); | 274 | addLine(wline, 0.f, LLColor4(1.f, 1.f, 1.f, 1.f)); |
303 | } | 275 | } |
304 | 276 | ||
305 | void LLConsole::addConsoleLine(const std::string& utf8line, const LLColor4 &color) | 277 | void LLConsole::addLine(const std::string& utf8line, F32 size, const LLColor4 &color) |
306 | { | 278 | { |
307 | LLWString wline = utf8str_to_wstring(utf8line); | 279 | LLWString wline = utf8str_to_wstring(utf8line); |
308 | addConsoleLine(wline, color); | 280 | addLine(wline, size, color); |
309 | } | ||
310 | |||
311 | void LLConsole::addConsoleLine(const LLWString& wline, const LLColor4 &color) | ||
312 | { | ||
313 | Paragraph* paragraph = new Paragraph(wline, color, mTimer.getElapsedTimeF32()); | ||
314 | LLMutexLock lock(&mQueueMutex); | ||
315 | mNewParagraphs.push_back ( paragraph ); | ||
316 | } | 281 | } |
317 | 282 | ||
318 | //Generate highlight color segments for this paragraph. Pass in default color of paragraph. | 283 | //Generate highlight color segments for this paragraph. Pass in default color of paragraph. |
@@ -394,7 +359,7 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, LLFontGL* font, bool fo | |||
394 | F32 x_position = 0; //Screen X position of text. | 359 | F32 x_position = 0; //Screen X position of text. |
395 | 360 | ||
396 | mMaxWidth = llmax( mMaxWidth, (F32)font->getWidth( mParagraphText.substr( paragraph_offset, drawable ).c_str() ) ); | 361 | mMaxWidth = llmax( mMaxWidth, (F32)font->getWidth( mParagraphText.substr( paragraph_offset, drawable ).c_str() ) ); |
397 | line_color_segments_t line; | 362 | Line line; |
398 | 363 | ||
399 | U32 left_to_draw = drawable; | 364 | U32 left_to_draw = drawable; |
400 | U32 drawn = 0; | 365 | U32 drawn = 0; |
@@ -403,7 +368,7 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, LLFontGL* font, bool fo | |||
403 | && current_color != mParagraphColorSegments.end() ) | 368 | && current_color != mParagraphColorSegments.end() ) |
404 | { | 369 | { |
405 | LLWString color_text = mParagraphText.substr( paragraph_offset + drawn, current_color_length ); | 370 | LLWString color_text = mParagraphText.substr( paragraph_offset + drawn, current_color_length ); |
406 | line.push_back( LineColorSegment( color_text, //Append segment to line. | 371 | line.mLineColorSegments.push_back( LineColorSegment( color_text, //Append segment to line. |
407 | (*current_color).mColor, | 372 | (*current_color).mColor, |
408 | x_position ) ); | 373 | x_position ) ); |
409 | 374 | ||
@@ -424,7 +389,7 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, LLFontGL* font, bool fo | |||
424 | { | 389 | { |
425 | LLWString color_text = mParagraphText.substr( paragraph_offset + drawn, left_to_draw ); | 390 | LLWString color_text = mParagraphText.substr( paragraph_offset + drawn, left_to_draw ); |
426 | 391 | ||
427 | line.push_back( LineColorSegment( color_text, //Append segment to line. | 392 | line.mLineColorSegments.push_back( LineColorSegment( color_text, //Append segment to line. |
428 | (*current_color).mColor, | 393 | (*current_color).mColor, |
429 | x_position ) ); | 394 | x_position ) ); |
430 | 395 | ||
@@ -442,9 +407,50 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, LLFontGL* font, bool fo | |||
442 | } | 407 | } |
443 | 408 | ||
444 | //Pass in the string and the default color for this block of text. | 409 | //Pass in the string and the default color for this block of text. |
445 | LLConsole::Paragraph::Paragraph (LLWString str, const LLColor4 &color, F32 add_time) | 410 | LLConsole::Paragraph::Paragraph (LLWString str, const LLColor4 &color, F32 add_time, LLFontGL* font, F32 screen_width) |
446 | : mParagraphText(str), mAddTime(add_time), mMaxWidth(-1) | 411 | : mParagraphText(str), mAddTime(add_time), mMaxWidth(-1) |
447 | { | 412 | { |
448 | makeParagraphColorSegments(color); | 413 | makeParagraphColorSegments(color); |
414 | updateLines( screen_width, font ); | ||
449 | } | 415 | } |
450 | 416 | ||
417 | void LLConsole::addLine(const LLWString& wline, F32 size, const LLColor4 &color) | ||
418 | { | ||
419 | Paragraph paragraph(wline, color, mTimer.getElapsedTimeF32(), mFont, (F32)getRect().getWidth() ); | ||
420 | |||
421 | mParagraphs.push_back ( paragraph ); | ||
422 | |||
423 | #if LL_WINDOWS && LL_LCD_COMPILE | ||
424 | // add to LCD screen | ||
425 | AddNewDebugConsoleToLCD(wline); | ||
426 | #endif | ||
427 | } | ||
428 | |||
429 | // | ||
430 | //check if there are some messages stored in the buffer | ||
431 | //if yes, output them. | ||
432 | // | ||
433 | void LLConsole::updateBuffer() | ||
434 | { | ||
435 | BOOL need_clear = FALSE ; | ||
436 | |||
437 | mMutex.lock() ; | ||
438 | if(!mLines.empty()) | ||
439 | { | ||
440 | S32 end = mLines.size() ; | ||
441 | LLColor4 color(1.f, 1.f, 1.f, 1.f) ; | ||
442 | for(S32 i = 0 ; i < end ; i++) | ||
443 | { | ||
444 | Paragraph paragraph(mLines[i], color, mAddTimes[i], mFont, (F32)getRect().getWidth() ); | ||
445 | mParagraphs.push_back ( paragraph ); | ||
446 | } | ||
447 | |||
448 | need_clear = TRUE ; | ||
449 | } | ||
450 | mMutex.unlock() ; | ||
451 | |||
452 | if(need_clear) | ||
453 | { | ||
454 | clear() ; | ||
455 | } | ||
456 | } | ||
diff --git a/linden/indra/newview/llconsole.h b/linden/indra/newview/llconsole.h index 578670e..2915c48 100644 --- a/linden/indra/newview/llconsole.h +++ b/linden/indra/newview/llconsole.h | |||
@@ -33,8 +33,7 @@ | |||
33 | #ifndef LL_LLCONSOLE_H | 33 | #ifndef LL_LLCONSOLE_H |
34 | #define LL_LLCONSOLE_H | 34 | #define LL_LLCONSOLE_H |
35 | 35 | ||
36 | #include "llerrorcontrol.h" // For LLLineBuffer | 36 | #include "llfixedbuffer.h" |
37 | #include "llthread.h" | ||
38 | #include "llview.h" | 37 | #include "llview.h" |
39 | #include "v4color.h" | 38 | #include "v4color.h" |
40 | #include <deque> | 39 | #include <deque> |
@@ -48,10 +47,10 @@ private: | |||
48 | F32 mLinePersistTime; // Age at which to stop drawing. | 47 | F32 mLinePersistTime; // Age at which to stop drawing. |
49 | F32 mFadeTime; // Age at which to start fading | 48 | F32 mFadeTime; // Age at which to start fading |
50 | LLFontGL* mFont; | 49 | LLFontGL* mFont; |
50 | S32 mLastBoxHeight; | ||
51 | S32 mLastBoxWidth; | ||
51 | S32 mConsoleWidth; | 52 | S32 mConsoleWidth; |
52 | S32 mConsoleHeight; | 53 | S32 mConsoleHeight; |
53 | LLMutex mQueueMutex; | ||
54 | LLTimer mTimer; | ||
55 | 54 | ||
56 | public: | 55 | public: |
57 | //A paragraph color segment defines the color of text in a line | 56 | //A paragraph color segment defines the color of text in a line |
@@ -81,7 +80,14 @@ public: | |||
81 | 80 | ||
82 | typedef std::list<LineColorSegment> line_color_segments_t; | 81 | typedef std::list<LineColorSegment> line_color_segments_t; |
83 | 82 | ||
84 | typedef std::list<line_color_segments_t> lines_t; | 83 | //A line is composed of one or more color segments. |
84 | class Line | ||
85 | { | ||
86 | public: | ||
87 | line_color_segments_t mLineColorSegments; | ||
88 | }; | ||
89 | |||
90 | typedef std::list<Line> lines_t; | ||
85 | typedef std::list<ParagraphColorSegment> paragraph_color_segments_t; | 91 | typedef std::list<ParagraphColorSegment> paragraph_color_segments_t; |
86 | 92 | ||
87 | //A paragraph is a processed element containing the entire text of the | 93 | //A paragraph is a processed element containing the entire text of the |
@@ -92,7 +98,7 @@ public: | |||
92 | class Paragraph | 98 | class Paragraph |
93 | { | 99 | { |
94 | public: | 100 | public: |
95 | Paragraph (LLWString str, const LLColor4 &color, F32 add_time); | 101 | Paragraph (LLWString str, const LLColor4 &color, F32 add_time, LLFontGL* font, F32 screen_width); |
96 | void makeParagraphColorSegments ( const LLColor4 &color); | 102 | void makeParagraphColorSegments ( const LLColor4 &color); |
97 | void updateLines ( F32 screen_width, LLFontGL* font, bool force_resize=false ); | 103 | void updateLines ( F32 screen_width, LLFontGL* font, bool force_resize=false ); |
98 | public: | 104 | public: |
@@ -105,32 +111,35 @@ public: | |||
105 | }; | 111 | }; |
106 | 112 | ||
107 | //The console contains a deque of paragraphs which represent the individual messages. | 113 | //The console contains a deque of paragraphs which represent the individual messages. |
108 | typedef std::deque<Paragraph*> paragraph_t; | 114 | typedef std::deque<Paragraph> paragraph_t; |
109 | paragraph_t mParagraphs; | 115 | paragraph_t mParagraphs; |
110 | paragraph_t mNewParagraphs; | ||
111 | 116 | ||
112 | // Font size: | 117 | // Font size: |
113 | // -1 = monospace, 0 means small, font size = 1 means big | 118 | // -1 = monospace, 0 means small, font size = 1 means big |
114 | LLConsole(const std::string& name, const LLRect &rect, | 119 | LLConsole(const std::string& name, const U32 max_lines, const LLRect &rect, |
115 | S32 font_size_index, F32 persist_time ); | 120 | S32 font_size_index, F32 persist_time ); |
116 | ~LLConsole(); | 121 | ~LLConsole(){}; |
117 | 122 | ||
118 | // each line lasts this long after being added | 123 | // each line lasts this long after being added |
119 | void setLinePersistTime(F32 seconds); | 124 | void setLinePersistTime(F32 seconds); |
120 | 125 | ||
121 | void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); | 126 | void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); |
122 | 127 | ||
123 | // -1 = monospace, 0 means small, font size = 1 means big | 128 | // -1 = monospace, 0 means small, font size = 1 means big |
124 | void setFontSize(S32 size_index); | 129 | void setFontSize(S32 size_index); |
125 | 130 | ||
126 | // From LLLineBuffer | 131 | void addLine(const std::string& utf8line, F32 size, const LLColor4 &color); |
127 | /*virtual*/ void clear(); | 132 | void addLine(const LLWString& wline, F32 size, const LLColor4 &color); |
128 | /*virtual*/ void addLine(const std::string& utf8line); | ||
129 | void addConsoleLine(const std::string& utf8line, const LLColor4 &color); | ||
130 | void addConsoleLine(const LLWString& wline, const LLColor4 &color); | ||
131 | 133 | ||
132 | // Overrides | 134 | // Overrides |
133 | /*virtual*/ void draw(); | 135 | /*virtual*/ void draw(); |
136 | |||
137 | //do not make these two "virtual" | ||
138 | void addLine(const std::string& utf8line); | ||
139 | void addLine(const LLWString& line); | ||
140 | |||
141 | private: | ||
142 | void updateBuffer() ; | ||
134 | }; | 143 | }; |
135 | 144 | ||
136 | extern LLConsole* gConsole; | 145 | extern LLConsole* gConsole; |
diff --git a/linden/indra/newview/lldebugview.cpp b/linden/indra/newview/lldebugview.cpp index a6d6f2d..40f5202 100644 --- a/linden/indra/newview/lldebugview.cpp +++ b/linden/indra/newview/lldebugview.cpp | |||
@@ -62,7 +62,7 @@ LLDebugView::LLDebugView(const std::string& name, const LLRect &rect) | |||
62 | LLRect r; | 62 | LLRect r; |
63 | 63 | ||
64 | r.set(10, rect.getHeight() - 100, rect.getWidth()/2, 100); | 64 | r.set(10, rect.getHeight() - 100, rect.getWidth()/2, 100); |
65 | mDebugConsolep = new LLConsole("debug console", r, -1, 0.f ); | 65 | mDebugConsolep = new LLConsole("debug console", 20, r, -1, 0.f ); |
66 | mDebugConsolep->setFollowsBottom(); | 66 | mDebugConsolep->setFollowsBottom(); |
67 | mDebugConsolep->setFollowsLeft(); | 67 | mDebugConsolep->setFollowsLeft(); |
68 | mDebugConsolep->setVisible( FALSE ); | 68 | mDebugConsolep->setVisible( FALSE ); |
@@ -98,27 +98,6 @@ LLDebugView::LLDebugView(const std::string& name, const LLRect &rect) | |||
98 | addChild(gTextureView); | 98 | addChild(gTextureView); |
99 | //gTextureView->reshape(r.getWidth(), r.getHeight(), TRUE); | 99 | //gTextureView->reshape(r.getWidth(), r.getHeight(), TRUE); |
100 | 100 | ||
101 | /* | ||
102 | //there seems to be some debug code, we don't have | ||
103 | #if !LL_RELEASE_FOR_DOWNLOAD | ||
104 | r.set(150, rect.getHeight() - 50, 900 + LLImageGL::sTextureLoadedCounter.size() * 30, 100); | ||
105 | gTextureSizeView = new LLTextureSizeView("gTextureSizeView"); | ||
106 | gTextureSizeView->setRect(r); | ||
107 | gTextureSizeView->setFollowsBottom(); | ||
108 | gTextureSizeView->setFollowsLeft(); | ||
109 | addChild(gTextureSizeView); | ||
110 | |||
111 | |||
112 | r.set(150, rect.getHeight() - 50, 900 + LLImageGL::sTextureMemByCategory.size() * 30, 100); | ||
113 | gTextureCategoryView = new LLTextureSizeView("gTextureCategoryView"); | ||
114 | gTextureCategoryView->setRect(r); | ||
115 | gTextureCategoryView->setFollowsBottom(); | ||
116 | gTextureCategoryView->setFollowsLeft(); | ||
117 | gTextureCategoryView->setType(LLTextureSizeView::TEXTURE_MEM_OVER_CATEGORY); | ||
118 | addChild(gTextureCategoryView); | ||
119 | #endif | ||
120 | */ | ||
121 | |||
122 | const S32 VELOCITY_LEFT = 10; // 370; | 101 | const S32 VELOCITY_LEFT = 10; // 370; |
123 | const S32 VELOCITY_WIDTH = 500; | 102 | const S32 VELOCITY_WIDTH = 500; |
124 | const S32 VELOCITY_TOP = 140; | 103 | const S32 VELOCITY_TOP = 140; |
@@ -136,6 +115,5 @@ LLDebugView::~LLDebugView() | |||
136 | // These have already been deleted. Fix the globals appropriately. | 115 | // These have already been deleted. Fix the globals appropriately. |
137 | gDebugView = NULL; | 116 | gDebugView = NULL; |
138 | gTextureView = NULL; | 117 | gTextureView = NULL; |
139 | gTextureSizeView = NULL; | ||
140 | } | 118 | } |
141 | 119 | ||
diff --git a/linden/indra/newview/lldrawable.cpp b/linden/indra/newview/lldrawable.cpp index 2b43374..5a383bc 100644 --- a/linden/indra/newview/lldrawable.cpp +++ b/linden/indra/newview/lldrawable.cpp | |||
@@ -102,7 +102,7 @@ void LLDrawable::init() | |||
102 | mVObjp = NULL; | 102 | mVObjp = NULL; |
103 | // mFaces | 103 | // mFaces |
104 | mSpatialGroupp = NULL; | 104 | mSpatialGroupp = NULL; |
105 | mVisible = 0; | 105 | mVisible = sCurVisible - 2;//invisible for the current frame and the last frame. |
106 | mRadius = 0.f; | 106 | mRadius = 0.f; |
107 | 107 | ||
108 | mGeneration = -1; | 108 | mGeneration = -1; |
@@ -125,7 +125,7 @@ void LLDrawable::destroy() | |||
125 | 125 | ||
126 | if (LLSpatialGroup::sNoDelete) | 126 | if (LLSpatialGroup::sNoDelete) |
127 | { | 127 | { |
128 | llwarns << "Illegal deletion of LLDrawable!" << llendl; | 128 | llerrs << "Illegal deletion of LLDrawable!" << llendl; |
129 | } | 129 | } |
130 | 130 | ||
131 | std::for_each(mFaces.begin(), mFaces.end(), DeletePointer()); | 131 | std::for_each(mFaces.begin(), mFaces.end(), DeletePointer()); |
@@ -234,7 +234,7 @@ LLFace* LLDrawable::addFace(LLFacePool *poolp, LLViewerImage *texturep) | |||
234 | LLMemType mt(LLMemType::MTYPE_DRAWABLE); | 234 | LLMemType mt(LLMemType::MTYPE_DRAWABLE); |
235 | 235 | ||
236 | LLFace *face = new LLFace(this, mVObjp); | 236 | LLFace *face = new LLFace(this, mVObjp); |
237 | if (!face) llwarns << "Allocating new Face: " << mFaces.size() << llendl; | 237 | if (!face) llerrs << "Allocating new Face: " << mFaces.size() << llendl; |
238 | 238 | ||
239 | if (face) | 239 | if (face) |
240 | { | 240 | { |
@@ -346,7 +346,7 @@ void LLDrawable::deleteFaces(S32 offset, S32 count) | |||
346 | 346 | ||
347 | void LLDrawable::update() | 347 | void LLDrawable::update() |
348 | { | 348 | { |
349 | llwarns << "Shouldn't be called!" << llendl; | 349 | llerrs << "Shouldn't be called!" << llendl; |
350 | } | 350 | } |
351 | 351 | ||
352 | 352 | ||
@@ -369,7 +369,7 @@ void LLDrawable::makeActive() | |||
369 | pcode == LLViewerObject::LL_VO_GROUND || | 369 | pcode == LLViewerObject::LL_VO_GROUND || |
370 | pcode == LLViewerObject::LL_VO_SKY) | 370 | pcode == LLViewerObject::LL_VO_SKY) |
371 | { | 371 | { |
372 | llwarns << "Static viewer object has active drawable!" << llendl; | 372 | llerrs << "Static viewer object has active drawable!" << llendl; |
373 | } | 373 | } |
374 | } | 374 | } |
375 | #endif | 375 | #endif |
@@ -693,22 +693,19 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) | |||
693 | pos += volume->getRegion()->getOriginAgent(); | 693 | pos += volume->getRegion()->getOriginAgent(); |
694 | } | 694 | } |
695 | 695 | ||
696 | if (isState(LLDrawable::HAS_ALPHA)) | 696 | for (S32 i = 0; i < getNumFaces(); i++) |
697 | { | 697 | { |
698 | for (S32 i = 0; i < getNumFaces(); i++) | 698 | LLFace* facep = getFace(i); |
699 | if (force_update || facep->getPoolType() == LLDrawPool::POOL_ALPHA) | ||
699 | { | 700 | { |
700 | LLFace* facep = getFace(i); | 701 | LLVector3 box = (facep->mExtents[1] - facep->mExtents[0]) * 0.25f; |
701 | if (facep->getPoolType() == LLDrawPool::POOL_ALPHA) | 702 | LLVector3 v = (facep->mCenterLocal-camera.getOrigin()); |
703 | LLVector3 at = camera.getAtAxis(); | ||
704 | for (U32 j = 0; j < 3; j++) | ||
702 | { | 705 | { |
703 | LLVector3 box = (facep->mExtents[1] - facep->mExtents[0]) * 0.25f; | 706 | v.mV[j] -= box.mV[j] * at.mV[j]; |
704 | LLVector3 v = (facep->mCenterLocal-camera.getOrigin()); | ||
705 | const LLVector3& at = camera.getAtAxis(); | ||
706 | for (U32 j = 0; j < 3; j++) | ||
707 | { | ||
708 | v.mV[j] -= box.mV[j] * at.mV[j]; | ||
709 | } | ||
710 | facep->mDistance = v * camera.getAtAxis(); | ||
711 | } | 707 | } |
708 | facep->mDistance = v * camera.getAtAxis(); | ||
712 | } | 709 | } |
713 | } | 710 | } |
714 | } | 711 | } |
@@ -740,11 +737,7 @@ void LLDrawable::updateTexture() | |||
740 | 737 | ||
741 | if (getVOVolume()) | 738 | if (getVOVolume()) |
742 | { | 739 | { |
743 | if (!isActive()) | 740 | if (isActive()) |
744 | { | ||
745 | //gPipeline.markMoved(this); | ||
746 | } | ||
747 | else | ||
748 | { | 741 | { |
749 | if (isRoot()) | 742 | if (isRoot()) |
750 | { | 743 | { |
@@ -1011,8 +1004,8 @@ BOOL LLDrawable::isVisible() const | |||
1011 | // Spatial Partition Bridging Drawable | 1004 | // Spatial Partition Bridging Drawable |
1012 | //======================================= | 1005 | //======================================= |
1013 | 1006 | ||
1014 | LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask) // KL Sd version | 1007 | LLSpatialBridge::LLSpatialBridge(LLDrawable* root, U32 data_mask) |
1015 | : LLSpatialPartition(data_mask, render_by_group, FALSE) | 1008 | : LLSpatialPartition(data_mask, FALSE) |
1016 | { | 1009 | { |
1017 | mDrawable = root; | 1010 | mDrawable = root; |
1018 | root->setSpatialBridge(this); | 1011 | root->setSpatialBridge(this); |
@@ -1142,26 +1135,26 @@ void LLDrawable::setVisible(LLCamera& camera, std::vector<LLDrawable*>* results, | |||
1142 | { | 1135 | { |
1143 | if (isActive() && !mParent->isActive()) | 1136 | if (isActive() && !mParent->isActive()) |
1144 | { | 1137 | { |
1145 | llwarns << "Active drawable has static parent!" << llendl; | 1138 | llerrs << "Active drawable has static parent!" << llendl; |
1146 | } | 1139 | } |
1147 | 1140 | ||
1148 | if (isStatic() && !mParent->isStatic()) | 1141 | if (isStatic() && !mParent->isStatic()) |
1149 | { | 1142 | { |
1150 | llwarns << "Static drawable has active parent!" << llendl; | 1143 | llerrs << "Static drawable has active parent!" << llendl; |
1151 | } | 1144 | } |
1152 | 1145 | ||
1153 | if (mSpatialBridge) | 1146 | if (mSpatialBridge) |
1154 | { | 1147 | { |
1155 | llwarns << "Child drawable has spatial bridge!" << llendl; | 1148 | llerrs << "Child drawable has spatial bridge!" << llendl; |
1156 | } | 1149 | } |
1157 | } | 1150 | } |
1158 | else if (isActive() && !mSpatialBridge) | 1151 | else if (isActive() && !mSpatialBridge) |
1159 | { | 1152 | { |
1160 | llwarns << "Active root drawable has no spatial bridge!" << llendl; | 1153 | llerrs << "Active root drawable has no spatial bridge!" << llendl; |
1161 | } | 1154 | } |
1162 | else if (isStatic() && mSpatialBridge.notNull()) | 1155 | else if (isStatic() && mSpatialBridge.notNull()) |
1163 | { | 1156 | { |
1164 | llwarns << "Static drawable has spatial bridge!" << llendl; | 1157 | llerrs << "Static drawable has spatial bridge!" << llendl; |
1165 | } | 1158 | } |
1166 | } | 1159 | } |
1167 | #endif | 1160 | #endif |
@@ -1285,25 +1278,12 @@ void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update) | |||
1285 | return; | 1278 | return; |
1286 | } | 1279 | } |
1287 | 1280 | ||
1288 | if (mDrawable->getVObj()) | 1281 | LLCamera camera = transformCamera(camera_in); |
1289 | { | ||
1290 | if (mDrawable->getVObj()->isAttachment()) | ||
1291 | { | ||
1292 | LLDrawable* parent = mDrawable->getParent(); | ||
1293 | if (parent && parent->getVObj()) | ||
1294 | { | ||
1295 | LLVOAvatar* av = parent->getVObj()->asAvatar(); | ||
1296 | if (av && av->isImpostor()) | ||
1297 | { | ||
1298 | return; | ||
1299 | } | ||
1300 | } | ||
1301 | } | ||
1302 | |||
1303 | LLCamera camera = transformCamera(camera_in); | ||
1304 | 1282 | ||
1305 | mDrawable->updateDistance(camera, force_update); | 1283 | mDrawable->updateDistance(camera, force_update); |
1306 | 1284 | ||
1285 | if (mDrawable->getVObj()) | ||
1286 | { | ||
1307 | LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren(); | 1287 | LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren(); |
1308 | for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); | 1288 | for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); |
1309 | iter != child_list.end(); iter++) | 1289 | iter != child_list.end(); iter++) |
@@ -1325,7 +1305,7 @@ void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update) | |||
1325 | 1305 | ||
1326 | void LLSpatialBridge::makeActive() | 1306 | void LLSpatialBridge::makeActive() |
1327 | { //it is an error to make a spatial bridge active (it's already active) | 1307 | { //it is an error to make a spatial bridge active (it's already active) |
1328 | llwarns << "makeActive called on spatial bridge" << llendl; | 1308 | llerrs << "makeActive called on spatial bridge" << llendl; |
1329 | } | 1309 | } |
1330 | 1310 | ||
1331 | void LLSpatialBridge::move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate) | 1311 | void LLSpatialBridge::move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate) |
@@ -1441,9 +1421,9 @@ void LLDrawable::updateFaceSize(S32 idx) | |||
1441 | } | 1421 | } |
1442 | 1422 | ||
1443 | LLBridgePartition::LLBridgePartition() | 1423 | LLBridgePartition::LLBridgePartition() |
1444 | : LLSpatialPartition(0, FALSE, 0) | 1424 | : LLSpatialPartition(0, TRUE) |
1445 | { | 1425 | { |
1446 | //mRenderByGroup = FALSE; // KL | 1426 | mRenderByGroup = FALSE; |
1447 | mDrawableType = LLPipeline::RENDER_TYPE_AVATAR; | 1427 | mDrawableType = LLPipeline::RENDER_TYPE_AVATAR; |
1448 | mPartitionType = LLViewerRegion::PARTITION_BRIDGE; | 1428 | mPartitionType = LLViewerRegion::PARTITION_BRIDGE; |
1449 | mLODPeriod = 16; | 1429 | mLODPeriod = 16; |
diff --git a/linden/indra/newview/lldrawable.h b/linden/indra/newview/lldrawable.h index e6753b5..71b75dc 100644 --- a/linden/indra/newview/lldrawable.h +++ b/linden/indra/newview/lldrawable.h | |||
@@ -267,8 +267,7 @@ public: | |||
267 | BUILT = 0x08000000, | 267 | BUILT = 0x08000000, |
268 | FORCE_INVISIBLE = 0x10000000, // stay invis until CLEAR_INVISIBLE is set (set of orphaned) | 268 | FORCE_INVISIBLE = 0x10000000, // stay invis until CLEAR_INVISIBLE is set (set of orphaned) |
269 | CLEAR_INVISIBLE = 0x20000000, // clear FORCE_INVISIBLE next draw frame | 269 | CLEAR_INVISIBLE = 0x20000000, // clear FORCE_INVISIBLE next draw frame |
270 | REBUILD_SHADOW = 0x40000000, | 270 | REBUILD_SHADOW = 0x40000000 |
271 | HAS_ALPHA = 0x80000000, | ||
272 | } EDrawableFlags; | 271 | } EDrawableFlags; |
273 | 272 | ||
274 | LLXformMatrix mXform; | 273 | LLXformMatrix mXform; |
diff --git a/linden/indra/newview/lldrawpool.h b/linden/indra/newview/lldrawpool.h index 6920a99..f8c2ead 100644 --- a/linden/indra/newview/lldrawpool.h +++ b/linden/indra/newview/lldrawpool.h | |||
@@ -68,11 +68,6 @@ public: | |||
68 | POOL_GLOW, | 68 | POOL_GLOW, |
69 | POOL_ALPHA, | 69 | POOL_ALPHA, |
70 | NUM_POOL_TYPES, | 70 | NUM_POOL_TYPES, |
71 | // * invisiprims work by rendering to the depth buffer but not the color buffer, occluding anything rendered after them | ||
72 | // - and the LLDrawPool types enum controls what order things are rendered in | ||
73 | // - so, it has absolute control over what invisprims block | ||
74 | // ...invisiprims being rendered in pool_invisible | ||
75 | // ...shiny/bump mapped objects in rendered in POOL_BUMP | ||
76 | }; | 71 | }; |
77 | 72 | ||
78 | LLDrawPool(const U32 type); | 73 | LLDrawPool(const U32 type); |
diff --git a/linden/indra/newview/lldrawpoolalpha.cpp b/linden/indra/newview/lldrawpoolalpha.cpp index c9c06f4..4b552ac 100644 --- a/linden/indra/newview/lldrawpoolalpha.cpp +++ b/linden/indra/newview/lldrawpoolalpha.cpp | |||
@@ -88,12 +88,7 @@ void LLDrawPoolAlpha::beginDeferredPass(S32 pass) | |||
88 | 88 | ||
89 | void LLDrawPoolAlpha::endDeferredPass(S32 pass) | 89 | void LLDrawPoolAlpha::endDeferredPass(S32 pass) |
90 | { | 90 | { |
91 | 91 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.4f); | |
92 | } | ||
93 | |||
94 | void LLDrawPoolAlpha::renderDeferred(S32 pass) | ||
95 | { | ||
96 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.f); | ||
97 | { | 92 | { |
98 | LLFastTimer t(LLFastTimer::FTM_RENDER_GRASS); | 93 | LLFastTimer t(LLFastTimer::FTM_RENDER_GRASS); |
99 | gDeferredTreeProgram.bind(); | 94 | gDeferredTreeProgram.bind(); |
@@ -104,6 +99,11 @@ void LLDrawPoolAlpha::renderDeferred(S32 pass) | |||
104 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); | 99 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); |
105 | } | 100 | } |
106 | 101 | ||
102 | void LLDrawPoolAlpha::renderDeferred(S32 pass) | ||
103 | { | ||
104 | |||
105 | } | ||
106 | |||
107 | 107 | ||
108 | S32 LLDrawPoolAlpha::getNumPostDeferredPasses() | 108 | S32 LLDrawPoolAlpha::getNumPostDeferredPasses() |
109 | { | 109 | { |
@@ -261,8 +261,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) | |||
261 | { | 261 | { |
262 | BOOL initialized_lighting = FALSE; | 262 | BOOL initialized_lighting = FALSE; |
263 | BOOL light_enabled = TRUE; | 263 | BOOL light_enabled = TRUE; |
264 | S32 diffuse_channel = 0; | ||
265 | |||
266 | //BOOL is_particle = FALSE; | 264 | //BOOL is_particle = FALSE; |
267 | BOOL use_shaders = (LLPipeline::sUnderWaterRender && gPipeline.canUseVertexShaders()) | 265 | BOOL use_shaders = (LLPipeline::sUnderWaterRender && gPipeline.canUseVertexShaders()) |
268 | || gPipeline.canUseWindLightShadersOnObjects(); | 266 | || gPipeline.canUseWindLightShadersOnObjects(); |
@@ -293,6 +291,19 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) | |||
293 | 291 | ||
294 | LLRenderPass::applyModelMatrix(params); | 292 | LLRenderPass::applyModelMatrix(params); |
295 | 293 | ||
294 | if (params.mTexture.notNull()) | ||
295 | { | ||
296 | gGL.getTexUnit(0)->activate(); | ||
297 | gGL.getTexUnit(0)->bind(params.mTexture.get()); | ||
298 | |||
299 | if (params.mTextureMatrix) | ||
300 | { | ||
301 | glMatrixMode(GL_TEXTURE); | ||
302 | glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix); | ||
303 | gPipeline.mTextureMatrixOps++; | ||
304 | } | ||
305 | } | ||
306 | |||
296 | if (params.mFullbright) | 307 | if (params.mFullbright) |
297 | { | 308 | { |
298 | // Turn off lighting if it hasn't already been so. | 309 | // Turn off lighting if it hasn't already been so. |
@@ -333,13 +344,11 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) | |||
333 | if (deferred_render && current_shader != NULL) | 344 | if (deferred_render && current_shader != NULL) |
334 | { | 345 | { |
335 | gPipeline.unbindDeferredShader(*current_shader); | 346 | gPipeline.unbindDeferredShader(*current_shader); |
336 | diffuse_channel = 0; | ||
337 | } | 347 | } |
338 | current_shader = target_shader; | 348 | current_shader = target_shader; |
339 | if (deferred_render) | 349 | if (deferred_render) |
340 | { | 350 | { |
341 | gPipeline.bindDeferredShader(*current_shader); | 351 | gPipeline.bindDeferredShader(*current_shader); |
342 | diffuse_channel = current_shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); | ||
343 | } | 352 | } |
344 | else | 353 | else |
345 | { | 354 | { |
@@ -348,12 +357,11 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) | |||
348 | } | 357 | } |
349 | else if (!use_shaders && current_shader != NULL) | 358 | else if (!use_shaders && current_shader != NULL) |
350 | { | 359 | { |
360 | LLGLSLShader::bindNoShader(); | ||
351 | if (deferred_render) | 361 | if (deferred_render) |
352 | { | 362 | { |
353 | gPipeline.unbindDeferredShader(*current_shader); | 363 | gPipeline.unbindDeferredShader(*current_shader); |
354 | diffuse_channel = 0; | ||
355 | } | 364 | } |
356 | LLGLSLShader::bindNoShader(); | ||
357 | current_shader = NULL; | 365 | current_shader = NULL; |
358 | } | 366 | } |
359 | 367 | ||
@@ -361,24 +369,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) | |||
361 | { | 369 | { |
362 | params.mGroup->rebuildMesh(); | 370 | params.mGroup->rebuildMesh(); |
363 | } | 371 | } |
364 | |||
365 | |||
366 | if (params.mTexture.notNull()) | ||
367 | { | ||
368 | gGL.getTexUnit(diffuse_channel)->bind(params.mTexture.get(), TRUE, TRUE); | ||
369 | if(params.mViewerTexture.notNull()) | ||
370 | { | ||
371 | params.mViewerTexture->addTextureStats(params.mVSize); | ||
372 | } | ||
373 | if (params.mTextureMatrix) | ||
374 | { | ||
375 | gGL.getTexUnit(0)->activate(); | ||
376 | glMatrixMode(GL_TEXTURE); | ||
377 | glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix); | ||
378 | gPipeline.mTextureMatrixOps++; | ||
379 | } | ||
380 | } | ||
381 | |||
382 | params.mVertexBuffer->setBuffer(mask); | 372 | params.mVertexBuffer->setBuffer(mask); |
383 | params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); | 373 | params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset); |
384 | gPipeline.addTrianglesDrawn(params.mCount/3); | 374 | gPipeline.addTrianglesDrawn(params.mCount/3); |
@@ -393,15 +383,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) | |||
393 | } | 383 | } |
394 | } | 384 | } |
395 | 385 | ||
396 | if (deferred_render && current_shader != NULL) | ||
397 | { | ||
398 | gPipeline.unbindDeferredShader(*current_shader); | ||
399 | LLVertexBuffer::unbind(); | ||
400 | LLGLState::checkStates(); | ||
401 | LLGLState::checkTextureChannels(); | ||
402 | LLGLState::checkClientArrays(); | ||
403 | } | ||
404 | |||
405 | if (!light_enabled) | 386 | if (!light_enabled) |
406 | { | 387 | { |
407 | gPipeline.enableLightsDynamic(); | 388 | gPipeline.enableLightsDynamic(); |
diff --git a/linden/indra/newview/lldrawpoolavatar.cpp b/linden/indra/newview/lldrawpoolavatar.cpp index af7b5e3..80c7d73 100644 --- a/linden/indra/newview/lldrawpoolavatar.cpp +++ b/linden/indra/newview/lldrawpoolavatar.cpp | |||
@@ -94,7 +94,6 @@ BOOL gAvatarEmbossBumpMap = FALSE; | |||
94 | static BOOL sRenderingSkinned = FALSE; | 94 | static BOOL sRenderingSkinned = FALSE; |
95 | S32 normal_channel = -1; | 95 | S32 normal_channel = -1; |
96 | S32 specular_channel = -1; | 96 | S32 specular_channel = -1; |
97 | S32 diffuse_channel = -1; | ||
98 | 97 | ||
99 | LLDrawPoolAvatar::LLDrawPoolAvatar() : | 98 | LLDrawPoolAvatar::LLDrawPoolAvatar() : |
100 | LLFacePool(POOL_AVATAR) | 99 | LLFacePool(POOL_AVATAR) |
@@ -448,8 +447,7 @@ void LLDrawPoolAvatar::beginDeferredImpostor() | |||
448 | 447 | ||
449 | normal_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::DEFERRED_NORMAL); | 448 | normal_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::DEFERRED_NORMAL); |
450 | specular_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::SPECULAR_MAP); | 449 | specular_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::SPECULAR_MAP); |
451 | diffuse_channel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); // KL SD | 450 | |
452 | |||
453 | sVertexProgram->bind(); | 451 | sVertexProgram->bind(); |
454 | } | 452 | } |
455 | 453 | ||
@@ -458,7 +456,6 @@ void LLDrawPoolAvatar::endDeferredImpostor() | |||
458 | sShaderLevel = mVertexShaderLevel; | 456 | sShaderLevel = mVertexShaderLevel; |
459 | sVertexProgram->disableTexture(LLViewerShaderMgr::DEFERRED_NORMAL); | 457 | sVertexProgram->disableTexture(LLViewerShaderMgr::DEFERRED_NORMAL); |
460 | sVertexProgram->disableTexture(LLViewerShaderMgr::SPECULAR_MAP); | 458 | sVertexProgram->disableTexture(LLViewerShaderMgr::SPECULAR_MAP); |
461 | sVertexProgram->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); // KL SD | ||
462 | sVertexProgram->unbind(); | 459 | sVertexProgram->unbind(); |
463 | gGL.getTexUnit(0)->activate(); | 460 | gGL.getTexUnit(0)->activate(); |
464 | } | 461 | } |
@@ -702,8 +699,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) | |||
702 | avatarp->mImpostor.bindTexture(1, specular_channel); | 699 | avatarp->mImpostor.bindTexture(1, specular_channel); |
703 | } | 700 | } |
704 | } | 701 | } |
705 | // avatarp->renderImpostor(LLColor4U(255,255,255,255), diffuse_channel); // KL SD | 702 | avatarp->renderImpostor(); |
706 | avatarp->renderImpostor(); | ||
707 | } | 703 | } |
708 | else if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS) && !LLPipeline::sRenderDeferred) | 704 | else if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS) && !LLPipeline::sRenderDeferred) |
709 | { | 705 | { |
@@ -756,67 +752,6 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) | |||
756 | 752 | ||
757 | if( !single_avatar || (avatarp == single_avatar) ) | 753 | if( !single_avatar || (avatarp == single_avatar) ) |
758 | { | 754 | { |
759 | if (LLVOAvatar::sShowCollisionVolumes) | ||
760 | { | ||
761 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); | ||
762 | avatarp->renderCollisionVolumes(); | ||
763 | } | ||
764 | |||
765 | if (avatarp->isSelf() && LLAgent::sDebugDisplayTarget) | ||
766 | { | ||
767 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); | ||
768 | LLVector3 pos = avatarp->getPositionAgent(); | ||
769 | |||
770 | gGL.color4f(1.0f, 0.0f, 0.0f, 0.8f); | ||
771 | gGL.begin(LLRender::LINES); | ||
772 | { | ||
773 | gGL.vertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); | ||
774 | gGL.vertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); | ||
775 | gGL.vertex3fv((pos - LLVector3(0.f, 0.2f, 0.f)).mV); | ||
776 | gGL.vertex3fv((pos + LLVector3(0.f, 0.2f, 0.f)).mV); | ||
777 | gGL.vertex3fv((pos - LLVector3(0.f, 0.f, 0.2f)).mV); | ||
778 | gGL.vertex3fv((pos + LLVector3(0.f, 0.f, 0.2f)).mV); | ||
779 | }gGL.end(); | ||
780 | |||
781 | pos = avatarp->mDrawable->getPositionAgent(); | ||
782 | gGL.color4f(1.0f, 0.0f, 0.0f, 0.8f); | ||
783 | gGL.begin(LLRender::LINES); | ||
784 | { | ||
785 | gGL.vertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); | ||
786 | gGL.vertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); | ||
787 | gGL.vertex3fv((pos - LLVector3(0.f, 0.2f, 0.f)).mV); | ||
788 | gGL.vertex3fv((pos + LLVector3(0.f, 0.2f, 0.f)).mV); | ||
789 | gGL.vertex3fv((pos - LLVector3(0.f, 0.f, 0.2f)).mV); | ||
790 | gGL.vertex3fv((pos + LLVector3(0.f, 0.f, 0.2f)).mV); | ||
791 | }gGL.end(); | ||
792 | |||
793 | pos = avatarp->mRoot.getWorldPosition(); | ||
794 | gGL.color4f(1.0f, 1.0f, 1.0f, 0.8f); | ||
795 | gGL.begin(LLRender::LINES); | ||
796 | { | ||
797 | gGL.vertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); | ||
798 | gGL.vertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); | ||
799 | gGL.vertex3fv((pos - LLVector3(0.f, 0.2f, 0.f)).mV); | ||
800 | gGL.vertex3fv((pos + LLVector3(0.f, 0.2f, 0.f)).mV); | ||
801 | gGL.vertex3fv((pos - LLVector3(0.f, 0.f, 0.2f)).mV); | ||
802 | gGL.vertex3fv((pos + LLVector3(0.f, 0.f, 0.2f)).mV); | ||
803 | }gGL.end(); | ||
804 | |||
805 | pos = avatarp->mPelvisp->getWorldPosition(); | ||
806 | gGL.color4f(0.0f, 0.0f, 1.0f, 0.8f); | ||
807 | gGL.begin(LLRender::LINES); | ||
808 | { | ||
809 | gGL.vertex3fv((pos - LLVector3(0.2f, 0.f, 0.f)).mV); | ||
810 | gGL.vertex3fv((pos + LLVector3(0.2f, 0.f, 0.f)).mV); | ||
811 | gGL.vertex3fv((pos - LLVector3(0.f, 0.2f, 0.f)).mV); | ||
812 | gGL.vertex3fv((pos + LLVector3(0.f, 0.2f, 0.f)).mV); | ||
813 | gGL.vertex3fv((pos - LLVector3(0.f, 0.f, 0.2f)).mV); | ||
814 | gGL.vertex3fv((pos + LLVector3(0.f, 0.f, 0.2f)).mV); | ||
815 | }gGL.end(); | ||
816 | |||
817 | color.setColor(1.0f, 1.0f, 1.0f, 1.0f); | ||
818 | } | ||
819 | |||
820 | avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE); | 755 | avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE); |
821 | } | 756 | } |
822 | } | 757 | } |
diff --git a/linden/indra/newview/lldrawpoolbump.cpp b/linden/indra/newview/lldrawpoolbump.cpp index e14b34d..93fadca 100644 --- a/linden/indra/newview/lldrawpoolbump.cpp +++ b/linden/indra/newview/lldrawpoolbump.cpp | |||
@@ -140,7 +140,7 @@ void LLStandardBumpmap::restoreGL() | |||
140 | return; | 140 | return; |
141 | } | 141 | } |
142 | 142 | ||
143 | // llinfos << "Loading bumpmap: " << bump_file << " from viewerart" << llendl; | 143 | llinfos << "Loading bumpmap: " << bump_file << " from viewerart" << llendl; |
144 | gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label; | 144 | gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label; |
145 | gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage = | 145 | gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage = |
146 | gImageList.getImageFromFile(bump_file, | 146 | gImageList.getImageFromFile(bump_file, |
@@ -310,8 +310,8 @@ void LLDrawPoolBump::endRenderPass(S32 pass) | |||
310 | void LLDrawPoolBump::beginShiny(bool invisible) | 310 | void LLDrawPoolBump::beginShiny(bool invisible) |
311 | { | 311 | { |
312 | LLFastTimer t(LLFastTimer::FTM_RENDER_SHINY); | 312 | LLFastTimer t(LLFastTimer::FTM_RENDER_SHINY); |
313 | if (!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY)|| | 313 | if ((!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY))|| |
314 | invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY)) | 314 | (invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY))) |
315 | { | 315 | { |
316 | return; | 316 | return; |
317 | } | 317 | } |
@@ -385,8 +385,8 @@ void LLDrawPoolBump::beginShiny(bool invisible) | |||
385 | void LLDrawPoolBump::renderShiny(bool invisible) | 385 | void LLDrawPoolBump::renderShiny(bool invisible) |
386 | { | 386 | { |
387 | LLFastTimer t(LLFastTimer::FTM_RENDER_SHINY); | 387 | LLFastTimer t(LLFastTimer::FTM_RENDER_SHINY); |
388 | if (!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY)|| | 388 | if ((!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY))|| |
389 | invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY)) | 389 | (invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY))) |
390 | { | 390 | { |
391 | return; | 391 | return; |
392 | } | 392 | } |
@@ -412,8 +412,8 @@ void LLDrawPoolBump::renderShiny(bool invisible) | |||
412 | void LLDrawPoolBump::endShiny(bool invisible) | 412 | void LLDrawPoolBump::endShiny(bool invisible) |
413 | { | 413 | { |
414 | LLFastTimer t(LLFastTimer::FTM_RENDER_SHINY); | 414 | LLFastTimer t(LLFastTimer::FTM_RENDER_SHINY); |
415 | if (!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY)|| | 415 | if ((!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY))|| |
416 | invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY)) | 416 | (invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY))) |
417 | { | 417 | { |
418 | return; | 418 | return; |
419 | } | 419 | } |
@@ -573,11 +573,7 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel) | |||
573 | LLImageGL* bump = NULL; | 573 | LLImageGL* bump = NULL; |
574 | 574 | ||
575 | U8 bump_code = params.mBump; | 575 | U8 bump_code = params.mBump; |
576 | LLViewerImage* tex = params.mViewerTexture; | 576 | LLViewerImage* tex = params.mTexture; |
577 | if(!tex) | ||
578 | { | ||
579 | return FALSE ; | ||
580 | } | ||
581 | 577 | ||
582 | switch( bump_code ) | 578 | switch( bump_code ) |
583 | { | 579 | { |
@@ -1231,10 +1227,7 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) | |||
1231 | if (params.mTexture.notNull()) | 1227 | if (params.mTexture.notNull()) |
1232 | { | 1228 | { |
1233 | gGL.getTexUnit(diffuse_channel)->bind(params.mTexture.get()); | 1229 | gGL.getTexUnit(diffuse_channel)->bind(params.mTexture.get()); |
1234 | if(params.mViewerTexture.notNull()) | 1230 | //params.mTexture->addTextureStats(params.mVSize); |
1235 | { | ||
1236 | params.mViewerTexture->addTextureStats(params.mVSize); | ||
1237 | } | ||
1238 | } | 1231 | } |
1239 | else | 1232 | else |
1240 | { | 1233 | { |
diff --git a/linden/indra/newview/lldrawpoolsky.cpp b/linden/indra/newview/lldrawpoolsky.cpp index 0ca9130..bed1030 100644 --- a/linden/indra/newview/lldrawpoolsky.cpp +++ b/linden/indra/newview/lldrawpoolsky.cpp | |||
@@ -61,8 +61,8 @@ LLDrawPool *LLDrawPoolSky::instancePool() | |||
61 | 61 | ||
62 | void LLDrawPoolSky::prerender() | 62 | void LLDrawPoolSky::prerender() |
63 | { | 63 | { |
64 | mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT); | 64 | mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT); |
65 | // gSky.mVOSkyp->updateGeometry(gSky.mVOSkyp->mDrawable); | 65 | gSky.mVOSkyp->updateGeometry(gSky.mVOSkyp->mDrawable); |
66 | } | 66 | } |
67 | 67 | ||
68 | void LLDrawPoolSky::render(S32 pass) | 68 | void LLDrawPoolSky::render(S32 pass) |
@@ -97,7 +97,6 @@ void LLDrawPoolSky::render(S32 pass) | |||
97 | } | 97 | } |
98 | 98 | ||
99 | 99 | ||
100 | LLVOSky *voskyp = gSky.mVOSkyp; | ||
101 | LLGLSPipelineSkyBox gls_skybox; | 100 | LLGLSPipelineSkyBox gls_skybox; |
102 | 101 | ||
103 | LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); | 102 | LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); |
@@ -120,43 +119,9 @@ void LLDrawPoolSky::render(S32 pass) | |||
120 | { | 119 | { |
121 | renderSkyCubeFace(i); | 120 | renderSkyCubeFace(i); |
122 | } | 121 | } |
123 | |||
124 | LLFace *hbfaces[3]; | ||
125 | hbfaces[0] = NULL; | ||
126 | hbfaces[1] = NULL; | ||
127 | hbfaces[2] = NULL; | ||
128 | for (S32 curr_face = 0; curr_face < face_count; curr_face++) | ||
129 | { | ||
130 | LLFace* facep = mDrawFace[curr_face]; | ||
131 | if (voskyp->isSameFace(LLVOSky::FACE_SUN, facep)) | ||
132 | { | ||
133 | hbfaces[0] = facep; | ||
134 | } | ||
135 | if (voskyp->isSameFace(LLVOSky::FACE_MOON, facep)) | ||
136 | { | ||
137 | hbfaces[1] = facep; | ||
138 | } | ||
139 | if (voskyp->isSameFace(LLVOSky::FACE_BLOOM, facep)) | ||
140 | { | ||
141 | hbfaces[2] = facep; | ||
142 | } | ||
143 | } | ||
144 | 122 | ||
145 | LLGLEnable blend(GL_BLEND); | 123 | LLGLEnable blend(GL_BLEND); |
146 | 124 | ||
147 | if (hbfaces[2]) | ||
148 | { | ||
149 | // renderSunHalo(hbfaces[2]); | ||
150 | } | ||
151 | if (hbfaces[0]) | ||
152 | { | ||
153 | // renderHeavenlyBody(0, hbfaces[0]); | ||
154 | } | ||
155 | if (hbfaces[1]) | ||
156 | { | ||
157 | // renderHeavenlyBody(1, hbfaces[1]); | ||
158 | } | ||
159 | |||
160 | glPopMatrix(); | 125 | glPopMatrix(); |
161 | } | 126 | } |
162 | 127 | ||
@@ -181,35 +146,6 @@ void LLDrawPoolSky::renderSkyCubeFace(U8 side) | |||
181 | } | 146 | } |
182 | } | 147 | } |
183 | 148 | ||
184 | void LLDrawPoolSky::renderHeavenlyBody(U8 hb, LLFace* face) | ||
185 | { | ||
186 | if ( !mHB[hb]->getDraw() ) return; | ||
187 | if (! face->getGeomCount()) return; | ||
188 | |||
189 | LLImageGL* tex = face->getTexture(); | ||
190 | gGL.getTexUnit(0)->bind(tex); | ||
191 | LLColor4 color(mHB[hb]->getInterpColor()); | ||
192 | LLOverrideFaceColor override(this, color); | ||
193 | face->renderIndexed(); | ||
194 | } | ||
195 | |||
196 | |||
197 | |||
198 | void LLDrawPoolSky::renderSunHalo(LLFace* face) | ||
199 | { | ||
200 | if (! mHB[0]->getDraw()) return; | ||
201 | if (! face->getGeomCount()) return; | ||
202 | |||
203 | LLImageGL* tex = face->getTexture(); | ||
204 | gGL.getTexUnit(0)->bind(tex); | ||
205 | LLColor4 color(mHB[0]->getInterpColor()); | ||
206 | color.mV[3] = llclamp(mHB[0]->getHaloBrighness(), 0.f, 1.f); | ||
207 | |||
208 | LLOverrideFaceColor override(this, color); | ||
209 | face->renderIndexed(); | ||
210 | } | ||
211 | |||
212 | |||
213 | void LLDrawPoolSky::renderForSelect() | 149 | void LLDrawPoolSky::renderForSelect() |
214 | { | 150 | { |
215 | } | 151 | } |
diff --git a/linden/indra/newview/lldrawpoolsky.h b/linden/indra/newview/lldrawpoolsky.h index f35b114..8595d73 100644 --- a/linden/indra/newview/lldrawpoolsky.h +++ b/linden/indra/newview/lldrawpoolsky.h | |||
@@ -36,14 +36,12 @@ | |||
36 | #include "lldrawpool.h" | 36 | #include "lldrawpool.h" |
37 | 37 | ||
38 | class LLSkyTex; | 38 | class LLSkyTex; |
39 | class LLHeavenBody; | ||
40 | class LLGLSLShader; | 39 | class LLGLSLShader; |
41 | 40 | ||
42 | class LLDrawPoolSky : public LLFacePool | 41 | class LLDrawPoolSky : public LLFacePool |
43 | { | 42 | { |
44 | private: | 43 | private: |
45 | LLSkyTex *mSkyTex; | 44 | LLSkyTex *mSkyTex; |
46 | LLHeavenBody *mHB[2]; // Sun and Moon | ||
47 | LLGLSLShader *mShader; | 45 | LLGLSLShader *mShader; |
48 | 46 | ||
49 | public: | 47 | public: |
@@ -69,8 +67,6 @@ public: | |||
69 | /*virtual*/ void renderForSelect(); | 67 | /*virtual*/ void renderForSelect(); |
70 | /*virtual*/ void endRenderPass(S32 pass); | 68 | /*virtual*/ void endRenderPass(S32 pass); |
71 | void setSkyTex(LLSkyTex* const st) { mSkyTex = st; } | 69 | void setSkyTex(LLSkyTex* const st) { mSkyTex = st; } |
72 | void setSun(LLHeavenBody* sun_flag) { mHB[0] = sun_flag; } | ||
73 | void setMoon(LLHeavenBody* moon) { mHB[1] = moon; } | ||
74 | 70 | ||
75 | void renderSkyCubeFace(U8 side); | 71 | void renderSkyCubeFace(U8 side); |
76 | void renderHeavenlyBody(U8 hb, LLFace* face); | 72 | void renderHeavenlyBody(U8 hb, LLFace* face); |
diff --git a/linden/indra/newview/lldrawpoolterrain.cpp b/linden/indra/newview/lldrawpoolterrain.cpp index 249f5a9..d0bf2c1 100644 --- a/linden/indra/newview/lldrawpoolterrain.cpp +++ b/linden/indra/newview/lldrawpoolterrain.cpp | |||
@@ -73,19 +73,19 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerImage *texturep) : | |||
73 | TRUE, TRUE, GL_ALPHA8, GL_ALPHA, | 73 | TRUE, TRUE, GL_ALPHA8, GL_ALPHA, |
74 | LLUUID("e97cf410-8e61-7005-ec06-629eba4cd1fb")); | 74 | LLUUID("e97cf410-8e61-7005-ec06-629eba4cd1fb")); |
75 | 75 | ||
76 | //gGL.getTexUnit(0)->bind(mAlphaRampImagep.get()); | 76 | gGL.getTexUnit(0)->bind(mAlphaRampImagep.get()); |
77 | mAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP); | 77 | mAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP); |
78 | 78 | ||
79 | m2DAlphaRampImagep = gImageList.getImageFromFile("alpha_gradient_2d.j2c", | 79 | m2DAlphaRampImagep = gImageList.getImageFromFile("alpha_gradient_2d.j2c", |
80 | TRUE, TRUE, GL_ALPHA8, GL_ALPHA, | 80 | TRUE, TRUE, GL_ALPHA8, GL_ALPHA, |
81 | LLUUID("38b86f85-2575-52a9-a531-23108d8da837")); | 81 | LLUUID("38b86f85-2575-52a9-a531-23108d8da837")); |
82 | 82 | ||
83 | //gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get()); | 83 | gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get()); |
84 | m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP); | 84 | m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP); |
85 | 85 | ||
86 | mTexturep->setBoostLevel(LLViewerImageBoostLevel::BOOST_TERRAIN); | 86 | mTexturep->setBoostLevel(LLViewerImageBoostLevel::BOOST_TERRAIN); |
87 | 87 | ||
88 | //gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); | 88 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); |
89 | } | 89 | } |
90 | 90 | ||
91 | LLDrawPoolTerrain::~LLDrawPoolTerrain() | 91 | LLDrawPoolTerrain::~LLDrawPoolTerrain() |
diff --git a/linden/indra/newview/lldrawpooltree.cpp b/linden/indra/newview/lldrawpooltree.cpp index 52f669a..e4560f2 100644 --- a/linden/indra/newview/lldrawpooltree.cpp +++ b/linden/indra/newview/lldrawpooltree.cpp | |||
@@ -52,7 +52,7 @@ LLDrawPoolTree::LLDrawPoolTree(LLViewerImage *texturep) : | |||
52 | LLFacePool(POOL_TREE), | 52 | LLFacePool(POOL_TREE), |
53 | mTexturep(texturep) | 53 | mTexturep(texturep) |
54 | { | 54 | { |
55 | // gGL.getTexUnit(0)->bind(mTexturep.get()); | 55 | gGL.getTexUnit(0)->bind(mTexturep.get()); |
56 | mTexturep->setAddressMode(LLTexUnit::TAM_WRAP); | 56 | mTexturep->setAddressMode(LLTexUnit::TAM_WRAP); |
57 | } | 57 | } |
58 | 58 | ||
@@ -110,7 +110,7 @@ void LLDrawPoolTree::render(S32 pass) | |||
110 | } | 110 | } |
111 | else | 111 | else |
112 | { | 112 | { |
113 | gGL.getTexUnit(sDiffTex)->bind(mTexturep, TRUE); | 113 | gGL.getTexUnit(sDiffTex)->bind(mTexturep); |
114 | 114 | ||
115 | for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); | 115 | for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); |
116 | iter != mDrawFace.end(); iter++) | 116 | iter != mDrawFace.end(); iter++) |
@@ -140,7 +140,7 @@ void LLDrawPoolTree::endRenderPass(S32 pass) | |||
140 | void LLDrawPoolTree::beginDeferredPass(S32 pass) | 140 | void LLDrawPoolTree::beginDeferredPass(S32 pass) |
141 | { | 141 | { |
142 | LLFastTimer t(LLFastTimer::FTM_RENDER_TREES); | 142 | LLFastTimer t(LLFastTimer::FTM_RENDER_TREES); |
143 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); // KL Render-pipeline has this set at 0.f ... NOOOOOO! make shitty trees :) | 143 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); |
144 | 144 | ||
145 | shader = &gDeferredTreeProgram; | 145 | shader = &gDeferredTreeProgram; |
146 | shader->bind(); | 146 | shader->bind(); |
@@ -166,9 +166,6 @@ void LLDrawPoolTree::beginShadowPass(S32 pass) | |||
166 | { | 166 | { |
167 | LLFastTimer t(LLFastTimer::FTM_SHADOW_TREE); | 167 | LLFastTimer t(LLFastTimer::FTM_SHADOW_TREE); |
168 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); | 168 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); |
169 | glPolygonOffset(gSavedSettings.getF32("RenderDeferredTreeShadowOffset"), | ||
170 | gSavedSettings.getF32("RenderDeferredTreeShadowBias")); | ||
171 | |||
172 | gDeferredShadowProgram.bind(); | 169 | gDeferredShadowProgram.bind(); |
173 | } | 170 | } |
174 | 171 | ||
@@ -181,11 +178,7 @@ void LLDrawPoolTree::endShadowPass(S32 pass) | |||
181 | { | 178 | { |
182 | LLFastTimer t(LLFastTimer::FTM_SHADOW_TREE); | 179 | LLFastTimer t(LLFastTimer::FTM_SHADOW_TREE); |
183 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); | 180 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); |
184 | 181 | gDeferredShadowProgram.unbind(); | |
185 | glPolygonOffset(gSavedSettings.getF32("RenderDeferredSpotShadowOffset"), | ||
186 | gSavedSettings.getF32("RenderDeferredSpotShadowBias")); | ||
187 | |||
188 | //gDeferredShadowProgram.unbind(); | ||
189 | } | 182 | } |
190 | 183 | ||
191 | 184 | ||
diff --git a/linden/indra/newview/lldrawpoolwater.cpp b/linden/indra/newview/lldrawpoolwater.cpp index d08d004..624b8a8 100644 --- a/linden/indra/newview/lldrawpoolwater.cpp +++ b/linden/indra/newview/lldrawpoolwater.cpp | |||
@@ -98,7 +98,7 @@ void LLDrawPoolWater::restoreGL() | |||
98 | 98 | ||
99 | LLDrawPool *LLDrawPoolWater::instancePool() | 99 | LLDrawPool *LLDrawPoolWater::instancePool() |
100 | { | 100 | { |
101 | llwarns << "Should never be calling instancePool on a water pool!" << llendl; | 101 | llerrs << "Should never be calling instancePool on a water pool!" << llendl; |
102 | return NULL; | 102 | return NULL; |
103 | } | 103 | } |
104 | 104 | ||
@@ -401,15 +401,6 @@ void LLDrawPoolWater::shade() | |||
401 | shader = &gWaterProgram; | 401 | shader = &gWaterProgram; |
402 | } | 402 | } |
403 | 403 | ||
404 | if (deferred_render) | ||
405 | { | ||
406 | gPipeline.bindDeferredShader(*shader); | ||
407 | } | ||
408 | else | ||
409 | { | ||
410 | shader->bind(); | ||
411 | } | ||
412 | |||
413 | sTime = (F32)LLFrameTimer::getElapsedSeconds()*0.5f; | 404 | sTime = (F32)LLFrameTimer::getElapsedSeconds()*0.5f; |
414 | 405 | ||
415 | S32 reftex = shader->enableTexture(LLViewerShaderMgr::WATER_REFTEX); | 406 | S32 reftex = shader->enableTexture(LLViewerShaderMgr::WATER_REFTEX); |
@@ -445,6 +436,15 @@ void LLDrawPoolWater::shade() | |||
445 | 436 | ||
446 | S32 screentex = shader->enableTexture(LLViewerShaderMgr::WATER_SCREENTEX); | 437 | S32 screentex = shader->enableTexture(LLViewerShaderMgr::WATER_SCREENTEX); |
447 | 438 | ||
439 | if (deferred_render) | ||
440 | { | ||
441 | gPipeline.bindDeferredShader(*shader); | ||
442 | } | ||
443 | else | ||
444 | { | ||
445 | shader->bind(); | ||
446 | } | ||
447 | |||
448 | if (screentex > -1) | 448 | if (screentex > -1) |
449 | { | 449 | { |
450 | shader->uniform4fv(LLViewerShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV); | 450 | shader->uniform4fv(LLViewerShaderMgr::WATER_FOGCOLOR, 1, sWaterFogColor.mV); |
diff --git a/linden/indra/newview/lldynamictexture.cpp b/linden/indra/newview/lldynamictexture.cpp index e219d4b..61f5a89 100644 --- a/linden/indra/newview/lldynamictexture.cpp +++ b/linden/indra/newview/lldynamictexture.cpp | |||
@@ -41,7 +41,6 @@ | |||
41 | #include "llvertexbuffer.h" | 41 | #include "llvertexbuffer.h" |
42 | #include "llviewerdisplay.h" | 42 | #include "llviewerdisplay.h" |
43 | #include "llrender.h" | 43 | #include "llrender.h" |
44 | #include "pipeline.h" | ||
45 | 44 | ||
46 | // static | 45 | // static |
47 | LLDynamicTexture::instance_list_t LLDynamicTexture::sInstances[ LLDynamicTexture::ORDER_COUNT ]; | 46 | LLDynamicTexture::instance_list_t LLDynamicTexture::sInstances[ LLDynamicTexture::ORDER_COUNT ]; |
@@ -59,14 +58,9 @@ LLDynamicTexture::LLDynamicTexture(S32 width, S32 height, S32 components, EOrder | |||
59 | mClamp(clamp) | 58 | mClamp(clamp) |
60 | { | 59 | { |
61 | llassert((1 <= components) && (components <= 4)); | 60 | llassert((1 <= components) && (components <= 4)); |
62 | if(!LLPipeline::sRenderDeferred) | 61 | |
63 | { | 62 | generateGLTexture(); |
64 | generateGLTexture(); | 63 | |
65 | } | ||
66 | else | ||
67 | { | ||
68 | gPipeline.markGLRebuild(this); // KL SD well for this to work its either gotta be one or the other so lets slap in the if/else can't do any harm. | ||
69 | } | ||
70 | llassert( 0 <= order && order < ORDER_COUNT ); | 64 | llassert( 0 <= order && order < ORDER_COUNT ); |
71 | LLDynamicTexture::sInstances[ order ].insert(this); | 65 | LLDynamicTexture::sInstances[ order ].insert(this); |
72 | } | 66 | } |
@@ -83,11 +77,6 @@ LLDynamicTexture::~LLDynamicTexture() | |||
83 | } | 77 | } |
84 | } | 78 | } |
85 | 79 | ||
86 | void LLDynamicTexture::updateGL() | ||
87 | { | ||
88 | generateGLTexture(); | ||
89 | } | ||
90 | |||
91 | //----------------------------------------------------------------------------- | 80 | //----------------------------------------------------------------------------- |
92 | // releaseGLTexture() | 81 | // releaseGLTexture() |
93 | //----------------------------------------------------------------------------- | 82 | //----------------------------------------------------------------------------- |
@@ -112,7 +101,7 @@ void LLDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum prima | |||
112 | { | 101 | { |
113 | if (mComponents < 1 || mComponents > 4) | 102 | if (mComponents < 1 || mComponents > 4) |
114 | { | 103 | { |
115 | llwarns << "Bad number of components in dynamic texture: " << mComponents << llendl; | 104 | llerrs << "Bad number of components in dynamic texture: " << mComponents << llendl; |
116 | } | 105 | } |
117 | releaseGLTexture(); | 106 | releaseGLTexture(); |
118 | LLPointer<LLImageRaw> raw_image = new LLImageRaw(mWidth, mHeight, mComponents); | 107 | LLPointer<LLImageRaw> raw_image = new LLImageRaw(mWidth, mHeight, mComponents); |
@@ -122,7 +111,7 @@ void LLDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum prima | |||
122 | mTexture->setExplicitFormat(internal_format, primary_format, type_format, swap_bytes); | 111 | mTexture->setExplicitFormat(internal_format, primary_format, type_format, swap_bytes); |
123 | } | 112 | } |
124 | // llinfos << "ALLOCATING " << (mWidth*mHeight*mComponents)/1024 << "K" << llendl; | 113 | // llinfos << "ALLOCATING " << (mWidth*mHeight*mComponents)/1024 << "K" << llendl; |
125 | mTexture->createGLTexture(0, raw_image); | 114 | mTexture->createGLTexture(0, raw_image, 0, TRUE, LLViewerImageBoostLevel::DYNAMIC_TEX); |
126 | mTexture->setAddressMode((mClamp) ? LLTexUnit::TAM_CLAMP : LLTexUnit::TAM_WRAP); | 115 | mTexture->setAddressMode((mClamp) ? LLTexUnit::TAM_CLAMP : LLTexUnit::TAM_WRAP); |
127 | mTexture->setGLTextureCreated(false); | 116 | mTexture->setGLTextureCreated(false); |
128 | } | 117 | } |
diff --git a/linden/indra/newview/lldynamictexture.h b/linden/indra/newview/lldynamictexture.h index 1480799..5a20eae 100644 --- a/linden/indra/newview/lldynamictexture.h +++ b/linden/indra/newview/lldynamictexture.h | |||
@@ -37,7 +37,7 @@ | |||
37 | #include "llcoord.h" | 37 | #include "llcoord.h" |
38 | #include "llimagegl.h" | 38 | #include "llimagegl.h" |
39 | 39 | ||
40 | class LLDynamicTexture : public LLGLUpdate | 40 | class LLDynamicTexture |
41 | { | 41 | { |
42 | public: | 42 | public: |
43 | enum EOrder { ORDER_FIRST = 0, ORDER_MIDDLE = 1, ORDER_LAST = 2, ORDER_RESET = 3, ORDER_COUNT = 4 }; | 43 | enum EOrder { ORDER_FIRST = 0, ORDER_MIDDLE = 1, ORDER_LAST = 2, ORDER_RESET = 3, ORDER_COUNT = 4 }; |
@@ -49,8 +49,6 @@ public: | |||
49 | BOOL clamp); | 49 | BOOL clamp); |
50 | virtual ~LLDynamicTexture(); | 50 | virtual ~LLDynamicTexture(); |
51 | 51 | ||
52 | void updateGL(); | ||
53 | |||
54 | S32 getOriginX() { return mOrigin.mX; } | 52 | S32 getOriginX() { return mOrigin.mX; } |
55 | S32 getOriginY() { return mOrigin.mY; } | 53 | S32 getOriginY() { return mOrigin.mY; } |
56 | S32 getWidth() { return mWidth; } | 54 | S32 getWidth() { return mWidth; } |
diff --git a/linden/indra/newview/llface.cpp b/linden/indra/newview/llface.cpp index ae57a3c..aa8cd15 100644 --- a/linden/indra/newview/llface.cpp +++ b/linden/indra/newview/llface.cpp | |||
@@ -176,8 +176,8 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp) | |||
176 | mLastIndicesCount = mIndicesCount; | 176 | mLastIndicesCount = mIndicesCount; |
177 | mLastIndicesIndex = mIndicesIndex; | 177 | mLastIndicesIndex = mIndicesIndex; |
178 | 178 | ||
179 | mAtlasInfop = NULL ; | 179 | mImportanceToCamera = 0.f ; |
180 | mUsingAtlas = FALSE ; | 180 | mBoundingSphereRadius = 0.0f ; |
181 | } | 181 | } |
182 | 182 | ||
183 | 183 | ||
@@ -205,14 +205,12 @@ void LLFace::destroy() | |||
205 | if (group) | 205 | if (group) |
206 | { | 206 | { |
207 | group->dirtyGeom(); | 207 | group->dirtyGeom(); |
208 | gPipeline.markRebuild(group, TRUE); | ||
209 | } | 208 | } |
210 | } | 209 | } |
211 | } | 210 | } |
212 | 211 | ||
213 | setDrawInfo(NULL); | 212 | setDrawInfo(NULL); |
214 | 213 | ||
215 | removeAtlas(); | ||
216 | mDrawablep = NULL; | 214 | mDrawablep = NULL; |
217 | mVObjp = NULL; | 215 | mVObjp = NULL; |
218 | } | 216 | } |
@@ -225,7 +223,7 @@ void LLFace::initClass() | |||
225 | 223 | ||
226 | void LLFace::setWorldMatrix(const LLMatrix4 &mat) | 224 | void LLFace::setWorldMatrix(const LLMatrix4 &mat) |
227 | { | 225 | { |
228 | llwarns << "Faces on this drawable are not independently modifiable\n" << llendl; | 226 | llerrs << "Faces on this drawable are not independently modifiable\n" << llendl; |
229 | } | 227 | } |
230 | 228 | ||
231 | void LLFace::setPool(LLFacePool* new_pool, LLViewerImage *texturep) | 229 | void LLFace::setPool(LLFacePool* new_pool, LLViewerImage *texturep) |
@@ -234,7 +232,7 @@ void LLFace::setPool(LLFacePool* new_pool, LLViewerImage *texturep) | |||
234 | 232 | ||
235 | if (!new_pool) | 233 | if (!new_pool) |
236 | { | 234 | { |
237 | llwarns << "Setting pool to null!" << llendl; | 235 | llerrs << "Setting pool to null!" << llendl; |
238 | } | 236 | } |
239 | 237 | ||
240 | if (new_pool != mDrawPoolp) | 238 | if (new_pool != mDrawPoolp) |
@@ -272,7 +270,6 @@ void LLFace::setTexture(LLViewerImage* tex) | |||
272 | if(mTexture.notNull()) | 270 | if(mTexture.notNull()) |
273 | { | 271 | { |
274 | mTexture->removeFace(this) ; | 272 | mTexture->removeFace(this) ; |
275 | removeAtlas() ; | ||
276 | } | 273 | } |
277 | 274 | ||
278 | mTexture = tex ; | 275 | mTexture = tex ; |
@@ -456,15 +453,8 @@ void LLFace::renderForSelect(U32 data_mask) | |||
456 | 453 | ||
457 | void LLFace::renderSelected(LLImageGL *imagep, const LLColor4& color) | 454 | void LLFace::renderSelected(LLImageGL *imagep, const LLColor4& color) |
458 | { | 455 | { |
459 | if (mDrawablep->getSpatialGroup() == NULL) | 456 | if(mDrawablep.isNull() || mVertexBuffer.isNull() || mDrawablep->getSpatialGroup() == NULL || |
460 | { | 457 | mDrawablep->getSpatialGroup()->isState(LLSpatialGroup::GEOM_DIRTY)) |
461 | return; | ||
462 | } | ||
463 | |||
464 | mDrawablep->getSpatialGroup()->rebuildGeom(); | ||
465 | mDrawablep->getSpatialGroup()->rebuildMesh(); | ||
466 | |||
467 | if(mDrawablep.isNull() || mVertexBuffer.isNull()) | ||
468 | { | 458 | { |
469 | return; | 459 | return; |
470 | } | 460 | } |
@@ -483,10 +473,17 @@ void LLFace::renderSelected(LLImageGL *imagep, const LLColor4& color) | |||
483 | glMultMatrixf((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix); | 473 | glMultMatrixf((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix); |
484 | } | 474 | } |
485 | 475 | ||
486 | glColor4fv(color.mV); | 476 | setFaceColor(color); |
477 | renderSetColor(); | ||
478 | |||
487 | mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0); | 479 | mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0); |
480 | #if !LL_RELEASE_FOR_DOWNLOAD | ||
481 | LLGLState::checkClientArrays("", LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0); | ||
482 | #endif | ||
488 | mVertexBuffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex); | 483 | mVertexBuffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex); |
489 | 484 | ||
485 | unsetFaceColor(); | ||
486 | unsetFaceColor(); | ||
490 | gGL.popMatrix(); | 487 | gGL.popMatrix(); |
491 | } | 488 | } |
492 | } | 489 | } |
@@ -730,8 +727,8 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, | |||
730 | } | 727 | } |
731 | 728 | ||
732 | mCenterLocal = (newMin+newMax)*0.5f; | 729 | mCenterLocal = (newMin+newMax)*0.5f; |
733 | // LLVector3 tmp = (newMin - newMax) ; | 730 | LLVector3 tmp = (newMin - newMax) ; |
734 | // mBoundingSphereRadius = tmp.length() * 0.5f ; | 731 | mBoundingSphereRadius = tmp.length() * 0.5f ; |
735 | 732 | ||
736 | updateCenterAgent(); | 733 | updateCenterAgent(); |
737 | } | 734 | } |
@@ -966,12 +963,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, | |||
966 | mVertexBuffer->getBinormalStrider(binormals, mGeomIndex); | 963 | mVertexBuffer->getBinormalStrider(binormals, mGeomIndex); |
967 | } | 964 | } |
968 | 965 | ||
969 | F32 tcoord_xoffset = 0.f ; | ||
970 | F32 tcoord_yoffset = 0.f ; | ||
971 | F32 tcoord_xscale = 1.f ; | ||
972 | F32 tcoord_yscale = 1.f ; | ||
973 | BOOL in_atlas = FALSE ; | ||
974 | |||
975 | if (rebuild_tcoord) | 966 | if (rebuild_tcoord) |
976 | { | 967 | { |
977 | mVertexBuffer->getTexCoord0Strider(tex_coords, mGeomIndex); | 968 | mVertexBuffer->getTexCoord0Strider(tex_coords, mGeomIndex); |
@@ -979,18 +970,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, | |||
979 | { | 970 | { |
980 | mVertexBuffer->getTexCoord1Strider(tex_coords2, mGeomIndex); | 971 | mVertexBuffer->getTexCoord1Strider(tex_coords2, mGeomIndex); |
981 | } | 972 | } |
982 | |||
983 | in_atlas = isAtlasInUse() ; | ||
984 | if(in_atlas) | ||
985 | { | ||
986 | const LLVector2* tmp = getTexCoordOffset() ; | ||
987 | tcoord_xoffset = tmp->mV[0] ; | ||
988 | tcoord_yoffset = tmp->mV[1] ; | ||
989 | |||
990 | tmp = getTexCoordScale() ; | ||
991 | tcoord_xscale = tmp->mV[0] ; | ||
992 | tcoord_yscale = tmp->mV[1] ; | ||
993 | } | ||
994 | } | 973 | } |
995 | if (rebuild_color) | 974 | if (rebuild_color) |
996 | { | 975 | { |
@@ -1078,7 +1057,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, | |||
1078 | 0.75f | 1057 | 0.75f |
1079 | }; | 1058 | }; |
1080 | 1059 | ||
1081 | if (getPoolType() != LLDrawPool::POOL_ALPHA && (LLPipeline::sRenderDeferred || LLPipeline::sRenderBump && tep->getShiny())) | 1060 | if (getPoolType() != LLDrawPool::POOL_ALPHA && (LLPipeline::sRenderDeferred || (LLPipeline::sRenderBump && tep->getShiny()))) |
1082 | { | 1061 | { |
1083 | color.mV[3] = U8 (alpha[tep->getShiny()] * 255); | 1062 | color.mV[3] = U8 (alpha[tep->getShiny()] * 255); |
1084 | } | 1063 | } |
@@ -1200,93 +1179,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, | |||
1200 | xform(tc, cos_ang, sin_ang, os, ot, ms, mt); | 1179 | xform(tc, cos_ang, sin_ang, os, ot, ms, mt); |
1201 | } | 1180 | } |
1202 | 1181 | ||
1203 | if(in_atlas) | ||
1204 | { | ||
1205 | // | ||
1206 | //manually calculate tex-coord per vertex for varying address modes. | ||
1207 | //should be removed if shader can handle this. | ||
1208 | // | ||
1209 | |||
1210 | S32 int_part = 0 ; | ||
1211 | switch(mTexture->getAddressMode()) | ||
1212 | { | ||
1213 | case LLTexUnit::TAM_CLAMP: | ||
1214 | if(tc.mV[0] < 0.f) | ||
1215 | { | ||
1216 | tc.mV[0] = 0.f ; | ||
1217 | } | ||
1218 | else if(tc.mV[0] > 1.f) | ||
1219 | { | ||
1220 | tc.mV[0] = 1.f; | ||
1221 | } | ||
1222 | |||
1223 | if(tc.mV[1] < 0.f) | ||
1224 | { | ||
1225 | tc.mV[1] = 0.f ; | ||
1226 | } | ||
1227 | else if(tc.mV[1] > 1.f) | ||
1228 | { | ||
1229 | tc.mV[1] = 1.f; | ||
1230 | } | ||
1231 | break; | ||
1232 | case LLTexUnit::TAM_MIRROR: | ||
1233 | if(tc.mV[0] < 0.f) | ||
1234 | { | ||
1235 | tc.mV[0] = -tc.mV[0] ; | ||
1236 | } | ||
1237 | int_part = (S32)tc.mV[0] ; | ||
1238 | if(int_part & 1) //odd number | ||
1239 | { | ||
1240 | tc.mV[0] = int_part + 1 - tc.mV[0] ; | ||
1241 | } | ||
1242 | else //even number | ||
1243 | { | ||
1244 | tc.mV[0] -= int_part ; | ||
1245 | } | ||
1246 | |||
1247 | if(tc.mV[1] < 0.f) | ||
1248 | { | ||
1249 | tc.mV[1] = -tc.mV[1] ; | ||
1250 | } | ||
1251 | int_part = (S32)tc.mV[1] ; | ||
1252 | if(int_part & 1) //odd number | ||
1253 | { | ||
1254 | tc.mV[1] = int_part + 1 - tc.mV[1] ; | ||
1255 | } | ||
1256 | else //even number | ||
1257 | { | ||
1258 | tc.mV[1] -= int_part ; | ||
1259 | } | ||
1260 | break; | ||
1261 | case LLTexUnit::TAM_WRAP: | ||
1262 | if(tc.mV[0] > 1.f) | ||
1263 | tc.mV[0] -= (S32)(tc.mV[0] - 0.00001f) ; | ||
1264 | else if(tc.mV[0] < -1.f) | ||
1265 | tc.mV[0] -= (S32)(tc.mV[0] + 0.00001f) ; | ||
1266 | |||
1267 | if(tc.mV[1] > 1.f) | ||
1268 | tc.mV[1] -= (S32)(tc.mV[1] - 0.00001f) ; | ||
1269 | else if(tc.mV[1] < -1.f) | ||
1270 | tc.mV[1] -= (S32)(tc.mV[1] + 0.00001f) ; | ||
1271 | |||
1272 | if(tc.mV[0] < 0.f) | ||
1273 | { | ||
1274 | tc.mV[0] = 1.0f + tc.mV[0] ; | ||
1275 | } | ||
1276 | if(tc.mV[1] < 0.f) | ||
1277 | { | ||
1278 | tc.mV[1] = 1.0f + tc.mV[1] ; | ||
1279 | } | ||
1280 | break; | ||
1281 | default: | ||
1282 | break; | ||
1283 | } | ||
1284 | |||
1285 | tc.mV[0] = tcoord_xoffset + tcoord_xscale * tc.mV[0] ; | ||
1286 | tc.mV[1] = tcoord_yoffset + tcoord_yscale * tc.mV[1] ; | ||
1287 | } | ||
1288 | |||
1289 | |||
1290 | *tex_coords++ = tc; | 1182 | *tex_coords++ = tc; |
1291 | 1183 | ||
1292 | if (bump_code && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1)) | 1184 | if (bump_code && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1)) |
@@ -1353,6 +1245,159 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, | |||
1353 | return TRUE; | 1245 | return TRUE; |
1354 | } | 1246 | } |
1355 | 1247 | ||
1248 | const F32 LEAST_IMPORTANCE = 0.05f ; | ||
1249 | const F32 LEAST_IMPORTANCE_FOR_LARGE_IMAGE = 0.3f ; | ||
1250 | |||
1251 | F32 LLFace::getTextureVirtualSize() | ||
1252 | { | ||
1253 | F32 radius; | ||
1254 | F32 cos_angle_to_view_dir; | ||
1255 | mPixelArea = calcPixelArea(cos_angle_to_view_dir, radius); | ||
1256 | |||
1257 | if (mPixelArea <= 0) | ||
1258 | { | ||
1259 | return 0.f; | ||
1260 | } | ||
1261 | |||
1262 | //get area of circle in texture space | ||
1263 | LLVector2 tdim = mTexExtents[1] - mTexExtents[0]; | ||
1264 | F32 texel_area = (tdim * 0.5f).lengthSquared()*3.14159f; | ||
1265 | if (texel_area <= 0) | ||
1266 | { | ||
1267 | // Probably animated, use default | ||
1268 | texel_area = 1.f; | ||
1269 | } | ||
1270 | |||
1271 | F32 face_area; | ||
1272 | if (mVObjp->isSculpted() && texel_area > 1.f) | ||
1273 | { | ||
1274 | //sculpts can break assumptions about texel area | ||
1275 | face_area = mPixelArea; | ||
1276 | } | ||
1277 | else | ||
1278 | { | ||
1279 | //apply texel area to face area to get accurate ratio | ||
1280 | //face_area /= llclamp(texel_area, 1.f/64.f, 16.f); | ||
1281 | face_area = mPixelArea / llclamp(texel_area, 0.015625f, 1024.f); | ||
1282 | } | ||
1283 | |||
1284 | if(face_area > LLViewerImage::sMaxSmallImageSize) | ||
1285 | { | ||
1286 | if(mImportanceToCamera < LEAST_IMPORTANCE) //if the face is not important, do not load hi-res. | ||
1287 | { | ||
1288 | face_area = LLViewerImage::sMaxSmallImageSize ; | ||
1289 | } | ||
1290 | else if(face_area > LLViewerImage::sMinLargeImageSize) //if is large image, shrink face_area by considering the partial overlapping. | ||
1291 | { | ||
1292 | if(mImportanceToCamera < LEAST_IMPORTANCE_FOR_LARGE_IMAGE)//if the face is not important, do not load hi-res. | ||
1293 | { | ||
1294 | face_area = LLViewerImage::sMinLargeImageSize ; | ||
1295 | } | ||
1296 | else if(mTexture.notNull() && mTexture->isLargeImage()) | ||
1297 | { | ||
1298 | face_area *= adjustPartialOverlapPixelArea(cos_angle_to_view_dir, radius ); | ||
1299 | } | ||
1300 | } | ||
1301 | } | ||
1302 | |||
1303 | return face_area; | ||
1304 | } | ||
1305 | |||
1306 | F32 LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) | ||
1307 | { | ||
1308 | //get area of circle around face | ||
1309 | LLVector3 center = getPositionAgent(); | ||
1310 | LLVector3 size = (mExtents[1] - mExtents[0]) * 0.5f; | ||
1311 | |||
1312 | LLVector3 lookAt = center - LLViewerCamera::getInstance()->getOrigin(); | ||
1313 | F32 dist = lookAt.normVec() ; | ||
1314 | |||
1315 | //get area of circle around node | ||
1316 | F32 app_angle = atanf(size.length()/dist); | ||
1317 | radius = app_angle*LLDrawable::sCurPixelAngle; | ||
1318 | F32 face_area = radius*radius * 3.14159f; | ||
1319 | |||
1320 | if(dist < mBoundingSphereRadius) //camera is very close | ||
1321 | { | ||
1322 | cos_angle_to_view_dir = 1.0f ; | ||
1323 | mImportanceToCamera = 1.0f ; | ||
1324 | } | ||
1325 | else | ||
1326 | { | ||
1327 | cos_angle_to_view_dir = lookAt * LLViewerCamera::getInstance()->getXAxis() ; | ||
1328 | mImportanceToCamera = LLFace::calcImportanceToCamera(cos_angle_to_view_dir, dist) ; | ||
1329 | } | ||
1330 | |||
1331 | return face_area ; | ||
1332 | } | ||
1333 | |||
1334 | //the projection of the face partially overlaps with the screen | ||
1335 | F32 LLFace::adjustPartialOverlapPixelArea(F32 cos_angle_to_view_dir, F32 radius ) | ||
1336 | { | ||
1337 | F32 screen_radius = (F32)llmax(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()) ; | ||
1338 | F32 center_angle = acosf(cos_angle_to_view_dir) ; | ||
1339 | F32 d = center_angle * LLDrawable::sCurPixelAngle ; | ||
1340 | |||
1341 | if(d + radius > screen_radius + 5.f) | ||
1342 | { | ||
1343 | //---------------------------------------------- | ||
1344 | //calculate the intersection area of two circles | ||
1345 | //F32 radius_square = radius * radius ; | ||
1346 | //F32 d_square = d * d ; | ||
1347 | //F32 screen_radius_square = screen_radius * screen_radius ; | ||
1348 | //face_area = | ||
1349 | // radius_square * acosf((d_square + radius_square - screen_radius_square)/(2 * d * radius)) + | ||
1350 | // screen_radius_square * acosf((d_square + screen_radius_square - radius_square)/(2 * d * screen_radius)) - | ||
1351 | // 0.5f * sqrtf((-d + radius + screen_radius) * (d + radius - screen_radius) * (d - radius + screen_radius) * (d + radius + screen_radius)) ; | ||
1352 | //---------------------------------------------- | ||
1353 | |||
1354 | //the above calculation is too expensive | ||
1355 | //the below is a good estimation: bounding box of the bounding sphere: | ||
1356 | F32 alpha = 0.5f * (radius + screen_radius - d) / radius ; | ||
1357 | alpha = llclamp(alpha, 0.f, 1.f) ; | ||
1358 | return alpha * alpha ; | ||
1359 | } | ||
1360 | return 1.0f ; | ||
1361 | } | ||
1362 | |||
1363 | const S8 FACE_IMPORTANCE_LEVEL = 4 ; | ||
1364 | const F32 FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[FACE_IMPORTANCE_LEVEL][2] = //{distance, importance_weight} | ||
1365 | {{16.1f, 1.0f}, {32.1f, 0.5f}, {48.1f, 0.2f}, {96.1f, 0.05f} } ; | ||
1366 | const F32 FACE_IMPORTANCE_TO_CAMERA_OVER_ANGLE[FACE_IMPORTANCE_LEVEL][2] = //{cos(angle), importance_weight} | ||
1367 | {{0.985f /*cos(10 degrees)*/, 1.0f}, {0.94f /*cos(20 degrees)*/, 0.8f}, {0.866f /*cos(30 degrees)*/, 0.64f}, {0.0f, 0.36f}} ; | ||
1368 | |||
1369 | //static | ||
1370 | F32 LLFace::calcImportanceToCamera(F32 cos_angle_to_view_dir, F32 dist) | ||
1371 | { | ||
1372 | F32 importance = 0.f ; | ||
1373 | |||
1374 | if(cos_angle_to_view_dir > LLViewerCamera::getInstance()->getCosHalfFov() && | ||
1375 | dist < FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[FACE_IMPORTANCE_LEVEL - 1][0]) | ||
1376 | { | ||
1377 | F32 camera_moving_speed = LLViewerCamera::getInstance()->getAverageSpeed() ; | ||
1378 | F32 camera_angular_speed = LLViewerCamera::getInstance()->getAverageAngularSpeed(); | ||
1379 | |||
1380 | if(camera_moving_speed > 10.0f || camera_angular_speed > 1.0f) | ||
1381 | { | ||
1382 | //if camera moves or rotates too fast, ignore the importance factor | ||
1383 | return 0.f ; | ||
1384 | } | ||
1385 | |||
1386 | //F32 camera_relative_speed = camera_moving_speed * (lookAt * LLViewerCamera::getInstance()->getVelocityDir()) ; | ||
1387 | |||
1388 | S32 i = 0 ; | ||
1389 | for(i = 0; i < FACE_IMPORTANCE_LEVEL && dist > FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[i][0]; ++i); | ||
1390 | i = llmin(i, FACE_IMPORTANCE_LEVEL - 1) ; | ||
1391 | F32 dist_factor = FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[i][1] ; | ||
1392 | |||
1393 | for(i = 0; i < FACE_IMPORTANCE_LEVEL && cos_angle_to_view_dir < FACE_IMPORTANCE_TO_CAMERA_OVER_ANGLE[i][0] ; ++i) ; | ||
1394 | i = llmin(i, FACE_IMPORTANCE_LEVEL - 1) ; | ||
1395 | importance = dist_factor * FACE_IMPORTANCE_TO_CAMERA_OVER_ANGLE[i][1] ; | ||
1396 | } | ||
1397 | |||
1398 | return importance ; | ||
1399 | } | ||
1400 | |||
1356 | BOOL LLFace::verify(const U32* indices_array) const | 1401 | BOOL LLFace::verify(const U32* indices_array) const |
1357 | { | 1402 | { |
1358 | BOOL ok = TRUE; | 1403 | BOOL ok = TRUE; |
@@ -1541,153 +1586,3 @@ LLVector3 LLFace::getPositionAgent() const | |||
1541 | return mCenterLocal * getRenderMatrix(); | 1586 | return mCenterLocal * getRenderMatrix(); |
1542 | } | 1587 | } |
1543 | } | 1588 | } |
1544 | |||
1545 | // | ||
1546 | //atlas | ||
1547 | // | ||
1548 | void LLFace::removeAtlas() | ||
1549 | { | ||
1550 | setAtlasInUse(FALSE) ; | ||
1551 | mAtlasInfop = NULL ; | ||
1552 | } | ||
1553 | |||
1554 | const LLTextureAtlas* LLFace::getAtlas()const | ||
1555 | { | ||
1556 | if(mAtlasInfop) | ||
1557 | { | ||
1558 | return mAtlasInfop->getAtlas() ; | ||
1559 | } | ||
1560 | return NULL ; | ||
1561 | } | ||
1562 | |||
1563 | const LLVector2* LLFace::getTexCoordOffset()const | ||
1564 | { | ||
1565 | if(isAtlasInUse()) | ||
1566 | { | ||
1567 | return mAtlasInfop->getTexCoordOffset() ; | ||
1568 | } | ||
1569 | return NULL ; | ||
1570 | } | ||
1571 | const LLVector2* LLFace::getTexCoordScale() const | ||
1572 | { | ||
1573 | if(isAtlasInUse()) | ||
1574 | { | ||
1575 | return mAtlasInfop->getTexCoordScale() ; | ||
1576 | } | ||
1577 | return NULL ; | ||
1578 | } | ||
1579 | |||
1580 | BOOL LLFace::isAtlasInUse()const | ||
1581 | { | ||
1582 | return mUsingAtlas ; | ||
1583 | } | ||
1584 | |||
1585 | BOOL LLFace::canUseAtlas()const | ||
1586 | { | ||
1587 | //no drawable or no spatial group, do not use atlas | ||
1588 | if(!mDrawablep || !mDrawablep->getSpatialGroup()) | ||
1589 | { | ||
1590 | return FALSE ; | ||
1591 | } | ||
1592 | |||
1593 | //if bump face, do not use atlas | ||
1594 | if(getTextureEntry() && getTextureEntry()->getBumpmap()) | ||
1595 | { | ||
1596 | return FALSE ; | ||
1597 | } | ||
1598 | |||
1599 | //if animated texture, do not use atlas | ||
1600 | if(isState(TEXTURE_ANIM)) | ||
1601 | { | ||
1602 | return FALSE ; | ||
1603 | } | ||
1604 | |||
1605 | return TRUE ; | ||
1606 | } | ||
1607 | |||
1608 | void LLFace::setAtlasInUse(BOOL flag) | ||
1609 | { | ||
1610 | //no valid atlas to use. | ||
1611 | if(flag && (!mAtlasInfop || !mAtlasInfop->isValid())) | ||
1612 | { | ||
1613 | flag = FALSE ; | ||
1614 | } | ||
1615 | |||
1616 | if(!flag && !mUsingAtlas) | ||
1617 | { | ||
1618 | return ; | ||
1619 | } | ||
1620 | |||
1621 | // | ||
1622 | //at this stage (flag || mUsingAtlas) is always true. | ||
1623 | // | ||
1624 | |||
1625 | //rebuild the tex coords | ||
1626 | if(mDrawablep) | ||
1627 | { | ||
1628 | gPipeline.markRebuild(mDrawablep, LLDrawable::REBUILD_TCOORD); | ||
1629 | mUsingAtlas = flag ; | ||
1630 | } | ||
1631 | else | ||
1632 | { | ||
1633 | mUsingAtlas = FALSE ; | ||
1634 | } | ||
1635 | } | ||
1636 | |||
1637 | LLTextureAtlasSlot* LLFace::getAtlasInfo() | ||
1638 | { | ||
1639 | return mAtlasInfop ; | ||
1640 | } | ||
1641 | |||
1642 | void LLFace::setAtlasInfo(LLTextureAtlasSlot* atlasp) | ||
1643 | { | ||
1644 | if(mAtlasInfop != atlasp) | ||
1645 | { | ||
1646 | if(mAtlasInfop) | ||
1647 | { | ||
1648 | //llwarns << "Atlas slot changed!" << llendl ; | ||
1649 | } | ||
1650 | mAtlasInfop = atlasp ; | ||
1651 | } | ||
1652 | } | ||
1653 | |||
1654 | LLImageGL* LLFace::getGLTexture() const | ||
1655 | { | ||
1656 | if(isAtlasInUse()) | ||
1657 | { | ||
1658 | return (LLImageGL*)mAtlasInfop->getAtlas() ; | ||
1659 | } | ||
1660 | |||
1661 | return (LLImageGL*)mTexture ; | ||
1662 | } | ||
1663 | |||
1664 | //switch to atlas or switch back to gl texture | ||
1665 | //return TRUE if using atlas. | ||
1666 | BOOL LLFace::switchTexture() | ||
1667 | { | ||
1668 | //no valid atlas or texture | ||
1669 | if(!mAtlasInfop || !mAtlasInfop->isValid() || !mTexture) | ||
1670 | { | ||
1671 | return FALSE ; | ||
1672 | } | ||
1673 | |||
1674 | if(mTexture->getTexelsInAtlas() >= (U32)mVSize || mTexture->getTexelsInAtlas() >= mTexture->getTexelsInGLTexture()) | ||
1675 | { | ||
1676 | //switch to use atlas | ||
1677 | //atlas resolution is qualified, use it. | ||
1678 | if(!mUsingAtlas) | ||
1679 | { | ||
1680 | setAtlasInUse(TRUE) ; | ||
1681 | } | ||
1682 | } | ||
1683 | else //if atlas not qualified. | ||
1684 | { | ||
1685 | //switch back to GL texture | ||
1686 | if(mUsingAtlas && mTexture->isGLTextureCreated() && mTexture->getDiscardLevel() < mTexture->getDiscardLevelInAtlas()) | ||
1687 | { | ||
1688 | setAtlasInUse(FALSE) ; | ||
1689 | } | ||
1690 | } | ||
1691 | |||
1692 | return mUsingAtlas ; | ||
1693 | } | ||
diff --git a/linden/indra/newview/llface.h b/linden/indra/newview/llface.h index 9f76d6b..4893e82 100644 --- a/linden/indra/newview/llface.h +++ b/linden/indra/newview/llface.h | |||
@@ -48,7 +48,6 @@ | |||
48 | #include "llviewerimage.h" | 48 | #include "llviewerimage.h" |
49 | #include "llstat.h" | 49 | #include "llstat.h" |
50 | #include "lldrawable.h" | 50 | #include "lldrawable.h" |
51 | #include "lltextureatlasmanager.h" | ||
52 | 51 | ||
53 | class LLFacePool; | 52 | class LLFacePool; |
54 | class LLVolume; | 53 | class LLVolume; |
@@ -57,7 +56,6 @@ class LLTextureEntry; | |||
57 | class LLVertexProgram; | 56 | class LLVertexProgram; |
58 | class LLViewerImage; | 57 | class LLViewerImage; |
59 | class LLGeometryManager; | 58 | class LLGeometryManager; |
60 | class LLTextureAtlasSlot; | ||
61 | 59 | ||
62 | const F32 MIN_ALPHA_SIZE = 1024.f; | 60 | const F32 MIN_ALPHA_SIZE = 1024.f; |
63 | const F32 MIN_TEX_ANIM_SIZE = 512.f; | 61 | const F32 MIN_TEX_ANIM_SIZE = 512.f; |
@@ -191,18 +189,14 @@ public: | |||
191 | void setIndicesIndex(S32 idx) { mIndicesIndex = idx; } | 189 | void setIndicesIndex(S32 idx) { mIndicesIndex = idx; } |
192 | void setDrawInfo(LLDrawInfo* draw_info); | 190 | void setDrawInfo(LLDrawInfo* draw_info); |
193 | 191 | ||
194 | // KL was atlas S19 | 192 | F32 getTextureVirtualSize() ; |
195 | LLImageGL* getGLTexture() const; | 193 | F32 getImportanceToCamera()const {return mImportanceToCamera ;} |
196 | LLTextureAtlasSlot* getAtlasInfo() ; | 194 | |
197 | void setAtlasInUse(BOOL flag); | 195 | private: |
198 | void setAtlasInfo(LLTextureAtlasSlot* atlasp); | 196 | F32 adjustPartialOverlapPixelArea(F32 cos_angle_to_view_dir, F32 radius ); |
199 | BOOL isAtlasInUse()const; | 197 | F32 calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) ; |
200 | BOOL canUseAtlas() const; | 198 | public: |
201 | const LLVector2* getTexCoordScale() const ; | 199 | static F32 calcImportanceToCamera(F32 to_view_dir, F32 dist); |
202 | const LLVector2* getTexCoordOffset()const; | ||
203 | const LLTextureAtlas* getAtlas()const ; | ||
204 | void removeAtlas() ; | ||
205 | BOOL switchTexture() ; | ||
206 | 200 | ||
207 | public: | 201 | public: |
208 | 202 | ||
@@ -218,7 +212,7 @@ public: | |||
218 | LLMatrix4* mTextureMatrix; | 212 | LLMatrix4* mTextureMatrix; |
219 | LLDrawInfo* mDrawInfo; | 213 | LLDrawInfo* mDrawInfo; |
220 | 214 | ||
221 | protected: | 215 | private: |
222 | friend class LLGeometryManager; | 216 | friend class LLGeometryManager; |
223 | friend class LLVolumeGeometryManager; | 217 | friend class LLVolumeGeometryManager; |
224 | 218 | ||
@@ -248,10 +242,12 @@ protected: | |||
248 | F32 mVSize; | 242 | F32 mVSize; |
249 | F32 mPixelArea; | 243 | F32 mPixelArea; |
250 | 244 | ||
251 | //atlas | 245 | //importance factor, in the range [0, 1.0]. |
252 | LLPointer<LLTextureAtlasSlot> mAtlasInfop ; | 246 | //1.0: the most important. |
253 | BOOL mUsingAtlas ; | 247 | //based on the distance from the face to the view point and the angle from the face center to the view direction. |
254 | 248 | F32 mImportanceToCamera ; | |
249 | F32 mBoundingSphereRadius ; | ||
250 | |||
255 | protected: | 251 | protected: |
256 | static BOOL sSafeRenderSelect; | 252 | static BOOL sSafeRenderSelect; |
257 | 253 | ||
@@ -279,9 +275,9 @@ public: | |||
279 | const LLTextureEntry* lte = lhs->getTextureEntry(); | 275 | const LLTextureEntry* lte = lhs->getTextureEntry(); |
280 | const LLTextureEntry* rte = rhs->getTextureEntry(); | 276 | const LLTextureEntry* rte = rhs->getTextureEntry(); |
281 | 277 | ||
282 | if(lhs->getGLTexture() != rhs->getGLTexture()) // KL SD get GL | 278 | if (lhs->getTexture() != rhs->getTexture()) |
283 | { | 279 | { |
284 | return lhs->getGLTexture() < rhs->getGLTexture(); // not getTexture? | 280 | return lhs->getTexture() < rhs->getTexture(); |
285 | } | 281 | } |
286 | else if (lte->getBumpShinyFullbright() != rte->getBumpShinyFullbright()) | 282 | else if (lte->getBumpShinyFullbright() != rte->getBumpShinyFullbright()) |
287 | { | 283 | { |
diff --git a/linden/indra/newview/llfloaterassetbrowser.cpp b/linden/indra/newview/llfloaterassetbrowser.cpp index ca0e8d1..af81c4a 100644 --- a/linden/indra/newview/llfloaterassetbrowser.cpp +++ b/linden/indra/newview/llfloaterassetbrowser.cpp | |||
@@ -63,7 +63,7 @@ LLFloaterAssetBrowser::~LLFloaterAssetBrowser() | |||
63 | mTextureAssets.clear(); | 63 | mTextureAssets.clear(); |
64 | mMaxIndex = 0; | 64 | mMaxIndex = 0; |
65 | mFirstIndex = 0; | 65 | mFirstIndex = 0; |
66 | mMouseOverIndex = NULL; | 66 | mMouseOverIndex = 0; |
67 | mMouseOverUUID = LLUUID::null; | 67 | mMouseOverUUID = LLUUID::null; |
68 | mMouseOverAssetUUID = LLUUID::null; | 68 | mMouseOverAssetUUID = LLUUID::null; |
69 | mFloaterTitle = ""; | 69 | mFloaterTitle = ""; |
@@ -79,7 +79,7 @@ void LLFloaterAssetBrowser::initialize() | |||
79 | mAssetInfoIndex = 0; | 79 | mAssetInfoIndex = 0; |
80 | mFloaterHeight = getRect().getHeight(); | 80 | mFloaterHeight = getRect().getHeight(); |
81 | mFloaterWidth = getRect().getWidth(); | 81 | mFloaterWidth = getRect().getWidth(); |
82 | mMouseOverIndex = NULL; | 82 | mMouseOverIndex = 0; |
83 | mMouseOverUUID = LLUUID::null; | 83 | mMouseOverUUID = LLUUID::null; |
84 | mMouseOverAssetUUID = LLUUID::null; | 84 | mMouseOverAssetUUID = LLUUID::null; |
85 | mFloaterTitle = ""; | 85 | mFloaterTitle = ""; |
@@ -131,14 +131,14 @@ void LLFloaterAssetBrowser::createThumbnails() | |||
131 | { | 131 | { |
132 | mTextureAssets[i].mTexturep = gImageList.getImage(mTextureAssets[i].mAssetUUID, MIPMAP_YES, IMMEDIATE_NO); | 132 | mTextureAssets[i].mTexturep = gImageList.getImage(mTextureAssets[i].mAssetUUID, MIPMAP_YES, IMMEDIATE_NO); |
133 | mTextureAssets[i].mTexturep->setBoostLevel(LLViewerImageBoostLevel::BOOST_PREVIEW); | 133 | mTextureAssets[i].mTexturep->setBoostLevel(LLViewerImageBoostLevel::BOOST_PREVIEW); |
134 | mTextureAssets[i].mTexturep->processTextureStats(); | 134 | //mTextureAssets[i].mTexturep->processTextureStats(); |
135 | } | 135 | } |
136 | 136 | ||
137 | //Generate the asset info text | 137 | //Generate the asset info text |
138 | for(S32 i = 0; i < items.count(); i++) | 138 | /*for(S32 i = 0; i < items.count(); i++) |
139 | { | 139 | { |
140 | std::string asset_info; | 140 | LLString asset_info; |
141 | std::string dimensions; | 141 | LLString dimensions; |
142 | 142 | ||
143 | asset_info.append(mTextureAssets[i].mName); | 143 | asset_info.append(mTextureAssets[i].mName); |
144 | 144 | ||
@@ -151,7 +151,7 @@ void LLFloaterAssetBrowser::createThumbnails() | |||
151 | asset_info.append(dimensions); | 151 | asset_info.append(dimensions); |
152 | 152 | ||
153 | mTextureAssets[i].mAssetInfo = asset_info; | 153 | mTextureAssets[i].mAssetInfo = asset_info; |
154 | } | 154 | }*/ |
155 | 155 | ||
156 | mFloaterTitle = llformat("Asset Browser (%d assets fetched)", mTextureAssets.size()); | 156 | mFloaterTitle = llformat("Asset Browser (%d assets fetched)", mTextureAssets.size()); |
157 | setTitle(mFloaterTitle); | 157 | setTitle(mFloaterTitle); |
@@ -288,7 +288,7 @@ void LLFloaterAssetBrowser::draw() | |||
288 | if(mImageAssetID.notNull()) | 288 | if(mImageAssetID.notNull()) |
289 | { | 289 | { |
290 | mTexturep = gImageList.getImage(mImageAssetID, MIPMAP_YES, IMMEDIATE_NO); | 290 | mTexturep = gImageList.getImage(mImageAssetID, MIPMAP_YES, IMMEDIATE_NO); |
291 | mTexturep->setBoostLevel(LLViewerImageBoostLevel::BOOST_PREVIEW); | 291 | //mTexturep->setBoostLevel(LLViewerImage::BOOST_PREVIEW); |
292 | mTexturep->processTextureStats(); | 292 | mTexturep->processTextureStats(); |
293 | mTextureAssets[i].mWidth = mTexturep->mFullWidth; | 293 | mTextureAssets[i].mWidth = mTexturep->mFullWidth; |
294 | mTextureAssets[i].mHeight = mTexturep->mFullHeight; | 294 | mTextureAssets[i].mHeight = mTexturep->mFullHeight; |
diff --git a/linden/indra/newview/llfloaterchat.cpp b/linden/indra/newview/llfloaterchat.cpp index 5f43406..2daa5aa 100644 --- a/linden/indra/newview/llfloaterchat.cpp +++ b/linden/indra/newview/llfloaterchat.cpp | |||
@@ -582,8 +582,7 @@ void LLFloaterChat::addChat(const LLChat& chat, | |||
582 | // We display anything if it's not an IM. If it's an IM, check pref... | 582 | // We display anything if it's not an IM. If it's an IM, check pref... |
583 | if ( !from_instant_message || gSavedSettings.getBOOL("IMInChatConsole") ) | 583 | if ( !from_instant_message || gSavedSettings.getBOOL("IMInChatConsole") ) |
584 | { | 584 | { |
585 | gConsole->addConsoleLine(chat.mText, text_color); | 585 | gConsole->addLine(chat.mText, size, text_color); |
586 | |||
587 | } | 586 | } |
588 | } | 587 | } |
589 | 588 | ||
diff --git a/linden/indra/newview/llfloaterhardwaresettings.cpp b/linden/indra/newview/llfloaterhardwaresettings.cpp index 8c91f5a..7886e39 100644 --- a/linden/indra/newview/llfloaterhardwaresettings.cpp +++ b/linden/indra/newview/llfloaterhardwaresettings.cpp | |||
@@ -68,7 +68,6 @@ void LLFloaterHardwareSettings::onClickHelp(void* data) | |||
68 | 68 | ||
69 | void LLFloaterHardwareSettings::initCallbacks(void) | 69 | void LLFloaterHardwareSettings::initCallbacks(void) |
70 | { | 70 | { |
71 | childSetCommitCallback("fbo", refreshState); | ||
72 | } | 71 | } |
73 | 72 | ||
74 | // menu maintenance functions | 73 | // menu maintenance functions |
@@ -84,8 +83,7 @@ void LLFloaterHardwareSettings::refresh() | |||
84 | mVideoCardMem = gSavedSettings.getS32("TextureMemory"); | 83 | mVideoCardMem = gSavedSettings.getS32("TextureMemory"); |
85 | mFogRatio = gSavedSettings.getF32("RenderFogRatio"); | 84 | mFogRatio = gSavedSettings.getF32("RenderFogRatio"); |
86 | mProbeHardwareOnStartup = gSavedSettings.getBOOL("ProbeHardwareOnStartup"); | 85 | mProbeHardwareOnStartup = gSavedSettings.getBOOL("ProbeHardwareOnStartup"); |
87 | mRenderDeferred = gSavedSettings.getBOOL("RenderDeferred"); | 86 | |
88 | mRenderUseFBO = gSavedSettings.getBOOL("RenderUseFBO"); | ||
89 | childSetValue("fsaa", (LLSD::Integer) mFSAASamples); | 87 | childSetValue("fsaa", (LLSD::Integer) mFSAASamples); |
90 | refreshEnabledState(); | 88 | refreshEnabledState(); |
91 | } | 89 | } |
@@ -103,20 +101,6 @@ void LLFloaterHardwareSettings::refreshEnabledState() | |||
103 | childSetEnabled("vbo", FALSE); | 101 | childSetEnabled("vbo", FALSE); |
104 | } | 102 | } |
105 | 103 | ||
106 | if (!gGLManager.mHasFramebufferObject) | ||
107 | { | ||
108 | childSetEnabled("fbo", FALSE); | ||
109 | } | ||
110 | |||
111 | if (!gGLManager.mHasDrawBuffers || !gSavedSettings.getBOOL("RenderUseFBO")) | ||
112 | { | ||
113 | childSetEnabled("deferred", FALSE); | ||
114 | } | ||
115 | else | ||
116 | { | ||
117 | childSetEnabled("deferred", TRUE); | ||
118 | } | ||
119 | |||
120 | // if no windlight shaders, turn off nighttime brightness, gamma, and fog distance | 104 | // if no windlight shaders, turn off nighttime brightness, gamma, and fog distance |
121 | childSetEnabled("gamma", !gPipeline.canUseWindLightShaders()); | 105 | childSetEnabled("gamma", !gPipeline.canUseWindLightShaders()); |
122 | childSetEnabled("(brightness, lower is brighter)", !gPipeline.canUseWindLightShaders()); | 106 | childSetEnabled("(brightness, lower is brighter)", !gPipeline.canUseWindLightShaders()); |
@@ -124,12 +108,6 @@ void LLFloaterHardwareSettings::refreshEnabledState() | |||
124 | 108 | ||
125 | } | 109 | } |
126 | 110 | ||
127 | //static | ||
128 | void LLFloaterHardwareSettings::refreshState(LLUICtrl*, void*) | ||
129 | { | ||
130 | LLFloaterHardwareSettings::instance()->refreshEnabledState(); | ||
131 | } | ||
132 | |||
133 | // static instance of it | 111 | // static instance of it |
134 | LLFloaterHardwareSettings* LLFloaterHardwareSettings::instance() | 112 | LLFloaterHardwareSettings* LLFloaterHardwareSettings::instance() |
135 | { | 113 | { |
@@ -224,8 +202,7 @@ void LLFloaterHardwareSettings::cancel() | |||
224 | gSavedSettings.setS32("TextureMemory", mVideoCardMem); | 202 | gSavedSettings.setS32("TextureMemory", mVideoCardMem); |
225 | gSavedSettings.setF32("RenderFogRatio", mFogRatio); | 203 | gSavedSettings.setF32("RenderFogRatio", mFogRatio); |
226 | gSavedSettings.setBOOL("ProbeHardwareOnStartup", mProbeHardwareOnStartup ); | 204 | gSavedSettings.setBOOL("ProbeHardwareOnStartup", mProbeHardwareOnStartup ); |
227 | gSavedSettings.setBOOL("RenderUseFBO", mRenderUseFBO); | 205 | |
228 | gSavedSettings.setBOOL("RenderDeferred", mRenderDeferred); | ||
229 | close(); | 206 | close(); |
230 | } | 207 | } |
231 | 208 | ||
diff --git a/linden/indra/newview/llfloaterhardwaresettings.h b/linden/indra/newview/llfloaterhardwaresettings.h index e564e1c..04a33f6 100644 --- a/linden/indra/newview/llfloaterhardwaresettings.h +++ b/linden/indra/newview/llfloaterhardwaresettings.h | |||
@@ -61,8 +61,6 @@ public: | |||
61 | /// OK button | 61 | /// OK button |
62 | static void onBtnOK( void* userdata ); | 62 | static void onBtnOK( void* userdata ); |
63 | 63 | ||
64 | static void refreshState(LLUICtrl*, void*); | ||
65 | |||
66 | //// menu management | 64 | //// menu management |
67 | 65 | ||
68 | /// show off our menu | 66 | /// show off our menu |
@@ -90,8 +88,6 @@ protected: | |||
90 | LLSliderCtrl* mCtrlVideoCardMem; | 88 | LLSliderCtrl* mCtrlVideoCardMem; |
91 | 89 | ||
92 | BOOL mUseVBO; | 90 | BOOL mUseVBO; |
93 | BOOL mRenderUseFBO; | ||
94 | BOOL mRenderDeferred; | ||
95 | BOOL mUseAniso; | 91 | BOOL mUseAniso; |
96 | U32 mFSAASamples; | 92 | U32 mFSAASamples; |
97 | F32 mGamma; | 93 | F32 mGamma; |
diff --git a/linden/indra/newview/llfloaterlagmeter.cpp b/linden/indra/newview/llfloaterlagmeter.cpp index 2ae2e32..8fe455f 100644 --- a/linden/indra/newview/llfloaterlagmeter.cpp +++ b/linden/indra/newview/llfloaterlagmeter.cpp | |||
@@ -180,7 +180,7 @@ void LLFloaterLagMeter::determineClient() | |||
180 | { | 180 | { |
181 | mClientCause->setText( getString("client_texture_loading_cause_msg", mStringArgs) ); | 181 | mClientCause->setText( getString("client_texture_loading_cause_msg", mStringArgs) ); |
182 | } | 182 | } |
183 | else if((LLViewerImage::sBoundTextureMemoryInBytes >> 20) > LLViewerImage::sMaxBoundTextureMemInMegaBytes) | 183 | else if((BYTES_TO_MEGA_BYTES(LLViewerImage::sBoundTextureMemoryInBytes)) > LLViewerImage::sMaxBoundTextureMemInMegaBytes) |
184 | { | 184 | { |
185 | mClientCause->setText( getString("client_texture_memory_cause_msg", mStringArgs) ); | 185 | mClientCause->setText( getString("client_texture_memory_cause_msg", mStringArgs) ); |
186 | } | 186 | } |
diff --git a/linden/indra/newview/llfloaterpostprocess.cpp b/linden/indra/newview/llfloaterpostprocess.cpp index c5b2018..de9b598 100644 --- a/linden/indra/newview/llfloaterpostprocess.cpp +++ b/linden/indra/newview/llfloaterpostprocess.cpp | |||
@@ -52,29 +52,28 @@ LLFloaterPostProcess::LLFloaterPostProcess() : LLFloater(std::string("Post-Proce | |||
52 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_post_process.xml"); | 52 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_post_process.xml"); |
53 | 53 | ||
54 | /// Color Filter Callbacks | 54 | /// Color Filter Callbacks |
55 | //childSetCommitCallback("ColorFilterToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_color_filter"); | 55 | childSetCommitCallback("ColorFilterToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_color_filter"); |
56 | childSetCommitCallback("wmiColorFilterToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_color_filter"); | ||
57 | //childSetCommitCallback("ColorFilterGamma", &LLFloaterPostProcess::onFloatControlMoved, &(gPostProcess->tweaks.gamma())); | 56 | //childSetCommitCallback("ColorFilterGamma", &LLFloaterPostProcess::onFloatControlMoved, &(gPostProcess->tweaks.gamma())); |
58 | childSetCommitCallback("wmiColorFilterBrightness", &LLFloaterPostProcess::onFloatControlMoved, (char*)"brightness"); | 57 | childSetCommitCallback("ColorFilterBrightness", &LLFloaterPostProcess::onFloatControlMoved, (char*)"brightness"); |
59 | childSetCommitCallback("wmiColorFilterSaturation", &LLFloaterPostProcess::onFloatControlMoved, (char*)"saturation"); | 58 | childSetCommitCallback("ColorFilterSaturation", &LLFloaterPostProcess::onFloatControlMoved, (char*)"saturation"); |
60 | childSetCommitCallback("wmiColorFilterContrast", &LLFloaterPostProcess::onFloatControlMoved, (char*)"contrast"); | 59 | childSetCommitCallback("ColorFilterContrast", &LLFloaterPostProcess::onFloatControlMoved, (char*)"contrast"); |
61 | 60 | ||
62 | childSetCommitCallback("wmiColorFilterBaseR", &LLFloaterPostProcess::onColorControlRMoved, (char*)"contrast_base"); | 61 | childSetCommitCallback("ColorFilterBaseR", &LLFloaterPostProcess::onColorControlRMoved, (char*)"contrast_base"); |
63 | childSetCommitCallback("wmiColorFilterBaseG", &LLFloaterPostProcess::onColorControlGMoved, (char*)"contrast_base"); | 62 | childSetCommitCallback("ColorFilterBaseG", &LLFloaterPostProcess::onColorControlGMoved, (char*)"contrast_base"); |
64 | childSetCommitCallback("wmiColorFilterBaseB", &LLFloaterPostProcess::onColorControlBMoved, (char*)"contrast_base"); | 63 | childSetCommitCallback("ColorFilterBaseB", &LLFloaterPostProcess::onColorControlBMoved, (char*)"contrast_base"); |
65 | childSetCommitCallback("wmiColorFilterBaseI", &LLFloaterPostProcess::onColorControlIMoved, (char*)"contrast_base"); | 64 | childSetCommitCallback("ColorFilterBaseI", &LLFloaterPostProcess::onColorControlIMoved, (char*)"contrast_base"); |
66 | 65 | ||
67 | /// Night Vision Callbacks | 66 | /// Night Vision Callbacks |
68 | childSetCommitCallback("wmiNightVisionToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_night_vision"); | 67 | childSetCommitCallback("NightVisionToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_night_vision"); |
69 | childSetCommitCallback("wmiNightVisionBrightMult", &LLFloaterPostProcess::onFloatControlMoved, (char*)"brightness_multiplier"); | 68 | childSetCommitCallback("NightVisionBrightMult", &LLFloaterPostProcess::onFloatControlMoved, (char*)"brightness_multiplier"); |
70 | childSetCommitCallback("wmiNightVisionNoiseSize", &LLFloaterPostProcess::onFloatControlMoved, (char*)"noise_size"); | 69 | childSetCommitCallback("NightVisionNoiseSize", &LLFloaterPostProcess::onFloatControlMoved, (char*)"noise_size"); |
71 | childSetCommitCallback("wmiNightVisionNoiseStrength", &LLFloaterPostProcess::onFloatControlMoved, (char*)"noise_strength"); | 70 | childSetCommitCallback("NightVisionNoiseStrength", &LLFloaterPostProcess::onFloatControlMoved, (char*)"noise_strength"); |
72 | 71 | ||
73 | /// Bloom Callbacks | 72 | /// Bloom Callbacks |
74 | childSetCommitCallback("wmiBloomToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_bloom"); | 73 | childSetCommitCallback("BloomToggle", &LLFloaterPostProcess::onBoolToggle, (char*)"enable_bloom"); |
75 | childSetCommitCallback("wmiBloomExtract", &LLFloaterPostProcess::onFloatControlMoved, (char*)"extract_low"); | 74 | childSetCommitCallback("BloomExtract", &LLFloaterPostProcess::onFloatControlMoved, (char*)"extract_low"); |
76 | childSetCommitCallback("wmiBloomSize", &LLFloaterPostProcess::onFloatControlMoved, (char*)"bloom_width"); | 75 | childSetCommitCallback("BloomSize", &LLFloaterPostProcess::onFloatControlMoved, (char*)"bloom_width"); |
77 | childSetCommitCallback("wmiBloomStrength", &LLFloaterPostProcess::onFloatControlMoved, (char*)"bloom_strength"); | 76 | childSetCommitCallback("BloomStrength", &LLFloaterPostProcess::onFloatControlMoved, (char*)"bloom_strength"); |
78 | 77 | ||
79 | // Effect loading and saving. | 78 | // Effect loading and saving. |
80 | LLComboBox* comboBox = getChild<LLComboBox>("PPEffectsCombo"); | 79 | LLComboBox* comboBox = getChild<LLComboBox>("PPEffectsCombo"); |
@@ -114,7 +113,6 @@ void LLFloaterPostProcess::onBoolToggle(LLUICtrl* ctrl, void* userData) | |||
114 | // check the bool | 113 | // check the bool |
115 | LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl); | 114 | LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl); |
116 | gPostProcess->tweaks[boolVariableName] = cbCtrl->getValue(); | 115 | gPostProcess->tweaks[boolVariableName] = cbCtrl->getValue(); |
117 | |||
118 | } | 116 | } |
119 | 117 | ||
120 | // Float Moved | 118 | // Float Moved |
@@ -249,25 +247,25 @@ void LLFloaterPostProcess::syncMenu() | |||
249 | comboBox->selectByValue(gPostProcess->getSelectedEffect()); | 247 | comboBox->selectByValue(gPostProcess->getSelectedEffect()); |
250 | 248 | ||
251 | /// Sync Color Filter Menu | 249 | /// Sync Color Filter Menu |
252 | childSetValue("wmiColorFilterToggle", gPostProcess->tweaks.useColorFilter()); | 250 | childSetValue("ColorFilterToggle", gPostProcess->tweaks.useColorFilter()); |
253 | //childSetValue("ColorFilterGamma", gPostProcess->tweaks.gamma()); | 251 | //childSetValue("ColorFilterGamma", gPostProcess->tweaks.gamma()); |
254 | childSetValue("wmiColorFilterBrightness", gPostProcess->tweaks.brightness()); | 252 | childSetValue("ColorFilterBrightness", gPostProcess->tweaks.brightness()); |
255 | childSetValue("wmiColorFilterSaturation", gPostProcess->tweaks.saturation()); | 253 | childSetValue("ColorFilterSaturation", gPostProcess->tweaks.saturation()); |
256 | childSetValue("wmiColorFilterContrast", gPostProcess->tweaks.contrast()); | 254 | childSetValue("ColorFilterContrast", gPostProcess->tweaks.contrast()); |
257 | childSetValue("wmiColorFilterBaseR", gPostProcess->tweaks.contrastBaseR()); | 255 | childSetValue("ColorFilterBaseR", gPostProcess->tweaks.contrastBaseR()); |
258 | childSetValue("wmiColorFilterBaseG", gPostProcess->tweaks.contrastBaseG()); | 256 | childSetValue("ColorFilterBaseG", gPostProcess->tweaks.contrastBaseG()); |
259 | childSetValue("wmiColorFilterBaseB", gPostProcess->tweaks.contrastBaseB()); | 257 | childSetValue("ColorFilterBaseB", gPostProcess->tweaks.contrastBaseB()); |
260 | childSetValue("wmiColorFilterBaseI", gPostProcess->tweaks.contrastBaseIntensity()); | 258 | childSetValue("ColorFilterBaseI", gPostProcess->tweaks.contrastBaseIntensity()); |
261 | 259 | ||
262 | /// Sync Night Vision Menu | 260 | /// Sync Night Vision Menu |
263 | childSetValue("wmiNightVisionToggle", gPostProcess->tweaks.useNightVisionShader()); | 261 | childSetValue("NightVisionToggle", gPostProcess->tweaks.useNightVisionShader()); |
264 | childSetValue("wmiNightVisionBrightMult", gPostProcess->tweaks.brightMult()); | 262 | childSetValue("NightVisionBrightMult", gPostProcess->tweaks.brightMult()); |
265 | childSetValue("wmiNightVisionNoiseSize", gPostProcess->tweaks.noiseSize()); | 263 | childSetValue("NightVisionNoiseSize", gPostProcess->tweaks.noiseSize()); |
266 | childSetValue("wmiNightVisionNoiseStrength", gPostProcess->tweaks.noiseStrength()); | 264 | childSetValue("NightVisionNoiseStrength", gPostProcess->tweaks.noiseStrength()); |
267 | 265 | ||
268 | /// Sync Bloom Menu | 266 | /// Sync Bloom Menu |
269 | childSetValue("wmiBloomToggle", LLSD(gPostProcess->tweaks.useBloomShader())); | 267 | childSetValue("BloomToggle", LLSD(gPostProcess->tweaks.useBloomShader())); |
270 | childSetValue("wmiBloomExtract", gPostProcess->tweaks.extractLow()); | 268 | childSetValue("BloomExtract", gPostProcess->tweaks.extractLow()); |
271 | childSetValue("wmiBloomSize", gPostProcess->tweaks.bloomWidth()); | 269 | childSetValue("BloomSize", gPostProcess->tweaks.bloomWidth()); |
272 | childSetValue("wmiBloomStrength", gPostProcess->tweaks.bloomStrength()); | 270 | childSetValue("BloomStrength", gPostProcess->tweaks.bloomStrength()); |
273 | } | 271 | } |
diff --git a/linden/indra/newview/llfloaterreporter.cpp b/linden/indra/newview/llfloaterreporter.cpp index 9209f41..a7f41ea 100644 --- a/linden/indra/newview/llfloaterreporter.cpp +++ b/linden/indra/newview/llfloaterreporter.cpp | |||
@@ -952,8 +952,7 @@ void LLFloaterReporter::takeScreenshot() | |||
952 | 952 | ||
953 | // store in the image list so it doesn't try to fetch from the server | 953 | // store in the image list so it doesn't try to fetch from the server |
954 | LLPointer<LLViewerImage> image_in_list = new LLViewerImage(mResourceDatap->mAssetInfo.mUuid); | 954 | LLPointer<LLViewerImage> image_in_list = new LLViewerImage(mResourceDatap->mAssetInfo.mUuid); |
955 | image_in_list->createGLTexture(0, raw); | 955 | image_in_list->createGLTexture(0, raw, 0, TRUE, LLViewerImageBoostLevel::OTHER); |
956 | |||
957 | gImageList.addImage(image_in_list); | 956 | gImageList.addImage(image_in_list); |
958 | 957 | ||
959 | // the texture picker then uses that texture | 958 | // the texture picker then uses that texture |
diff --git a/linden/indra/newview/llhudeffect.cpp b/linden/indra/newview/llhudeffect.cpp index 20bbb32..c1d46f9 100644 --- a/linden/indra/newview/llhudeffect.cpp +++ b/linden/indra/newview/llhudeffect.cpp | |||
@@ -78,7 +78,7 @@ void LLHUDEffect::unpackData(LLMessageSystem *mesgsys, S32 blocknum) | |||
78 | 78 | ||
79 | void LLHUDEffect::render() | 79 | void LLHUDEffect::render() |
80 | { | 80 | { |
81 | llwarns << "Never call this!" << llendl; // Then why the &*^&*^ is it here? | 81 | llerrs << "Never call this!" << llendl; |
82 | } | 82 | } |
83 | 83 | ||
84 | void LLHUDEffect::setID(const LLUUID &id) | 84 | void LLHUDEffect::setID(const LLUUID &id) |
diff --git a/linden/indra/newview/llhudtext.cpp b/linden/indra/newview/llhudtext.cpp index b17f8d7..7d9f7f9 100644 --- a/linden/indra/newview/llhudtext.cpp +++ b/linden/indra/newview/llhudtext.cpp | |||
@@ -1116,8 +1116,6 @@ void LLHUDText::renderAllHUD() | |||
1116 | 1116 | ||
1117 | LLVertexBuffer::unbind(); | 1117 | LLVertexBuffer::unbind(); |
1118 | 1118 | ||
1119 | LLVertexBuffer::unbind(); // KL not entirely sure why but render pipeline has this twice? | ||
1120 | |||
1121 | LLGLState::checkStates(); | 1119 | LLGLState::checkStates(); |
1122 | LLGLState::checkTextureChannels(); | 1120 | LLGLState::checkTextureChannels(); |
1123 | LLGLState::checkClientArrays(); | 1121 | LLGLState::checkClientArrays(); |
diff --git a/linden/indra/newview/llmanip.cpp b/linden/indra/newview/llmanip.cpp index 0c88c47..45550fc 100644 --- a/linden/indra/newview/llmanip.cpp +++ b/linden/indra/newview/llmanip.cpp | |||
@@ -60,7 +60,7 @@ | |||
60 | #include "llglheaders.h" | 60 | #include "llglheaders.h" |
61 | 61 | ||
62 | // Local constants... | 62 | // Local constants... |
63 | const S32 VERTICAL_OFFSET = 100; // KL adjusted to compensate for toolbars move to the top of the screen! | 63 | const S32 VERTICAL_OFFSET = 50; |
64 | 64 | ||
65 | F32 LLManip::sHelpTextVisibleTime = 2.f; | 65 | F32 LLManip::sHelpTextVisibleTime = 2.f; |
66 | F32 LLManip::sHelpTextFadeTime = 2.f; | 66 | F32 LLManip::sHelpTextFadeTime = 2.f; |
diff --git a/linden/indra/newview/llmaniptranslate.h b/linden/indra/newview/llmaniptranslate.h index 25ff35c..77f12ff 100644 --- a/linden/indra/newview/llmaniptranslate.h +++ b/linden/indra/newview/llmaniptranslate.h | |||
@@ -116,7 +116,7 @@ private: | |||
116 | LLVector3d mDragCursorStartGlobal; | 116 | LLVector3d mDragCursorStartGlobal; |
117 | LLVector3d mDragSelectionStartGlobal; | 117 | LLVector3d mDragSelectionStartGlobal; |
118 | LLTimer mUpdateTimer; | 118 | LLTimer mUpdateTimer; |
119 | typedef std::set<ManipulatorHandle*, compare_manipulators> minpulator_list_t; | 119 | typedef std::multiset<ManipulatorHandle*, compare_manipulators> minpulator_list_t; |
120 | minpulator_list_t mProjectedManipulators; | 120 | minpulator_list_t mProjectedManipulators; |
121 | LLVector4 mManipulatorVertices[18]; | 121 | LLVector4 mManipulatorVertices[18]; |
122 | F32 mSnapOffsetMeters; | 122 | F32 mSnapOffsetMeters; |
diff --git a/linden/indra/newview/llmediactrl.cpp b/linden/indra/newview/llmediactrl.cpp index a517332..1530598 100644 --- a/linden/indra/newview/llmediactrl.cpp +++ b/linden/indra/newview/llmediactrl.cpp | |||
@@ -1012,7 +1012,8 @@ BOOL LLWebBrowserTexture::render() | |||
1012 | x_pos, | 1012 | x_pos, |
1013 | y_pos, | 1013 | y_pos, |
1014 | width, | 1014 | width, |
1015 | height); | 1015 | height, |
1016 | TRUE); // force a fast update (i.e. don't call analyzeAlpha, etc.) | ||
1016 | } | 1017 | } |
1017 | 1018 | ||
1018 | media_plugin->resetDirty(); | 1019 | media_plugin->resetDirty(); |
diff --git a/linden/indra/newview/lloverlaybar.cpp b/linden/indra/newview/lloverlaybar.cpp index 1b60eee..3af3d0e 100644 --- a/linden/indra/newview/lloverlaybar.cpp +++ b/linden/indra/newview/lloverlaybar.cpp | |||
@@ -444,6 +444,7 @@ void LLOverlayBar::toggleMusicPlay(void*) | |||
444 | // if ( gAudiop->isInternetStreamPlaying() == 0 ) | 444 | // if ( gAudiop->isInternetStreamPlaying() == 0 ) |
445 | { | 445 | { |
446 | gAudiop->startInternetStream(parcel->getMusicURL()); | 446 | gAudiop->startInternetStream(parcel->getMusicURL()); |
447 | //awfixme sTitleObserver.init(parcel->getMusicURL()); | ||
447 | } | 448 | } |
448 | } | 449 | } |
449 | } | 450 | } |
diff --git a/linden/indra/newview/llpanelvolume.cpp b/linden/indra/newview/llpanelvolume.cpp index 4270f0b..6d014a2 100644 --- a/linden/indra/newview/llpanelvolume.cpp +++ b/linden/indra/newview/llpanelvolume.cpp | |||
@@ -53,7 +53,6 @@ | |||
53 | #include "llbutton.h" | 53 | #include "llbutton.h" |
54 | #include "llcheckboxctrl.h" | 54 | #include "llcheckboxctrl.h" |
55 | #include "llcolorswatch.h" | 55 | #include "llcolorswatch.h" |
56 | #include "lltexturectrl.h" | ||
57 | #include "llcombobox.h" | 56 | #include "llcombobox.h" |
58 | #include "llfirstuse.h" | 57 | #include "llfirstuse.h" |
59 | #include "llfocusmgr.h" | 58 | #include "llfocusmgr.h" |
@@ -112,28 +111,12 @@ BOOL LLPanelVolume::postBuild() | |||
112 | LightColorSwatch->setOnSelectCallback(onLightSelectColor); | 111 | LightColorSwatch->setOnSelectCallback(onLightSelectColor); |
113 | childSetCommitCallback("colorswatch",onCommitLight,this); | 112 | childSetCommitCallback("colorswatch",onCommitLight,this); |
114 | } | 113 | } |
115 | |||
116 | LLTextureCtrl* LightTexPicker = getChild<LLTextureCtrl>("light texture control"); | ||
117 | if (LightTexPicker) | ||
118 | { | ||
119 | LightTexPicker->setOnCancelCallback(onLightCancelTexture); | ||
120 | LightTexPicker->setOnSelectCallback(onLightSelectTexture); | ||
121 | childSetCommitCallback("light texture control", onCommitLight, this); | ||
122 | } | ||
123 | |||
124 | childSetCommitCallback("Light Intensity",onCommitLight,this); | 114 | childSetCommitCallback("Light Intensity",onCommitLight,this); |
125 | childSetValidate("Light Intensity",precommitValidate); | 115 | childSetValidate("Light Intensity",precommitValidate); |
126 | childSetCommitCallback("Light Radius",onCommitLight,this); | 116 | childSetCommitCallback("Light Radius",onCommitLight,this); |
127 | childSetValidate("Light Radius",precommitValidate); | 117 | childSetValidate("Light Radius",precommitValidate); |
128 | childSetCommitCallback("Light Falloff",onCommitLight,this); | 118 | childSetCommitCallback("Light Falloff",onCommitLight,this); |
129 | childSetValidate("Light Falloff",precommitValidate); | 119 | childSetValidate("Light Falloff",precommitValidate); |
130 | |||
131 | childSetCommitCallback("Light FOV", onCommitLight, this); | ||
132 | childSetValidate("Light FOV", precommitValidate); | ||
133 | childSetCommitCallback("Light Focus", onCommitLight, this); | ||
134 | childSetValidate("Light Focus", precommitValidate); | ||
135 | childSetCommitCallback("Light Ambiance", onCommitLight, this); | ||
136 | childSetValidate("Light Ambiance", precommitValidate); | ||
137 | } | 120 | } |
138 | 121 | ||
139 | // Start with everyone disabled | 122 | // Start with everyone disabled |
@@ -238,32 +221,14 @@ void LLPanelVolume::getState( ) | |||
238 | LightColorSwatch->setValid( TRUE ); | 221 | LightColorSwatch->setValid( TRUE ); |
239 | LightColorSwatch->set(volobjp->getLightBaseColor()); | 222 | LightColorSwatch->set(volobjp->getLightBaseColor()); |
240 | } | 223 | } |
241 | |||
242 | LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control"); | ||
243 | if (LightTextureCtrl) | ||
244 | { | ||
245 | LightTextureCtrl->setEnabled(TRUE); | ||
246 | LightTextureCtrl->setValid(TRUE); | ||
247 | LightTextureCtrl->setImageAssetID(volobjp->getLightTextureID()); | ||
248 | } | ||
249 | |||
250 | childSetEnabled("Light Intensity",true); | 224 | childSetEnabled("Light Intensity",true); |
251 | childSetEnabled("Light Radius",true); | 225 | childSetEnabled("Light Radius",true); |
252 | childSetEnabled("Light Falloff",true); | 226 | childSetEnabled("Light Falloff",true); |
253 | 227 | ||
254 | childSetEnabled("Light FOV", true); | ||
255 | childSetEnabled("Light Focus", true); | ||
256 | childSetEnabled("Light Ambiance", true); | ||
257 | |||
258 | childSetValue("Light Intensity",volobjp->getLightIntensity()); | 228 | childSetValue("Light Intensity",volobjp->getLightIntensity()); |
259 | childSetValue("Light Radius",volobjp->getLightRadius()); | 229 | childSetValue("Light Radius",volobjp->getLightRadius()); |
260 | childSetValue("Light Falloff",volobjp->getLightFalloff()); | 230 | childSetValue("Light Falloff",volobjp->getLightFalloff()); |
261 | 231 | ||
262 | LLVector3 params = volobjp->getSpotLightParams(); | ||
263 | childSetValue("Light FOV", params.mV[0]); | ||
264 | childSetValue("Light Focus", params.mV[1]); | ||
265 | childSetValue("Light Ambiance", params.mV[2]); | ||
266 | |||
267 | mLightSavedColor = volobjp->getLightColor(); | 232 | mLightSavedColor = volobjp->getLightColor(); |
268 | } | 233 | } |
269 | else | 234 | else |
@@ -279,20 +244,9 @@ void LLPanelVolume::getState( ) | |||
279 | LightColorSwatch->setEnabled( FALSE ); | 244 | LightColorSwatch->setEnabled( FALSE ); |
280 | LightColorSwatch->setValid( FALSE ); | 245 | LightColorSwatch->setValid( FALSE ); |
281 | } | 246 | } |
282 | LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control"); | ||
283 | if (LightTextureCtrl) | ||
284 | { | ||
285 | LightTextureCtrl->setEnabled(FALSE); | ||
286 | LightTextureCtrl->setValid(FALSE); | ||
287 | } | ||
288 | |||
289 | childSetEnabled("Light Intensity",false); | 247 | childSetEnabled("Light Intensity",false); |
290 | childSetEnabled("Light Radius",false); | 248 | childSetEnabled("Light Radius",false); |
291 | childSetEnabled("Light Falloff",false); | 249 | childSetEnabled("Light Falloff",false); |
292 | |||
293 | childSetEnabled("Light FOV",false); | ||
294 | childSetEnabled("Light Focus",false); | ||
295 | childSetEnabled("Light Ambiance",false); | ||
296 | } | 250 | } |
297 | 251 | ||
298 | // Flexible properties | 252 | // Flexible properties |
@@ -408,13 +362,6 @@ void LLPanelVolume::clearCtrls() | |||
408 | LightColorSwatch->setEnabled( FALSE ); | 362 | LightColorSwatch->setEnabled( FALSE ); |
409 | LightColorSwatch->setValid( FALSE ); | 363 | LightColorSwatch->setValid( FALSE ); |
410 | } | 364 | } |
411 | LLTextureCtrl* LightTextureCtrl = getChild<LLTextureCtrl>("light texture control"); | ||
412 | if(LightTextureCtrl) | ||
413 | { | ||
414 | LightTextureCtrl->setEnabled( FALSE ); | ||
415 | LightTextureCtrl->setValid( FALSE ); | ||
416 | } | ||
417 | |||
418 | childSetEnabled("Light Intensity",false); | 365 | childSetEnabled("Light Intensity",false); |
419 | childSetEnabled("Light Radius",false); | 366 | childSetEnabled("Light Radius",false); |
420 | childSetEnabled("Light Falloff",false); | 367 | childSetEnabled("Light Falloff",false); |
@@ -491,16 +438,6 @@ void LLPanelVolume::onLightCancelColor(LLUICtrl* ctrl, void* userdata) | |||
491 | onLightSelectColor(NULL, userdata); | 438 | onLightSelectColor(NULL, userdata); |
492 | } | 439 | } |
493 | 440 | ||
494 | void LLPanelVolume::onLightCancelTexture(LLUICtrl* ctrl, void* userdata) | ||
495 | { | ||
496 | LLPanelVolume* self = (LLPanelVolume*) userdata; | ||
497 | LLTextureCtrl* LightTextureCtrl = self->getChild<LLTextureCtrl>("light texture control"); | ||
498 | if (LightTextureCtrl) | ||
499 | { | ||
500 | LightTextureCtrl->setImageAssetID(self->mLightSavedTexture); | ||
501 | } | ||
502 | } | ||
503 | |||
504 | void LLPanelVolume::onLightSelectColor(LLUICtrl* ctrl, void* userdata) | 441 | void LLPanelVolume::onLightSelectColor(LLUICtrl* ctrl, void* userdata) |
505 | { | 442 | { |
506 | LLPanelVolume* self = (LLPanelVolume*) userdata; | 443 | LLPanelVolume* self = (LLPanelVolume*) userdata; |
@@ -522,25 +459,6 @@ void LLPanelVolume::onLightSelectColor(LLUICtrl* ctrl, void* userdata) | |||
522 | } | 459 | } |
523 | } | 460 | } |
524 | 461 | ||
525 | void LLPanelVolume::onLightSelectTexture(LLUICtrl* ctrl, void* userdata) | ||
526 | { | ||
527 | LLPanelVolume* self = (LLPanelVolume*) userdata; | ||
528 | LLViewerObject* objectp = self->mObject; | ||
529 | if (!objectp || (objectp->getPCode() != LL_PCODE_VOLUME)) | ||
530 | { | ||
531 | return; | ||
532 | } | ||
533 | LLVOVolume *volobjp = (LLVOVolume *)objectp; | ||
534 | |||
535 | |||
536 | LLTextureCtrl* LightTextureCtrl = self->getChild<LLTextureCtrl>("light texture control"); | ||
537 | if(LightTextureCtrl) | ||
538 | { | ||
539 | LLUUID id = LightTextureCtrl->getImageAssetID(); | ||
540 | volobjp->setLightTextureID(id); | ||
541 | self->mLightSavedTexture = id; | ||
542 | } | ||
543 | } | ||
544 | // static | 462 | // static |
545 | void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata ) | 463 | void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata ) |
546 | { | 464 | { |
@@ -556,47 +474,12 @@ void LLPanelVolume::onCommitLight( LLUICtrl* ctrl, void* userdata ) | |||
556 | volobjp->setLightIntensity((F32)self->childGetValue("Light Intensity").asReal()); | 474 | volobjp->setLightIntensity((F32)self->childGetValue("Light Intensity").asReal()); |
557 | volobjp->setLightRadius((F32)self->childGetValue("Light Radius").asReal()); | 475 | volobjp->setLightRadius((F32)self->childGetValue("Light Radius").asReal()); |
558 | volobjp->setLightFalloff((F32)self->childGetValue("Light Falloff").asReal()); | 476 | volobjp->setLightFalloff((F32)self->childGetValue("Light Falloff").asReal()); |
559 | |||
560 | LLColorSwatchCtrl* LightColorSwatch = self->getChild<LLColorSwatchCtrl>("colorswatch"); | 477 | LLColorSwatchCtrl* LightColorSwatch = self->getChild<LLColorSwatchCtrl>("colorswatch"); |
561 | if(LightColorSwatch) | 478 | if(LightColorSwatch) |
562 | { | 479 | { |
563 | LLColor4 clr = LightColorSwatch->get(); | 480 | LLColor4 clr = LightColorSwatch->get(); |
564 | volobjp->setLightColor(LLColor3(clr)); | 481 | volobjp->setLightColor(LLColor3(clr)); |
565 | } | 482 | } |
566 | |||
567 | LLTextureCtrl* LightTextureCtrl = self->getChild<LLTextureCtrl>("light texture control"); | ||
568 | if(LightTextureCtrl) | ||
569 | { | ||
570 | LLUUID id = LightTextureCtrl->getImageAssetID(); | ||
571 | if (id.notNull()) | ||
572 | { | ||
573 | if (volobjp->getLightTextureID().isNull()) | ||
574 | { //this commit is making this a spot light, set UI to default params | ||
575 | volobjp->setLightTextureID(id); | ||
576 | LLVector3 spot_params = volobjp->getSpotLightParams(); | ||
577 | self->childSetValue("Light FOV", spot_params.mV[0]); | ||
578 | self->childSetValue("Light Focus", spot_params.mV[1]); | ||
579 | self->childSetValue("Light Ambiance", spot_params.mV[2]); | ||
580 | } | ||
581 | else | ||
582 | { //modifying existing params | ||
583 | LLVector3 spot_params; | ||
584 | spot_params.mV[0] = (F32) self->childGetValue("Light FOV").asReal(); | ||
585 | spot_params.mV[1] = (F32) self->childGetValue("Light Focus").asReal(); | ||
586 | spot_params.mV[2] = (F32) self->childGetValue("Light Ambiance").asReal(); | ||
587 | volobjp->setSpotLightParams(spot_params); | ||
588 | } | ||
589 | } | ||
590 | else if (volobjp->getLightTextureID().notNull()) | ||
591 | { //no longer a spot light | ||
592 | volobjp->setLightTextureID(id); | ||
593 | //self->childDisable("Light FOV"); | ||
594 | //self->childDisable("Light Focus"); | ||
595 | //self->childDisable("Light Ambiance"); | ||
596 | } | ||
597 | } | ||
598 | |||
599 | |||
600 | } | 483 | } |
601 | 484 | ||
602 | // static | 485 | // static |
diff --git a/linden/indra/newview/llpanelvolume.h b/linden/indra/newview/llpanelvolume.h index 5d206fc..841880b 100644 --- a/linden/indra/newview/llpanelvolume.h +++ b/linden/indra/newview/llpanelvolume.h | |||
@@ -74,10 +74,6 @@ public: | |||
74 | static void onLightCancelColor(LLUICtrl* ctrl, void* userdata); | 74 | static void onLightCancelColor(LLUICtrl* ctrl, void* userdata); |
75 | static void onLightSelectColor(LLUICtrl* ctrl, void* userdata); | 75 | static void onLightSelectColor(LLUICtrl* ctrl, void* userdata); |
76 | 76 | ||
77 | static void onLightCancelTexture(LLUICtrl* ctrl, void* userdata); | ||
78 | static void onLightSelectTexture(LLUICtrl* ctrl, void* userdata); | ||
79 | |||
80 | |||
81 | protected: | 77 | protected: |
82 | void getState(); | 78 | void getState(); |
83 | 79 | ||
@@ -103,7 +99,6 @@ protected: | |||
103 | */ | 99 | */ |
104 | 100 | ||
105 | LLColor4 mLightSavedColor; | 101 | LLColor4 mLightSavedColor; |
106 | LLUUID mLightSavedTexture; | ||
107 | LLPointer<LLViewerObject> mObject; | 102 | LLPointer<LLViewerObject> mObject; |
108 | LLPointer<LLViewerObject> mRootObject; | 103 | LLPointer<LLViewerObject> mRootObject; |
109 | }; | 104 | }; |
diff --git a/linden/indra/newview/llpostprocess.cpp b/linden/indra/newview/llpostprocess.cpp deleted file mode 100644 index c7d5dad..0000000 --- a/linden/indra/newview/llpostprocess.cpp +++ /dev/null | |||
@@ -1,594 +0,0 @@ | |||
1 | /** | ||
2 | * @file llpostprocess.cpp | ||
3 | * @brief LLPostProcess class implementation | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2007&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2007-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 | #include "llviewerprecompiledheaders.h" | ||
34 | |||
35 | #include "linden_common.h" | ||
36 | |||
37 | #include "llpostprocess.h" | ||
38 | #include "llglslshader.h" | ||
39 | #include "llsdserialize.h" | ||
40 | #include "llrender.h" | ||
41 | |||
42 | #include "llviewershadermgr.h" // KL throwing some includes at postprocess see if we can get the bastard working! | ||
43 | #include "pipeline.h" | ||
44 | #include "llimagegl.h" | ||
45 | |||
46 | |||
47 | |||
48 | LLPostProcess * gPostProcess = NULL; | ||
49 | |||
50 | |||
51 | static const unsigned int NOISE_SIZE = 512; | ||
52 | |||
53 | /// CALCULATING LUMINANCE (Using NTSC lum weights) | ||
54 | /// http://en.wikipedia.org/wiki/Luma_%28video%29 | ||
55 | static const float LUMINANCE_R = 0.299f; | ||
56 | static const float LUMINANCE_G = 0.587f; | ||
57 | static const float LUMINANCE_B = 0.114f; | ||
58 | |||
59 | static const char * const XML_FILENAME = "postprocesseffects.xml"; | ||
60 | |||
61 | LLPostProcess::LLPostProcess(void) : | ||
62 | initialized(false), | ||
63 | mAllEffects(LLSD::emptyMap()), | ||
64 | screenW(1), screenH(1) | ||
65 | { | ||
66 | mSceneRenderTexture = NULL ; | ||
67 | mNoiseTexture = NULL ; | ||
68 | mTempBloomTexture = NULL ; | ||
69 | |||
70 | // Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender. | ||
71 | std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); | ||
72 | LL_DEBUGS2("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL; | ||
73 | |||
74 | llifstream effectsXML(pathName); | ||
75 | |||
76 | if (effectsXML) | ||
77 | { | ||
78 | LLPointer<LLSDParser> parser = new LLSDXMLParser(); | ||
79 | |||
80 | parser->parse(effectsXML, mAllEffects, LLSDSerialize::SIZE_UNLIMITED); | ||
81 | } | ||
82 | |||
83 | if (!mAllEffects.has("default")) | ||
84 | { | ||
85 | LLSD & defaultEffect = (mAllEffects["default"] = LLSD::emptyMap()); | ||
86 | |||
87 | defaultEffect["enable_night_vision"] = LLSD::Boolean(false); | ||
88 | defaultEffect["enable_bloom"] = LLSD::Boolean(false); | ||
89 | defaultEffect["enable_color_filter"] = LLSD::Boolean(false); | ||
90 | |||
91 | /// NVG Defaults | ||
92 | defaultEffect["brightness_multiplier"] = 3.0; | ||
93 | defaultEffect["noise_size"] = 25.0; | ||
94 | defaultEffect["noise_strength"] = 0.4; | ||
95 | |||
96 | // TODO BTest potentially add this to tweaks? | ||
97 | noiseTextureScale = 1.0f; | ||
98 | |||
99 | /// Bloom Defaults | ||
100 | defaultEffect["extract_low"] = 0.95; | ||
101 | defaultEffect["extract_high"] = 1.0; | ||
102 | defaultEffect["bloom_width"] = 2.25; | ||
103 | defaultEffect["bloom_strength"] = 1.5; | ||
104 | |||
105 | /// Color Filter Defaults | ||
106 | defaultEffect["brightness"] = 1.0; | ||
107 | defaultEffect["contrast"] = 1.0; | ||
108 | defaultEffect["saturation"] = 1.0; | ||
109 | |||
110 | LLSD& contrastBase = (defaultEffect["contrast_base"] = LLSD::emptyArray()); | ||
111 | contrastBase.append(1.0); | ||
112 | contrastBase.append(1.0); | ||
113 | contrastBase.append(1.0); | ||
114 | contrastBase.append(0.5); | ||
115 | } | ||
116 | |||
117 | setSelectedEffect("default"); | ||
118 | |||
119 | } | ||
120 | |||
121 | LLPostProcess::~LLPostProcess(void) | ||
122 | { | ||
123 | invalidate() ; | ||
124 | } | ||
125 | |||
126 | // static | ||
127 | void LLPostProcess::initClass(void) | ||
128 | { | ||
129 | //this will cause system to crash at second time login | ||
130 | //if first time login fails due to network connection --- bao | ||
131 | //***llassert_always(gPostProcess == NULL); | ||
132 | //replaced by the following line: | ||
133 | if(gPostProcess) | ||
134 | return ; | ||
135 | |||
136 | |||
137 | gPostProcess = new LLPostProcess(); | ||
138 | } | ||
139 | |||
140 | // static | ||
141 | void LLPostProcess::cleanupClass() | ||
142 | { | ||
143 | delete gPostProcess; | ||
144 | gPostProcess = NULL; | ||
145 | } | ||
146 | |||
147 | void LLPostProcess::setSelectedEffect(std::string const & effectName) | ||
148 | { | ||
149 | mSelectedEffectName = effectName; | ||
150 | static_cast<LLSD &>(tweaks) = mAllEffects[effectName]; | ||
151 | } | ||
152 | |||
153 | void LLPostProcess::saveEffect(std::string const & effectName) | ||
154 | { | ||
155 | // Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender. | ||
156 | mAllEffects[effectName] = tweaks; | ||
157 | |||
158 | std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); | ||
159 | //llinfos << "Saving PostProcess Effects settings to " << pathName << llendl; | ||
160 | |||
161 | llofstream effectsXML(pathName); | ||
162 | |||
163 | LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter(); | ||
164 | |||
165 | formatter->format(mAllEffects, effectsXML); | ||
166 | |||
167 | } | ||
168 | void LLPostProcess::invalidate() | ||
169 | { | ||
170 | mSceneRenderTexture = NULL ; | ||
171 | mNoiseTexture = NULL ; | ||
172 | mTempBloomTexture = NULL ; | ||
173 | initialized = FALSE ; | ||
174 | } | ||
175 | |||
176 | void LLPostProcess::apply(unsigned int width, unsigned int height) | ||
177 | { | ||
178 | if (!initialized || width != screenW || height != screenH){ | ||
179 | initialize(width, height); | ||
180 | } | ||
181 | if (shadersEnabled()){ | ||
182 | doEffects(); | ||
183 | } | ||
184 | } | ||
185 | |||
186 | void LLPostProcess::initialize(unsigned int width, unsigned int height) | ||
187 | { | ||
188 | screenW = width; | ||
189 | screenH = height; | ||
190 | createTexture(mSceneRenderTexture, screenW, screenH); | ||
191 | initialized = true; | ||
192 | |||
193 | checkError(); | ||
194 | createNightVisionShader(); | ||
195 | createBloomShader(); | ||
196 | createColorFilterShader(); | ||
197 | checkError(); | ||
198 | } | ||
199 | |||
200 | inline bool LLPostProcess::shadersEnabled(void) | ||
201 | { | ||
202 | return (tweaks.useColorFilter().asBoolean() || | ||
203 | tweaks.useNightVisionShader().asBoolean() || | ||
204 | tweaks.useBloomShader().asBoolean() ); | ||
205 | |||
206 | } | ||
207 | |||
208 | void LLPostProcess::applyShaders(void) | ||
209 | { | ||
210 | if (tweaks.useColorFilter()){ | ||
211 | applyColorFilterShader(); | ||
212 | checkError(); | ||
213 | } | ||
214 | if (tweaks.useNightVisionShader()){ | ||
215 | /// If any of the above shaders have been called update the frame buffer; | ||
216 | if (tweaks.useColorFilter()) | ||
217 | { | ||
218 | U32 tex = mSceneRenderTexture->getTexName() ; | ||
219 | copyFrameBuffer(tex, screenW, screenH); | ||
220 | } | ||
221 | applyNightVisionShader(); | ||
222 | checkError(); | ||
223 | } | ||
224 | if (tweaks.useBloomShader()){ | ||
225 | /// If any of the above shaders have been called update the frame buffer; | ||
226 | if (tweaks.useColorFilter().asBoolean() || tweaks.useNightVisionShader().asBoolean()) | ||
227 | { | ||
228 | U32 tex = mSceneRenderTexture->getTexName() ; | ||
229 | copyFrameBuffer(tex, screenW, screenH); | ||
230 | } | ||
231 | applyBloomShader(); | ||
232 | checkError(); | ||
233 | } | ||
234 | } | ||
235 | |||
236 | void LLPostProcess::applyColorFilterShader(void) | ||
237 | { | ||
238 | // Do nothing. moved back to newview work in progress KL | ||
239 | gPostColorFilterProgram.bind(); | ||
240 | |||
241 | gGL.getTexUnit(0)->activate(); | ||
242 | gGL.getTexUnit(0)->enable(LLTexUnit::TT_RECT_TEXTURE); | ||
243 | |||
244 | U32 tex = mSceneRenderTexture->getTexName() ; // KL | ||
245 | |||
246 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, tex); | ||
247 | |||
248 | getShaderUniforms(colorFilterUniforms, gPostColorFilterProgram.mProgramObject); | ||
249 | glUniform1iARB(colorFilterUniforms["RenderTexture"], 0); | ||
250 | glUniform1fARB(colorFilterUniforms["brightness"], tweaks.getBrightness()); | ||
251 | glUniform1fARB(colorFilterUniforms["contrast"], tweaks.getContrast()); | ||
252 | float baseI = (tweaks.getContrastBaseR() + tweaks.getContrastBaseG() + tweaks.getContrastBaseB()) / 3.0f; | ||
253 | baseI = tweaks.getContrastBaseIntensity() / ((baseI < 0.001f) ? 0.001f : baseI); | ||
254 | float baseR = tweaks.getContrastBaseR() * baseI; | ||
255 | float baseG = tweaks.getContrastBaseG() * baseI; | ||
256 | float baseB = tweaks.getContrastBaseB() * baseI; | ||
257 | glUniform3fARB(colorFilterUniforms["contrastBase"], baseR, baseG, baseB); | ||
258 | glUniform1fARB(colorFilterUniforms["saturation"], tweaks.getSaturation()); | ||
259 | glUniform3fARB(colorFilterUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B); | ||
260 | |||
261 | LLGLEnable blend(GL_BLEND); | ||
262 | gGL.setSceneBlendType(LLRender::BT_REPLACE); | ||
263 | LLGLDepthTest depth(GL_FALSE); | ||
264 | |||
265 | /// Draw a screen space quad | ||
266 | drawOrthoQuad(screenW, screenH, QUAD_NORMAL); | ||
267 | gPostColorFilterProgram.unbind(); | ||
268 | |||
269 | } | ||
270 | |||
271 | void LLPostProcess::createColorFilterShader(void) | ||
272 | { | ||
273 | /// Define uniform names | ||
274 | colorFilterUniforms["RenderTexture"] = 0; | ||
275 | colorFilterUniforms["brightness"] = 0; | ||
276 | colorFilterUniforms["contrast"] = 0; | ||
277 | colorFilterUniforms["contrastBase"] = 0; | ||
278 | colorFilterUniforms["saturation"] = 0; | ||
279 | colorFilterUniforms["lumWeights"] = 0; | ||
280 | } | ||
281 | |||
282 | void LLPostProcess::applyNightVisionShader(void) | ||
283 | { | ||
284 | // KL re-enabled and moved back to newview | ||
285 | gPostNightVisionProgram.bind(); | ||
286 | |||
287 | gGL.getTexUnit(0)->activate(); | ||
288 | gGL.getTexUnit(0)->enable(LLTexUnit::TT_RECT_TEXTURE); | ||
289 | |||
290 | getShaderUniforms(nightVisionUniforms, gPostNightVisionProgram.mProgramObject); | ||
291 | U32 sceneRenderTexture = mSceneRenderTexture->getTexName() ; // KL | ||
292 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, sceneRenderTexture); | ||
293 | glUniform1iARB(nightVisionUniforms["RenderTexture"], 0); | ||
294 | |||
295 | gGL.getTexUnit(1)->activate(); | ||
296 | gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); | ||
297 | U32 noiseTexture = mNoiseTexture->getTexName(); //KL | ||
298 | gGL.getTexUnit(1)->bindManual(LLTexUnit::TT_TEXTURE, noiseTexture); | ||
299 | glUniform1iARB(nightVisionUniforms["NoiseTexture"], 1); | ||
300 | |||
301 | |||
302 | glUniform1fARB(nightVisionUniforms["brightMult"], tweaks.getBrightMult()); | ||
303 | glUniform1fARB(nightVisionUniforms["noiseStrength"], tweaks.getNoiseStrength()); | ||
304 | noiseTextureScale = 0.01f + ((101.f - tweaks.getNoiseSize()) / 100.f); | ||
305 | noiseTextureScale *= (screenH / NOISE_SIZE); | ||
306 | |||
307 | |||
308 | glUniform3fARB(nightVisionUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B); | ||
309 | |||
310 | LLGLEnable blend(GL_BLEND); | ||
311 | gGL.setSceneBlendType(LLRender::BT_REPLACE); | ||
312 | LLGLDepthTest depth(GL_FALSE); | ||
313 | |||
314 | /// Draw a screen space quad | ||
315 | drawOrthoQuad(screenW, screenH, QUAD_NOISE); | ||
316 | gPostNightVisionProgram.unbind(); | ||
317 | gGL.getTexUnit(0)->activate(); | ||
318 | |||
319 | } | ||
320 | |||
321 | void LLPostProcess::createNightVisionShader(void) | ||
322 | { | ||
323 | /// Define uniform names | ||
324 | nightVisionUniforms["RenderTexture"] = 0; | ||
325 | nightVisionUniforms["NoiseTexture"] = 0; | ||
326 | nightVisionUniforms["brightMult"] = 0; | ||
327 | nightVisionUniforms["noiseStrength"] = 0; | ||
328 | nightVisionUniforms["lumWeights"] = 0; | ||
329 | |||
330 | createNoiseTexture(mNoiseTexture); | ||
331 | } | ||
332 | |||
333 | void LLPostProcess::applyBloomShader(void) | ||
334 | { | ||
335 | |||
336 | } | ||
337 | |||
338 | void LLPostProcess::createBloomShader(void) | ||
339 | { | ||
340 | createTexture(mTempBloomTexture, unsigned(screenW * 0.5), unsigned(screenH * 0.5)); | ||
341 | |||
342 | /// Create Bloom Extract Shader | ||
343 | bloomExtractUniforms["RenderTexture"] = 0; | ||
344 | bloomExtractUniforms["extractLow"] = 0; | ||
345 | bloomExtractUniforms["extractHigh"] = 0; | ||
346 | bloomExtractUniforms["lumWeights"] = 0; | ||
347 | |||
348 | /// Create Bloom Blur Shader | ||
349 | bloomBlurUniforms["RenderTexture"] = 0; | ||
350 | bloomBlurUniforms["bloomStrength"] = 0; | ||
351 | bloomBlurUniforms["texelSize"] = 0; | ||
352 | bloomBlurUniforms["blurDirection"] = 0; | ||
353 | bloomBlurUniforms["blurWidth"] = 0; | ||
354 | } | ||
355 | |||
356 | void LLPostProcess::getShaderUniforms(glslUniforms & uniforms, GLhandleARB & prog) | ||
357 | { | ||
358 | /// Find uniform locations and insert into map | ||
359 | std::map<const char *, GLuint>::iterator i; | ||
360 | for (i = uniforms.begin(); i != uniforms.end(); ++i){ | ||
361 | i->second = glGetUniformLocationARB(prog, i->first); | ||
362 | } | ||
363 | } | ||
364 | |||
365 | void LLPostProcess::doEffects(void) | ||
366 | { | ||
367 | /// Save GL State | ||
368 | glPushAttrib(GL_ALL_ATTRIB_BITS); | ||
369 | glPushClientAttrib(GL_ALL_ATTRIB_BITS); | ||
370 | |||
371 | /// Copy the screen buffer to the render texture | ||
372 | { | ||
373 | U32 tex = mSceneRenderTexture->getTexName() ; | ||
374 | copyFrameBuffer(tex, screenW, screenH); | ||
375 | } | ||
376 | |||
377 | /// Clear the frame buffer. | ||
378 | glClearColor(0.0f, 0.0f, 0.0f, 1.0f); | ||
379 | glClear(GL_COLOR_BUFFER_BIT); | ||
380 | |||
381 | /// Change to an orthogonal view | ||
382 | viewOrthogonal(screenW, screenH); | ||
383 | |||
384 | checkError(); | ||
385 | applyShaders(); | ||
386 | |||
387 | LLGLSLShader::bindNoShader(); | ||
388 | checkError(); | ||
389 | |||
390 | /// Change to a perspective view | ||
391 | viewPerspective(); | ||
392 | |||
393 | /// Reset GL State | ||
394 | glPopClientAttrib(); | ||
395 | glPopAttrib(); | ||
396 | checkError(); | ||
397 | } | ||
398 | |||
399 | void LLPostProcess::copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height) | ||
400 | { | ||
401 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, texture); | ||
402 | glCopyTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, 0, 0, width, height, 0); | ||
403 | } | ||
404 | |||
405 | void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadType type) | ||
406 | { | ||
407 | |||
408 | float noiseX = 0.f; | ||
409 | float noiseY = 0.f; | ||
410 | float screenRatio = 1.0f; | ||
411 | |||
412 | if (type == QUAD_NOISE){ | ||
413 | noiseX = ((float) rand() / (float) RAND_MAX); | ||
414 | noiseY = ((float) rand() / (float) RAND_MAX); | ||
415 | screenRatio = (float) width / (float) height; | ||
416 | } | ||
417 | |||
418 | |||
419 | glBegin(GL_QUADS); | ||
420 | if (type != QUAD_BLOOM_EXTRACT){ | ||
421 | glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, (GLfloat) height); | ||
422 | } else { | ||
423 | glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, (GLfloat) height * 2.0f); | ||
424 | } | ||
425 | if (type == QUAD_NOISE){ | ||
426 | glMultiTexCoord2fARB(GL_TEXTURE1_ARB, | ||
427 | noiseX, | ||
428 | noiseTextureScale + noiseY); | ||
429 | } else if (type == QUAD_BLOOM_COMBINE){ | ||
430 | glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.f, (GLfloat) height * 0.5f); | ||
431 | } | ||
432 | glVertex2f(0.f, (GLfloat) screenH - height); | ||
433 | |||
434 | if (type != QUAD_BLOOM_EXTRACT){ | ||
435 | glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, 0.f); | ||
436 | } else { | ||
437 | glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, 0.f); | ||
438 | } | ||
439 | if (type == QUAD_NOISE){ | ||
440 | glMultiTexCoord2fARB(GL_TEXTURE1_ARB, | ||
441 | noiseX, | ||
442 | noiseY); | ||
443 | } else if (type == QUAD_BLOOM_COMBINE){ | ||
444 | glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.f, 0.f); | ||
445 | } | ||
446 | glVertex2f(0.f, (GLfloat) height + (screenH - height)); | ||
447 | |||
448 | |||
449 | if (type != QUAD_BLOOM_EXTRACT){ | ||
450 | glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width, 0.f); | ||
451 | } else { | ||
452 | glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width * 2.0f, 0.f); | ||
453 | } | ||
454 | if (type == QUAD_NOISE){ | ||
455 | glMultiTexCoord2fARB(GL_TEXTURE1_ARB, | ||
456 | screenRatio * noiseTextureScale + noiseX, | ||
457 | noiseY); | ||
458 | } else if (type == QUAD_BLOOM_COMBINE){ | ||
459 | glMultiTexCoord2fARB(GL_TEXTURE1_ARB, (GLfloat) width * 0.5f, 0.f); | ||
460 | } | ||
461 | glVertex2f((GLfloat) width, (GLfloat) height + (screenH - height)); | ||
462 | |||
463 | |||
464 | if (type != QUAD_BLOOM_EXTRACT){ | ||
465 | glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width, (GLfloat) height); | ||
466 | } else { | ||
467 | glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width * 2.0f, (GLfloat) height * 2.0f); | ||
468 | } | ||
469 | if (type == QUAD_NOISE){ | ||
470 | glMultiTexCoord2fARB(GL_TEXTURE1_ARB, | ||
471 | screenRatio * noiseTextureScale + noiseX, | ||
472 | noiseTextureScale + noiseY); | ||
473 | } else if (type == QUAD_BLOOM_COMBINE){ | ||
474 | glMultiTexCoord2fARB(GL_TEXTURE1_ARB, (GLfloat) width * 0.5f, (GLfloat) height * 0.5f); | ||
475 | } | ||
476 | glVertex2f((GLfloat) width, (GLfloat) screenH - height); | ||
477 | glEnd(); | ||
478 | |||
479 | } | ||
480 | |||
481 | void LLPostProcess::viewOrthogonal(unsigned int width, unsigned int height) | ||
482 | { | ||
483 | glMatrixMode(GL_PROJECTION); | ||
484 | glPushMatrix(); | ||
485 | glLoadIdentity(); | ||
486 | glOrtho( 0.f, (GLdouble) width , (GLdouble) height , 0.f, -1.f, 1.f ); | ||
487 | glMatrixMode(GL_MODELVIEW); | ||
488 | glPushMatrix(); | ||
489 | glLoadIdentity(); | ||
490 | } | ||
491 | |||
492 | void LLPostProcess::viewPerspective(void) | ||
493 | { | ||
494 | glMatrixMode( GL_PROJECTION ); | ||
495 | glPopMatrix(); | ||
496 | glMatrixMode( GL_MODELVIEW ); | ||
497 | glPopMatrix(); | ||
498 | } | ||
499 | |||
500 | void LLPostProcess::changeOrthogonal(unsigned int width, unsigned int height) | ||
501 | { | ||
502 | viewPerspective(); | ||
503 | viewOrthogonal(width, height); | ||
504 | } | ||
505 | |||
506 | void LLPostProcess::createTexture(LLPointer<LLImageGL>& texture, unsigned int width, unsigned int height) | ||
507 | { | ||
508 | std::vector<GLubyte> data(width * height * 4, 0) ; | ||
509 | |||
510 | texture = new LLImageGL(FALSE) ; | ||
511 | if(texture->createGLTexture()) | ||
512 | { | ||
513 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, texture->getTexName()); | ||
514 | glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 4, width, height, 0, | ||
515 | GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); | ||
516 | gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); | ||
517 | gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); | ||
518 | } | ||
519 | } | ||
520 | |||
521 | void LLPostProcess::createNoiseTexture(LLPointer<LLImageGL>& texture) | ||
522 | { | ||
523 | std::vector<GLubyte> buffer(NOISE_SIZE * NOISE_SIZE); | ||
524 | for (unsigned int i = 0; i < NOISE_SIZE; i++){ | ||
525 | for (unsigned int k = 0; k < NOISE_SIZE; k++){ | ||
526 | buffer[(i * NOISE_SIZE) + k] = (GLubyte)((double) rand() / ((double) RAND_MAX + 1.f) * 255.f); | ||
527 | } | ||
528 | } | ||
529 | |||
530 | texture = new LLImageGL(FALSE) ; | ||
531 | if(texture->createGLTexture()) | ||
532 | { | ||
533 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, texture->getTexName()); | ||
534 | LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_LUMINANCE, NOISE_SIZE, NOISE_SIZE, GL_LUMINANCE, GL_UNSIGNED_BYTE, &buffer[0]); | ||
535 | gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); | ||
536 | gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP); | ||
537 | } | ||
538 | } | ||
539 | |||
540 | bool LLPostProcess::checkError(void) | ||
541 | { | ||
542 | GLenum glErr; | ||
543 | bool retCode = false; | ||
544 | |||
545 | glErr = glGetError(); | ||
546 | while (glErr != GL_NO_ERROR) | ||
547 | { | ||
548 | // shaderErrorLog << (const char *) gluErrorString(glErr) << std::endl; | ||
549 | char const * err_str_raw = (const char *) gluErrorString(glErr); | ||
550 | |||
551 | if(err_str_raw == NULL) | ||
552 | { | ||
553 | std::ostringstream err_builder; | ||
554 | err_builder << "unknown error number " << glErr; | ||
555 | mShaderErrorString = err_builder.str(); | ||
556 | } | ||
557 | else | ||
558 | { | ||
559 | mShaderErrorString = err_str_raw; | ||
560 | } | ||
561 | |||
562 | retCode = true; | ||
563 | glErr = glGetError(); | ||
564 | } | ||
565 | return retCode; | ||
566 | } | ||
567 | |||
568 | void LLPostProcess::checkShaderError(GLhandleARB shader) | ||
569 | { | ||
570 | GLint infologLength = 0; | ||
571 | GLint charsWritten = 0; | ||
572 | GLchar *infoLog; | ||
573 | |||
574 | checkError(); // Check for OpenGL errors | ||
575 | |||
576 | glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &infologLength); | ||
577 | |||
578 | checkError(); // Check for OpenGL errors | ||
579 | |||
580 | if (infologLength > 0) | ||
581 | { | ||
582 | infoLog = (GLchar *)malloc(infologLength); | ||
583 | if (infoLog == NULL) | ||
584 | { | ||
585 | /// Could not allocate infolog buffer | ||
586 | return; | ||
587 | } | ||
588 | glGetInfoLogARB(shader, infologLength, &charsWritten, infoLog); | ||
589 | // shaderErrorLog << (char *) infoLog << std::endl; | ||
590 | mShaderErrorString = (char *) infoLog; | ||
591 | free(infoLog); | ||
592 | } | ||
593 | checkError(); // Check for OpenGL errors | ||
594 | } \ No newline at end of file | ||
diff --git a/linden/indra/newview/llpostprocess.h b/linden/indra/newview/llpostprocess.h deleted file mode 100644 index d6926e4..0000000 --- a/linden/indra/newview/llpostprocess.h +++ /dev/null | |||
@@ -1,274 +0,0 @@ | |||
1 | /** | ||
2 | * @file llpostprocess.h | ||
3 | * @brief LLPostProcess class definition | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2007&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2007-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_POSTPROCESS_H | ||
34 | #define LL_POSTPROCESS_H | ||
35 | |||
36 | #include <map> | ||
37 | #include <fstream> | ||
38 | #include "llgl.h" | ||
39 | #include "llglheaders.h" | ||
40 | |||
41 | class LLPostProcess | ||
42 | { | ||
43 | public: | ||
44 | |||
45 | typedef enum _QuadType { | ||
46 | QUAD_NORMAL, | ||
47 | QUAD_NOISE, | ||
48 | QUAD_BLOOM_EXTRACT, | ||
49 | QUAD_BLOOM_COMBINE | ||
50 | } QuadType; | ||
51 | |||
52 | /// GLSL Shader Encapsulation Struct | ||
53 | typedef std::map<const char *, GLuint> glslUniforms; | ||
54 | |||
55 | struct PostProcessTweaks : public LLSD { | ||
56 | inline PostProcessTweaks() : LLSD(LLSD::emptyMap()) | ||
57 | { | ||
58 | } | ||
59 | |||
60 | inline LLSD & brightMult() { | ||
61 | return (*this)["brightness_multiplier"]; | ||
62 | } | ||
63 | |||
64 | inline LLSD & noiseStrength() { | ||
65 | return (*this)["noise_strength"]; | ||
66 | } | ||
67 | |||
68 | inline LLSD & noiseSize() { | ||
69 | return (*this)["noise_size"]; | ||
70 | } | ||
71 | |||
72 | inline LLSD & extractLow() { | ||
73 | return (*this)["extract_low"]; | ||
74 | } | ||
75 | |||
76 | inline LLSD & extractHigh() { | ||
77 | return (*this)["extract_high"]; | ||
78 | } | ||
79 | |||
80 | inline LLSD & bloomWidth() { | ||
81 | return (*this)["bloom_width"]; | ||
82 | } | ||
83 | |||
84 | inline LLSD & bloomStrength() { | ||
85 | return (*this)["bloom_strength"]; | ||
86 | } | ||
87 | |||
88 | inline LLSD & brightness() { | ||
89 | return (*this)["brightness"]; | ||
90 | } | ||
91 | |||
92 | inline LLSD & contrast() { | ||
93 | return (*this)["contrast"]; | ||
94 | } | ||
95 | |||
96 | inline LLSD & contrastBaseR() { | ||
97 | return (*this)["contrast_base"][0]; | ||
98 | } | ||
99 | |||
100 | inline LLSD & contrastBaseG() { | ||
101 | return (*this)["contrast_base"][1]; | ||
102 | } | ||
103 | |||
104 | inline LLSD & contrastBaseB() { | ||
105 | return (*this)["contrast_base"][2]; | ||
106 | } | ||
107 | |||
108 | inline LLSD & contrastBaseIntensity() { | ||
109 | return (*this)["contrast_base"][3]; | ||
110 | } | ||
111 | |||
112 | inline LLSD & saturation() { | ||
113 | return (*this)["saturation"]; | ||
114 | } | ||
115 | |||
116 | inline LLSD & useNightVisionShader() { | ||
117 | return (*this)["enable_night_vision"]; | ||
118 | } | ||
119 | |||
120 | inline LLSD & useBloomShader() { | ||
121 | return (*this)["enable_bloom"]; | ||
122 | } | ||
123 | |||
124 | inline LLSD & useColorFilter() { | ||
125 | return (*this)["enable_color_filter"]; | ||
126 | } | ||
127 | |||
128 | |||
129 | inline F32 getBrightMult() const { | ||
130 | return F32((*this)["brightness_multiplier"].asReal()); | ||
131 | } | ||
132 | |||
133 | inline F32 getNoiseStrength() const { | ||
134 | return F32((*this)["noise_strength"].asReal()); | ||
135 | } | ||
136 | |||
137 | inline F32 getNoiseSize() const { | ||
138 | return F32((*this)["noise_size"].asReal()); | ||
139 | } | ||
140 | |||
141 | inline F32 getExtractLow() const { | ||
142 | return F32((*this)["extract_low"].asReal()); | ||
143 | } | ||
144 | |||
145 | inline F32 getExtractHigh() const { | ||
146 | return F32((*this)["extract_high"].asReal()); | ||
147 | } | ||
148 | |||
149 | inline F32 getBloomWidth() const { | ||
150 | return F32((*this)["bloom_width"].asReal()); | ||
151 | } | ||
152 | |||
153 | inline F32 getBloomStrength() const { | ||
154 | return F32((*this)["bloom_strength"].asReal()); | ||
155 | } | ||
156 | |||
157 | inline F32 getBrightness() const { | ||
158 | return F32((*this)["brightness"].asReal()); | ||
159 | } | ||
160 | |||
161 | inline F32 getContrast() const { | ||
162 | return F32((*this)["contrast"].asReal()); | ||
163 | } | ||
164 | |||
165 | inline F32 getContrastBaseR() const { | ||
166 | return F32((*this)["contrast_base"][0].asReal()); | ||
167 | } | ||
168 | |||
169 | inline F32 getContrastBaseG() const { | ||
170 | return F32((*this)["contrast_base"][1].asReal()); | ||
171 | } | ||
172 | |||
173 | inline F32 getContrastBaseB() const { | ||
174 | return F32((*this)["contrast_base"][2].asReal()); | ||
175 | } | ||
176 | |||
177 | inline F32 getContrastBaseIntensity() const { | ||
178 | return F32((*this)["contrast_base"][3].asReal()); | ||
179 | } | ||
180 | |||
181 | inline F32 getSaturation() const { | ||
182 | return F32((*this)["saturation"].asReal()); | ||
183 | } | ||
184 | |||
185 | }; | ||
186 | |||
187 | bool initialized; | ||
188 | PostProcessTweaks tweaks; | ||
189 | |||
190 | // the map of all availible effects | ||
191 | LLSD mAllEffects; | ||
192 | |||
193 | private: | ||
194 | LLPointer<LLImageGL> mSceneRenderTexture ; | ||
195 | LLPointer<LLImageGL> mNoiseTexture ; | ||
196 | LLPointer<LLImageGL> mTempBloomTexture ; | ||
197 | |||
198 | |||
199 | |||
200 | public: | ||
201 | LLPostProcess(void); | ||
202 | |||
203 | ~LLPostProcess(void); | ||
204 | |||
205 | void apply(unsigned int width, unsigned int height); | ||
206 | void invalidate() ; | ||
207 | |||
208 | /// Perform global initialization for this class. | ||
209 | static void initClass(void); | ||
210 | |||
211 | // Cleanup of global data that's only inited once per class. | ||
212 | static void cleanupClass(); | ||
213 | |||
214 | void setSelectedEffect(std::string const & effectName); | ||
215 | |||
216 | inline std::string const & getSelectedEffect(void) const { | ||
217 | return mSelectedEffectName; | ||
218 | } | ||
219 | |||
220 | void saveEffect(std::string const & effectName); | ||
221 | |||
222 | private: | ||
223 | /// read in from file | ||
224 | std::string mShaderErrorString; | ||
225 | unsigned int screenW; | ||
226 | unsigned int screenH; | ||
227 | |||
228 | float noiseTextureScale; | ||
229 | |||
230 | /// Shader Uniforms | ||
231 | glslUniforms nightVisionUniforms; | ||
232 | glslUniforms bloomExtractUniforms; | ||
233 | glslUniforms bloomBlurUniforms; | ||
234 | glslUniforms colorFilterUniforms; | ||
235 | |||
236 | // the name of currently selected effect in mAllEffects | ||
237 | //invariant: tweaks == mAllEffects[mSelectedEffectName] | ||
238 | std::string mSelectedEffectName; | ||
239 | |||
240 | /// General functions | ||
241 | void initialize(unsigned int width, unsigned int height); | ||
242 | void doEffects(void); | ||
243 | void applyShaders(void); | ||
244 | bool shadersEnabled(void); | ||
245 | |||
246 | /// Night Vision Functions | ||
247 | void createNightVisionShader(void); | ||
248 | void applyNightVisionShader(void); | ||
249 | |||
250 | /// Bloom Functions | ||
251 | void createBloomShader(void); | ||
252 | void applyBloomShader(void); | ||
253 | |||
254 | /// Color Filter Functions | ||
255 | void createColorFilterShader(void); | ||
256 | void applyColorFilterShader(void); | ||
257 | |||
258 | /// OpenGL Helper Functions | ||
259 | void getShaderUniforms(glslUniforms & uniforms, GLhandleARB & prog); | ||
260 | void createTexture(LLPointer<LLImageGL>& texture, unsigned int width, unsigned int height); | ||
261 | void copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height); | ||
262 | void createNoiseTexture(LLPointer<LLImageGL>& texture); | ||
263 | bool checkError(void); | ||
264 | void checkShaderError(GLhandleARB shader); | ||
265 | void drawOrthoQuad(unsigned int width, unsigned int height, QuadType type); | ||
266 | void viewOrthogonal(unsigned int width, unsigned int height); | ||
267 | void changeOrthogonal(unsigned int width, unsigned int height); | ||
268 | void viewPerspective(void); | ||
269 | }; | ||
270 | |||
271 | extern LLPostProcess * gPostProcess; | ||
272 | |||
273 | |||
274 | #endif // LL_POSTPROCESS_H | ||
diff --git a/linden/indra/newview/llpreview.cpp b/linden/indra/newview/llpreview.cpp index 019bd5f..f679a75 100644 --- a/linden/indra/newview/llpreview.cpp +++ b/linden/indra/newview/llpreview.cpp | |||
@@ -641,7 +641,6 @@ void LLPreview::setAssetId(const LLUUID& asset_id) | |||
641 | LLViewerObject* object = gObjectList.findObject(mObjectUUID); | 641 | LLViewerObject* object = gObjectList.findObject(mObjectUUID); |
642 | if(NULL == object) | 642 | if(NULL == object) |
643 | { | 643 | { |
644 | llwarns << "LLPreview::setAssetId() called on unrecognized object, UUID : " << mObjectUUID << llendl; | ||
645 | return; | 644 | return; |
646 | } | 645 | } |
647 | object->updateViewerInventoryAsset(item, asset_id); | 646 | object->updateViewerInventoryAsset(item, asset_id); |
diff --git a/linden/indra/newview/llselectmgr.cpp b/linden/indra/newview/llselectmgr.cpp index 44ac8fd..16f79ec 100644 --- a/linden/indra/newview/llselectmgr.cpp +++ b/linden/indra/newview/llselectmgr.cpp | |||
@@ -766,7 +766,7 @@ void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, BOOL undoab | |||
766 | } | 766 | } |
767 | else | 767 | else |
768 | { | 768 | { |
769 | llwarns << "LLSelectMgr::add face " << face << " out-of-range" << llendl; | 769 | llerrs << "LLSelectMgr::add face " << face << " out-of-range" << llendl; |
770 | return; | 770 | return; |
771 | } | 771 | } |
772 | 772 | ||
@@ -1189,7 +1189,7 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable) | |||
1189 | } | 1189 | } |
1190 | else | 1190 | else |
1191 | { | 1191 | { |
1192 | llwarns << "LLSelectMgr::remove - tried to remove TE " << te << " that wasn't selected" << llendl; | 1192 | llerrs << "LLSelectMgr::remove - tried to remove TE " << te << " that wasn't selected" << llendl; |
1193 | return; | 1193 | return; |
1194 | } | 1194 | } |
1195 | 1195 | ||
@@ -1212,7 +1212,7 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable) | |||
1212 | else | 1212 | else |
1213 | { | 1213 | { |
1214 | // ...out of range face | 1214 | // ...out of range face |
1215 | llwarns << "LLSelectMgr::remove - TE " << te << " out of range" << llendl; | 1215 | llerrs << "LLSelectMgr::remove - TE " << te << " out of range" << llendl; |
1216 | } | 1216 | } |
1217 | 1217 | ||
1218 | updateSelectionCenter(); | 1218 | updateSelectionCenter(); |
@@ -1711,7 +1711,7 @@ void LLSelectMgr::selectionSetFullbright(U8 fullbright) | |||
1711 | } sendfunc(fullbright); | 1711 | } sendfunc(fullbright); |
1712 | getSelection()->applyToObjects(&sendfunc); | 1712 | getSelection()->applyToObjects(&sendfunc); |
1713 | } | 1713 | } |
1714 | /* | 1714 | |
1715 | void LLSelectMgr::selectionSetMediaTypeAndURL(U8 media_type, const std::string& media_url) | 1715 | void LLSelectMgr::selectionSetMediaTypeAndURL(U8 media_type, const std::string& media_url) |
1716 | { | 1716 | { |
1717 | U8 media_flags = LLTextureEntry::MF_NONE; | 1717 | U8 media_flags = LLTextureEntry::MF_NONE; |
@@ -1754,7 +1754,7 @@ void LLSelectMgr::selectionSetMediaTypeAndURL(U8 media_type, const std::string& | |||
1754 | } sendfunc(media_type, media_url); | 1754 | } sendfunc(media_type, media_url); |
1755 | getSelection()->applyToObjects(&sendfunc); | 1755 | getSelection()->applyToObjects(&sendfunc); |
1756 | } | 1756 | } |
1757 | */ | 1757 | |
1758 | void LLSelectMgr::selectionSetGlow(F32 glow) | 1758 | void LLSelectMgr::selectionSetGlow(F32 glow) |
1759 | { | 1759 | { |
1760 | struct f1 : public LLSelectedTEFunctor | 1760 | struct f1 : public LLSelectedTEFunctor |
@@ -3359,7 +3359,7 @@ void LLSelectMgr::packPermissionsHead(void* user_data) | |||
3359 | /* | 3359 | /* |
3360 | void LLSelectMgr::sendSelect() | 3360 | void LLSelectMgr::sendSelect() |
3361 | { | 3361 | { |
3362 | llwarns << "Not implemented" << llendl; | 3362 | llerrs << "Not implemented" << llendl; |
3363 | } | 3363 | } |
3364 | */ | 3364 | */ |
3365 | 3365 | ||
@@ -4183,7 +4183,7 @@ void LLSelectMgr::sendListToRegions(const std::string& message_name, | |||
4183 | break; | 4183 | break; |
4184 | 4184 | ||
4185 | default: | 4185 | default: |
4186 | llwarns << "Bad send type " << send_type << " passed to SendListToRegions()" << llendl; | 4186 | llerrs << "Bad send type " << send_type << " passed to SendListToRegions()" << llendl; |
4187 | } | 4187 | } |
4188 | 4188 | ||
4189 | // bail if nothing selected | 4189 | // bail if nothing selected |
@@ -4590,6 +4590,11 @@ extern LLGLdouble gGLModelView[16]; | |||
4590 | 4590 | ||
4591 | void LLSelectMgr::updateSilhouettes() | 4591 | void LLSelectMgr::updateSilhouettes() |
4592 | { | 4592 | { |
4593 | if (!mRenderSilhouettes || !LLSelectMgr::sRenderSelectionHighlights) | ||
4594 | { | ||
4595 | return; | ||
4596 | } | ||
4597 | |||
4593 | S32 num_sils_genned = 0; | 4598 | S32 num_sils_genned = 0; |
4594 | 4599 | ||
4595 | LLVector3d cameraPos = gAgent.getCameraPositionGlobal(); | 4600 | LLVector3d cameraPos = gAgent.getCameraPositionGlobal(); |
@@ -5803,7 +5808,8 @@ BOOL LLSelectMgr::canSelectObject(LLViewerObject* object) | |||
5803 | } | 5808 | } |
5804 | 5809 | ||
5805 | if ((gSavedSettings.getBOOL("SelectOwnedOnly") && !object->permYouOwner()) || | 5810 | if ((gSavedSettings.getBOOL("SelectOwnedOnly") && !object->permYouOwner()) || |
5806 | (gSavedSettings.getBOOL("SelectMovableOnly") && !object->permMove())) | 5811 | (gSavedSettings.getBOOL("SelectMovableOnly") && !object->permMove()) || |
5812 | (gSavedSettings.getBOOL("SelectCopyableOnly") && !object->permCopy())) | ||
5807 | { | 5813 | { |
5808 | // only select my own objects | 5814 | // only select my own objects |
5809 | return FALSE; | 5815 | return FALSE; |
diff --git a/linden/indra/newview/llselectmgr.h b/linden/indra/newview/llselectmgr.h index 0c57f7b..c19d33d 100644 --- a/linden/indra/newview/llselectmgr.h +++ b/linden/indra/newview/llselectmgr.h | |||
@@ -503,7 +503,7 @@ public: | |||
503 | void selectionSetTexGen( U8 texgen ); | 503 | void selectionSetTexGen( U8 texgen ); |
504 | void selectionSetShiny( U8 shiny ); | 504 | void selectionSetShiny( U8 shiny ); |
505 | void selectionSetFullbright( U8 fullbright ); | 505 | void selectionSetFullbright( U8 fullbright ); |
506 | // void selectionSetMediaTypeAndURL( U8 media_type, const std::string& media_url ); | 506 | void selectionSetMediaTypeAndURL( U8 media_type, const std::string& media_url ); |
507 | void selectionSetClickAction(U8 action); | 507 | void selectionSetClickAction(U8 action); |
508 | void selectionSetIncludeInSearch(bool include_in_search); | 508 | void selectionSetIncludeInSearch(bool include_in_search); |
509 | void selectionSetGlow(const F32 glow); | 509 | void selectionSetGlow(const F32 glow); |
diff --git a/linden/indra/newview/llsky.cpp b/linden/indra/newview/llsky.cpp index b779aa0..ac7e865 100644 --- a/linden/indra/newview/llsky.cpp +++ b/linden/indra/newview/llsky.cpp | |||
@@ -422,20 +422,6 @@ void LLSky::updateFog(const F32 distance) | |||
422 | 422 | ||
423 | void LLSky::updateCull() | 423 | void LLSky::updateCull() |
424 | { | 424 | { |
425 | /*if (mVOSkyp.notNull() && mVOSkyp->mDrawable.notNull()) | ||
426 | { | ||
427 | gPipeline.markVisible(mVOSkyp->mDrawable); | ||
428 | } | ||
429 | else | ||
430 | { | ||
431 | llinfos << "No sky drawable!" << llendl; | ||
432 | }*/ | ||
433 | |||
434 | /*if (mVOGroundp.notNull() && mVOGroundp->mDrawable.notNull()) | ||
435 | { | ||
436 | gPipeline.markVisible(mVOGroundp->mDrawable); | ||
437 | }*/ | ||
438 | |||
439 | // *TODO: do culling for wl sky properly -Brad | 425 | // *TODO: do culling for wl sky properly -Brad |
440 | } | 426 | } |
441 | 427 | ||
diff --git a/linden/indra/newview/llspatialpartition.cpp b/linden/indra/newview/llspatialpartition.cpp index 34ed292..c1d5ff3 100644 --- a/linden/indra/newview/llspatialpartition.cpp +++ b/linden/indra/newview/llspatialpartition.cpp | |||
@@ -48,7 +48,6 @@ | |||
48 | #include "llrender.h" | 48 | #include "llrender.h" |
49 | #include "lloctree.h" | 49 | #include "lloctree.h" |
50 | #include "llvoavatar.h" | 50 | #include "llvoavatar.h" |
51 | #include "lltextureatlas.h" | ||
52 | 51 | ||
53 | const F32 SG_OCCLUSION_FUDGE = 0.25f; | 52 | const F32 SG_OCCLUSION_FUDGE = 0.25f; |
54 | #define SG_DISCARD_TOLERANCE 0.01f | 53 | #define SG_DISCARD_TOLERANCE 0.01f |
@@ -96,7 +95,7 @@ void sg_assert(BOOL expr) | |||
96 | #if LL_OCTREE_PARANOIA_CHECK | 95 | #if LL_OCTREE_PARANOIA_CHECK |
97 | if (!expr) | 96 | if (!expr) |
98 | { | 97 | { |
99 | llwarns << "Octree invalid!" << llendl; | 98 | llerrs << "Octree invalid!" << llendl; |
100 | } | 99 | } |
101 | #endif | 100 | #endif |
102 | } | 101 | } |
@@ -282,10 +281,10 @@ S32 LLSphereAABB(const LLVector3& center, const LLVector3& size, const LLVector3 | |||
282 | 281 | ||
283 | LLSpatialGroup::~LLSpatialGroup() | 282 | LLSpatialGroup::~LLSpatialGroup() |
284 | { | 283 | { |
285 | /*if (sNoDelete) | 284 | if (sNoDelete) |
286 | { | 285 | { |
287 | llwarns << "Illegal deletion of LLSpatialGroup!" << llendl; | 286 | llerrs << "Illegal deletion of LLSpatialGroup!" << llendl; |
288 | }*/ | 287 | } |
289 | 288 | ||
290 | if (isState(DEAD)) | 289 | if (isState(DEAD)) |
291 | { | 290 | { |
@@ -303,129 +302,6 @@ LLSpatialGroup::~LLSpatialGroup() | |||
303 | 302 | ||
304 | LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); | 303 | LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); |
305 | clearDrawMap(); | 304 | clearDrawMap(); |
306 | clearAtlasList() ; | ||
307 | } | ||
308 | |||
309 | BOOL LLSpatialGroup::hasAtlas(LLTextureAtlas* atlasp) | ||
310 | { | ||
311 | S8 type = atlasp->getComponents() - 1 ; | ||
312 | for(std::list<LLTextureAtlas*>::iterator iter = mAtlasList[type].begin(); iter != mAtlasList[type].end() ; ++iter) | ||
313 | { | ||
314 | if(atlasp == *iter) | ||
315 | { | ||
316 | return TRUE ; | ||
317 | } | ||
318 | } | ||
319 | return FALSE ; | ||
320 | } | ||
321 | |||
322 | void LLSpatialGroup::addAtlas(LLTextureAtlas* atlasp, S8 recursive_level) | ||
323 | { | ||
324 | if(!hasAtlas(atlasp)) | ||
325 | { | ||
326 | mAtlasList[atlasp->getComponents() - 1].push_back(atlasp) ; | ||
327 | atlasp->addSpatialGroup(this) ; | ||
328 | } | ||
329 | |||
330 | --recursive_level; | ||
331 | if(recursive_level)//levels propagating up. | ||
332 | { | ||
333 | LLSpatialGroup* parent = getParent() ; | ||
334 | if(parent) | ||
335 | { | ||
336 | parent->addAtlas(atlasp, recursive_level) ; | ||
337 | } | ||
338 | } | ||
339 | } | ||
340 | |||
341 | void LLSpatialGroup::removeAtlas(LLTextureAtlas* atlasp, BOOL remove_group, S8 recursive_level) | ||
342 | { | ||
343 | mAtlasList[atlasp->getComponents() - 1].remove(atlasp) ; | ||
344 | if(remove_group) | ||
345 | { | ||
346 | atlasp->removeSpatialGroup(this) ; | ||
347 | } | ||
348 | |||
349 | --recursive_level; | ||
350 | if(recursive_level)//levels propagating up. | ||
351 | { | ||
352 | LLSpatialGroup* parent = getParent() ; | ||
353 | if(parent) | ||
354 | { | ||
355 | parent->removeAtlas(atlasp, recursive_level) ; | ||
356 | } | ||
357 | } | ||
358 | } | ||
359 | |||
360 | void LLSpatialGroup::clearAtlasList() | ||
361 | { | ||
362 | std::list<LLTextureAtlas*>::iterator iter ; | ||
363 | for(S8 i = 0 ; i < 4 ; i++) | ||
364 | { | ||
365 | if(mAtlasList[i].size() > 0) | ||
366 | { | ||
367 | for(iter = mAtlasList[i].begin(); iter != mAtlasList[i].end() ; ++iter) | ||
368 | { | ||
369 | ((LLTextureAtlas*)*iter)->removeSpatialGroup(this) ; | ||
370 | } | ||
371 | mAtlasList[i].clear() ; | ||
372 | } | ||
373 | } | ||
374 | } | ||
375 | |||
376 | LLTextureAtlas* LLSpatialGroup::getAtlas(S8 ncomponents, S8 to_be_reserved, S8 recursive_level) | ||
377 | { | ||
378 | S8 type = ncomponents - 1 ; | ||
379 | if(mAtlasList[type].size() > 0) | ||
380 | { | ||
381 | for(std::list<LLTextureAtlas*>::iterator iter = mAtlasList[type].begin(); iter != mAtlasList[type].end() ; ++iter) | ||
382 | { | ||
383 | if(!((LLTextureAtlas*)*iter)->isFull(to_be_reserved)) | ||
384 | { | ||
385 | return *iter ; | ||
386 | } | ||
387 | } | ||
388 | } | ||
389 | |||
390 | --recursive_level; | ||
391 | if(recursive_level) | ||
392 | { | ||
393 | LLSpatialGroup* parent = getParent() ; | ||
394 | if(parent) | ||
395 | { | ||
396 | return parent->getAtlas(ncomponents, to_be_reserved, recursive_level) ; | ||
397 | } | ||
398 | } | ||
399 | return NULL ; | ||
400 | } | ||
401 | |||
402 | void LLSpatialGroup::setCurUpdatingSlot(LLTextureAtlasSlot* slotp) | ||
403 | { | ||
404 | mCurUpdatingSlotp = slotp; | ||
405 | |||
406 | //if(!hasAtlas(mCurUpdatingSlotp->getAtlas())) | ||
407 | //{ | ||
408 | // addAtlas(mCurUpdatingSlotp->getAtlas()) ; | ||
409 | //} | ||
410 | } | ||
411 | |||
412 | LLTextureAtlasSlot* LLSpatialGroup::getCurUpdatingSlot(LLViewerImage* imagep, S8 recursive_level) | ||
413 | { | ||
414 | if(gFrameCount && mCurUpdatingTime == gFrameCount && mCurUpdatingTexture == imagep) | ||
415 | { | ||
416 | return mCurUpdatingSlotp ; | ||
417 | } | ||
418 | |||
419 | //--recursive_level ; | ||
420 | //if(recursive_level) | ||
421 | //{ | ||
422 | // LLSpatialGroup* parent = getParent() ; | ||
423 | // if(parent) | ||
424 | // { | ||
425 | // return parent->getCurUpdatingSlot(imagep, recursive_level) ; | ||
426 | // } | ||
427 | //} | ||
428 | return NULL ; | ||
429 | } | 305 | } |
430 | 306 | ||
431 | void LLSpatialGroup::clearDrawMap() | 307 | void LLSpatialGroup::clearDrawMap() |
@@ -472,7 +348,7 @@ void LLSpatialGroup::validate() | |||
472 | LLSpatialPartition* part = drawable->asPartition(); | 348 | LLSpatialPartition* part = drawable->asPartition(); |
473 | if (!part) | 349 | if (!part) |
474 | { | 350 | { |
475 | llwarns << "Drawable reports it is a spatial bridge but not a partition." << llendl; | 351 | llerrs << "Drawable reports it is a spatial bridge but not a partition." << llendl; |
476 | } | 352 | } |
477 | LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0); | 353 | LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0); |
478 | group->validate(); | 354 | group->validate(); |
@@ -535,7 +411,7 @@ public: | |||
535 | 411 | ||
536 | if (mInheritedMask && !group->isState(mInheritedMask)) | 412 | if (mInheritedMask && !group->isState(mInheritedMask)) |
537 | { | 413 | { |
538 | llwarns << "Spatial group failed inherited mask test." << llendl; | 414 | llerrs << "Spatial group failed inherited mask test." << llendl; |
539 | } | 415 | } |
540 | 416 | ||
541 | if (group->isState(LLSpatialGroup::DIRTY)) | 417 | if (group->isState(LLSpatialGroup::DIRTY)) |
@@ -551,7 +427,7 @@ public: | |||
551 | { | 427 | { |
552 | if (!parent->isState(state)) | 428 | if (!parent->isState(state)) |
553 | { | 429 | { |
554 | llwarns << "Spatial group failed parent state check." << llendl; | 430 | llerrs << "Spatial group failed parent state check." << llendl; |
555 | } | 431 | } |
556 | parent = parent->getParent(); | 432 | parent = parent->getParent(); |
557 | } | 433 | } |
@@ -572,39 +448,39 @@ void validate_draw_info(LLDrawInfo& params) | |||
572 | #if LL_OCTREE_PARANOIA_CHECK | 448 | #if LL_OCTREE_PARANOIA_CHECK |
573 | if (params.mVertexBuffer.isNull()) | 449 | if (params.mVertexBuffer.isNull()) |
574 | { | 450 | { |
575 | llwarns << "Draw batch has no vertex buffer." << llendl; | 451 | llerrs << "Draw batch has no vertex buffer." << llendl; |
576 | } | 452 | } |
577 | 453 | ||
578 | //bad range | 454 | //bad range |
579 | if (params.mStart >= params.mEnd) | 455 | if (params.mStart >= params.mEnd) |
580 | { | 456 | { |
581 | llwarns << "Draw batch has invalid range." << llendl; | 457 | llerrs << "Draw batch has invalid range." << llendl; |
582 | } | 458 | } |
583 | 459 | ||
584 | if (params.mEnd >= (U32) params.mVertexBuffer->getNumVerts()) | 460 | if (params.mEnd >= (U32) params.mVertexBuffer->getNumVerts()) |
585 | { | 461 | { |
586 | llwarns << "Draw batch has buffer overrun error." << llendl; | 462 | llerrs << "Draw batch has buffer overrun error." << llendl; |
587 | } | 463 | } |
588 | 464 | ||
589 | if (params.mOffset + params.mCount > (U32) params.mVertexBuffer->getNumIndices()) | 465 | if (params.mOffset + params.mCount > (U32) params.mVertexBuffer->getNumIndices()) |
590 | { | 466 | { |
591 | llwarns << "Draw batch has index buffer ovverrun error." << llendl; | 467 | llerrs << "Draw batch has index buffer ovverrun error." << llendl; |
592 | } | 468 | } |
593 | 469 | ||
594 | //bad indices | 470 | //bad indices |
595 | U16* indicesp = (U16*) params.mVertexBuffer->getIndicesPointer(); // KL 16 indices for SD not 32 | 471 | U32* indicesp = (U32*) params.mVertexBuffer->getIndicesPointer(); |
596 | if (indicesp) | 472 | if (indicesp) |
597 | { | 473 | { |
598 | for (U32 i = params.mOffset; i < params.mOffset+params.mCount; i++) | 474 | for (U32 i = params.mOffset; i < params.mOffset+params.mCount; i++) |
599 | { | 475 | { |
600 | if (indicesp[i] < (U16)params.mStart) //KL | 476 | if (indicesp[i] < params.mStart) |
601 | { | 477 | { |
602 | llwarns << "Draw batch has vertex buffer index out of range error (index too low)." << llendl; | 478 | llerrs << "Draw batch has vertex buffer index out of range error (index too low)." << llendl; |
603 | } | 479 | } |
604 | 480 | ||
605 | if (indicesp[i] > (U16)params.mEnd) // KL | 481 | if (indicesp[i] > params.mEnd) |
606 | { | 482 | { |
607 | llwarns << "Draw batch has vertex buffer index out of range error (index too high)." << llendl; | 483 | llerrs << "Draw batch has vertex buffer index out of range error (index too high)." << llendl; |
608 | } | 484 | } |
609 | } | 485 | } |
610 | } | 486 | } |
@@ -664,7 +540,6 @@ BOOL LLSpatialGroup::addObject(LLDrawable *drawablep, BOOL add_all, BOOL from_oc | |||
664 | drawablep->setSpatialGroup(this); | 540 | drawablep->setSpatialGroup(this); |
665 | validate_drawable(drawablep); | 541 | validate_drawable(drawablep); |
666 | setState(OBJECT_DIRTY | GEOM_DIRTY | DISCARD_QUERY); | 542 | setState(OBJECT_DIRTY | GEOM_DIRTY | DISCARD_QUERY); |
667 | gPipeline.markRebuild(this, TRUE); | ||
668 | if (drawablep->isSpatialBridge()) | 543 | if (drawablep->isSpatialBridge()) |
669 | { | 544 | { |
670 | mBridgeList.push_back((LLSpatialBridge*) drawablep); | 545 | mBridgeList.push_back((LLSpatialBridge*) drawablep); |
@@ -697,23 +572,22 @@ void LLSpatialGroup::rebuildMesh() | |||
697 | 572 | ||
698 | void LLSpatialPartition::rebuildGeom(LLSpatialGroup* group) | 573 | void LLSpatialPartition::rebuildGeom(LLSpatialGroup* group) |
699 | { | 574 | { |
700 | /*if (!gPipeline.hasRenderType(mDrawableType)) | 575 | if (!gPipeline.hasRenderType(mDrawableType)) |
701 | { | 576 | { |
702 | return; | 577 | return; |
703 | }*/ | 578 | } |
579 | |||
580 | if (!LLPipeline::sSkipUpdate && group->changeLOD()) | ||
581 | { | ||
582 | group->mLastUpdateDistance = group->mDistance; | ||
583 | group->mLastUpdateViewAngle = group->mViewAngle; | ||
584 | } | ||
704 | 585 | ||
705 | if (group->isDead() || !group->isState(LLSpatialGroup::GEOM_DIRTY)) | 586 | if (group->isDead() || !group->isState(LLSpatialGroup::GEOM_DIRTY)) |
706 | { | 587 | { |
707 | /*if (!group->isState(LLSpatialGroup::GEOM_DIRTY) && mRenderByGroup) | ||
708 | { | ||
709 | llwarns << "WTF?" << llendl; | ||
710 | }*/ | ||
711 | return; | 588 | return; |
712 | } | 589 | } |
713 | 590 | ||
714 | group->mLastUpdateDistance = group->mDistance; | ||
715 | group->mLastUpdateViewAngle = group->mViewAngle; | ||
716 | |||
717 | LLFastTimer ftm(LLFastTimer::FTM_REBUILD_VBO); | 591 | LLFastTimer ftm(LLFastTimer::FTM_REBUILD_VBO); |
718 | 592 | ||
719 | group->clearDrawMap(); | 593 | group->clearDrawMap(); |
@@ -751,7 +625,6 @@ void LLSpatialPartition::rebuildGeom(LLSpatialGroup* group) | |||
751 | group->clearState(LLSpatialGroup::GEOM_DIRTY); | 625 | group->clearState(LLSpatialGroup::GEOM_DIRTY); |
752 | } | 626 | } |
753 | 627 | ||
754 | |||
755 | void LLSpatialPartition::rebuildMesh(LLSpatialGroup* group) | 628 | void LLSpatialPartition::rebuildMesh(LLSpatialGroup* group) |
756 | { | 629 | { |
757 | 630 | ||
@@ -790,11 +663,8 @@ BOOL LLSpatialGroup::boundObjects(BOOL empty, LLVector3& minOut, LLVector3& maxO | |||
790 | drawablep = *i; | 663 | drawablep = *i; |
791 | minMax = drawablep->getSpatialExtents(); | 664 | minMax = drawablep->getSpatialExtents(); |
792 | 665 | ||
793 | update_min_max(newMin, newMax, minMax[0]); | ||
794 | update_min_max(newMin, newMax, minMax[1]); | ||
795 | |||
796 | //bin up the object | 666 | //bin up the object |
797 | /*for (U32 i = 0; i < 3; i++) | 667 | for (U32 i = 0; i < 3; i++) |
798 | { | 668 | { |
799 | if (minMax[0].mV[i] < newMin.mV[i]) | 669 | if (minMax[0].mV[i] < newMin.mV[i]) |
800 | { | 670 | { |
@@ -804,7 +674,7 @@ BOOL LLSpatialGroup::boundObjects(BOOL empty, LLVector3& minOut, LLVector3& maxO | |||
804 | { | 674 | { |
805 | newMax.mV[i] = minMax[1].mV[i]; | 675 | newMax.mV[i] = minMax[1].mV[i]; |
806 | } | 676 | } |
807 | }*/ | 677 | } |
808 | } | 678 | } |
809 | 679 | ||
810 | mObjectBounds[0] = (newMin + newMax) * 0.5f; | 680 | mObjectBounds[0] = (newMin + newMax) * 0.5f; |
@@ -868,10 +738,6 @@ LLSpatialGroup* LLSpatialGroup::getParent() | |||
868 | return NULL; | 738 | return NULL; |
869 | } | 739 | } |
870 | 740 | ||
871 | if(!mOctreeNode) | ||
872 | { | ||
873 | return NULL; | ||
874 | } | ||
875 | OctreeNode* parent = mOctreeNode->getOctParent(); | 741 | OctreeNode* parent = mOctreeNode->getOctParent(); |
876 | 742 | ||
877 | if (parent) | 743 | if (parent) |
@@ -897,8 +763,6 @@ BOOL LLSpatialGroup::removeObject(LLDrawable *drawablep, BOOL from_octree) | |||
897 | { | 763 | { |
898 | drawablep->setSpatialGroup(NULL); | 764 | drawablep->setSpatialGroup(NULL); |
899 | setState(GEOM_DIRTY); | 765 | setState(GEOM_DIRTY); |
900 | gPipeline.markRebuild(this, TRUE); | ||
901 | |||
902 | if (drawablep->isSpatialBridge()) | 766 | if (drawablep->isSpatialBridge()) |
903 | { | 767 | { |
904 | for (bridge_list_t::iterator i = mBridgeList.begin(); i != mBridgeList.end(); ++i) | 768 | for (bridge_list_t::iterator i = mBridgeList.begin(); i != mBridgeList.end(); ++i) |
@@ -935,7 +799,6 @@ void LLSpatialGroup::shift(const LLVector3 &offset) | |||
935 | //if (!mSpatialPartition->mRenderByGroup) | 799 | //if (!mSpatialPartition->mRenderByGroup) |
936 | { | 800 | { |
937 | setState(GEOM_DIRTY); | 801 | setState(GEOM_DIRTY); |
938 | gPipeline.markRebuild(this, TRUE); | ||
939 | } | 802 | } |
940 | 803 | ||
941 | if (mOcclusionVerts) | 804 | if (mOcclusionVerts) |
@@ -1085,11 +948,7 @@ LLSpatialGroup::LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part) : | |||
1085 | mLastUpdateDistance(-1.f), | 948 | mLastUpdateDistance(-1.f), |
1086 | mLastUpdateTime(gFrameTimeSeconds), | 949 | mLastUpdateTime(gFrameTimeSeconds), |
1087 | mViewAngle(0.f), | 950 | mViewAngle(0.f), |
1088 | mLastUpdateViewAngle(-1.f), | 951 | mLastUpdateViewAngle(-1.f) |
1089 | mAtlasList(4), | ||
1090 | mCurUpdatingTime(0), | ||
1091 | mCurUpdatingSlotp(NULL), | ||
1092 | mCurUpdatingTexture (NULL) | ||
1093 | { | 952 | { |
1094 | sNodeCount++; | 953 | sNodeCount++; |
1095 | LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); | 954 | LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); |
@@ -1097,7 +956,6 @@ LLSpatialGroup::LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part) : | |||
1097 | sg_assert(mOctreeNode->getListenerCount() == 0); | 956 | sg_assert(mOctreeNode->getListenerCount() == 0); |
1098 | mOctreeNode->addListener(this); | 957 | mOctreeNode->addListener(this); |
1099 | setState(SG_INITIAL_STATE_MASK); | 958 | setState(SG_INITIAL_STATE_MASK); |
1100 | gPipeline.markRebuild(this, TRUE); | ||
1101 | 959 | ||
1102 | mBounds[0] = LLVector3(node->getCenter()); | 960 | mBounds[0] = LLVector3(node->getCenter()); |
1103 | mBounds[1] = LLVector3(node->getSize()); | 961 | mBounds[1] = LLVector3(node->getSize()); |
@@ -1117,7 +975,7 @@ void LLSpatialGroup::updateDistance(LLCamera &camera) | |||
1117 | #if !LL_RELEASE_FOR_DOWNLOAD | 975 | #if !LL_RELEASE_FOR_DOWNLOAD |
1118 | if (isState(LLSpatialGroup::OBJECT_DIRTY)) | 976 | if (isState(LLSpatialGroup::OBJECT_DIRTY)) |
1119 | { | 977 | { |
1120 | llwarns << "Spatial group dirty on distance update." << llendl; | 978 | llerrs << "Spatial group dirty on distance update." << llendl; |
1121 | } | 979 | } |
1122 | #endif | 980 | #endif |
1123 | if (!getData().empty() && !LLSpatialPartition::sFreezeState) | 981 | if (!getData().empty() && !LLSpatialPartition::sFreezeState) |
@@ -1156,7 +1014,6 @@ F32 LLSpatialPartition::calcDistance(LLSpatialGroup* group, LLCamera& camera) | |||
1156 | //NOTE: If there is a trivial way to detect that alpha sorting here would not change the render order, | 1014 | //NOTE: If there is a trivial way to detect that alpha sorting here would not change the render order, |
1157 | //not setting this node to dirty would be a very good thing | 1015 | //not setting this node to dirty would be a very good thing |
1158 | group->setState(LLSpatialGroup::ALPHA_DIRTY); | 1016 | group->setState(LLSpatialGroup::ALPHA_DIRTY); |
1159 | gPipeline.markRebuild(group, FALSE); | ||
1160 | } | 1017 | } |
1161 | } | 1018 | } |
1162 | } | 1019 | } |
@@ -1193,18 +1050,6 @@ F32 LLSpatialPartition::calcPixelArea(LLSpatialGroup* group, LLCamera& camera) | |||
1193 | return LLPipeline::calcPixelArea(group->mObjectBounds[0], group->mObjectBounds[1], camera); | 1050 | return LLPipeline::calcPixelArea(group->mObjectBounds[0], group->mObjectBounds[1], camera); |
1194 | } | 1051 | } |
1195 | 1052 | ||
1196 | F32 LLSpatialGroup::getUpdateUrgency() const | ||
1197 | { | ||
1198 | if (!isVisible()) | ||
1199 | { | ||
1200 | return 0.f; | ||
1201 | } | ||
1202 | else | ||
1203 | { | ||
1204 | return (gFrameTimeSeconds - mLastUpdateTime+4.f)/mDistance; | ||
1205 | } | ||
1206 | } | ||
1207 | |||
1208 | BOOL LLSpatialGroup::needsUpdate() | 1053 | BOOL LLSpatialGroup::needsUpdate() |
1209 | { | 1054 | { |
1210 | return (LLDrawable::getCurrentFrame()%mSpatialPartition->mLODPeriod == mLODHash) ? TRUE : FALSE; | 1055 | return (LLDrawable::getCurrentFrame()%mSpatialPartition->mLODPeriod == mLODHash) ? TRUE : FALSE; |
@@ -1312,8 +1157,6 @@ void LLSpatialGroup::handleChildRemoval(const OctreeNode* parent, const OctreeNo | |||
1312 | void LLSpatialGroup::destroyGL() | 1157 | void LLSpatialGroup::destroyGL() |
1313 | { | 1158 | { |
1314 | setState(LLSpatialGroup::GEOM_DIRTY | LLSpatialGroup::IMAGE_DIRTY); | 1159 | setState(LLSpatialGroup::GEOM_DIRTY | LLSpatialGroup::IMAGE_DIRTY); |
1315 | gPipeline.markRebuild(this, TRUE); | ||
1316 | |||
1317 | mLastUpdateTime = gFrameTimeSeconds; | 1160 | mLastUpdateTime = gFrameTimeSeconds; |
1318 | mVertexBuffer = NULL; | 1161 | mVertexBuffer = NULL; |
1319 | mBufferMap.clear(); | 1162 | mBufferMap.clear(); |
@@ -1517,8 +1360,7 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera) | |||
1517 | 1360 | ||
1518 | //============================================== | 1361 | //============================================== |
1519 | 1362 | ||
1520 | LLSpatialPartition::LLSpatialPartition(U32 data_mask, BOOL render_by_group, U32 buffer_usage) | 1363 | LLSpatialPartition::LLSpatialPartition(U32 data_mask, U32 buffer_usage) |
1521 | : mRenderByGroup(render_by_group) | ||
1522 | { | 1364 | { |
1523 | LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); | 1365 | LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); |
1524 | mOcclusionEnabled = TRUE; | 1366 | mOcclusionEnabled = TRUE; |
@@ -1530,7 +1372,7 @@ LLSpatialPartition::LLSpatialPartition(U32 data_mask, BOOL render_by_group, U32 | |||
1530 | mBufferUsage = buffer_usage; | 1372 | mBufferUsage = buffer_usage; |
1531 | mDepthMask = FALSE; | 1373 | mDepthMask = FALSE; |
1532 | mSlopRatio = 0.25f; | 1374 | mSlopRatio = 0.25f; |
1533 | //mRenderByGroup = TRUE; | 1375 | mRenderByGroup = TRUE; |
1534 | mInfiniteFarClip = FALSE; | 1376 | mInfiniteFarClip = FALSE; |
1535 | 1377 | ||
1536 | LLGLNamePool::registerPool(&sQueryPool); | 1378 | LLGLNamePool::registerPool(&sQueryPool); |
@@ -1826,76 +1668,13 @@ public: | |||
1826 | return false; | 1668 | return false; |
1827 | } | 1669 | } |
1828 | 1670 | ||
1829 | virtual void traverse(const LLSpatialGroup::TreeNode* n) | ||
1830 | { | ||
1831 | LLSpatialGroup* group = (LLSpatialGroup*) n->getListener(0); | ||
1832 | |||
1833 | if (earlyFail(group)) | ||
1834 | { | ||
1835 | return; | ||
1836 | } | ||
1837 | |||
1838 | if (mRes == 2) | ||
1839 | { | ||
1840 | //fully in, don't traverse further (won't effect extents | ||
1841 | } | ||
1842 | else if (mRes && group->isState(LLSpatialGroup::SKIP_FRUSTUM_CHECK)) | ||
1843 | { //don't need to do frustum check | ||
1844 | LLSpatialGroup::OctreeTraveler::traverse(n); | ||
1845 | } | ||
1846 | else | ||
1847 | { | ||
1848 | mRes = frustumCheck(group); | ||
1849 | |||
1850 | if (mRes) | ||
1851 | { //at least partially in, run on down | ||
1852 | LLSpatialGroup::OctreeTraveler::traverse(n); | ||
1853 | } | ||
1854 | |||
1855 | mRes = 0; | ||
1856 | } | ||
1857 | } | ||
1858 | |||
1859 | virtual void processGroup(LLSpatialGroup* group) | 1671 | virtual void processGroup(LLSpatialGroup* group) |
1860 | { | 1672 | { |
1861 | if (group->isState(LLSpatialGroup::DIRTY) || group->getData().empty()) | 1673 | if (group->mObjectBounds[1].magVecSquared() < 256.f * 256.f) |
1862 | { | 1674 | { //megaprims and water edge patches be damned! |
1863 | llwarns << "WTF?" << llendl; | ||
1864 | } | ||
1865 | |||
1866 | if (mRes < 2) | ||
1867 | { | ||
1868 | |||
1869 | if (mCamera->AABBInFrustum(group->mObjectBounds[0], group->mObjectBounds[1]) == 2) | ||
1870 | { | ||
1871 | mEmpty = FALSE; | ||
1872 | update_min_max(mMin, mMax, group->mObjectExtents[0]); | ||
1873 | update_min_max(mMin, mMax, group->mObjectExtents[1]); | ||
1874 | } | ||
1875 | else | ||
1876 | { | ||
1877 | if (group->mObjectBounds[1].magVecSquared() < 256.f * 256.f) | ||
1878 | { //megaprims and water edge patches be damned! | ||
1879 | for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) | ||
1880 | { | ||
1881 | LLDrawable* drawable = i->get(); | ||
1882 | const LLVector3* ext = drawable->getSpatialExtents(); | ||
1883 | |||
1884 | if (mCamera->AABBInFrustum((ext[1]+ext[0])*0.5f, (ext[1]-ext[0])*0.5f)) | ||
1885 | { | ||
1886 | mEmpty = FALSE; | ||
1887 | update_min_max(mMin, mMax, ext[0]); | ||
1888 | update_min_max(mMin, mMax, ext[1]); | ||
1889 | } | ||
1890 | } | ||
1891 | } | ||
1892 | } | ||
1893 | } | ||
1894 | else | ||
1895 | { | ||
1896 | mEmpty = FALSE; | 1675 | mEmpty = FALSE; |
1897 | update_min_max(mMin, mMax, group->mExtents[0]); | 1676 | update_min_max(mMin, mMax, group->mObjectExtents[0]); |
1898 | update_min_max(mMin, mMax, group->mExtents[1]); | 1677 | update_min_max(mMin, mMax, group->mObjectExtents[1]); |
1899 | } | 1678 | } |
1900 | } | 1679 | } |
1901 | 1680 | ||
@@ -2674,39 +2453,6 @@ void renderBatchSize(LLDrawInfo* params) | |||
2674 | pushVerts(params, LLVertexBuffer::MAP_VERTEX); | 2453 | pushVerts(params, LLVertexBuffer::MAP_VERTEX); |
2675 | } | 2454 | } |
2676 | 2455 | ||
2677 | void renderShadowFrusta(LLDrawInfo* params) | ||
2678 | { | ||
2679 | LLGLEnable blend(GL_BLEND); | ||
2680 | gGL.setSceneBlendType(LLRender::BT_ADD); | ||
2681 | |||
2682 | LLVector3 center = (params->mExtents[1]+params->mExtents[0])*0.5f; | ||
2683 | LLVector3 size = (params->mExtents[1]-params->mExtents[0])*0.5f; | ||
2684 | |||
2685 | if (gPipeline.mShadowCamera[4].AABBInFrustum(center, size)) | ||
2686 | { | ||
2687 | glColor3f(1,0,0); | ||
2688 | pushVerts(params, LLVertexBuffer::MAP_VERTEX); | ||
2689 | } | ||
2690 | if (gPipeline.mShadowCamera[5].AABBInFrustum(center, size)) | ||
2691 | { | ||
2692 | glColor3f(0,1,0); | ||
2693 | pushVerts(params, LLVertexBuffer::MAP_VERTEX); | ||
2694 | } | ||
2695 | if (gPipeline.mShadowCamera[6].AABBInFrustum(center, size)) | ||
2696 | { | ||
2697 | glColor3f(0,0,1); | ||
2698 | pushVerts(params, LLVertexBuffer::MAP_VERTEX); | ||
2699 | } | ||
2700 | if (gPipeline.mShadowCamera[7].AABBInFrustum(center, size)) | ||
2701 | { | ||
2702 | glColor3f(1,0,1); | ||
2703 | pushVerts(params, LLVertexBuffer::MAP_VERTEX); | ||
2704 | } | ||
2705 | |||
2706 | gGL.setSceneBlendType(LLRender::BT_ALPHA); | ||
2707 | } | ||
2708 | |||
2709 | |||
2710 | void renderLights(LLDrawable* drawablep) | 2456 | void renderLights(LLDrawable* drawablep) |
2711 | { | 2457 | { |
2712 | if (!drawablep->isLight()) | 2458 | if (!drawablep->isLight()) |
@@ -2842,9 +2588,6 @@ public: | |||
2842 | //draw tight fit bounding boxes for spatial group | 2588 | //draw tight fit bounding boxes for spatial group |
2843 | if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCTREE)) | 2589 | if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCTREE)) |
2844 | { | 2590 | { |
2845 | group->rebuildGeom(); | ||
2846 | group->rebuildMesh(); | ||
2847 | |||
2848 | renderOctree(group); | 2591 | renderOctree(group); |
2849 | stop_glerror(); | 2592 | stop_glerror(); |
2850 | } | 2593 | } |
@@ -2852,9 +2595,6 @@ public: | |||
2852 | //render visibility wireframe | 2595 | //render visibility wireframe |
2853 | if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION)) | 2596 | if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION)) |
2854 | { | 2597 | { |
2855 | group->rebuildGeom(); | ||
2856 | group->rebuildMesh(); | ||
2857 | |||
2858 | gGL.flush(); | 2598 | gGL.flush(); |
2859 | glPushMatrix(); | 2599 | glPushMatrix(); |
2860 | gGLLastMatrix = NULL; | 2600 | gGLLastMatrix = NULL; |
@@ -2880,19 +2620,6 @@ public: | |||
2880 | LLVector3 nodeCenter = group->mBounds[0]; | 2620 | LLVector3 nodeCenter = group->mBounds[0]; |
2881 | LLVector3 octCenter = LLVector3(group->mOctreeNode->getCenter()); | 2621 | LLVector3 octCenter = LLVector3(group->mOctreeNode->getCenter()); |
2882 | 2622 | ||
2883 | group->rebuildGeom(); | ||
2884 | group->rebuildMesh(); | ||
2885 | |||
2886 | if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BBOXES)) | ||
2887 | { | ||
2888 | if (!group->getData().empty()) | ||
2889 | { | ||
2890 | gGL.color3f(0,0,1); | ||
2891 | drawBoxOutline(group->mObjectBounds[0], | ||
2892 | group->mObjectBounds[1]); | ||
2893 | } | ||
2894 | } | ||
2895 | |||
2896 | for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) | 2623 | for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) |
2897 | { | 2624 | { |
2898 | LLDrawable* drawable = *i; | 2625 | LLDrawable* drawable = *i; |
@@ -2902,16 +2629,6 @@ public: | |||
2902 | renderBoundingBox(drawable); | 2629 | renderBoundingBox(drawable); |
2903 | } | 2630 | } |
2904 | 2631 | ||
2905 | if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BUILD_QUEUE)) | ||
2906 | { | ||
2907 | if (drawable->isState(LLDrawable::IN_REBUILD_Q2)) | ||
2908 | { | ||
2909 | gGL.color4f(0.6f, 0.6f, 0.1f, 1.f); | ||
2910 | const LLVector3* ext = drawable->getSpatialExtents(); | ||
2911 | drawBoxOutline((ext[0]+ext[1])*0.5f, (ext[1]-ext[0])*0.5f); | ||
2912 | } | ||
2913 | } | ||
2914 | |||
2915 | if (drawable->getVOVolume() && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY)) | 2632 | if (drawable->getVOVolume() && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY)) |
2916 | { | 2633 | { |
2917 | renderTexturePriority(drawable); | 2634 | renderTexturePriority(drawable); |
@@ -2932,9 +2649,9 @@ public: | |||
2932 | renderRaycast(drawable); | 2649 | renderRaycast(drawable); |
2933 | } | 2650 | } |
2934 | 2651 | ||
2935 | // LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(drawable->getVObj().get()); | 2652 | LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(drawable->getVObj().get()); |
2936 | 2653 | ||
2937 | /* if (avatar && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AVATAR_VOLUME)) | 2654 | if (avatar && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AVATAR_VOLUME)) |
2938 | { | 2655 | { |
2939 | renderAvatarCollisionVolumes(avatar); | 2656 | renderAvatarCollisionVolumes(avatar); |
2940 | } | 2657 | } |
@@ -2942,7 +2659,7 @@ public: | |||
2942 | if (avatar && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AGENT_TARGET)) | 2659 | if (avatar && gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AGENT_TARGET)) |
2943 | { | 2660 | { |
2944 | renderAgentTarget(avatar); | 2661 | renderAgentTarget(avatar); |
2945 | } */ | 2662 | } |
2946 | 2663 | ||
2947 | } | 2664 | } |
2948 | 2665 | ||
@@ -2960,10 +2677,6 @@ public: | |||
2960 | { | 2677 | { |
2961 | renderBatchSize(draw_info); | 2678 | renderBatchSize(draw_info); |
2962 | } | 2679 | } |
2963 | if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) | ||
2964 | { | ||
2965 | renderShadowFrusta(draw_info); | ||
2966 | } | ||
2967 | } | 2680 | } |
2968 | } | 2681 | } |
2969 | } | 2682 | } |
@@ -3014,7 +2727,7 @@ void LLSpatialPartition::renderIntersectingBBoxes(LLCamera* camera) | |||
3014 | pusher.traverse(mOctree); | 2727 | pusher.traverse(mOctree); |
3015 | } | 2728 | } |
3016 | 2729 | ||
3017 | void LLSpatialPartition::renderDebug() // KL SD version | 2730 | void LLSpatialPartition::renderDebug() |
3018 | { | 2731 | { |
3019 | if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCTREE | | 2732 | if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCTREE | |
3020 | LLPipeline::RENDER_DEBUG_OCCLUSION | | 2733 | LLPipeline::RENDER_DEBUG_OCCLUSION | |
@@ -3025,8 +2738,8 @@ void LLSpatialPartition::renderDebug() // KL SD version | |||
3025 | LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY | | 2738 | LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY | |
3026 | LLPipeline::RENDER_DEBUG_TEXTURE_ANIM | | 2739 | LLPipeline::RENDER_DEBUG_TEXTURE_ANIM | |
3027 | LLPipeline::RENDER_DEBUG_RAYCAST | | 2740 | LLPipeline::RENDER_DEBUG_RAYCAST | |
3028 | LLPipeline::RENDER_DEBUG_BUILD_QUEUE | | 2741 | LLPipeline::RENDER_DEBUG_AVATAR_VOLUME | |
3029 | LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) | 2742 | LLPipeline::RENDER_DEBUG_AGENT_TARGET)) |
3030 | { | 2743 | { |
3031 | return; | 2744 | return; |
3032 | } | 2745 | } |
@@ -3061,12 +2774,6 @@ void LLSpatialPartition::renderDebug() // KL SD version | |||
3061 | render_debug.traverse(mOctree); | 2774 | render_debug.traverse(mOctree); |
3062 | } | 2775 | } |
3063 | 2776 | ||
3064 | void LLSpatialGroup::drawObjectBox(LLColor4 col) | ||
3065 | { | ||
3066 | gGL.color4fv(col.mV); | ||
3067 | drawBox(mObjectBounds[0], mObjectBounds[1]*1.01f+LLVector3(0.001f, 0.001f, 0.001f)); | ||
3068 | } | ||
3069 | |||
3070 | 2777 | ||
3071 | BOOL LLSpatialPartition::isVisible(const LLVector3& v) | 2778 | BOOL LLSpatialPartition::isVisible(const LLVector3& v) |
3072 | { | 2779 | { |
@@ -3211,12 +2918,11 @@ LLDrawable* LLSpatialPartition::lineSegmentIntersect(const LLVector3& start, con | |||
3211 | } | 2918 | } |
3212 | 2919 | ||
3213 | LLDrawInfo::LLDrawInfo(U16 start, U16 end, U32 count, U32 offset, | 2920 | LLDrawInfo::LLDrawInfo(U16 start, U16 end, U32 count, U32 offset, |
3214 | LLImageGL* gl_texture, LLViewerImage* texture, LLVertexBuffer* buffer, | 2921 | LLViewerImage* texture, LLVertexBuffer* buffer, |
3215 | BOOL fullbright, U8 bump, BOOL particle, F32 part_size) | 2922 | BOOL fullbright, U8 bump, BOOL particle, F32 part_size) |
3216 | : | 2923 | : |
3217 | mVertexBuffer(buffer), | 2924 | mVertexBuffer(buffer), |
3218 | mTexture(gl_texture), | 2925 | mTexture(texture), |
3219 | mViewerTexture(texture), | ||
3220 | mTextureMatrix(NULL), | 2926 | mTextureMatrix(NULL), |
3221 | mModelMatrix(NULL), | 2927 | mModelMatrix(NULL), |
3222 | mStart(start), | 2928 | mStart(start), |
@@ -3236,22 +2942,22 @@ LLDrawInfo::LLDrawInfo(U16 start, U16 end, U32 count, U32 offset, | |||
3236 | if (mStart >= mVertexBuffer->getRequestedVerts() || | 2942 | if (mStart >= mVertexBuffer->getRequestedVerts() || |
3237 | mEnd >= mVertexBuffer->getRequestedVerts()) | 2943 | mEnd >= mVertexBuffer->getRequestedVerts()) |
3238 | { | 2944 | { |
3239 | llwarns << "Invalid draw info vertex range." << llendl; | 2945 | llerrs << "Invalid draw info vertex range." << llendl; |
3240 | } | 2946 | } |
3241 | 2947 | ||
3242 | if (mOffset >= (U32) mVertexBuffer->getRequestedIndices() || | 2948 | if (mOffset >= (U32) mVertexBuffer->getRequestedIndices() || |
3243 | mOffset + mCount > (U32) mVertexBuffer->getRequestedIndices()) | 2949 | mOffset + mCount > (U32) mVertexBuffer->getRequestedIndices()) |
3244 | { | 2950 | { |
3245 | llwarns << "Invalid draw info index range." << llendl; | 2951 | llerrs << "Invalid draw info index range." << llendl; |
3246 | } | 2952 | } |
3247 | } | 2953 | } |
3248 | 2954 | ||
3249 | LLDrawInfo::~LLDrawInfo() | 2955 | LLDrawInfo::~LLDrawInfo() |
3250 | { | 2956 | { |
3251 | /*if (LLSpatialGroup::sNoDelete) | 2957 | if (LLSpatialGroup::sNoDelete) |
3252 | { | 2958 | { |
3253 | llwarns << "LLDrawInfo deleted illegally!" << llendl; | 2959 | llerrs << "LLDrawInfo deleted illegally!" << llendl; |
3254 | }*/ | 2960 | } |
3255 | 2961 | ||
3256 | if (mFace) | 2962 | if (mFace) |
3257 | { | 2963 | { |
@@ -3456,7 +3162,7 @@ void LLCullResult::assertDrawMapsEmpty() | |||
3456 | { | 3162 | { |
3457 | if (mRenderMapSize[i] != 0) | 3163 | if (mRenderMapSize[i] != 0) |
3458 | { | 3164 | { |
3459 | llwarns << "Stale LLDrawInfo's in LLCullResult!" << llendl; | 3165 | llerrs << "Stale LLDrawInfo's in LLCullResult!" << llendl; |
3460 | } | 3166 | } |
3461 | } | 3167 | } |
3462 | } | 3168 | } |
diff --git a/linden/indra/newview/llspatialpartition.h b/linden/indra/newview/llspatialpartition.h index deb8b0e..be0163b 100644 --- a/linden/indra/newview/llspatialpartition.h +++ b/linden/indra/newview/llspatialpartition.h | |||
@@ -52,8 +52,6 @@ | |||
52 | class LLSpatialPartition; | 52 | class LLSpatialPartition; |
53 | class LLSpatialBridge; | 53 | class LLSpatialBridge; |
54 | class LLSpatialGroup; | 54 | class LLSpatialGroup; |
55 | class LLTextureAtlas; | ||
56 | class LLTextureAtlasSlot; | ||
57 | 55 | ||
58 | S32 AABBSphereIntersect(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &rad); | 56 | S32 AABBSphereIntersect(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &rad); |
59 | S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &radius_squared); | 57 | S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &radius_squared); |
@@ -68,13 +66,12 @@ protected: | |||
68 | 66 | ||
69 | public: | 67 | public: |
70 | LLDrawInfo(U16 start, U16 end, U32 count, U32 offset, | 68 | LLDrawInfo(U16 start, U16 end, U32 count, U32 offset, |
71 | LLImageGL* gl_image, LLViewerImage* image, LLVertexBuffer* buffer, | 69 | LLViewerImage* image, LLVertexBuffer* buffer, |
72 | BOOL fullbright = FALSE, U8 bump = 0, BOOL particle = FALSE, F32 part_size = 0); | 70 | BOOL fullbright = FALSE, U8 bump = 0, BOOL particle = FALSE, F32 part_size = 0); |
73 | 71 | ||
74 | 72 | ||
75 | LLPointer<LLVertexBuffer> mVertexBuffer; | 73 | LLPointer<LLVertexBuffer> mVertexBuffer; |
76 | LLPointer<LLImageGL> mTexture; | 74 | LLPointer<LLViewerImage> mTexture; |
77 | LLPointer<LLViewerImage> mViewerTexture; | ||
78 | LLColor4U mGlowColor; | 75 | LLColor4U mGlowColor; |
79 | S32 mDebugColor; | 76 | S32 mDebugColor; |
80 | const LLMatrix4* mTextureMatrix; | 77 | const LLMatrix4* mTextureMatrix; |
@@ -162,13 +159,11 @@ public: | |||
162 | 159 | ||
163 | typedef std::vector<LLPointer<LLSpatialGroup> > sg_vector_t; | 160 | typedef std::vector<LLPointer<LLSpatialGroup> > sg_vector_t; |
164 | typedef std::set<LLPointer<LLSpatialGroup> > sg_set_t; | 161 | typedef std::set<LLPointer<LLSpatialGroup> > sg_set_t; |
165 | typedef std::list<LLPointer<LLSpatialGroup> > sg_list_t; | ||
166 | typedef std::vector<LLPointer<LLSpatialBridge> > bridge_list_t; | 162 | typedef std::vector<LLPointer<LLSpatialBridge> > bridge_list_t; |
167 | typedef std::vector<LLPointer<LLDrawInfo> > drawmap_elem_t; | 163 | typedef std::vector<LLPointer<LLDrawInfo> > drawmap_elem_t; |
168 | typedef std::map<U32, drawmap_elem_t > draw_map_t; | 164 | typedef std::map<U32, drawmap_elem_t > draw_map_t; |
169 | typedef std::vector<LLPointer<LLVertexBuffer> > buffer_list_t; | 165 | typedef std::vector<LLPointer<LLVertexBuffer> > buffer_list_t; |
170 | typedef std::map<LLPointer<LLImageGL>, buffer_list_t> buffer_texture_map_t; // KL render-pipeline | 166 | typedef std::map<LLPointer<LLViewerImage>, buffer_list_t> buffer_texture_map_t; |
171 | // typedef std::map<LLPointer<LLViewerImage>, buffer_list_t> buffer_texture_map_t; // KL standard | ||
172 | typedef std::map<U32, buffer_texture_map_t> buffer_map_t; | 167 | typedef std::map<U32, buffer_texture_map_t> buffer_map_t; |
173 | 168 | ||
174 | typedef LLOctreeListener<LLDrawable> BaseType; | 169 | typedef LLOctreeListener<LLDrawable> BaseType; |
@@ -188,14 +183,6 @@ public: | |||
188 | } | 183 | } |
189 | }; | 184 | }; |
190 | 185 | ||
191 | struct CompareUpdateUrgency | ||
192 | { | ||
193 | bool operator()(const LLPointer<LLSpatialGroup> lhs, const LLPointer<LLSpatialGroup> rhs) | ||
194 | { | ||
195 | return lhs->getUpdateUrgency() > rhs->getUpdateUrgency(); | ||
196 | } | ||
197 | }; | ||
198 | |||
199 | struct CompareDepthGreater | 186 | struct CompareDepthGreater |
200 | { | 187 | { |
201 | bool operator()(const LLSpatialGroup* const& lhs, const LLSpatialGroup* const& rhs) | 188 | bool operator()(const LLSpatialGroup* const& lhs, const LLSpatialGroup* const& rhs) |
@@ -222,10 +209,6 @@ public: | |||
222 | IMAGE_DIRTY = 0x00004000, | 209 | IMAGE_DIRTY = 0x00004000, |
223 | OCCLUSION_DIRTY = 0x00008000, | 210 | OCCLUSION_DIRTY = 0x00008000, |
224 | MESH_DIRTY = 0x00010000, | 211 | MESH_DIRTY = 0x00010000, |
225 | NEW_DRAWINFO = 0x00020000, | ||
226 | IN_BUILD_Q1 = 0x00040000, | ||
227 | IN_BUILD_Q2 = 0x00080000, | ||
228 | |||
229 | } eSpatialState; | 212 | } eSpatialState; |
230 | 213 | ||
231 | typedef enum | 214 | typedef enum |
@@ -269,7 +252,6 @@ public: | |||
269 | 252 | ||
270 | void updateDistance(LLCamera& camera); | 253 | void updateDistance(LLCamera& camera); |
271 | BOOL needsUpdate(); | 254 | BOOL needsUpdate(); |
272 | F32 getUpdateUrgency() const; | ||
273 | BOOL changeLOD(); | 255 | BOOL changeLOD(); |
274 | void rebuildGeom(); | 256 | void rebuildGeom(); |
275 | void rebuildMesh(); | 257 | void rebuildMesh(); |
@@ -279,8 +261,6 @@ public: | |||
279 | element_list& getData() { return mOctreeNode->getData(); } | 261 | element_list& getData() { return mOctreeNode->getData(); } |
280 | U32 getElementCount() const { return mOctreeNode->getElementCount(); } | 262 | U32 getElementCount() const { return mOctreeNode->getElementCount(); } |
281 | 263 | ||
282 | void drawObjectBox(LLColor4 col); | ||
283 | |||
284 | //LISTENER FUNCTIONS | 264 | //LISTENER FUNCTIONS |
285 | virtual void handleInsertion(const TreeNode* node, LLDrawable* face); | 265 | virtual void handleInsertion(const TreeNode* node, LLDrawable* face); |
286 | virtual void handleRemoval(const TreeNode* node, LLDrawable* face); | 266 | virtual void handleRemoval(const TreeNode* node, LLDrawable* face); |
@@ -289,36 +269,6 @@ public: | |||
289 | virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child); | 269 | virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child); |
290 | virtual void handleChildRemoval(const OctreeNode* parent, const OctreeNode* child); | 270 | virtual void handleChildRemoval(const OctreeNode* parent, const OctreeNode* child); |
291 | 271 | ||
292 | //------------------- | ||
293 | //for atlas use | ||
294 | //------------------- | ||
295 | //atlas | ||
296 | void setCurUpdatingTime(U32 t) {mCurUpdatingTime = t ;} | ||
297 | U32 getCurUpdatingTime() const { return mCurUpdatingTime ;} | ||
298 | |||
299 | void setCurUpdatingSlot(LLTextureAtlasSlot* slotp) ; | ||
300 | LLTextureAtlasSlot* getCurUpdatingSlot(LLViewerImage* imagep, S8 recursive_level = 3) ; | ||
301 | |||
302 | void setCurUpdatingTexture(LLViewerImage* tex){ mCurUpdatingTexture = tex ;} | ||
303 | LLViewerImage* getCurUpdatingTexture() const { return mCurUpdatingTexture ;} | ||
304 | |||
305 | BOOL hasAtlas(LLTextureAtlas* atlasp) ; | ||
306 | LLTextureAtlas* getAtlas(S8 ncomponents, S8 to_be_reserved, S8 recursive_level = 3) ; | ||
307 | void addAtlas(LLTextureAtlas* atlasp, S8 recursive_level = 3) ; | ||
308 | void removeAtlas(LLTextureAtlas* atlasp, BOOL remove_group = TRUE, S8 recursive_level = 3) ; | ||
309 | void clearAtlasList() ; | ||
310 | private: | ||
311 | U32 mCurUpdatingTime ; | ||
312 | //do not make the below two to use LLPointer | ||
313 | //because mCurUpdatingTime invalidates them automatically. | ||
314 | LLTextureAtlasSlot* mCurUpdatingSlotp ; | ||
315 | LLViewerImage* mCurUpdatingTexture ; | ||
316 | |||
317 | std::vector< std::list<LLTextureAtlas*> > mAtlasList ; | ||
318 | //------------------- | ||
319 | //end for atlas use | ||
320 | //------------------- | ||
321 | |||
322 | protected: | 272 | protected: |
323 | virtual ~LLSpatialGroup(); | 273 | virtual ~LLSpatialGroup(); |
324 | 274 | ||
@@ -377,7 +327,7 @@ class LLSpatialPartition: public LLGeometryManager | |||
377 | public: | 327 | public: |
378 | static BOOL sFreezeState; //if true, no spatialgroup state updates will be made | 328 | static BOOL sFreezeState; //if true, no spatialgroup state updates will be made |
379 | 329 | ||
380 | LLSpatialPartition(U32 data_mask, BOOL render_by_group, U32 mBufferUsage); | 330 | LLSpatialPartition(U32 data_mask, U32 mBufferUsage = GL_STATIC_DRAW_ARB); |
381 | virtual ~LLSpatialPartition(); | 331 | virtual ~LLSpatialPartition(); |
382 | 332 | ||
383 | LLSpatialGroup *put(LLDrawable *drawablep, BOOL was_visible = FALSE); | 333 | LLSpatialGroup *put(LLDrawable *drawablep, BOOL was_visible = FALSE); |
@@ -423,7 +373,7 @@ public: | |||
423 | BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed | 373 | BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed |
424 | BOOL mInfiniteFarClip; // if TRUE, frustum culling ignores far clip plane | 374 | BOOL mInfiniteFarClip; // if TRUE, frustum culling ignores far clip plane |
425 | U32 mBufferUsage; | 375 | U32 mBufferUsage; |
426 | const BOOL mRenderByGroup; | 376 | BOOL mRenderByGroup; |
427 | U32 mLODSeed; | 377 | U32 mLODSeed; |
428 | U32 mLODPeriod; //number of frames between LOD updates for a given spatial group (staggered by mLODSeed) | 378 | U32 mLODPeriod; //number of frames between LOD updates for a given spatial group (staggered by mLODSeed) |
429 | U32 mVertexDataMask; | 379 | U32 mVertexDataMask; |
@@ -442,7 +392,7 @@ protected: | |||
442 | public: | 392 | public: |
443 | typedef std::vector<LLPointer<LLSpatialBridge> > bridge_vector_t; | 393 | typedef std::vector<LLPointer<LLSpatialBridge> > bridge_vector_t; |
444 | 394 | ||
445 | LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask); | 395 | LLSpatialBridge(LLDrawable* root, U32 data_mask); |
446 | 396 | ||
447 | virtual BOOL isSpatialBridge() const { return TRUE; } | 397 | virtual BOOL isSpatialBridge() const { return TRUE; } |
448 | 398 | ||
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index a03ce1d..bd22772 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp | |||
@@ -3735,7 +3735,7 @@ void init_start_screen(S32 location_id) | |||
3735 | } | 3735 | } |
3736 | 3736 | ||
3737 | raw->expandToPowerOfTwo(); | 3737 | raw->expandToPowerOfTwo(); |
3738 | gStartImageGL->createGLTexture(0, raw); | 3738 | gStartImageGL->createGLTexture(0, raw, 0, TRUE, LLViewerImageBoostLevel::OTHER); |
3739 | } | 3739 | } |
3740 | 3740 | ||
3741 | 3741 | ||
diff --git a/linden/indra/newview/llsurface.cpp b/linden/indra/newview/llsurface.cpp index f6ef9c7..578b565 100644 --- a/linden/indra/newview/llsurface.cpp +++ b/linden/indra/newview/llsurface.cpp | |||
@@ -149,7 +149,7 @@ LLSurface::~LLSurface() | |||
149 | } | 149 | } |
150 | else | 150 | else |
151 | { | 151 | { |
152 | llwarns << "Terrain pool not empty!" << llendl; | 152 | llerrs << "Terrain pool not empty!" << llendl; |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
@@ -238,7 +238,6 @@ void LLSurface::createSTexture() | |||
238 | if (!mSTexturep) | 238 | if (!mSTexturep) |
239 | { | 239 | { |
240 | // Fill with dummy gray data. | 240 | // Fill with dummy gray data. |
241 | // GL NOT ACTIVE HERE | ||
242 | LLPointer<LLImageRaw> raw = new LLImageRaw(sTextureSize, sTextureSize, 3); | 241 | LLPointer<LLImageRaw> raw = new LLImageRaw(sTextureSize, sTextureSize, 3); |
243 | U8 *default_texture = raw->getData(); | 242 | U8 *default_texture = raw->getData(); |
244 | for (S32 i = 0; i < sTextureSize; i++) | 243 | for (S32 i = 0; i < sTextureSize; i++) |
@@ -256,7 +255,6 @@ void LLSurface::createSTexture() | |||
256 | gGL.getTexUnit(0)->bind(mSTexturep.get()); | 255 | gGL.getTexUnit(0)->bind(mSTexturep.get()); |
257 | mSTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); | 256 | mSTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); |
258 | gImageList.addImage(mSTexturep); | 257 | gImageList.addImage(mSTexturep); |
259 | |||
260 | } | 258 | } |
261 | } | 259 | } |
262 | 260 | ||
@@ -280,7 +278,7 @@ void LLSurface::createWaterTexture() | |||
280 | 278 | ||
281 | mWaterTexturep = new LLViewerImage(raw, FALSE); | 279 | mWaterTexturep = new LLViewerImage(raw, FALSE); |
282 | mWaterTexturep->dontDiscard(); | 280 | mWaterTexturep->dontDiscard(); |
283 | gGL.getTexUnit(0)->bind(mWaterTexturep); | 281 | gGL.getTexUnit(0)->bind(mWaterTexturep.get()); |
284 | mWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); | 282 | mWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); |
285 | gImageList.addImage(mWaterTexturep); | 283 | gImageList.addImage(mWaterTexturep); |
286 | } | 284 | } |
@@ -632,8 +630,6 @@ void LLSurface::updatePatchVisibilities(LLAgent &agent) | |||
632 | 630 | ||
633 | BOOL LLSurface::idleUpdate(F32 max_update_time) | 631 | BOOL LLSurface::idleUpdate(F32 max_update_time) |
634 | { | 632 | { |
635 | //SG2: LLMemType mt_ius(LLMemType::MTYPE_IDLE_UPDATE_SURFACE); | ||
636 | |||
637 | if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_TERRAIN)) | 633 | if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_TERRAIN)) |
638 | { | 634 | { |
639 | return FALSE; | 635 | return FALSE; |
@@ -1138,12 +1134,12 @@ LLSurfacePatch *LLSurface::getPatch(const S32 x, const S32 y) const | |||
1138 | { | 1134 | { |
1139 | if ((x < 0) || (x >= mPatchesPerEdge)) | 1135 | if ((x < 0) || (x >= mPatchesPerEdge)) |
1140 | { | 1136 | { |
1141 | llwarns << "Asking for patch out of bounds" << llendl; | 1137 | llerrs << "Asking for patch out of bounds" << llendl; |
1142 | return NULL; | 1138 | return NULL; |
1143 | } | 1139 | } |
1144 | if ((y < 0) || (y >= mPatchesPerEdge)) | 1140 | if ((y < 0) || (y >= mPatchesPerEdge)) |
1145 | { | 1141 | { |
1146 | llwarns << "Asking for patch out of bounds" << llendl; | 1142 | llerrs << "Asking for patch out of bounds" << llendl; |
1147 | return NULL; | 1143 | return NULL; |
1148 | } | 1144 | } |
1149 | 1145 | ||
@@ -1287,11 +1283,6 @@ BOOL LLSurface::generateWaterTexture(const F32 x, const F32 y, | |||
1287 | } | 1283 | } |
1288 | } | 1284 | } |
1289 | 1285 | ||
1290 | if (!mWaterTexturep->getHasGLTexture()) | ||
1291 | { | ||
1292 | mWaterTexturep->createGLTexture(0, raw); | ||
1293 | } | ||
1294 | |||
1295 | mWaterTexturep->setSubImage(raw, x_begin, y_begin, x_end - x_begin, y_end - y_begin); | 1286 | mWaterTexturep->setSubImage(raw, x_begin, y_begin, x_end - x_begin, y_end - y_begin); |
1296 | return TRUE; | 1287 | return TRUE; |
1297 | } | 1288 | } |
diff --git a/linden/indra/newview/llsurfacepatch.cpp b/linden/indra/newview/llsurfacepatch.cpp index 04b732a..5fac5fd 100644 --- a/linden/indra/newview/llsurfacepatch.cpp +++ b/linden/indra/newview/llsurfacepatch.cpp | |||
@@ -712,7 +712,17 @@ BOOL LLSurfacePatch::updateTexture() | |||
712 | if (mVObjp) | 712 | if (mVObjp) |
713 | { | 713 | { |
714 | mVObjp->dirtyGeom(); | 714 | mVObjp->dirtyGeom(); |
715 | gPipeline.markGLRebuild(mVObjp); | 715 | } |
716 | updateCompositionStats(); | ||
717 | F32 tex_patch_size = meters_per_grid*grids_per_patch_edge; | ||
718 | if (comp->generateTexture((F32)origin_region[VX], (F32)origin_region[VY], | ||
719 | tex_patch_size, tex_patch_size)) | ||
720 | { | ||
721 | mSTexUpdate = FALSE; | ||
722 | |||
723 | // Also generate the water texture | ||
724 | mSurfacep->generateWaterTexture((F32)origin_region.mdV[VX], (F32)origin_region.mdV[VY], | ||
725 | tex_patch_size, tex_patch_size); | ||
716 | return TRUE; | 726 | return TRUE; |
717 | } | 727 | } |
718 | } | 728 | } |
@@ -725,28 +735,6 @@ BOOL LLSurfacePatch::updateTexture() | |||
725 | } | 735 | } |
726 | } | 736 | } |
727 | 737 | ||
728 | void LLSurfacePatch::updateGL() // KL SD | ||
729 | { | ||
730 | F32 meters_per_grid = getSurface()->getMetersPerGrid(); | ||
731 | F32 grids_per_patch_edge = (F32)getSurface()->getGridsPerPatchEdge(); | ||
732 | |||
733 | LLViewerRegion *regionp = getSurface()->getRegion(); | ||
734 | LLVector3d origin_region = getOriginGlobal() - getSurface()->getOriginGlobal(); | ||
735 | |||
736 | LLVLComposition* comp = regionp->getComposition(); | ||
737 | |||
738 | updateCompositionStats(); | ||
739 | F32 tex_patch_size = meters_per_grid*grids_per_patch_edge; | ||
740 | if (comp->generateTexture((F32)origin_region[VX], (F32)origin_region[VY], | ||
741 | tex_patch_size, tex_patch_size)) | ||
742 | { | ||
743 | mSTexUpdate = FALSE; | ||
744 | |||
745 | // Also generate the water texture | ||
746 | mSurfacep->generateWaterTexture((F32)origin_region.mdV[VX], (F32)origin_region.mdV[VY], | ||
747 | tex_patch_size, tex_patch_size); | ||
748 | } | ||
749 | } // KL | ||
750 | 738 | ||
751 | void LLSurfacePatch::dirtyZ() | 739 | void LLSurfacePatch::dirtyZ() |
752 | { | 740 | { |
diff --git a/linden/indra/newview/llsurfacepatch.h b/linden/indra/newview/llsurfacepatch.h index 1f9658d..7e84f7f 100644 --- a/linden/indra/newview/llsurfacepatch.h +++ b/linden/indra/newview/llsurfacepatch.h | |||
@@ -90,7 +90,6 @@ public: | |||
90 | 90 | ||
91 | void updateCameraDistanceRegion( const LLVector3 &pos_region); | 91 | void updateCameraDistanceRegion( const LLVector3 &pos_region); |
92 | void updateVisibility(); | 92 | void updateVisibility(); |
93 | void updateGL(); | ||
94 | 93 | ||
95 | void dirtyZ(); // Dirty the z values of this patch | 94 | void dirtyZ(); // Dirty the z values of this patch |
96 | void setHasReceivedData(); | 95 | void setHasReceivedData(); |
diff --git a/linden/indra/newview/lltexlayer.cpp b/linden/indra/newview/lltexlayer.cpp index fb5be84..5175cbb 100644 --- a/linden/indra/newview/lltexlayer.cpp +++ b/linden/indra/newview/lltexlayer.cpp | |||
@@ -813,19 +813,14 @@ void LLTexLayerSet::requestUpdate() | |||
813 | if( mUpdatesEnabled ) | 813 | if( mUpdatesEnabled ) |
814 | { | 814 | { |
815 | createComposite(); | 815 | createComposite(); |
816 | if (mComposite) | 816 | mComposite->requestUpdate(); |
817 | { | ||
818 | mComposite->requestUpdate(); | ||
819 | } | ||
820 | } | 817 | } |
821 | } | 818 | } |
822 | 819 | ||
823 | void LLTexLayerSet::requestUpload() | 820 | void LLTexLayerSet::requestUpload() |
824 | { | 821 | { |
825 | if (mComposite) | 822 | createComposite(); |
826 | { | 823 | mComposite->requestUpload(); |
827 | mComposite->requestUpload(); | ||
828 | } | ||
829 | } | 824 | } |
830 | 825 | ||
831 | void LLTexLayerSet::cancelUpload() | 826 | void LLTexLayerSet::cancelUpload() |
@@ -840,15 +835,6 @@ void LLTexLayerSet::createComposite() | |||
840 | { | 835 | { |
841 | if( !mComposite ) | 836 | if( !mComposite ) |
842 | { | 837 | { |
843 | gPipeline.markGLRebuild(this); | ||
844 | } | ||
845 | //updateGL(); // KL | ||
846 | } | ||
847 | |||
848 | void LLTexLayerSet::updateGL() | ||
849 | { | ||
850 | if (!mComposite) | ||
851 | { | ||
852 | S32 width = mInfo->mWidth; | 838 | S32 width = mInfo->mWidth; |
853 | S32 height = mInfo->mHeight; | 839 | S32 height = mInfo->mHeight; |
854 | // Composite other avatars at reduced resolution | 840 | // Composite other avatars at reduced resolution |
@@ -879,7 +865,7 @@ void LLTexLayerSet::setUpdatesEnabled( BOOL b ) | |||
879 | void LLTexLayerSet::updateComposite() | 865 | void LLTexLayerSet::updateComposite() |
880 | { | 866 | { |
881 | createComposite(); | 867 | createComposite(); |
882 | //mComposite->updateImmediate(); //KL exception here this needs fixing for S19 | 868 | mComposite->updateImmediate(); |
883 | } | 869 | } |
884 | 870 | ||
885 | LLTexLayerSetBuffer* LLTexLayerSet::getComposite() | 871 | LLTexLayerSetBuffer* LLTexLayerSet::getComposite() |
@@ -2118,7 +2104,7 @@ BOOL LLTexLayerParamAlpha::render( S32 x, S32 y, S32 width, S32 height ) | |||
2118 | // Create the GL texture, and then hang onto it for future use. | 2104 | // Create the GL texture, and then hang onto it for future use. |
2119 | if( mNeedsCreateTexture ) | 2105 | if( mNeedsCreateTexture ) |
2120 | { | 2106 | { |
2121 | mCachedProcessedImageGL->createGLTexture(0, mStaticImageRaw, 0); | 2107 | mCachedProcessedImageGL->createGLTexture(0, mStaticImageRaw, 0, TRUE, LLViewerImageBoostLevel::TEXLAYER_CACHE); |
2122 | mNeedsCreateTexture = FALSE; | 2108 | mNeedsCreateTexture = FALSE; |
2123 | gGL.getTexUnit(0)->bind(mCachedProcessedImageGL); | 2109 | gGL.getTexUnit(0)->bind(mCachedProcessedImageGL); |
2124 | mCachedProcessedImageGL->setAddressMode(LLTexUnit::TAM_CLAMP); | 2110 | mCachedProcessedImageGL->setAddressMode(LLTexUnit::TAM_CLAMP); |
@@ -2574,7 +2560,7 @@ LLImageGL* LLTexStaticImageList::getImageGL(const std::string& file_name, BOOL i | |||
2574 | image_gl->setExplicitFormat( GL_ALPHA8, GL_ALPHA ); | 2560 | image_gl->setExplicitFormat( GL_ALPHA8, GL_ALPHA ); |
2575 | } | 2561 | } |
2576 | 2562 | ||
2577 | image_gl->createGLTexture(0, image_raw, 0); | 2563 | image_gl->createGLTexture(0, image_raw, 0, TRUE, LLViewerImageBoostLevel::OTHER); |
2578 | 2564 | ||
2579 | gGL.getTexUnit(0)->bind(image_gl); | 2565 | gGL.getTexUnit(0)->bind(image_gl); |
2580 | image_gl->setAddressMode(LLTexUnit::TAM_CLAMP); | 2566 | image_gl->setAddressMode(LLTexUnit::TAM_CLAMP); |
diff --git a/linden/indra/newview/lltexlayer.h b/linden/indra/newview/lltexlayer.h index b841fa3..020ba86 100644 --- a/linden/indra/newview/lltexlayer.h +++ b/linden/indra/newview/lltexlayer.h | |||
@@ -249,7 +249,7 @@ private: | |||
249 | // LLTexLayerSet | 249 | // LLTexLayerSet |
250 | // An ordered set of texture layers that get composited into a single texture. | 250 | // An ordered set of texture layers that get composited into a single texture. |
251 | //----------------------------------------------------------------------------- | 251 | //----------------------------------------------------------------------------- |
252 | class LLTexLayerSet : public LLGLUpdate | 252 | class LLTexLayerSet |
253 | { | 253 | { |
254 | friend class LLTexLayerSetBuffer; | 254 | friend class LLTexLayerSetBuffer; |
255 | public: | 255 | public: |
@@ -284,7 +284,7 @@ public: | |||
284 | LLVOAvatarDefines::EBakedTextureIndex getBakedTexIndex() { return mBakedTexIndex; } | 284 | LLVOAvatarDefines::EBakedTextureIndex getBakedTexIndex() { return mBakedTexIndex; } |
285 | void setBakedTexIndex(LLVOAvatarDefines::EBakedTextureIndex index) { mBakedTexIndex = index; } | 285 | void setBakedTexIndex(LLVOAvatarDefines::EBakedTextureIndex index) { mBakedTexIndex = index; } |
286 | BOOL isVisible() const { return mIsVisible; } | 286 | BOOL isVisible() const { return mIsVisible; } |
287 | /*virtual*/ void updateGL(); | 287 | |
288 | public: | 288 | public: |
289 | static BOOL sHasCaches; | 289 | static BOOL sHasCaches; |
290 | 290 | ||
diff --git a/linden/indra/newview/lltextureatlasmanager.cpp b/linden/indra/newview/lltextureatlasmanager.cpp deleted file mode 100644 index df6a39d..0000000 --- a/linden/indra/newview/lltextureatlasmanager.cpp +++ /dev/null | |||
@@ -1,274 +0,0 @@ | |||
1 | /** | ||
2 | * @file lltextureatlasmanager.cpp | ||
3 | * @brief LLTextureAtlasManager class implementation. | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2002-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 | #include "llviewerprecompiledheaders.h" | ||
33 | #include "linden_common.h" | ||
34 | #include "llerror.h" | ||
35 | #include "llmath.h" | ||
36 | #include "lltextureatlas.h" | ||
37 | #include "lltextureatlasmanager.h" | ||
38 | #include "llspatialpartition.h" | ||
39 | |||
40 | const S8 MAX_NUM_EMPTY_ATLAS = 2 ; | ||
41 | const F32 MIN_ATLAS_FULLNESS = 0.6f ; | ||
42 | |||
43 | //********************************************************************************************* | ||
44 | //implementation of class LLTextureAtlasInfo | ||
45 | //********************************************************************************************* | ||
46 | LLTextureAtlasSlot::LLTextureAtlasSlot(LLTextureAtlas* atlasp, LLSpatialGroup* groupp, S16 col, S16 row, F32 xoffset, F32 yoffset, S8 slot_width) : | ||
47 | mAtlasp(atlasp), | ||
48 | mGroupp(groupp), | ||
49 | mCol(col), | ||
50 | mRow(row), | ||
51 | mReservedSlotWidth(slot_width), | ||
52 | mValid(FALSE), | ||
53 | mUpdatedTime(0), | ||
54 | mTexCoordOffset(xoffset, yoffset), | ||
55 | mTexCoordScale(1.f, 1.f) | ||
56 | { | ||
57 | llassert_always(mAtlasp || mGroupp || mReservedSlotWidth) ; | ||
58 | } | ||
59 | |||
60 | LLTextureAtlasSlot::~LLTextureAtlasSlot() | ||
61 | { | ||
62 | if(mAtlasp) | ||
63 | { | ||
64 | mAtlasp->releaseSlot(mCol, mRow, mReservedSlotWidth) ; | ||
65 | if(mAtlasp->isEmpty()) | ||
66 | { | ||
67 | LLTextureAtlasManager::getInstance()->releaseAtlas(mAtlasp) ; | ||
68 | } | ||
69 | mAtlasp = NULL ; | ||
70 | } | ||
71 | } | ||
72 | |||
73 | //void LLTextureAtlasSlot::setAtlas(LLTextureAtlas* atlasp) | ||
74 | //{ | ||
75 | // mAtlasp = atlasp ; | ||
76 | //} | ||
77 | //void LLTextureAtlasSlot::setSlotPos(S16 col, S16 row) | ||
78 | //{ | ||
79 | // mCol = col ; | ||
80 | // mRow = row ; | ||
81 | //} | ||
82 | //void LLTextureAtlasSlot::setSlotWidth(S8 width) | ||
83 | //{ | ||
84 | // //slot is a square with each edge length a power-of-two number | ||
85 | // mReservedSlotWidth = width ; | ||
86 | //} | ||
87 | //void LLTextureAtlasSlot::setTexCoordOffset(F32 xoffset, F32 yoffset) | ||
88 | //{ | ||
89 | // mTexCoordOffset.mV[0] = xoffset ; | ||
90 | // mTexCoordOffset.mV[1] = yoffset ; | ||
91 | //} | ||
92 | |||
93 | void LLTextureAtlasSlot::setSpatialGroup(LLSpatialGroup* groupp) | ||
94 | { | ||
95 | mGroupp = groupp ; | ||
96 | } | ||
97 | void LLTextureAtlasSlot::setTexCoordScale(F32 xscale, F32 yscale) | ||
98 | { | ||
99 | mTexCoordScale.mV[0] = xscale ; | ||
100 | mTexCoordScale.mV[1] = yscale ; | ||
101 | } | ||
102 | //********************************************************************************************* | ||
103 | //END of implementation of class LLTextureAtlasInfo | ||
104 | //********************************************************************************************* | ||
105 | |||
106 | //********************************************************************************************* | ||
107 | //implementation of class LLTextureAtlasManager | ||
108 | //********************************************************************************************* | ||
109 | LLTextureAtlasManager::LLTextureAtlasManager() : | ||
110 | mAtlasMap(4), | ||
111 | mEmptyAtlasMap(4) | ||
112 | { | ||
113 | } | ||
114 | |||
115 | LLTextureAtlasManager::~LLTextureAtlasManager() | ||
116 | { | ||
117 | for(S32 i = 0 ; i < 4 ; i++) | ||
118 | { | ||
119 | for(ll_texture_atlas_list_t::iterator j = mAtlasMap[i].begin() ; j != mAtlasMap[i].end() ; ++j) | ||
120 | { | ||
121 | *j = NULL ; | ||
122 | } | ||
123 | for(ll_texture_atlas_list_t::iterator j = mEmptyAtlasMap[i].begin() ; j != mEmptyAtlasMap[i].end() ; ++j) | ||
124 | { | ||
125 | *j = NULL ; | ||
126 | } | ||
127 | |||
128 | mAtlasMap[i].clear() ; | ||
129 | mEmptyAtlasMap[i].clear() ; | ||
130 | } | ||
131 | mAtlasMap.clear() ; | ||
132 | mEmptyAtlasMap.clear() ; | ||
133 | } | ||
134 | |||
135 | //return TRUE if qualified | ||
136 | BOOL LLTextureAtlasManager::canAddToAtlas(S32 w, S32 h, S8 ncomponents, LLGLenum target) | ||
137 | { | ||
138 | if(ncomponents < 1 || ncomponents > 4) | ||
139 | { | ||
140 | return FALSE ; | ||
141 | } | ||
142 | //only support GL_TEXTURE_2D | ||
143 | if(GL_TEXTURE_2D != target) | ||
144 | { | ||
145 | return FALSE ; | ||
146 | } | ||
147 | //real image size overflows | ||
148 | if(w < 8 || w > LLTextureAtlas::sMaxSubTextureSize || h < 8 || h > LLTextureAtlas::sMaxSubTextureSize) | ||
149 | { | ||
150 | return FALSE ; | ||
151 | } | ||
152 | |||
153 | //if non-power-of-two number | ||
154 | if((w & (w - 1)) || (h & (h - 1))) | ||
155 | { | ||
156 | return FALSE ; | ||
157 | } | ||
158 | |||
159 | return TRUE ; | ||
160 | } | ||
161 | |||
162 | void LLTextureAtlasManager::releaseAtlas(LLTextureAtlas* atlasp) | ||
163 | { | ||
164 | LLSpatialGroup* groupp = atlasp->getLastSpatialGroup() ; | ||
165 | while(groupp) | ||
166 | { | ||
167 | groupp->removeAtlas(atlasp, FALSE) ; | ||
168 | atlasp->removeLastSpatialGroup() ; | ||
169 | |||
170 | groupp = atlasp->getLastSpatialGroup() ; | ||
171 | } | ||
172 | |||
173 | S8 type = atlasp->getComponents() - 1 ; | ||
174 | //insert to the empty list | ||
175 | if(mEmptyAtlasMap[type].size() < MAX_NUM_EMPTY_ATLAS) | ||
176 | { | ||
177 | mEmptyAtlasMap[type].push_back(atlasp) ; | ||
178 | } | ||
179 | |||
180 | //delete the atlasp | ||
181 | mAtlasMap[type].remove(atlasp) ; | ||
182 | } | ||
183 | |||
184 | // | ||
185 | //this function reserves an appropriate slot from atlas pool for an image. | ||
186 | //return non-NULL if succeeds. | ||
187 | //Note: | ||
188 | //1, this function does not check if the image this slot assigned for qualifies for atlas or not, | ||
189 | // call LLTextureAtlasManager::canAddToAtlas(...) to do the check before calling this function. | ||
190 | //2, this function also dose not check if the image is already in atlas. It always assigns a new slot anyway. | ||
191 | //3, this function tries to group sub-textures from same spatial group into ONE atlas to improve render batching. | ||
192 | // | ||
193 | LLPointer<LLTextureAtlasSlot> LLTextureAtlasManager::reserveAtlasSlot(S32 sub_texture_size, S8 ncomponents, | ||
194 | LLSpatialGroup* groupp, LLViewerImage* imagep) | ||
195 | { | ||
196 | if(!groupp) | ||
197 | { | ||
198 | //do not insert to atlas if does not have a group. | ||
199 | return NULL ; | ||
200 | } | ||
201 | |||
202 | //bits_len must <= 8 and is a power of two number, i.e.: must be one of these numbers: 1, 2, 4, 8. | ||
203 | if(sub_texture_size > LLTextureAtlas::sMaxSubTextureSize) | ||
204 | { | ||
205 | sub_texture_size = LLTextureAtlas::sMaxSubTextureSize ; | ||
206 | } | ||
207 | S8 bits_len = sub_texture_size / LLTextureAtlas::sSlotSize ; | ||
208 | if(bits_len < 1) | ||
209 | { | ||
210 | bits_len = 1 ; | ||
211 | } | ||
212 | |||
213 | S16 col = -1, row = -1; | ||
214 | S8 total_bits = bits_len * bits_len ; | ||
215 | |||
216 | //insert to the atlas reserved by the same spatial group | ||
217 | LLPointer<LLTextureAtlas> atlasp = groupp->getAtlas(ncomponents, total_bits) ; | ||
218 | if(atlasp.notNull()) | ||
219 | { | ||
220 | if(!atlasp->getNextAvailableSlot(bits_len, col, row)) | ||
221 | { | ||
222 | //failed | ||
223 | atlasp = NULL ; | ||
224 | } | ||
225 | } | ||
226 | |||
227 | //search an atlas to fit for 'size' | ||
228 | if(!atlasp) | ||
229 | { | ||
230 | S8 atlas_index = ncomponents - 1 ; | ||
231 | ll_texture_atlas_list_t::iterator iter = mAtlasMap[atlas_index].begin() ; | ||
232 | for(; iter != mAtlasMap[atlas_index].end(); ++iter) | ||
233 | { | ||
234 | LLTextureAtlas* cur = (LLTextureAtlas*)*iter ; | ||
235 | if(cur->getFullness() < MIN_ATLAS_FULLNESS)//this atlas is empty enough for this group to insert more sub-textures later if necessary. | ||
236 | { | ||
237 | if(cur->getNextAvailableSlot(bits_len, col, row)) | ||
238 | { | ||
239 | atlasp = cur ; | ||
240 | groupp->addAtlas(atlasp) ; | ||
241 | break ; | ||
242 | } | ||
243 | } | ||
244 | } | ||
245 | } | ||
246 | |||
247 | //create a new atlas if necessary | ||
248 | if(!atlasp) | ||
249 | { | ||
250 | if(mEmptyAtlasMap[ncomponents - 1].size() > 0) | ||
251 | { | ||
252 | //there is an empty one | ||
253 | atlasp = mEmptyAtlasMap[ncomponents - 1].back() ; | ||
254 | mEmptyAtlasMap[ncomponents - 1].pop_back() ; | ||
255 | } | ||
256 | else | ||
257 | { | ||
258 | atlasp = new LLTextureAtlas(ncomponents, 16) ; | ||
259 | } | ||
260 | mAtlasMap[ncomponents - 1].push_back(atlasp) ; | ||
261 | atlasp->getNextAvailableSlot(bits_len, col, row) ; | ||
262 | groupp->addAtlas(atlasp) ; | ||
263 | } | ||
264 | |||
265 | F32 xoffset, yoffset ; | ||
266 | atlasp->getTexCoordOffset(col, row, xoffset, yoffset) ; | ||
267 | LLPointer<LLTextureAtlasSlot> slot_infop = new LLTextureAtlasSlot(atlasp, groupp, col, row, xoffset, yoffset, bits_len) ; | ||
268 | |||
269 | return slot_infop ; | ||
270 | } | ||
271 | |||
272 | //********************************************************************************************* | ||
273 | //END of implementation of class LLTextureAtlasManager | ||
274 | //********************************************************************************************* | ||
diff --git a/linden/indra/newview/lltextureatlasmanager.h b/linden/indra/newview/lltextureatlasmanager.h deleted file mode 100644 index 70689bf..0000000 --- a/linden/indra/newview/lltextureatlasmanager.h +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | /** | ||
2 | * @file lltextureatlasmanager.h | ||
3 | * @brief LLTextureAtlasManager base class. | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2002-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 | |||
34 | #ifndef LL_TEXTUREATLASMANAGER_H | ||
35 | #define LL_TEXTUREATLASMANAGER_H | ||
36 | |||
37 | #include "llmemory.h" | ||
38 | |||
39 | class LLSpatialGroup ; | ||
40 | class LLViewerImage ; | ||
41 | |||
42 | //just use it as a structure. | ||
43 | class LLTextureAtlasSlot : public LLRefCount | ||
44 | { | ||
45 | public: | ||
46 | LLTextureAtlasSlot(LLTextureAtlas* atlasp, LLSpatialGroup* groupp, S16 col, S16 row, F32 xoffset, F32 yoffset, S8 slot_width) ; | ||
47 | |||
48 | protected: | ||
49 | virtual ~LLTextureAtlasSlot(); | ||
50 | |||
51 | public: | ||
52 | |||
53 | // | ||
54 | //do not allow to change those values | ||
55 | // | ||
56 | //void setAtlas(LLTextureAtlas* atlasp) ; | ||
57 | //void setSlotPos(S16 col, S16 row) ; | ||
58 | //void setSlotWidth(S8 width) ; | ||
59 | //void setTexCoordOffset(F32 xoffser, F32 yoffset) ; | ||
60 | // | ||
61 | |||
62 | void setSpatialGroup(LLSpatialGroup* groupp) ; | ||
63 | void setTexCoordScale(F32 xscale, F32 yscale) ; | ||
64 | void setValid() {mValid = TRUE ;} | ||
65 | |||
66 | LLTextureAtlas* getAtlas()const {return mAtlasp;} | ||
67 | LLSpatialGroup* getSpatialGroup() const {return mGroupp ;} | ||
68 | S16 getSlotCol()const {return mCol;} | ||
69 | S16 getSlotRow()const {return mRow;} | ||
70 | S8 getSlotWidth()const{return mReservedSlotWidth;} | ||
71 | BOOL isValid()const { return mValid;} | ||
72 | const LLVector2* getTexCoordOffset()const {return &mTexCoordOffset;} | ||
73 | const LLVector2* getTexCoordScale() const {return &mTexCoordScale;} | ||
74 | |||
75 | void setUpdatedTime(U32 t) {mUpdatedTime = t;} | ||
76 | U32 getUpdatedTime()const {return mUpdatedTime;} | ||
77 | |||
78 | private: | ||
79 | LLTextureAtlas* mAtlasp; | ||
80 | S16 mCol ;//col of the slot | ||
81 | S16 mRow ;//row of the slot | ||
82 | S8 mReservedSlotWidth ; //slot is a square with each edge length a power-of-two number | ||
83 | LLSpatialGroup* mGroupp ; | ||
84 | BOOL mValid ; | ||
85 | |||
86 | LLVector2 mTexCoordOffset ; | ||
87 | LLVector2 mTexCoordScale ; | ||
88 | |||
89 | U32 mUpdatedTime ; | ||
90 | } ; | ||
91 | |||
92 | class LLTextureAtlasManager : public LLSingleton<LLTextureAtlasManager> | ||
93 | { | ||
94 | private: | ||
95 | typedef std::list<LLPointer<LLTextureAtlas> > ll_texture_atlas_list_t ; | ||
96 | |||
97 | public: | ||
98 | LLTextureAtlasManager(); | ||
99 | ~LLTextureAtlasManager(); | ||
100 | |||
101 | LLPointer<LLTextureAtlasSlot> reserveAtlasSlot(S32 sub_texture_size, S8 ncomponents, | ||
102 | LLSpatialGroup* groupp, LLViewerImage* imagep) ; | ||
103 | void releaseAtlas(LLTextureAtlas* atlasp); | ||
104 | |||
105 | BOOL canAddToAtlas(S32 w, S32 h, S8 ncomponents, LLGLenum target) ; | ||
106 | |||
107 | private: | ||
108 | std::vector<ll_texture_atlas_list_t> mAtlasMap ; | ||
109 | std::vector<ll_texture_atlas_list_t> mEmptyAtlasMap ; //delay some empty atlases deletion to avoid possible creation of new atlas immediately. | ||
110 | }; | ||
111 | |||
112 | #endif | ||
diff --git a/linden/indra/newview/lltextureview.cpp b/linden/indra/newview/lltextureview.cpp index 903a6e5..04cebf5 100644 --- a/linden/indra/newview/lltextureview.cpp +++ b/linden/indra/newview/lltextureview.cpp | |||
@@ -57,16 +57,14 @@ | |||
57 | extern F32 texmem_lower_bound_scale; | 57 | extern F32 texmem_lower_bound_scale; |
58 | 58 | ||
59 | LLTextureView *gTextureView = NULL; | 59 | LLTextureView *gTextureView = NULL; |
60 | LLTextureSizeView *gTextureSizeView = NULL; | ||
61 | LLTextureSizeView *gTextureCategoryView = NULL; | ||
62 | 60 | ||
63 | //static | 61 | //static |
64 | std::set<LLViewerImage*> LLTextureView::sDebugImages; | 62 | std::set<LLViewerImage*> LLTextureView::sDebugImages; |
65 | 63 | ||
66 | //////////////////////////////////////////////////////////////////////////// | 64 | //////////////////////////////////////////////////////////////////////////// |
67 | 65 | ||
68 | static std::string title_string1a("Tex UUID Area DDis(Req) DecodePri(Fetch) [download]"); | 66 | static std::string title_string1a("Tex UUID Area DDis(Req) DecodePri(Fetch) [download] pk/max"); |
69 | static std::string title_string1b("Tex UUID Area DDis(Req) Fetch(DecodePri) [download]"); | 67 | static std::string title_string1b("Tex UUID Area DDis(Req) Fetch(DecodePri) [download] pk/max"); |
70 | static std::string title_string2("State"); | 68 | static std::string title_string2("State"); |
71 | static std::string title_string3("Pkt Bnd"); | 69 | static std::string title_string3("Pkt Bnd"); |
72 | static std::string title_string4(" W x H (Dis) Mem"); | 70 | static std::string title_string4(" W x H (Dis) Mem"); |
@@ -203,14 +201,13 @@ void LLTextureBar::draw() | |||
203 | } | 201 | } |
204 | else | 202 | else |
205 | { | 203 | { |
206 | tex_str = llformat("%s %7.0f %d(%d) %8.0f(0x%08x) %1.2f", | 204 | tex_str = llformat("%s %7.0f %d(%d) %8.0f(0x%08x)", |
207 | uuid_str.c_str(), | 205 | uuid_str.c_str(), |
208 | mImagep->mMaxVirtualSize, | 206 | mImagep->mMaxVirtualSize, |
209 | mImagep->mDesiredDiscardLevel, | 207 | mImagep->mDesiredDiscardLevel, |
210 | mImagep->mRequestedDiscardLevel, | 208 | mImagep->mRequestedDiscardLevel, |
211 | mImagep->getDecodePriority(), | 209 | mImagep->getDecodePriority(), |
212 | mImagep->mFetchPriority, | 210 | mImagep->mFetchPriority); |
213 | mImagep->mDownloadProgress); | ||
214 | } | 211 | } |
215 | 212 | ||
216 | LLFontGL::getFontMonospace()->renderUTF8(tex_str, 0, title_x1, getRect().getHeight(), | 213 | LLFontGL::getFontMonospace()->renderUTF8(tex_str, 0, title_x1, getRect().getHeight(), |
@@ -256,7 +253,7 @@ void LLTextureBar::draw() | |||
256 | 253 | ||
257 | // Draw the progress bar. | 254 | // Draw the progress bar. |
258 | S32 bar_width = 100; | 255 | S32 bar_width = 100; |
259 | S32 bar_left = 330; | 256 | S32 bar_left = 260; |
260 | left = bar_left; | 257 | left = bar_left; |
261 | right = left + bar_width; | 258 | right = left + bar_width; |
262 | 259 | ||
@@ -265,7 +262,7 @@ void LLTextureBar::draw() | |||
265 | 262 | ||
266 | F32 data_progress = mImagep->mDownloadProgress; | 263 | F32 data_progress = mImagep->mDownloadProgress; |
267 | 264 | ||
268 | if (data_progress > 0.0f && data_progress <= 1.0f) | 265 | if (data_progress > 0.0f) |
269 | { | 266 | { |
270 | // Downloaded bytes | 267 | // Downloaded bytes |
271 | right = left + llfloor(data_progress * (F32)bar_width); | 268 | right = left + llfloor(data_progress * (F32)bar_width); |
@@ -275,16 +272,6 @@ void LLTextureBar::draw() | |||
275 | gl_rect_2d(left, top, right, bottom); | 272 | gl_rect_2d(left, top, right, bottom); |
276 | } | 273 | } |
277 | } | 274 | } |
278 | else if (data_progress > 1.0f) | ||
279 | { | ||
280 | // Small cached textures generate this oddity. SNOW-168 | ||
281 | right = left + bar_width; | ||
282 | if (right > left) | ||
283 | { | ||
284 | gGL.color4f(0.f, 0.33f, 0.f, 0.75f); | ||
285 | gl_rect_2d(left, top, right, bottom); | ||
286 | } | ||
287 | } | ||
288 | 275 | ||
289 | S32 pip_width = 6; | 276 | S32 pip_width = 6; |
290 | S32 pip_space = 14; | 277 | S32 pip_space = 14; |
@@ -399,9 +386,9 @@ private: | |||
399 | 386 | ||
400 | void LLGLTexMemBar::draw() | 387 | void LLGLTexMemBar::draw() |
401 | { | 388 | { |
402 | S32 bound_mem = (LLViewerImage::sBoundTextureMemoryInBytes >> 20); | 389 | S32 bound_mem = BYTES_TO_MEGA_BYTES(LLViewerImage::sBoundTextureMemoryInBytes); |
403 | S32 max_bound_mem = LLViewerImage::sMaxBoundTextureMemInMegaBytes; | 390 | S32 max_bound_mem = LLViewerImage::sMaxBoundTextureMemInMegaBytes; |
404 | S32 total_mem = (LLViewerImage::sTotalTextureMemoryInBytes >> 20); | 391 | S32 total_mem = BYTES_TO_MEGA_BYTES(LLViewerImage::sTotalTextureMemoryInBytes); |
405 | S32 max_total_mem = LLViewerImage::sMaxTotalTextureMemInMegaBytes; | 392 | S32 max_total_mem = LLViewerImage::sMaxTotalTextureMemInMegaBytes; |
406 | F32 discard_bias = LLViewerImage::sDesiredDiscardBias; | 393 | F32 discard_bias = LLViewerImage::sDesiredDiscardBias; |
407 | S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); | 394 | S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); |
@@ -491,25 +478,28 @@ void LLGLTexMemBar::draw() | |||
491 | #endif | 478 | #endif |
492 | //---------------------------------------------------------------------------- | 479 | //---------------------------------------------------------------------------- |
493 | 480 | ||
494 | text = llformat("Textures: %d Fetch: %d(%d) Pkts:%d(%d) Cache R/W: %d/%d LFS:%d IW:%d RAW:%d HTP:%d BW: %.0f/%.0f", | 481 | text = llformat("Textures: %d Fetch: %d(%d) Pkts:%d(%d) Cache R/W: %d/%d LFS:%d IW:%d RAW:%d HTP:%d", |
495 | gImageList.getNumImages(), | 482 | gImageList.getNumImages(), |
496 | LLAppViewer::getTextureFetch()->getNumRequests(), | 483 | LLAppViewer::getTextureFetch()->getNumRequests(), LLAppViewer::getTextureFetch()->getNumDeletes(), |
497 | LLAppViewer::getTextureFetch()->getNumDeletes(), | 484 | LLAppViewer::getTextureFetch()->mPacketCount, LLAppViewer::getTextureFetch()->mBadPacketCount, |
498 | LLAppViewer::getTextureFetch()->mPacketCount, | 485 | LLAppViewer::getTextureCache()->getNumReads(), LLAppViewer::getTextureCache()->getNumWrites(), |
499 | LLAppViewer::getTextureFetch()->mBadPacketCount, | ||
500 | LLAppViewer::getTextureCache()->getNumReads(), | ||
501 | LLAppViewer::getTextureCache()->getNumWrites(), | ||
502 | LLLFSThread::sLocal->getPending(), | 486 | LLLFSThread::sLocal->getPending(), |
503 | LLAppViewer::getImageDecodeThread()->getPending(), | 487 | LLAppViewer::getImageDecodeThread()->getPending(), |
504 | LLImageRaw::sRawImageCount, | 488 | LLImageRaw::sRawImageCount, |
505 | LLAppViewer::getTextureFetch()->getNumHTTPRequests(), | 489 | LLAppViewer::getTextureFetch()->getNumHTTPRequests()); |
506 | LLAppViewer::getTextureFetch()->getTextureBandwidth(), | ||
507 | gSavedSettings.getF32("ThrottleBandwidthKBPS")); | ||
508 | 490 | ||
509 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, line_height*2, | 491 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, line_height*2, |
510 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | 492 | text_color, LLFontGL::LEFT, LLFontGL::TOP); |
511 | 493 | ||
512 | left = 600; | 494 | |
495 | left = 550; | ||
496 | F32 bandwidth = LLAppViewer::getTextureFetch()->getTextureBandwidth(); | ||
497 | F32 max_bandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS"); | ||
498 | color = bandwidth > max_bandwidth ? LLColor4::red : bandwidth > max_bandwidth*.75f ? LLColor4::yellow : text_color; | ||
499 | color[VALPHA] = text_color[VALPHA]; | ||
500 | text = llformat("BW:%.0f/%.0f",bandwidth, max_bandwidth); | ||
501 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left, line_height*2, | ||
502 | color, LLFontGL::LEFT, LLFontGL::TOP); | ||
513 | 503 | ||
514 | S32 dx1 = 0; | 504 | S32 dx1 = 0; |
515 | if (LLAppViewer::getTextureFetch()->mDebugPause) | 505 | if (LLAppViewer::getTextureFetch()->mDebugPause) |
@@ -576,7 +566,7 @@ public: | |||
576 | void setTop(S32 loaded, S32 bound, F32 scale) {mTopLoaded = loaded ; mTopBound = bound; mScale = scale ;} | 566 | void setTop(S32 loaded, S32 bound, F32 scale) {mTopLoaded = loaded ; mTopBound = bound; mScale = scale ;} |
577 | 567 | ||
578 | void draw(); | 568 | void draw(); |
579 | BOOL handleHover(S32 x, S32 y, MASK mask) ; | 569 | BOOL handleHover(S32 x, S32 y, MASK mask, BOOL set_pick_size) ; |
580 | 570 | ||
581 | private: | 571 | private: |
582 | S32 mIndex ; | 572 | S32 mIndex ; |
@@ -589,19 +579,16 @@ private: | |||
589 | F32 mScale ; | 579 | F32 mScale ; |
590 | }; | 580 | }; |
591 | 581 | ||
592 | BOOL LLGLTexSizeBar::handleHover(S32 x, S32 y, MASK mask) | 582 | BOOL LLGLTexSizeBar::handleHover(S32 x, S32 y, MASK mask, BOOL set_pick_size) |
593 | { | 583 | { |
594 | #if !LL_RELEASE_FOR_DOWNLOAD | ||
595 | if(y > mBottom && (y < mBottom + (S32)(mTopLoaded * mScale) || y < mBottom + (S32)(mTopBound * mScale))) | 584 | if(y > mBottom && (y < mBottom + (S32)(mTopLoaded * mScale) || y < mBottom + (S32)(mTopBound * mScale))) |
596 | { | 585 | { |
597 | LLImageGL::setCurTexSizebar(mIndex); | 586 | LLImageGL::setCurTexSizebar(mIndex, set_pick_size); |
598 | } | 587 | } |
599 | #endif | ||
600 | return TRUE ; | 588 | return TRUE ; |
601 | } | 589 | } |
602 | void LLGLTexSizeBar::draw() | 590 | void LLGLTexSizeBar::draw() |
603 | { | 591 | { |
604 | #if !LL_RELEASE_FOR_DOWNLOAD | ||
605 | LLGLSUIDefault gls_ui; | 592 | LLGLSUIDefault gls_ui; |
606 | 593 | ||
607 | if(LLImageGL::sCurTexSizeBar == mIndex) | 594 | if(LLImageGL::sCurTexSizeBar == mIndex) |
@@ -622,7 +609,6 @@ void LLGLTexSizeBar::draw() | |||
622 | F32 bound_color[] = {1.0f, 1.0f, 0.0f, 0.75f}; | 609 | F32 bound_color[] = {1.0f, 1.0f, 0.0f, 0.75f}; |
623 | gl_rect_2d(mLeft, mBottom + (S32)(mTopLoaded * mScale), (mLeft + mRight) / 2, mBottom, loaded_color) ; | 610 | gl_rect_2d(mLeft, mBottom + (S32)(mTopLoaded * mScale), (mLeft + mRight) / 2, mBottom, loaded_color) ; |
624 | gl_rect_2d((mLeft + mRight) / 2, mBottom + (S32)(mTopBound * mScale), mRight, mBottom, bound_color) ; | 611 | gl_rect_2d((mLeft + mRight) / 2, mBottom + (S32)(mTopBound * mScale), mRight, mBottom, bound_color) ; |
625 | #endif | ||
626 | } | 612 | } |
627 | //////////////////////////////////////////////////////////////////////////// | 613 | //////////////////////////////////////////////////////////////////////////// |
628 | 614 | ||
@@ -927,7 +913,31 @@ LLTextureSizeView::~LLTextureSizeView() | |||
927 | } | 913 | } |
928 | void LLTextureSizeView::draw() | 914 | void LLTextureSizeView::draw() |
929 | { | 915 | { |
930 | #if !LL_RELEASE_FOR_DOWNLOAD | 916 | if(mType == TEXTURE_MEM_OVER_SIZE) |
917 | { | ||
918 | drawTextureSizeGraph(); | ||
919 | } | ||
920 | else | ||
921 | { | ||
922 | drawTextureCategoryGraph() ; | ||
923 | } | ||
924 | |||
925 | LLView::draw(); | ||
926 | } | ||
927 | |||
928 | BOOL LLTextureSizeView::handleHover(S32 x, S32 y, MASK mask) | ||
929 | { | ||
930 | if(x > mTextureSizeBarRect.mLeft && x < mTextureSizeBarRect.mRight) | ||
931 | { | ||
932 | mTextureSizeBar[(x - mTextureSizeBarRect.mLeft) / mTextureSizeBarWidth]->handleHover(x, y, mask, (mType == TEXTURE_MEM_OVER_SIZE)) ; | ||
933 | } | ||
934 | |||
935 | return TRUE ; | ||
936 | } | ||
937 | |||
938 | //draw real-time texture mem bar over size | ||
939 | void LLTextureSizeView::drawTextureSizeGraph() | ||
940 | { | ||
931 | if(mTextureSizeBar.size() == 0) | 941 | if(mTextureSizeBar.size() == 0) |
932 | { | 942 | { |
933 | S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); | 943 | S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); |
@@ -948,29 +958,16 @@ void LLTextureSizeView::draw() | |||
948 | mTextureSizeBar[i]->draw() ; | 958 | mTextureSizeBar[i]->draw() ; |
949 | } | 959 | } |
950 | LLImageGL::resetCurTexSizebar(); | 960 | LLImageGL::resetCurTexSizebar(); |
951 | |||
952 | LLView::draw(); | ||
953 | #endif | ||
954 | } | ||
955 | |||
956 | BOOL LLTextureSizeView::handleHover(S32 x, S32 y, MASK mask) | ||
957 | { | ||
958 | if(x > mTextureSizeBarRect.mLeft && x < mTextureSizeBarRect.mRight) | ||
959 | { | ||
960 | mTextureSizeBar[(x - mTextureSizeBarRect.mLeft) / mTextureSizeBarWidth]->handleHover(x, y, mask) ; | ||
961 | } | ||
962 | |||
963 | return TRUE ; | ||
964 | } | 961 | } |
965 | 962 | ||
966 | //draw background of texture size bar graph | 963 | //draw background of texture size bar graph |
967 | F32 LLTextureSizeView::drawTextureSizeDistributionGraph() | 964 | F32 LLTextureSizeView::drawTextureSizeDistributionGraph() |
968 | { | 965 | { |
966 | //scale | ||
969 | F32 scale = 1.0f ; | 967 | F32 scale = 1.0f ; |
970 | #if !LL_RELEASE_FOR_DOWNLOAD | 968 | |
971 | LLGLSUIDefault gls_ui; | 969 | LLGLSUIDefault gls_ui; |
972 | 970 | ||
973 | //scale | ||
974 | { | 971 | { |
975 | S32 count = 0 ; | 972 | S32 count = 0 ; |
976 | for(U32 i = 0 ; i < LLImageGL::sTextureLoadedCounter.size() ; i++) | 973 | for(U32 i = 0 ; i < LLImageGL::sTextureLoadedCounter.size() ; i++) |
@@ -1060,7 +1057,136 @@ F32 LLTextureSizeView::drawTextureSizeDistributionGraph() | |||
1060 | text = llformat("Texture Size Distribution") ; | 1057 | text = llformat("Texture Size Distribution") ; |
1061 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 250, top + line_height * 3, | 1058 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 250, top + line_height * 3, |
1062 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | 1059 | text_color, LLFontGL::LEFT, LLFontGL::TOP); |
1060 | return scale ; | ||
1061 | } | ||
1062 | |||
1063 | //draw real-time texture mem bar over category | ||
1064 | void LLTextureSizeView::drawTextureCategoryGraph() | ||
1065 | { | ||
1066 | if(mTextureSizeBar.size() == 0) | ||
1067 | { | ||
1068 | S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); | ||
1069 | mTextureSizeBar.resize(LLImageGL::sTextureMemByCategory.size()) ; | ||
1070 | mTextureSizeBarRect.set(700, line_height * 2 + 400, 700 + mTextureSizeBar.size() * mTextureSizeBarWidth, line_height * 2) ; | ||
1071 | |||
1072 | for(U32 i = 0 ; i < mTextureSizeBar.size() ; i++) | ||
1073 | { | ||
1074 | mTextureSizeBar[i] = new LLGLTexSizeBar(i, mTextureSizeBarRect.mLeft + i * mTextureSizeBarWidth , | ||
1075 | line_height * 2, mTextureSizeBarRect.mLeft + (i + 1) * mTextureSizeBarWidth, line_height) ; | ||
1076 | } | ||
1077 | } | ||
1078 | |||
1079 | F32 size_bar_scale = drawTextureCategoryDistributionGraph() ; | ||
1080 | for(U32 i = 0 ; i < mTextureSizeBar.size() ; i++) | ||
1081 | { | ||
1082 | mTextureSizeBar[i]->setTop(LLImageGL::sTextureMemByCategory[i] >> 20, LLImageGL::sTextureMemByCategoryBound[i] >> 20, size_bar_scale) ; | ||
1083 | mTextureSizeBar[i]->draw() ; | ||
1084 | } | ||
1085 | LLImageGL::resetCurTexSizebar(); | ||
1086 | } | ||
1087 | |||
1088 | //draw background for TEXTURE_MEM_OVER_CATEGORY | ||
1089 | F32 LLTextureSizeView::drawTextureCategoryDistributionGraph() | ||
1090 | { | ||
1091 | //scale | ||
1092 | F32 scale = 4.0f ; | ||
1093 | |||
1094 | LLGLSUIDefault gls_ui; | ||
1095 | |||
1096 | { | ||
1097 | S32 count = 0 ; | ||
1098 | for(U32 i = 0 ; i < LLImageGL::sTextureMemByCategory.size() ; i++) | ||
1099 | { | ||
1100 | S32 tmp = LLImageGL::sTextureMemByCategory[i] >> 20 ; | ||
1101 | if(tmp > count) | ||
1102 | { | ||
1103 | count = tmp ; | ||
1104 | } | ||
1105 | } | ||
1106 | if(count > mTextureSizeBarRect.getHeight() * 0.25f) | ||
1107 | { | ||
1108 | scale = (F32)mTextureSizeBarRect.getHeight() * 0.25f / count ; | ||
1109 | } | ||
1110 | } | ||
1111 | |||
1112 | S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); | ||
1113 | S32 left = mTextureSizeBarRect.mLeft ; | ||
1114 | S32 bottom = mTextureSizeBarRect.mBottom ; | ||
1115 | S32 right = mTextureSizeBarRect.mRight ; | ||
1116 | S32 top = mTextureSizeBarRect.mTop ; | ||
1117 | |||
1118 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); | ||
1119 | |||
1120 | //background rect | ||
1121 | gl_rect_2d(left - 25, top + 30, right + 100, bottom - 25, LLColor4(0.0f, 0.0f, 0.0f, 0.25f)) ; | ||
1122 | |||
1123 | //-------------------------------------------------- | ||
1124 | gGL.color4f(1.0f, 0.5f, 0.5f, 0.75f); | ||
1125 | gl_line_2d(left, bottom, right, bottom) ; //x axis | ||
1126 | gl_line_2d(left, bottom, left, top) ; //y axis | ||
1127 | |||
1128 | //ruler | ||
1129 | //-------------------------------------------------- | ||
1130 | gGL.color4f(1.0f, 0.5f, 0.5f, 0.5f); | ||
1131 | for(S32 i = bottom + 50 ; i <= top ; i += 50) | ||
1132 | { | ||
1133 | gl_line_2d(left, i, right, i) ; | ||
1134 | } | ||
1135 | |||
1136 | //texts | ||
1137 | //-------------------------------------------------- | ||
1138 | F32 text_color[] = {1.f, 1.f, 1.f, 0.75f}; | ||
1139 | std::string text; | ||
1140 | |||
1141 | //------- | ||
1142 | //x axis: size label | ||
1143 | static char category[LLViewerImageBoostLevel::MAX_GL_IMAGE_CATEGORY][4] = | ||
1144 | {"Non", "Bak", "Av", "Cld", "Scp", "Hi", "Trn", "Slt", "Hud", "Bsf", "UI", "Pvw", "Map", "Mvs", "Slf", "Tbp", "Scr", "Fnt", "Bmp", "Dyn", "Tlc", "Mdi", "ALT", "Oth" } ; | ||
1145 | |||
1146 | text = llformat("%s", category[0]) ; | ||
1147 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 12, bottom - line_height / 2, | ||
1148 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1149 | for(U32 i = 1 ; i < mTextureSizeBar.size() ; i++) | ||
1150 | { | ||
1151 | text = llformat("%s", category[i]) ; | ||
1152 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + i * mTextureSizeBarWidth + 12, bottom - line_height / 2, | ||
1153 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1154 | } | ||
1155 | //------- | ||
1156 | |||
1157 | //y axis: number label | ||
1158 | for(S32 i = bottom + 50 ; i <= top ; i += 50) | ||
1159 | { | ||
1160 | text = llformat("%d", (S32)((i - bottom) / scale)) ; | ||
1161 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left - 20, i + line_height / 2 , | ||
1162 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1163 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, right + 5, i + line_height / 2 , | ||
1164 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1165 | } | ||
1166 | |||
1167 | text = llformat("MB") ; | ||
1168 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left - 20, top + line_height * 2 , | ||
1169 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1170 | //-------------------------------------------------- | ||
1171 | F32 loaded_color[] = {1.0f, 0.0f, 0.0f, 0.75f}; | ||
1172 | gl_rect_2d(left + 70, top + line_height * 2, left + 90, top + line_height, loaded_color) ; | ||
1173 | text = llformat("Loaded") ; | ||
1174 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 100, top + line_height * 2, | ||
1175 | loaded_color, | ||
1176 | LLFontGL::LEFT, LLFontGL::TOP); | ||
1177 | |||
1178 | F32 bound_color[] = {1.0f, 1.0f, 0.0f, 0.75f}; | ||
1179 | gl_rect_2d(left + 170, top + line_height * 2, left + 190, top + line_height, bound_color) ; | ||
1180 | text = llformat("Bound") ; | ||
1181 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 200, top + line_height * 2, | ||
1182 | bound_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1183 | |||
1184 | //-------------------------------------------------- | ||
1185 | |||
1186 | //title | ||
1187 | text = llformat("Texture Category Distribution") ; | ||
1188 | LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 250, top + line_height * 3, | ||
1189 | text_color, LLFontGL::LEFT, LLFontGL::TOP); | ||
1063 | 1190 | ||
1064 | #endif | ||
1065 | return scale ; | 1191 | return scale ; |
1066 | } | 1192 | } |
diff --git a/linden/indra/newview/lltoolpie.h b/linden/indra/newview/lltoolpie.h index 54bf409..001886f 100644 --- a/linden/indra/newview/lltoolpie.h +++ b/linden/indra/newview/lltoolpie.h | |||
@@ -86,6 +86,7 @@ private: | |||
86 | LLPickInfo mPick; | 86 | LLPickInfo mPick; |
87 | U8 mClickAction; | 87 | U8 mClickAction; |
88 | LLSafeHandle<LLObjectSelection> mLeftClickSelection; | 88 | LLSafeHandle<LLObjectSelection> mLeftClickSelection; |
89 | protected: | ||
89 | LLPointer<LLViewerObject> mClickActionObject; | 90 | LLPointer<LLViewerObject> mClickActionObject; |
90 | }; | 91 | }; |
91 | 92 | ||
diff --git a/linden/indra/newview/llviewercamera.cpp b/linden/indra/newview/llviewercamera.cpp index 6cef2af..dade65f 100644 --- a/linden/indra/newview/llviewercamera.cpp +++ b/linden/indra/newview/llviewercamera.cpp | |||
@@ -769,8 +769,8 @@ BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts) | |||
769 | 769 | ||
770 | BOOL in_frustum = pointInFrustum(LLVector3(vec)) > 0; | 770 | BOOL in_frustum = pointInFrustum(LLVector3(vec)) > 0; |
771 | 771 | ||
772 | if ( !in_frustum && all_verts || | 772 | if (( !in_frustum && all_verts) || |
773 | in_frustum && !all_verts) | 773 | (in_frustum && !all_verts)) |
774 | { | 774 | { |
775 | return !all_verts; | 775 | return !all_verts; |
776 | } | 776 | } |
diff --git a/linden/indra/newview/llviewercontrol.cpp b/linden/indra/newview/llviewercontrol.cpp index 4c9c098..1531e6c 100644 --- a/linden/indra/newview/llviewercontrol.cpp +++ b/linden/indra/newview/llviewercontrol.cpp | |||
@@ -90,7 +90,7 @@ std::string gCurrentVersion; | |||
90 | extern BOOL gResizeScreenTexture; | 90 | extern BOOL gResizeScreenTexture; |
91 | extern BOOL gDebugGL; | 91 | extern BOOL gDebugGL; |
92 | 92 | ||
93 | //extern BOOL gAuditTexture; | 93 | extern BOOL gAuditTexture; |
94 | 94 | ||
95 | //////////////////////////////////////////////////////////////////////////// | 95 | //////////////////////////////////////////////////////////////////////////// |
96 | // Listeners | 96 | // Listeners |
@@ -418,12 +418,12 @@ static bool handleRenderUseImpostorsChanged(const LLSD& newvalue) | |||
418 | LLVOAvatar::sUseImpostors = newvalue.asBoolean(); | 418 | LLVOAvatar::sUseImpostors = newvalue.asBoolean(); |
419 | return true; | 419 | return true; |
420 | } | 420 | } |
421 | /* | 421 | |
422 | static bool handleAuditTextureChanged(const LLSD& newvalue) | 422 | static bool handleAuditTextureChanged(const LLSD& newvalue) |
423 | { | 423 | { |
424 | gAuditTexture = newvalue.asBoolean(); | 424 | gAuditTexture = newvalue.asBoolean(); |
425 | return true; | 425 | return true; |
426 | }*/ | 426 | } |
427 | 427 | ||
428 | static bool handleRenderDebugGLChanged(const LLSD& newvalue) | 428 | static bool handleRenderDebugGLChanged(const LLSD& newvalue) |
429 | { | 429 | { |
@@ -528,11 +528,6 @@ void settings_setup_listeners() | |||
528 | gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1)); | 528 | gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1)); |
529 | gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); | 529 | gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); |
530 | gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); | 530 | gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); |
531 | |||
532 | gSavedSettings.getControl("RenderSpecularResX")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1)); | ||
533 | gSavedSettings.getControl("RenderSpecularResY")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1)); | ||
534 | gSavedSettings.getControl("RenderSpecularExponent")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1)); | ||
535 | |||
536 | gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1)); | 531 | gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1)); |
537 | gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); | 532 | gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); |
538 | gSavedSettings.getControl("EnableRippleWater")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); | 533 | gSavedSettings.getControl("EnableRippleWater")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); |
@@ -544,9 +539,6 @@ void settings_setup_listeners() | |||
544 | gSavedSettings.getControl("RenderAvatarInvisible")->getSignal()->connect(boost::bind(&handleSetSelfInvisible, _1)); | 539 | gSavedSettings.getControl("RenderAvatarInvisible")->getSignal()->connect(boost::bind(&handleSetSelfInvisible, _1)); |
545 | gSavedSettings.getControl("RenderVolumeLODFactor")->getSignal()->connect(boost::bind(&handleVolumeLODChanged, _1)); | 540 | gSavedSettings.getControl("RenderVolumeLODFactor")->getSignal()->connect(boost::bind(&handleVolumeLODChanged, _1)); |
546 | gSavedSettings.getControl("RenderAvatarLODFactor")->getSignal()->connect(boost::bind(&handleAvatarLODChanged, _1)); | 541 | gSavedSettings.getControl("RenderAvatarLODFactor")->getSignal()->connect(boost::bind(&handleAvatarLODChanged, _1)); |
547 | gSavedSettings.getControl("RenderDeferredShadow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); | ||
548 | gSavedSettings.getControl("RenderDeferredGI")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); | ||
549 | |||
550 | gSavedSettings.getControl("RenderTerrainLODFactor")->getSignal()->connect(boost::bind(&handleTerrainLODChanged, _1)); | 542 | gSavedSettings.getControl("RenderTerrainLODFactor")->getSignal()->connect(boost::bind(&handleTerrainLODChanged, _1)); |
551 | gSavedSettings.getControl("RenderTreeLODFactor")->getSignal()->connect(boost::bind(&handleTreeLODChanged, _1)); | 543 | gSavedSettings.getControl("RenderTreeLODFactor")->getSignal()->connect(boost::bind(&handleTreeLODChanged, _1)); |
552 | gSavedSettings.getControl("RenderFlexTimeFactor")->getSignal()->connect(boost::bind(&handleFlexLODChanged, _1)); | 544 | gSavedSettings.getControl("RenderFlexTimeFactor")->getSignal()->connect(boost::bind(&handleFlexLODChanged, _1)); |
@@ -592,7 +584,7 @@ void settings_setup_listeners() | |||
592 | gSavedSettings.getControl("AudioLevelDoppler")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); | 584 | gSavedSettings.getControl("AudioLevelDoppler")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); |
593 | gSavedSettings.getControl("AudioLevelRolloff")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); | 585 | gSavedSettings.getControl("AudioLevelRolloff")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); |
594 | gSavedSettings.getControl("AudioStreamingMusic")->getSignal()->connect(boost::bind(&handleAudioStreamMusicChanged, _1)); | 586 | gSavedSettings.getControl("AudioStreamingMusic")->getSignal()->connect(boost::bind(&handleAudioStreamMusicChanged, _1)); |
595 | // gSavedSettings.getControl("AuditTexture")->getSignal()->connect(boost::bind(&handleAuditTextureChanged, _1)); | 587 | gSavedSettings.getControl("AuditTexture")->getSignal()->connect(boost::bind(&handleAuditTextureChanged, _1)); |
596 | gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); | 588 | gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); |
597 | gSavedSettings.getControl("MuteMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); | 589 | gSavedSettings.getControl("MuteMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); |
598 | gSavedSettings.getControl("MuteMedia")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); | 590 | gSavedSettings.getControl("MuteMedia")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1)); |
diff --git a/linden/indra/newview/llviewerdisplay.cpp b/linden/indra/newview/llviewerdisplay.cpp index 5e1cf80..5316337 100644 --- a/linden/indra/newview/llviewerdisplay.cpp +++ b/linden/indra/newview/llviewerdisplay.cpp | |||
@@ -128,11 +128,6 @@ void display_startup() | |||
128 | return; | 128 | return; |
129 | } | 129 | } |
130 | 130 | ||
131 | gPipeline.updateGL(); | ||
132 | |||
133 | // Update images? | ||
134 | gImageList.updateImages(0.01f); | ||
135 | |||
136 | LLGLSDefault gls_default; | 131 | LLGLSDefault gls_default; |
137 | 132 | ||
138 | // Required for HTML update in login screen | 133 | // Required for HTML update in login screen |
@@ -604,9 +599,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
604 | gPipeline.updateGeom(max_geom_update_time); | 599 | gPipeline.updateGeom(max_geom_update_time); |
605 | stop_glerror(); | 600 | stop_glerror(); |
606 | 601 | ||
607 | gPipeline.updateGL(); | ||
608 | stop_glerror(); | ||
609 | |||
610 | gFrameStats.start(LLFrameStats::UPDATE_CULL); | 602 | gFrameStats.start(LLFrameStats::UPDATE_CULL); |
611 | S32 water_clip = 0; | 603 | S32 water_clip = 0; |
612 | if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT) > 1) && | 604 | if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT) > 1) && |
@@ -697,8 +689,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
697 | gPipeline.generateSunShadow(*LLViewerCamera::getInstance()); | 689 | gPipeline.generateSunShadow(*LLViewerCamera::getInstance()); |
698 | } | 690 | } |
699 | 691 | ||
700 | LLVertexBuffer::unbind(); // KL | ||
701 | |||
702 | LLGLState::checkStates(); | 692 | LLGLState::checkStates(); |
703 | LLGLState::checkTextureChannels(); | 693 | LLGLState::checkTextureChannels(); |
704 | LLGLState::checkClientArrays(); | 694 | LLGLState::checkClientArrays(); |
@@ -729,7 +719,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
729 | { | 719 | { |
730 | LLAppViewer::instance()->pingMainloopTimeout("Display:Imagery"); | 720 | LLAppViewer::instance()->pingMainloopTimeout("Display:Imagery"); |
731 | gPipeline.generateWaterReflection(*LLViewerCamera::getInstance()); | 721 | gPipeline.generateWaterReflection(*LLViewerCamera::getInstance()); |
732 | gPipeline.generateHighlight(*LLViewerCamera::getInstance()); | ||
733 | } | 722 | } |
734 | 723 | ||
735 | ////////////////////////////////////// | 724 | ////////////////////////////////////// |
@@ -754,9 +743,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
754 | 743 | ||
755 | const F32 max_image_decode_time = llmin(0.005f, 0.005f*10.f*gFrameIntervalSeconds); // 50 ms/second decode time (no more than 5ms/frame) | 744 | const F32 max_image_decode_time = llmin(0.005f, 0.005f*10.f*gFrameIntervalSeconds); // 50 ms/second decode time (no more than 5ms/frame) |
756 | gImageList.updateImages(max_image_decode_time); | 745 | gImageList.updateImages(max_image_decode_time); |
757 | |||
758 | //remove dead textures from GL KL is it req? | ||
759 | LLImageGL::deleteDeadTextures(); | ||
760 | stop_glerror(); | 746 | stop_glerror(); |
761 | } | 747 | } |
762 | llpushcallstacks ; | 748 | llpushcallstacks ; |
@@ -911,7 +897,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
911 | /// and then display it again with compositor effects. | 897 | /// and then display it again with compositor effects. |
912 | /// Using render to texture would be faster/better, but I don't have a | 898 | /// Using render to texture would be faster/better, but I don't have a |
913 | /// grasp of their full display stack just yet. | 899 | /// grasp of their full display stack just yet. |
914 | gPostProcess->apply(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); // KL | 900 | // gPostProcess->apply(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); |
915 | 901 | ||
916 | if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender) | 902 | if (LLPipeline::sRenderDeferred && !LLPipeline::sUnderWaterRender) |
917 | { | 903 | { |
@@ -927,8 +913,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) | |||
927 | render_ui(); | 913 | render_ui(); |
928 | } | 914 | } |
929 | 915 | ||
930 | gPipeline.rebuildGroups(); | ||
931 | |||
932 | LLSpatialGroup::sNoDelete = FALSE; | 916 | LLSpatialGroup::sNoDelete = FALSE; |
933 | } | 917 | } |
934 | 918 | ||
@@ -1015,15 +999,6 @@ void render_hud_attachments() | |||
1015 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_VOLUME); | 999 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_VOLUME); |
1016 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_ALPHA); | 1000 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_ALPHA); |
1017 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_FULLBRIGHT); | 1001 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_FULLBRIGHT); |
1018 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_ALPHA); | ||
1019 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK); | ||
1020 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_BUMP); | ||
1021 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT); | ||
1022 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK); | ||
1023 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_SHINY); | ||
1024 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_SHINY); | ||
1025 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_INVISIBLE); | ||
1026 | gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_PASS_INVISI_SHINY); | ||
1027 | 1002 | ||
1028 | gPipeline.stateSort(hud_cam, result); | 1003 | gPipeline.stateSort(hud_cam, result); |
1029 | 1004 | ||
diff --git a/linden/indra/newview/llviewerimage.cpp b/linden/indra/newview/llviewerimage.cpp index 93c17a2..400fb2f 100644 --- a/linden/indra/newview/llviewerimage.cpp +++ b/linden/indra/newview/llviewerimage.cpp | |||
@@ -60,8 +60,6 @@ | |||
60 | #include "pipeline.h" | 60 | #include "pipeline.h" |
61 | #include "llappviewer.h" | 61 | #include "llappviewer.h" |
62 | #include "llface.h" | 62 | #include "llface.h" |
63 | #include "lltextureatlas.h" | ||
64 | #include "lltextureatlasmanager.h" | ||
65 | #include "llviewercamera.h" | 63 | #include "llviewercamera.h" |
66 | /////////////////////////////////////////////////////////////////////////////// | 64 | /////////////////////////////////////////////////////////////////////////////// |
67 | 65 | ||
@@ -104,7 +102,7 @@ void LLViewerImage::initClass() | |||
104 | sNullImagep = new LLImageGL(1,1,3,TRUE); | 102 | sNullImagep = new LLImageGL(1,1,3,TRUE); |
105 | LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,3); | 103 | LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,3); |
106 | raw->clear(0x77, 0x77, 0x77, 0xFF); | 104 | raw->clear(0x77, 0x77, 0x77, 0xFF); |
107 | sNullImagep->createGLTexture(0, raw); | 105 | sNullImagep->createGLTexture(0, raw, 0, TRUE, LLViewerImageBoostLevel::OTHER); |
108 | 106 | ||
109 | #if 1 | 107 | #if 1 |
110 | LLPointer<LLViewerImage> imagep = new LLViewerImage(IMG_DEFAULT); | 108 | LLPointer<LLViewerImage> imagep = new LLViewerImage(IMG_DEFAULT); |
@@ -133,7 +131,7 @@ void LLViewerImage::initClass() | |||
133 | } | 131 | } |
134 | } | 132 | } |
135 | } | 133 | } |
136 | imagep->createGLTexture(0, image_raw); | 134 | imagep->createGLTexture(0, image_raw, 0, TRUE, LLViewerImageBoostLevel::OTHER); |
137 | image_raw = NULL; | 135 | image_raw = NULL; |
138 | gImageList.addImage(imagep); | 136 | gImageList.addImage(imagep); |
139 | imagep->dontDiscard(); | 137 | imagep->dontDiscard(); |
@@ -143,48 +141,48 @@ void LLViewerImage::initClass() | |||
143 | sSmokeImagep = gImageList.getImage(IMG_SMOKE, TRUE, TRUE); | 141 | sSmokeImagep = gImageList.getImage(IMG_SMOKE, TRUE, TRUE); |
144 | sSmokeImagep->setNoDelete() ; | 142 | sSmokeImagep->setNoDelete() ; |
145 | 143 | ||
146 | #if !LL_RELEASE_FOR_DOWNLOAD | 144 | if(gAuditTexture) |
147 | sDefaultTexturep = new LLImageGL() ; | ||
148 | image_raw = new LLImageRaw(dim,dim,3); | ||
149 | data = image_raw->getData(); | ||
150 | for (S32 i = 0; i<dim; i++) | ||
151 | { | 145 | { |
152 | for (S32 j = 0; j<dim; j++) | 146 | sDefaultTexturep = new LLImageGL() ; |
147 | image_raw = new LLImageRaw(dim,dim,3); | ||
148 | data = image_raw->getData(); | ||
149 | for (S32 i = 0; i<dim; i++) | ||
153 | { | 150 | { |
154 | const S32 border = 2; | 151 | for (S32 j = 0; j<dim; j++) |
155 | if (i<border || j<border || i>=(dim-border) || j>=(dim-border)) | ||
156 | { | ||
157 | *data++ = 0xff; | ||
158 | *data++ = 0xff; | ||
159 | *data++ = 0xff; | ||
160 | } | ||
161 | else | ||
162 | { | 152 | { |
163 | *data++ = 0xff; | 153 | const S32 border = 2; |
164 | *data++ = 0xff; | 154 | if (i<border || j<border || i>=(dim-border) || j>=(dim-border)) |
165 | *data++ = 0x00; | 155 | { |
156 | *data++ = 0xff; | ||
157 | *data++ = 0xff; | ||
158 | *data++ = 0xff; | ||
159 | } | ||
160 | else | ||
161 | { | ||
162 | *data++ = 0xff; | ||
163 | *data++ = 0xff; | ||
164 | *data++ = 0x00; | ||
165 | } | ||
166 | } | 166 | } |
167 | } | 167 | } |
168 | sDefaultTexturep->createGLTexture(0, image_raw, 0, TRUE, LLViewerImageBoostLevel::OTHER); | ||
169 | image_raw = NULL; | ||
170 | sDefaultTexturep->dontDiscard(); | ||
168 | } | 171 | } |
169 | sDefaultTexturep->createGLTexture(0, image_raw); | ||
170 | image_raw = NULL; | ||
171 | sDefaultTexturep->dontDiscard(); | ||
172 | #endif | ||
173 | } | 172 | } |
174 | 173 | ||
175 | // static | 174 | // static |
176 | void LLViewerImage::cleanupClass() | 175 | void LLViewerImage::cleanupClass() |
177 | { | 176 | { |
178 | stop_glerror(); | 177 | stop_glerror(); |
178 | LLImageGL::cleanupClass() ; | ||
179 | |||
179 | sNullImagep = NULL; | 180 | sNullImagep = NULL; |
180 | sDefaultImagep = NULL; | 181 | sDefaultImagep = NULL; |
181 | sSmokeImagep = NULL; | 182 | sSmokeImagep = NULL; |
182 | sMissingAssetImagep = NULL; | 183 | sMissingAssetImagep = NULL; |
183 | sWhiteImagep = NULL; | 184 | sWhiteImagep = NULL; |
184 | 185 | sDefaultTexturep = NULL ; | |
185 | #if !LL_RELEASE_FOR_DOWNLOAD | ||
186 | LLImageGL::sDefaultTexturep = NULL ; | ||
187 | #endif | ||
188 | } | 186 | } |
189 | 187 | ||
190 | // tuning params | 188 | // tuning params |
@@ -233,7 +231,12 @@ void LLViewerImage::updateClass(const F32 velocity, const F32 angular_velocity) | |||
233 | } | 231 | } |
234 | sDesiredDiscardBias = llclamp(sDesiredDiscardBias, sDesiredDiscardBiasMin, sDesiredDiscardBiasMax); | 232 | sDesiredDiscardBias = llclamp(sDesiredDiscardBias, sDesiredDiscardBiasMin, sDesiredDiscardBiasMax); |
235 | 233 | ||
236 | LLImageGL::sUseTextureAtlas = gSavedSettings.getBOOL("EnableTextureAtlas") ; | 234 | F32 camera_moving_speed = LLViewerCamera::getInstance()->getAverageSpeed() ; |
235 | F32 camera_angular_speed = LLViewerCamera::getInstance()->getAverageAngularSpeed(); | ||
236 | sCameraMovingDiscardBias = (S8)llmax(0.2f * camera_moving_speed, 2.0f * camera_angular_speed - 1) ; | ||
237 | |||
238 | LLViewerImage::sFreezeImageScalingDown = (BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) < 0.75f * sMaxBoundTextureMemInMegaBytes * texmem_middle_bound_scale) && | ||
239 | (BYTES_TO_MEGA_BYTES(sTotalTextureMemoryInBytes) < 0.75f * sMaxTotalTextureMemInMegaBytes * texmem_middle_bound_scale) ; | ||
237 | } | 240 | } |
238 | 241 | ||
239 | // static | 242 | // static |
@@ -379,7 +382,6 @@ LLViewerImage::~LLViewerImage() | |||
379 | void LLViewerImage::cleanup() | 382 | void LLViewerImage::cleanup() |
380 | { | 383 | { |
381 | mFaceList.clear() ; | 384 | mFaceList.clear() ; |
382 | |||
383 | for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); | 385 | for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); |
384 | iter != mLoadedCallbackList.end(); ) | 386 | iter != mLoadedCallbackList.end(); ) |
385 | { | 387 | { |
@@ -409,192 +411,6 @@ void LLViewerImage::reinit(BOOL usemipmaps /* = TRUE */) | |||
409 | setSize(0,0,0); | 411 | setSize(0,0,0); |
410 | } | 412 | } |
411 | 413 | ||
412 | void LLViewerImage::resetFaceAtlas() | ||
413 | { | ||
414 | //Nothing should be done here. | ||
415 | } | ||
416 | |||
417 | //invalidate all atlas slots for this image. | ||
418 | void LLViewerImage::invalidateAtlas(BOOL rebuild_geom) | ||
419 | { | ||
420 | for(ll_face_list_t::iterator iter = mFaceList.begin(); iter != mFaceList.end(); ++iter) | ||
421 | { | ||
422 | if(*iter) | ||
423 | { | ||
424 | LLFace* facep = (LLFace*)*iter ; | ||
425 | facep->removeAtlas() ; | ||
426 | if(rebuild_geom && facep->getDrawable() && facep->getDrawable()->getSpatialGroup()) | ||
427 | { | ||
428 | facep->getDrawable()->getSpatialGroup()->setState(LLSpatialGroup::GEOM_DIRTY); | ||
429 | } | ||
430 | } | ||
431 | } | ||
432 | } | ||
433 | |||
434 | BOOL LLViewerImage::insertToAtlas() | ||
435 | { | ||
436 | if(mFaceList.size() < 1) | ||
437 | { | ||
438 | return FALSE ; | ||
439 | } | ||
440 | if(!canAddToAtlas()) | ||
441 | { | ||
442 | return FALSE ; | ||
443 | } | ||
444 | if(getDiscardLevelInAtlas() > 0 && mRawDiscardLevel >= getDiscardLevelInAtlas()) | ||
445 | { | ||
446 | return FALSE ; | ||
447 | } | ||
448 | if(!LLTextureAtlasManager::getInstance()->canAddToAtlas(mRawImage->getWidth(), mRawImage->getHeight(), mRawImage->getComponents(), getTexTarget())) | ||
449 | { | ||
450 | return FALSE ; | ||
451 | } | ||
452 | |||
453 | BOOL ret = TRUE ;//if ret is set to false, will generate a gl texture for this image. | ||
454 | S32 raw_w = mRawImage->getWidth() ; | ||
455 | S32 raw_h = mRawImage->getHeight() ; | ||
456 | F32 xscale = 1.0f, yscale = 1.0f ; | ||
457 | LLPointer<LLTextureAtlasSlot> slot_infop; | ||
458 | LLTextureAtlasSlot* cur_slotp ;//no need to be smart pointer. | ||
459 | LLSpatialGroup* groupp ; | ||
460 | LLFace* facep; | ||
461 | |||
462 | //if the atlas slot pointers for some faces are null, process them later. | ||
463 | ll_face_list_t waiting_list ; | ||
464 | |||
465 | for(ll_face_list_t::iterator iter = mFaceList.begin(); iter != mFaceList.end(); ++iter) | ||
466 | { | ||
467 | if(*iter) | ||
468 | { | ||
469 | facep = (LLFace*)*iter ; | ||
470 | |||
471 | //face can not use atlas. | ||
472 | if(!facep->canUseAtlas()) | ||
473 | { | ||
474 | if(facep->getAtlasInfo()) | ||
475 | { | ||
476 | facep->removeAtlas() ; | ||
477 | } | ||
478 | ret = FALSE ; | ||
479 | continue ; | ||
480 | } | ||
481 | |||
482 | //the atlas slot is updated | ||
483 | slot_infop = facep->getAtlasInfo() ; | ||
484 | groupp = facep->getDrawable()->getSpatialGroup() ; | ||
485 | |||
486 | if(slot_infop) | ||
487 | { | ||
488 | if(slot_infop->getSpatialGroup() != groupp) | ||
489 | { | ||
490 | if((cur_slotp = groupp->getCurUpdatingSlot(this))) //switch slot | ||
491 | { | ||
492 | facep->setAtlasInfo(cur_slotp) ; | ||
493 | facep->setAtlasInUse(TRUE) ; | ||
494 | continue ; | ||
495 | } | ||
496 | else //do not forget to update slot_infop->getSpatialGroup(). | ||
497 | { | ||
498 | LLSpatialGroup* gp = slot_infop->getSpatialGroup() ; | ||
499 | gp->setCurUpdatingTime(gFrameCount) ; | ||
500 | gp->setCurUpdatingTexture(this) ; | ||
501 | gp->setCurUpdatingSlot(slot_infop) ; | ||
502 | } | ||
503 | } | ||
504 | else //same group | ||
505 | { | ||
506 | if(gFrameCount && slot_infop->getUpdatedTime() == gFrameCount)//slot is just updated | ||
507 | { | ||
508 | facep->setAtlasInUse(TRUE) ; | ||
509 | continue ; | ||
510 | } | ||
511 | } | ||
512 | } | ||
513 | else | ||
514 | { | ||
515 | //if the slot is null, wait to process them later. | ||
516 | waiting_list.push_back(facep) ; | ||
517 | continue ; | ||
518 | } | ||
519 | |||
520 | //---------- | ||
521 | //insert to atlas | ||
522 | if(!LLImageGL::createGLTextureInAtlas(mRawDiscardLevel, mRawImage, slot_infop->getAtlas(), slot_infop->getSlotCol(), slot_infop->getSlotRow())) | ||
523 | { | ||
524 | //the texture does not qualify to add to atlas, do not bother to try for other faces. | ||
525 | //invalidateAtlas(); | ||
526 | return FALSE ; | ||
527 | } | ||
528 | |||
529 | //update texture scale | ||
530 | slot_infop->getAtlas()->getTexCoordScale(raw_w, raw_h, xscale, yscale) ; | ||
531 | slot_infop->setTexCoordScale(xscale, yscale) ; | ||
532 | slot_infop->setValid() ; | ||
533 | slot_infop->setUpdatedTime(gFrameCount) ; | ||
534 | |||
535 | //update spatial group atlas info | ||
536 | groupp->setCurUpdatingTime(gFrameCount) ; | ||
537 | groupp->setCurUpdatingTexture(this) ; | ||
538 | groupp->setCurUpdatingSlot(slot_infop) ; | ||
539 | |||
540 | //make the face to switch to the atlas. | ||
541 | facep->setAtlasInUse(TRUE) ; | ||
542 | } | ||
543 | } | ||
544 | |||
545 | //process the waiting_list | ||
546 | for(ll_face_list_t::iterator iter = waiting_list.begin(); iter != waiting_list.end(); ++iter) | ||
547 | { | ||
548 | facep = (LLFace*)*iter ; | ||
549 | groupp = facep->getDrawable()->getSpatialGroup() ; | ||
550 | |||
551 | //check if this texture already inserted to atlas for this group | ||
552 | if((cur_slotp = groupp->getCurUpdatingSlot(this))) | ||
553 | { | ||
554 | facep->setAtlasInfo(cur_slotp) ; | ||
555 | facep->setAtlasInUse(TRUE) ; | ||
556 | continue ; | ||
557 | } | ||
558 | |||
559 | //need to reserve a slot from atlas | ||
560 | slot_infop = LLTextureAtlasManager::getInstance()->reserveAtlasSlot(llmax(mFullWidth, mFullHeight), getComponents(), groupp, this) ; | ||
561 | |||
562 | facep->setAtlasInfo(slot_infop) ; | ||
563 | |||
564 | groupp->setCurUpdatingTime(gFrameCount) ; | ||
565 | groupp->setCurUpdatingTexture(this) ; | ||
566 | groupp->setCurUpdatingSlot(slot_infop) ; | ||
567 | |||
568 | //slot allocation failed. | ||
569 | if(!slot_infop || !slot_infop->getAtlas()) | ||
570 | { | ||
571 | ret = FALSE ; | ||
572 | facep->setAtlasInUse(FALSE) ; | ||
573 | continue ; | ||
574 | } | ||
575 | |||
576 | //insert to atlas | ||
577 | if(!LLImageGL::createGLTextureInAtlas(mRawDiscardLevel, mRawImage, slot_infop->getAtlas(), slot_infop->getSlotCol(), slot_infop->getSlotRow())) | ||
578 | { | ||
579 | //the texture does not qualify to add to atlas, do not bother to try for other faces. | ||
580 | ret = FALSE ; | ||
581 | //invalidateAtlas(); | ||
582 | break ; | ||
583 | } | ||
584 | |||
585 | //update texture scale | ||
586 | slot_infop->getAtlas()->getTexCoordScale(raw_w, raw_h, xscale, yscale) ; | ||
587 | slot_infop->setTexCoordScale(xscale, yscale) ; | ||
588 | slot_infop->setValid() ; | ||
589 | slot_infop->setUpdatedTime(gFrameCount) ; | ||
590 | |||
591 | //make the face to switch to the atlas. | ||
592 | facep->setAtlasInUse(TRUE) ; | ||
593 | } | ||
594 | |||
595 | return ret ; | ||
596 | } | ||
597 | |||
598 | /////////////////////////////////////////////////////////////////////////////// | 414 | /////////////////////////////////////////////////////////////////////////////// |
599 | // ONLY called from LLViewerImageList | 415 | // ONLY called from LLViewerImageList |
600 | void LLViewerImage::destroyTexture() | 416 | void LLViewerImage::destroyTexture() |
@@ -616,7 +432,7 @@ void LLViewerImage::addToCreateTexture() | |||
616 | if(isForSculptOnly()) | 432 | if(isForSculptOnly()) |
617 | { | 433 | { |
618 | //just update some variables, not to create a real GL texture. | 434 | //just update some variables, not to create a real GL texture. |
619 | createGLTexture(mRawDiscardLevel, mRawImage, 0) ; | 435 | createGLTexture(mRawDiscardLevel, mRawImage, 0, FALSE) ; |
620 | mNeedsCreateTexture = FALSE ; | 436 | mNeedsCreateTexture = FALSE ; |
621 | destroyRawImage(); | 437 | destroyRawImage(); |
622 | } | 438 | } |
@@ -679,7 +495,7 @@ BOOL LLViewerImage::createTexture(S32 usename/*= 0*/) | |||
679 | mNeedsCreateTexture = FALSE; | 495 | mNeedsCreateTexture = FALSE; |
680 | if (mRawImage.isNull()) | 496 | if (mRawImage.isNull()) |
681 | { | 497 | { |
682 | llwarns << "LLViewerImage trying to create texture with no Raw Image" << llendl; | 498 | llerrs << "LLViewerImage trying to create texture with no Raw Image" << llendl; |
683 | } | 499 | } |
684 | // llinfos << llformat("IMAGE Creating (%d) [%d x %d] Bytes: %d ", | 500 | // llinfos << llformat("IMAGE Creating (%d) [%d x %d] Bytes: %d ", |
685 | // mRawDiscardLevel, | 501 | // mRawDiscardLevel, |
@@ -703,25 +519,32 @@ BOOL LLViewerImage::createTexture(S32 usename/*= 0*/) | |||
703 | mOrigHeight = mFullHeight; | 519 | mOrigHeight = mFullHeight; |
704 | } | 520 | } |
705 | 521 | ||
706 | if (LLImageGL::checkSize(mRawImage->getWidth(), mRawImage->getHeight())) | 522 | bool size_okay = true; |
523 | |||
524 | U32 raw_width = mRawImage->getWidth() << mRawDiscardLevel; | ||
525 | U32 raw_height = mRawImage->getHeight() << mRawDiscardLevel; | ||
526 | if( raw_width > MAX_IMAGE_SIZE || raw_height > MAX_IMAGE_SIZE ) | ||
707 | { | 527 | { |
708 | if(!(res = insertToAtlas())) | 528 | llinfos << "Width or height is greater than " << MAX_IMAGE_SIZE << ": (" << raw_width << "," << raw_height << ")" << llendl; |
709 | { | 529 | size_okay = false; |
710 | res = LLImageGL::createGLTexture(mRawDiscardLevel, mRawImage, usename); | ||
711 | resetFaceAtlas() ; | ||
712 | } | ||
713 | } | 530 | } |
714 | 531 | ||
715 | else | 532 | if (!LLImageGL::checkSize(mRawImage->getWidth(), mRawImage->getHeight())) |
716 | { | 533 | { |
717 | // A non power-of-two image was uploaded (through a non standard client) | 534 | // A non power-of-two image was uploaded (through a non standard client) |
535 | llinfos << "Non power of two width or height: (" << mRawImage->getWidth() << "," << mRawImage->getHeight() << ")" << llendl; | ||
536 | size_okay = false; | ||
537 | } | ||
538 | |||
539 | if( !size_okay ) | ||
540 | { | ||
541 | // An inappropriately-sized image was uploaded (through a non standard client) | ||
718 | // We treat these images as missing assets which causes them to | 542 | // We treat these images as missing assets which causes them to |
719 | // be renderd as 'missing image' and to stop requesting data | 543 | // be renderd as 'missing image' and to stop requesting data |
720 | setIsMissingAsset(); | 544 | setIsMissingAsset(); |
721 | destroyRawImage(); | 545 | destroyRawImage(); |
722 | return FALSE; | 546 | return FALSE; |
723 | } | 547 | } |
724 | |||
725 | if (mRawImage->getComponents()>4) | 548 | if (mRawImage->getComponents()>4) |
726 | { | 549 | { |
727 | LL_DEBUGS("Openjpeg")<<"broken raw image" << LL_ENDL; | 550 | LL_DEBUGS("Openjpeg")<<"broken raw image" << LL_ENDL; |
@@ -730,6 +553,7 @@ BOOL LLViewerImage::createTexture(S32 usename/*= 0*/) | |||
730 | return FALSE; | 553 | return FALSE; |
731 | } | 554 | } |
732 | 555 | ||
556 | res = LLImageGL::createGLTexture(mRawDiscardLevel, mRawImage, usename); | ||
733 | } | 557 | } |
734 | 558 | ||
735 | // | 559 | // |
@@ -831,7 +655,6 @@ void LLViewerImage::processTextureStats() | |||
831 | S32 fullwidth = llmin(mFullWidth,(S32)MAX_IMAGE_SIZE_DEFAULT); | 655 | S32 fullwidth = llmin(mFullWidth,(S32)MAX_IMAGE_SIZE_DEFAULT); |
832 | S32 fullheight = llmin(mFullHeight,(S32)MAX_IMAGE_SIZE_DEFAULT); | 656 | S32 fullheight = llmin(mFullHeight,(S32)MAX_IMAGE_SIZE_DEFAULT); |
833 | mTexelsPerImage = (F32)fullwidth * fullheight; | 657 | mTexelsPerImage = (F32)fullwidth * fullheight; |
834 | |||
835 | F32 discard_level = 0.f; | 658 | F32 discard_level = 0.f; |
836 | 659 | ||
837 | // If we know the output width and height, we can force the discard | 660 | // If we know the output width and height, we can force the discard |
@@ -839,8 +662,7 @@ void LLViewerImage::processTextureStats() | |||
839 | // data than we need to. | 662 | // data than we need to. |
840 | if (mBoostLevel == LLViewerImageBoostLevel::BOOST_UI || | 663 | if (mBoostLevel == LLViewerImageBoostLevel::BOOST_UI || |
841 | mBoostLevel == LLViewerImageBoostLevel::BOOST_PREVIEW || | 664 | mBoostLevel == LLViewerImageBoostLevel::BOOST_PREVIEW || |
842 | mBoostLevel == LLViewerImageBoostLevel::BOOST_AVATAR_SELF || | 665 | mBoostLevel == LLViewerImageBoostLevel::BOOST_AVATAR_SELF) // JAMESDEBUG what about AVATAR_BAKED_SELF? |
843 | mBoostLevel == LLViewerImageBoostLevel::BOOST_AVATAR_BAKED_SELF) | ||
844 | { | 666 | { |
845 | discard_level = 0; // full res | 667 | discard_level = 0; // full res |
846 | } | 668 | } |
@@ -855,6 +677,12 @@ void LLViewerImage::processTextureStats() | |||
855 | } | 677 | } |
856 | else | 678 | else |
857 | { | 679 | { |
680 | if(isLargeImage() && !isJustBound() && mAdditionalDecodePriority < 1.0f) | ||
681 | { | ||
682 | //if is a big image and not being used recently, nor close to the view point, do not load hi-res data. | ||
683 | mMaxVirtualSize = llmin(mMaxVirtualSize, (F32)LLViewerImage::sMinLargeImageSize) ; | ||
684 | } | ||
685 | |||
858 | if ((mCalculatedDiscardLevel >= 0.f) && | 686 | if ((mCalculatedDiscardLevel >= 0.f) && |
859 | (llabs(mMaxVirtualSize - mDiscardVirtualSize) < mMaxVirtualSize*.20f)) | 687 | (llabs(mMaxVirtualSize - mDiscardVirtualSize) < mMaxVirtualSize*.20f)) |
860 | { | 688 | { |
@@ -877,7 +705,6 @@ void LLViewerImage::processTextureStats() | |||
877 | discard_level += sCameraMovingDiscardBias ; | 705 | discard_level += sCameraMovingDiscardBias ; |
878 | } | 706 | } |
879 | discard_level = floorf(discard_level); | 707 | discard_level = floorf(discard_level); |
880 | // discard_level -= (gImageList.mVideoMemorySetting>>1); // more video ram = higher detail | ||
881 | 708 | ||
882 | F32 min_discard = 0.f; | 709 | F32 min_discard = 0.f; |
883 | if (mFullWidth > MAX_IMAGE_SIZE_DEFAULT || mFullHeight > MAX_IMAGE_SIZE_DEFAULT) | 710 | if (mFullWidth > MAX_IMAGE_SIZE_DEFAULT || mFullHeight > MAX_IMAGE_SIZE_DEFAULT) |
@@ -899,12 +726,15 @@ void LLViewerImage::processTextureStats() | |||
899 | if ((sDesiredDiscardBias > 0.0f) && | 726 | if ((sDesiredDiscardBias > 0.0f) && |
900 | (current_discard >= 0 && mDesiredDiscardLevel >= current_discard)) | 727 | (current_discard >= 0 && mDesiredDiscardLevel >= current_discard)) |
901 | { | 728 | { |
902 | if ( (sBoundTextureMemoryInBytes >> 20) > sMaxBoundTextureMemInMegaBytes*texmem_middle_bound_scale) | 729 | // Limit the amount of GL memory bound each frame |
730 | if ( (BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) > sMaxBoundTextureMemInMegaBytes * texmem_middle_bound_scale) && | ||
731 | (!getBoundRecently() || mDesiredDiscardLevel >= mCachedRawDiscardLevel)) | ||
903 | { | 732 | { |
904 | scaleDown() ; | 733 | scaleDown() ; |
905 | } | 734 | } |
906 | // Only allow GL to have 2x the video card memory | 735 | // Only allow GL to have 2x the video card memory |
907 | else if (!getBoundRecently() || mDesiredDiscardLevel >= mCachedRawDiscardLevel) | 736 | else if ( (BYTES_TO_MEGA_BYTES(sTotalTextureMemoryInBytes) > sMaxTotalTextureMemInMegaBytes*texmem_middle_bound_scale) && |
737 | (!getBoundRecently() || mDesiredDiscardLevel >= mCachedRawDiscardLevel)) | ||
908 | { | 738 | { |
909 | scaleDown() ; | 739 | scaleDown() ; |
910 | } | 740 | } |
@@ -926,7 +756,7 @@ void LLViewerImage::updateVirtualSize() | |||
926 | if(facep->getDrawable()->isRecentlyVisible()) | 756 | if(facep->getDrawable()->isRecentlyVisible()) |
927 | { | 757 | { |
928 | addTextureStats(facep->getVirtualSize()) ; | 758 | addTextureStats(facep->getVirtualSize()) ; |
929 | //setAdditionalDecodePriority(facep->getImportanceToCamera()) ; | 759 | setAdditionalDecodePriority(facep->getImportanceToCamera()) ; |
930 | } | 760 | } |
931 | } | 761 | } |
932 | } | 762 | } |
@@ -966,7 +796,6 @@ void LLViewerImage::switchToCachedImage() | |||
966 | mNeedsCreateTexture = TRUE; | 796 | mNeedsCreateTexture = TRUE; |
967 | } | 797 | } |
968 | } | 798 | } |
969 | |||
970 | //============================================================================ | 799 | //============================================================================ |
971 | 800 | ||
972 | F32 LLViewerImage::calcDecodePriority() | 801 | F32 LLViewerImage::calcDecodePriority() |
@@ -988,6 +817,13 @@ F32 LLViewerImage::calcDecodePriority() | |||
988 | } | 817 | } |
989 | 818 | ||
990 | S32 cur_discard = getDiscardLevel(); | 819 | S32 cur_discard = getDiscardLevel(); |
820 | |||
821 | //no need to update if the texture reaches its highest res and the memory is sufficient. | ||
822 | //if(LLViewerImage::sFreezeImageScalingDown && !cur_discard) | ||
823 | //{ | ||
824 | // return -5.0f ; | ||
825 | //} | ||
826 | |||
991 | bool have_all_data = (cur_discard >= 0 && (cur_discard <= mDesiredDiscardLevel)); | 827 | bool have_all_data = (cur_discard >= 0 && (cur_discard <= mDesiredDiscardLevel)); |
992 | F32 pixel_priority = fsqrtf(mMaxVirtualSize); | 828 | F32 pixel_priority = fsqrtf(mMaxVirtualSize); |
993 | const S32 MIN_NOT_VISIBLE_FRAMES = 30; // NOTE: this function is not called every frame | 829 | const S32 MIN_NOT_VISIBLE_FRAMES = 30; // NOTE: this function is not called every frame |
@@ -1006,6 +842,14 @@ F32 LLViewerImage::calcDecodePriority() | |||
1006 | { | 842 | { |
1007 | priority = -1.0f ; | 843 | priority = -1.0f ; |
1008 | } | 844 | } |
845 | else if (!isJustBound() && mCachedRawImageReady) | ||
846 | { | ||
847 | priority = -1.0f; | ||
848 | } | ||
849 | else if(mCachedRawDiscardLevel > -1 && mDesiredDiscardLevel >= mCachedRawDiscardLevel) | ||
850 | { | ||
851 | priority = -1.0f; | ||
852 | } | ||
1009 | else if (mDesiredDiscardLevel > mMaxDiscardLevel) | 853 | else if (mDesiredDiscardLevel > mMaxDiscardLevel) |
1010 | { | 854 | { |
1011 | // Don't decode anything we don't need | 855 | // Don't decode anything we don't need |
@@ -1066,6 +910,7 @@ F32 LLViewerImage::calcDecodePriority() | |||
1066 | ddiscard-=2; | 910 | ddiscard-=2; |
1067 | } | 911 | } |
1068 | ddiscard = llclamp(ddiscard, 0, 4); | 912 | ddiscard = llclamp(ddiscard, 0, 4); |
913 | |||
1069 | priority = ddiscard*100000.f; | 914 | priority = ddiscard*100000.f; |
1070 | } | 915 | } |
1071 | if (priority > 0.0f) | 916 | if (priority > 0.0f) |
@@ -1097,7 +942,7 @@ F32 LLViewerImage::calcDecodePriority() | |||
1097 | //static | 942 | //static |
1098 | F32 LLViewerImage::maxDecodePriority() | 943 | F32 LLViewerImage::maxDecodePriority() |
1099 | { | 944 | { |
1100 | return 6000000.f; // KL 2000000 in render pipeline | 945 | return 6000000.f; |
1101 | } | 946 | } |
1102 | 947 | ||
1103 | void LLViewerImage::setDecodePriority(F32 priority) | 948 | void LLViewerImage::setDecodePriority(F32 priority) |
@@ -1124,7 +969,10 @@ void LLViewerImage::setBoostLevel(S32 level) | |||
1124 | { | 969 | { |
1125 | mBoostLevel = level; | 970 | mBoostLevel = level; |
1126 | 971 | ||
1127 | 972 | if(gAuditTexture) | |
973 | { | ||
974 | setCategory(mBoostLevel); | ||
975 | } | ||
1128 | 976 | ||
1129 | if(mBoostLevel != LLViewerImageBoostLevel::BOOST_NONE) | 977 | if(mBoostLevel != LLViewerImageBoostLevel::BOOST_NONE) |
1130 | { | 978 | { |
@@ -1174,15 +1022,11 @@ bool LLViewerImage::updateFetch() | |||
1174 | return false; // process any raw image data in callbacks before replacing | 1022 | return false; // process any raw image data in callbacks before replacing |
1175 | } | 1023 | } |
1176 | 1024 | ||
1177 | mFetchState = 0; | ||
1178 | mFetchPriority = 0; | ||
1179 | mFetchDeltaTime = 999999.f; | ||
1180 | mRequestDeltaTime = 999999.f; | ||
1181 | S32 current_discard = getDiscardLevel(); | 1025 | S32 current_discard = getDiscardLevel(); |
1182 | S32 desired_discard = getDesiredDiscardLevel(); | 1026 | S32 desired_discard = getDesiredDiscardLevel(); |
1183 | F32 decode_priority = getDecodePriority(); | 1027 | F32 decode_priority = getDecodePriority(); |
1184 | decode_priority = llmax(decode_priority, 0.0f); | 1028 | decode_priority = llmax(decode_priority, 0.0f); |
1185 | //decode_priority = llmin(decode_priority, maxDecodePriority()); | 1029 | decode_priority = llmin(decode_priority, maxDecodePriority()); |
1186 | 1030 | ||
1187 | if (mIsFetching) | 1031 | if (mIsFetching) |
1188 | { | 1032 | { |
@@ -1215,6 +1059,7 @@ bool LLViewerImage::updateFetch() | |||
1215 | if (mRawImage.notNull()) | 1059 | if (mRawImage.notNull()) |
1216 | { | 1060 | { |
1217 | mRawDiscardLevel = fetch_discard; | 1061 | mRawDiscardLevel = fetch_discard; |
1062 | |||
1218 | if ((mRawImage->getDataSize() > 0 && mRawDiscardLevel >= 0) && | 1063 | if ((mRawImage->getDataSize() > 0 && mRawDiscardLevel >= 0) && |
1219 | (current_discard < 0 || mRawDiscardLevel < current_discard)) | 1064 | (current_discard < 0 || mRawDiscardLevel < current_discard)) |
1220 | { | 1065 | { |
@@ -1333,6 +1178,10 @@ bool LLViewerImage::updateFetch() | |||
1333 | { | 1178 | { |
1334 | make_request = false; | 1179 | make_request = false; |
1335 | } | 1180 | } |
1181 | else if (!isJustBound() && mCachedRawImageReady) | ||
1182 | { | ||
1183 | make_request = false; | ||
1184 | } | ||
1336 | else | 1185 | else |
1337 | { | 1186 | { |
1338 | if (mIsFetching) | 1187 | if (mIsFetching) |
@@ -1367,13 +1216,14 @@ bool LLViewerImage::updateFetch() | |||
1367 | w, h, c, desired_discard, needsAux()); | 1216 | w, h, c, desired_discard, needsAux()); |
1368 | 1217 | ||
1369 | if (fetch_request_created) | 1218 | if (fetch_request_created) |
1370 | { | 1219 | { |
1371 | mHasFetcher = TRUE; | 1220 | mHasFetcher = TRUE; |
1372 | mIsFetching = TRUE; | 1221 | mIsFetching = TRUE; |
1373 | mRequestedDiscardLevel = desired_discard; | 1222 | mRequestedDiscardLevel = desired_discard; |
1223 | |||
1374 | mFetchState = LLAppViewer::getTextureFetch()->getFetchState(mID, mDownloadProgress, mRequestedDownloadPriority, | 1224 | mFetchState = LLAppViewer::getTextureFetch()->getFetchState(mID, mDownloadProgress, mRequestedDownloadPriority, |
1375 | mFetchPriority, mFetchDeltaTime, mRequestDeltaTime); | 1225 | mFetchPriority, mFetchDeltaTime, mRequestDeltaTime); |
1376 | } | 1226 | } |
1377 | 1227 | ||
1378 | // if createRequest() failed, we're finishing up a request for this UUID, | 1228 | // if createRequest() failed, we're finishing up a request for this UUID, |
1379 | // wait for it to complete | 1229 | // wait for it to complete |
@@ -1445,12 +1295,12 @@ BOOL LLViewerImage::forceFetch() | |||
1445 | w, h, c, desired_discard, needsAux()); | 1295 | w, h, c, desired_discard, needsAux()); |
1446 | 1296 | ||
1447 | if (fetch_request_created) | 1297 | if (fetch_request_created) |
1448 | { | 1298 | { |
1449 | mHasFetcher = TRUE; | 1299 | mHasFetcher = TRUE; |
1450 | mIsFetching = TRUE; | 1300 | mIsFetching = TRUE; |
1451 | // Set the image's decode priority to maxDecodePriority() too, or updateFetch() will set | 1301 | // Set the image's decode priority to maxDecodePriority() too, or updateFetch() will set |
1452 | // the request priority to 0 and terminate the fetch before we even started (SNOW-203). | 1302 | // the request priority to 0 and terminate the fetch before we even started (SNOW-203). |
1453 | // gImageList.bumpToMaxDecodePriority(this); // Kl force immediate update?? | 1303 | gImageList.bumpToMaxDecodePriority(this); |
1454 | mRequestedDiscardLevel = desired_discard ; | 1304 | mRequestedDiscardLevel = desired_discard ; |
1455 | 1305 | ||
1456 | mFetchState = LLAppViewer::getTextureFetch()->getFetchState(mID, mDownloadProgress, mRequestedDownloadPriority, | 1306 | mFetchState = LLAppViewer::getTextureFetch()->getFetchState(mID, mDownloadProgress, mRequestedDownloadPriority, |
@@ -1623,8 +1473,8 @@ bool LLViewerImage::doLoadedCallbacks() | |||
1623 | 1473 | ||
1624 | destroyRawImage(); | 1474 | destroyRawImage(); |
1625 | readBackRawImage(gl_discard); | 1475 | readBackRawImage(gl_discard); |
1626 | //llassert_always(mRawImage.notNull()); | 1476 | llassert_always(mRawImage.notNull()); |
1627 | //llassert_always(!mNeedsAux || mAuxRawImage.notNull()); | 1477 | llassert_always(!mNeedsAux || mAuxRawImage.notNull()); |
1628 | } | 1478 | } |
1629 | 1479 | ||
1630 | // | 1480 | // |
@@ -1786,18 +1636,7 @@ bool LLViewerImage::bindDefaultImage(S32 stage) | |||
1786 | //virtual | 1636 | //virtual |
1787 | void LLViewerImage::forceImmediateUpdate() | 1637 | void LLViewerImage::forceImmediateUpdate() |
1788 | { | 1638 | { |
1789 | //only immediately update a deleted texture which is now being re-used. | 1639 | gImageList.bumpToMaxDecodePriority(this) ; |
1790 | if(!isDeleted()) | ||
1791 | { | ||
1792 | return ; | ||
1793 | } | ||
1794 | //if already called forceImmediateUpdate() | ||
1795 | if(mInImageList && mDecodePriority == LLViewerImage::maxDecodePriority()) | ||
1796 | { | ||
1797 | return ; | ||
1798 | } | ||
1799 | |||
1800 | gImageList.forceImmediateUpdate(this) ; | ||
1801 | return ; | 1640 | return ; |
1802 | } | 1641 | } |
1803 | 1642 | ||
@@ -1808,7 +1647,7 @@ LLImageRaw* LLViewerImage::readBackRawImage(S8 discard_level) | |||
1808 | llassert_always(mComponents > 0); | 1647 | llassert_always(mComponents > 0); |
1809 | if (mRawImage.notNull()) | 1648 | if (mRawImage.notNull()) |
1810 | { | 1649 | { |
1811 | llwarns << "called with existing mRawImage" << llendl; | 1650 | llerrs << "called with existing mRawImage" << llendl; |
1812 | mRawImage = NULL; | 1651 | mRawImage = NULL; |
1813 | } | 1652 | } |
1814 | 1653 | ||
@@ -1826,7 +1665,7 @@ LLImageRaw* LLViewerImage::readBackRawImage(S8 discard_level) | |||
1826 | 1665 | ||
1827 | sRawCount++; | 1666 | sRawCount++; |
1828 | mIsRawImageValid = TRUE; | 1667 | mIsRawImageValid = TRUE; |
1829 | 1668 | ||
1830 | return mRawImage; | 1669 | return mRawImage; |
1831 | } | 1670 | } |
1832 | 1671 | ||
diff --git a/linden/indra/newview/llviewerimage.h b/linden/indra/newview/llviewerimage.h index 7d646be..c82b68b 100644 --- a/linden/indra/newview/llviewerimage.h +++ b/linden/indra/newview/llviewerimage.h | |||
@@ -41,13 +41,11 @@ | |||
41 | #include <map> | 41 | #include <map> |
42 | #include <list> | 42 | #include <list> |
43 | 43 | ||
44 | 44 | class LLFace; | |
45 | #define MIN_VIDEO_RAM_IN_MEGA_BYTES 32 | 45 | #define MIN_VIDEO_RAM_IN_MEGA_BYTES 32 |
46 | #define MAX_VIDEO_RAM_IN_MEGA_BYTES 512 // 512MB max for performance reasons. | 46 | #define MAX_VIDEO_RAM_IN_MEGA_BYTES 512 // 512MB max for performance reasons. |
47 | 47 | ||
48 | class LLViewerImage; | 48 | class LLViewerImage; |
49 | class LLTextureAtlas ; | ||
50 | class LLFace ; | ||
51 | 49 | ||
52 | typedef void (*loaded_callback_func)( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); | 50 | typedef void (*loaded_callback_func)( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); |
53 | 51 | ||
@@ -263,29 +261,8 @@ public: | |||
263 | void setMinDiscardLevel(S32 discard) { mMinDesiredDiscardLevel = llmin(mMinDesiredDiscardLevel,(S8)discard); } | 261 | void setMinDiscardLevel(S32 discard) { mMinDesiredDiscardLevel = llmin(mMinDesiredDiscardLevel,(S8)discard); } |
264 | 262 | ||
265 | // Host we think might have this image, used for baked av textures. | 263 | // Host we think might have this image, used for baked av textures. |
266 | void setTargetHost(LLHost host) { mTargetHost = host; } | ||
267 | LLHost getTargetHost() const { return mTargetHost; } | 264 | LLHost getTargetHost() const { return mTargetHost; } |
268 | 265 | ||
269 | enum | ||
270 | { | ||
271 | BOOST_NONE = 0, | ||
272 | BOOST_AVATAR_BAKED = 1, | ||
273 | BOOST_AVATAR = 2, | ||
274 | BOOST_CLOUDS = 3, | ||
275 | BOOST_SCULPTED = 4, | ||
276 | |||
277 | BOOST_HIGH = 10, | ||
278 | BOOST_TERRAIN = 11, // has to be high priority for minimap / low detail | ||
279 | BOOST_SELECTED = 12, | ||
280 | BOOST_HUD = 13, | ||
281 | BOOST_AVATAR_BAKED_SELF = 14, | ||
282 | BOOST_UI = 15, | ||
283 | BOOST_PREVIEW = 16, | ||
284 | BOOST_MAP = 17, | ||
285 | BOOST_MAP_LAYER = 18, | ||
286 | BOOST_AVATAR_SELF = 19, // needed for baking avatar | ||
287 | BOOST_MAX_LEVEL | ||
288 | }; | ||
289 | void setBoostLevel(S32 level); | 266 | void setBoostLevel(S32 level); |
290 | S32 getBoostLevel() { return mBoostLevel; } | 267 | S32 getBoostLevel() { return mBoostLevel; } |
291 | 268 | ||
@@ -318,10 +295,6 @@ public: | |||
318 | S32 getOriginalWidth() { return mOrigWidth; } | 295 | S32 getOriginalWidth() { return mOrigWidth; } |
319 | S32 getOriginalHeight() { return mOrigHeight; } | 296 | S32 getOriginalHeight() { return mOrigHeight; } |
320 | 297 | ||
321 | BOOL insertToAtlas() ; | ||
322 | void resetFaceAtlas() ; | ||
323 | void invalidateAtlas(BOOL rebuild_geom = FALSE); | ||
324 | |||
325 | BOOL isForSculptOnly() const ; | 298 | BOOL isForSculptOnly() const ; |
326 | void setForSculpt(); | 299 | void setForSculpt(); |
327 | 300 | ||
@@ -340,7 +313,6 @@ public: | |||
340 | 313 | ||
341 | void addFace(LLFace* facep) ; | 314 | void addFace(LLFace* facep) ; |
342 | void removeFace(LLFace* facep) ; | 315 | void removeFace(LLFace* facep) ; |
343 | BOOL isReferenced()const {return mFaceList.size() > 0 ; } | ||
344 | 316 | ||
345 | friend class LocalBitmap; // tag: vaa emerald local_asset_browser | 317 | friend class LocalBitmap; // tag: vaa emerald local_asset_browser |
346 | 318 | ||
@@ -446,7 +418,6 @@ private: | |||
446 | typedef std::list<LLFace*> ll_face_list_t ; | 418 | typedef std::list<LLFace*> ll_face_list_t ; |
447 | ll_face_list_t mFaceList ; //reverse pointer pointing to the faces using this image as texture | 419 | ll_face_list_t mFaceList ; //reverse pointer pointing to the faces using this image as texture |
448 | 420 | ||
449 | BOOL mInCreationList ; | ||
450 | public: | 421 | public: |
451 | static const U32 sCurrentFileVersion; | 422 | static const U32 sCurrentFileVersion; |
452 | // Default textures | 423 | // Default textures |
diff --git a/linden/indra/newview/llviewerimagelist.cpp b/linden/indra/newview/llviewerimagelist.cpp index 7642e80..e0f37c9 100644 --- a/linden/indra/newview/llviewerimagelist.cpp +++ b/linden/indra/newview/llviewerimagelist.cpp | |||
@@ -199,6 +199,7 @@ static std::string get_texture_list_name() | |||
199 | 199 | ||
200 | void LLViewerImageList::doPrefetchImages() | 200 | void LLViewerImageList::doPrefetchImages() |
201 | { | 201 | { |
202 | #if 1 | ||
202 | if (LLAppViewer::instance()->getPurgeCache()) | 203 | if (LLAppViewer::instance()->getPurgeCache()) |
203 | { | 204 | { |
204 | // cache was purged, no point | 205 | // cache was purged, no point |
@@ -226,7 +227,7 @@ void LLViewerImageList::doPrefetchImages() | |||
226 | image->addTextureStats((F32)pixel_area); | 227 | image->addTextureStats((F32)pixel_area); |
227 | } | 228 | } |
228 | } | 229 | } |
229 | 230 | #endif | |
230 | 231 | ||
231 | } | 232 | } |
232 | 233 | ||
@@ -485,7 +486,7 @@ void LLViewerImageList::removeImageFromList(LLViewerImage *image) | |||
485 | { | 486 | { |
486 | llinfos << "Image is not in mUUIDMap!" << llendl ; | 487 | llinfos << "Image is not in mUUIDMap!" << llendl ; |
487 | } | 488 | } |
488 | llwarns << "LLViewerImageList::removeImageFromList - Image not in list" << llendl; | 489 | llerrs << "LLViewerImageList::removeImageFromList - Image not in list" << llendl; |
489 | } | 490 | } |
490 | llverify(mImageList.erase(image) == 1); | 491 | llverify(mImageList.erase(image) == 1); |
491 | image->mInImageList = FALSE; | 492 | image->mInImageList = FALSE; |
@@ -534,8 +535,7 @@ void LLViewerImageList::deleteImage(LLViewerImage *image) | |||
534 | 535 | ||
535 | void LLViewerImageList::dirtyImage(LLViewerImage *image) | 536 | void LLViewerImageList::dirtyImage(LLViewerImage *image) |
536 | { | 537 | { |
537 | //mDirtyTextureList.insert(image); | 538 | mDirtyTextureList.insert(image); |
538 | image->invalidateAtlas(TRUE) ; // KL | ||
539 | } | 539 | } |
540 | 540 | ||
541 | //////////////////////////////////////////////////////////////////////////// | 541 | //////////////////////////////////////////////////////////////////////////// |
@@ -547,21 +547,25 @@ void LLViewerImageList::updateImages(F32 max_time) | |||
547 | 547 | ||
548 | sNumImagesStat.addValue(sNumImages); | 548 | sNumImagesStat.addValue(sNumImages); |
549 | sNumRawImagesStat.addValue(LLImageRaw::sRawImageCount); | 549 | sNumRawImagesStat.addValue(LLImageRaw::sRawImageCount); |
550 | sGLTexMemStat.addValue((F32)(LLImageGL::sGlobalTextureMemoryInBytes >> 20)); | 550 | sGLTexMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sGlobalTextureMemoryInBytes)); |
551 | sGLBoundMemStat.addValue((F32)(LLImageGL::sBoundTextureMemoryInBytes >> 20)); | 551 | sGLBoundMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sBoundTextureMemoryInBytes)); |
552 | sRawMemStat.addValue((F32)(LLImageRaw::sGlobalRawMemory >> 20)); | 552 | sRawMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageRaw::sGlobalRawMemory)); |
553 | sFormattedMemStat.addValue((F32)(LLImageFormatted::sGlobalFormattedMemory >> 20)); | 553 | sFormattedMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageFormatted::sGlobalFormattedMemory)); |
554 | 554 | ||
555 | llpushcallstacks ; | 555 | llpushcallstacks ; |
556 | |||
556 | updateImagesDecodePriorities(); | 557 | updateImagesDecodePriorities(); |
558 | |||
557 | llpushcallstacks ; | 559 | llpushcallstacks ; |
560 | F32 total_max_time = max_time; | ||
558 | max_time -= updateImagesFetchTextures(max_time); | 561 | max_time -= updateImagesFetchTextures(max_time); |
562 | |||
559 | llpushcallstacks ; | 563 | llpushcallstacks ; |
560 | max_time = llmin(llmax(max_time, 0.001f*10.f*gFrameIntervalSeconds), 0.001f); | 564 | max_time = llmax(max_time, total_max_time*.25f); // at least 25% of max_time |
561 | max_time -= updateImagesCreateTextures(max_time); | 565 | max_time -= updateImagesCreateTextures(max_time); |
566 | |||
562 | llpushcallstacks ; | 567 | llpushcallstacks ; |
563 | max_time = llmin(llmax(max_time, 0.001f*10.f*gFrameIntervalSeconds), 0.001f); | 568 | |
564 | llpushcallstacks ; | ||
565 | if (!mDirtyTextureList.empty()) | 569 | if (!mDirtyTextureList.empty()) |
566 | { | 570 | { |
567 | LLFastTimer t(LLFastTimer::FTM_IMAGE_MARK_DIRTY); | 571 | LLFastTimer t(LLFastTimer::FTM_IMAGE_MARK_DIRTY); |
@@ -735,7 +739,7 @@ F32 LLViewerImageList::updateImagesCreateTextures(F32 max_time) | |||
735 | return create_timer.getElapsedTimeF32(); | 739 | return create_timer.getElapsedTimeF32(); |
736 | } | 740 | } |
737 | 741 | ||
738 | void LLViewerImageList::forceImmediateUpdate(LLViewerImage* imagep) | 742 | void LLViewerImageList::bumpToMaxDecodePriority(LLViewerImage* imagep) |
739 | { | 743 | { |
740 | if(!imagep) | 744 | if(!imagep) |
741 | { | 745 | { |
@@ -743,6 +747,11 @@ void LLViewerImageList::forceImmediateUpdate(LLViewerImage* imagep) | |||
743 | } | 747 | } |
744 | if(imagep->mInImageList) | 748 | if(imagep->mInImageList) |
745 | { | 749 | { |
750 | if (imagep->getDecodePriority() == LLViewerImage::maxDecodePriority()) | ||
751 | { | ||
752 | // Already at maximum. | ||
753 | return; | ||
754 | } | ||
746 | removeImageFromList(imagep); | 755 | removeImageFromList(imagep); |
747 | } | 756 | } |
748 | 757 | ||
@@ -1019,16 +1028,13 @@ LLPointer<LLImageJ2C> LLViewerImageList::convertToUploadFile(LLPointer<LLImageRa | |||
1019 | 1028 | ||
1020 | return compressedImage; | 1029 | return compressedImage; |
1021 | } | 1030 | } |
1022 | |||
1023 | const S32 MIN_VIDEO_RAM = 32; | ||
1024 | const S32 MAX_VIDEO_RAM = 512; // 512MB max for performance reasons. | ||
1025 | 1031 | ||
1026 | // Returns min setting for TextureMemory (in MB) | 1032 | // Returns min setting for TextureMemory (in MB) |
1027 | S32 LLViewerImageList::getMinVideoRamSetting() | 1033 | S32 LLViewerImageList::getMinVideoRamSetting() |
1028 | { | 1034 | { |
1029 | S32 system_ram = (S32)(gSysMemory.getPhysicalMemoryClamped() >> 20); | 1035 | S32 system_ram = (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped()); |
1030 | //min texture mem sets to 64M if total physical mem is more than 1.5GB | 1036 | //min texture mem sets to 64M if total physical mem is more than 1.5GB |
1031 | return (system_ram > 1500) ? 64 : MIN_VIDEO_RAM; | 1037 | return (system_ram > 1500) ? 64 : MIN_VIDEO_RAM_IN_MEGA_BYTES ; |
1032 | } | 1038 | } |
1033 | 1039 | ||
1034 | //static | 1040 | //static |
@@ -1055,14 +1061,14 @@ S32 LLViewerImageList::getMaxVideoRamSetting(bool get_recommended) | |||
1055 | llwarns << "VRAM amount not detected, defaulting to " << max_texmem << " MB" << llendl; | 1061 | llwarns << "VRAM amount not detected, defaulting to " << max_texmem << " MB" << llendl; |
1056 | } | 1062 | } |
1057 | 1063 | ||
1058 | S32 system_ram = (S32)(gSysMemory.getPhysicalMemoryClamped() >> 20); // In MB | 1064 | S32 system_ram = (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped()); // In MB |
1059 | //llinfos << "*** DETECTED " << system_ram << " MB of system memory." << llendl; | 1065 | //llinfos << "*** DETECTED " << system_ram << " MB of system memory." << llendl; |
1060 | if (get_recommended) | 1066 | if (get_recommended) |
1061 | max_texmem = llmin(max_texmem, (S32)(system_ram/2)); | 1067 | max_texmem = llmin(max_texmem, (S32)(system_ram/2)); |
1062 | else | 1068 | else |
1063 | max_texmem = llmin(max_texmem, (S32)(system_ram)); | 1069 | max_texmem = llmin(max_texmem, (S32)(system_ram)); |
1064 | 1070 | ||
1065 | max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), MAX_VIDEO_RAM); | 1071 | max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), MAX_VIDEO_RAM_IN_MEGA_BYTES); |
1066 | 1072 | ||
1067 | return max_texmem; | 1073 | return max_texmem; |
1068 | } | 1074 | } |
@@ -1107,9 +1113,9 @@ void LLViewerImageList::updateMaxResidentTexMem(S32 mem) | |||
1107 | mMaxTotalTextureMemInMegaBytes -= (mMaxResidentTexMemInMegaBytes >> 2); | 1113 | mMaxTotalTextureMemInMegaBytes -= (mMaxResidentTexMemInMegaBytes >> 2); |
1108 | } | 1114 | } |
1109 | 1115 | ||
1110 | if (mMaxTotalTextureMemInMegaBytes > (S32)(gSysMemory.getPhysicalMemoryClamped() >> 20) - 128) | 1116 | if (mMaxTotalTextureMemInMegaBytes > (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped()) - 128) |
1111 | { | 1117 | { |
1112 | mMaxTotalTextureMemInMegaBytes = (gSysMemory.getPhysicalMemoryClamped() >> 20) - 128 ; | 1118 | mMaxTotalTextureMemInMegaBytes = (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped()) - 128 ; |
1113 | } | 1119 | } |
1114 | 1120 | ||
1115 | llinfos << "Total Video Memory set to: " << vb_mem << " MB" << llendl; | 1121 | llinfos << "Total Video Memory set to: " << vb_mem << " MB" << llendl; |
diff --git a/linden/indra/newview/llviewerimagelist.h b/linden/indra/newview/llviewerimagelist.h index f82d9f3..561e8e5 100644 --- a/linden/indra/newview/llviewerimagelist.h +++ b/linden/indra/newview/llviewerimagelist.h | |||
@@ -112,7 +112,7 @@ public: | |||
112 | LLGLenum primary_format = 0, | 112 | LLGLenum primary_format = 0, |
113 | const LLUUID& force_id = LLUUID::null | 113 | const LLUUID& force_id = LLUUID::null |
114 | ); | 114 | ); |
115 | 115 | ||
116 | // Request image from a specific host, used for baked avatar textures. | 116 | // Request image from a specific host, used for baked avatar textures. |
117 | // Implemented in header in case someone changes default params above. JC | 117 | // Implemented in header in case someone changes default params above. JC |
118 | LLViewerImage* getImageFromHost(const LLUUID& image_id, LLHost host) | 118 | LLViewerImage* getImageFromHost(const LLUUID& image_id, LLHost host) |
@@ -129,7 +129,7 @@ public: | |||
129 | 129 | ||
130 | // Using image stats, determine what images are necessary, and perform image updates. | 130 | // Using image stats, determine what images are necessary, and perform image updates. |
131 | void updateImages(F32 max_time); | 131 | void updateImages(F32 max_time); |
132 | void forceImmediateUpdate(LLViewerImage* imagep) ; | 132 | void bumpToMaxDecodePriority(LLViewerImage* imagep) ; |
133 | 133 | ||
134 | // Decode and create textures for all images currently in list. | 134 | // Decode and create textures for all images currently in list. |
135 | void decodeAllImages(F32 max_decode_time); | 135 | void decodeAllImages(F32 max_decode_time); |
diff --git a/linden/indra/newview/llviewerjointmesh.cpp b/linden/indra/newview/llviewerjointmesh.cpp index dc08bcd..b6f0daf 100644 --- a/linden/indra/newview/llviewerjointmesh.cpp +++ b/linden/indra/newview/llviewerjointmesh.cpp | |||
@@ -523,9 +523,9 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) | |||
523 | //---------------------------------------------------------------- | 523 | //---------------------------------------------------------------- |
524 | if (!gRenderForSelect) | 524 | if (!gRenderForSelect) |
525 | { | 525 | { |
526 | /* if (is_dummy) | 526 | if (is_dummy) |
527 | glColor4fv(LLVOAvatar::getDummyColor().mV); | 527 | glColor4fv(LLVOAvatar::getDummyColor().mV); |
528 | else */ | 528 | else |
529 | glColor4fv(mColor.mV); | 529 | glColor4fv(mColor.mV); |
530 | } | 530 | } |
531 | 531 | ||
@@ -557,7 +557,7 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) | |||
557 | { | 557 | { |
558 | if( mLayerSet->hasComposite() ) | 558 | if( mLayerSet->hasComposite() ) |
559 | { | 559 | { |
560 | gGL.getTexUnit(0)->bind(mLayerSet->getComposite()->getTexture(), TRUE); // KL SD | 560 | gGL.getTexUnit(0)->bind(mLayerSet->getComposite()->getTexture()); |
561 | } | 561 | } |
562 | else | 562 | else |
563 | { | 563 | { |
@@ -565,7 +565,7 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) | |||
565 | // Ignore the warning if that's the case. | 565 | // Ignore the warning if that's the case. |
566 | if (!gSavedSettings.getBOOL("RenderUnloadedAvatar")) | 566 | if (!gSavedSettings.getBOOL("RenderUnloadedAvatar")) |
567 | { | 567 | { |
568 | //llwarns << "Layerset without composite" << llendl; | 568 | llwarns << "Layerset without composite" << llendl; |
569 | } | 569 | } |
570 | gGL.getTexUnit(0)->bind(gImageList.getImage(IMG_DEFAULT)); | 570 | gGL.getTexUnit(0)->bind(gImageList.getImage(IMG_DEFAULT)); |
571 | } | 571 | } |
@@ -574,7 +574,7 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) | |||
574 | if ( !is_dummy && mTexture.notNull() ) | 574 | if ( !is_dummy && mTexture.notNull() ) |
575 | { | 575 | { |
576 | old_mode = mTexture->getAddressMode(); | 576 | old_mode = mTexture->getAddressMode(); |
577 | gGL.getTexUnit(0)->bind(mTexture.get(), TRUE); // KL SD | 577 | gGL.getTexUnit(0)->bind(mTexture.get()); |
578 | gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); | 578 | gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); |
579 | } | 579 | } |
580 | else | 580 | else |
diff --git a/linden/indra/newview/llviewermedia.cpp b/linden/indra/newview/llviewermedia.cpp index 8857170..8c5cf6a 100644 --- a/linden/indra/newview/llviewermedia.cpp +++ b/linden/indra/newview/llviewermedia.cpp | |||
@@ -938,7 +938,9 @@ void LLViewerMediaImpl::update() | |||
938 | x_pos, | 938 | x_pos, |
939 | y_pos, | 939 | y_pos, |
940 | width, | 940 | width, |
941 | height); | 941 | height, |
942 | TRUE); // force a fast update (i.e. don't call analyzeAlpha, etc.) | ||
943 | |||
942 | } | 944 | } |
943 | 945 | ||
944 | mMediaSource->resetDirty(); | 946 | mMediaSource->resetDirty(); |
diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index 3d3399a..a405764 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp | |||
@@ -1412,14 +1412,14 @@ void init_debug_avatar_menu(LLMenuGL* menu) | |||
1412 | //menu->append(new LLMenuItemToggleGL("Show Attachment Points", &LLVOAvatar::sShowAttachmentPoints)); | 1412 | //menu->append(new LLMenuItemToggleGL("Show Attachment Points", &LLVOAvatar::sShowAttachmentPoints)); |
1413 | //diabling collision plane due to DEV-14477 -brad | 1413 | //diabling collision plane due to DEV-14477 -brad |
1414 | //menu->append(new LLMenuItemToggleGL("Show Collision Plane", &LLVOAvatar::sShowFootPlane)); | 1414 | //menu->append(new LLMenuItemToggleGL("Show Collision Plane", &LLVOAvatar::sShowFootPlane)); |
1415 | /*menu->append(new LLMenuItemCheckGL("Show Collision Skeleton", | 1415 | menu->append(new LLMenuItemCheckGL("Show Collision Skeleton", |
1416 | &LLPipeline::toggleRenderDebug, NULL, | 1416 | &LLPipeline::toggleRenderDebug, NULL, |
1417 | &LLPipeline::toggleRenderDebugControl, | 1417 | &LLPipeline::toggleRenderDebugControl, |
1418 | (void*)LLPipeline::RENDER_DEBUG_AVATAR_VOLUME)); | 1418 | (void*)LLPipeline::RENDER_DEBUG_AVATAR_VOLUME)); |
1419 | menu->append(new LLMenuItemCheckGL("Display Agent Target", | 1419 | menu->append(new LLMenuItemCheckGL("Display Agent Target", |
1420 | &LLPipeline::toggleRenderDebug, NULL, | 1420 | &LLPipeline::toggleRenderDebug, NULL, |
1421 | &LLPipeline::toggleRenderDebugControl, | 1421 | &LLPipeline::toggleRenderDebugControl, |
1422 | (void*)LLPipeline::RENDER_DEBUG_AGENT_TARGET));*/ | 1422 | (void*)LLPipeline::RENDER_DEBUG_AGENT_TARGET)); |
1423 | menu->append(new LLMenuItemToggleGL( "Debug Rotation", &LLVOAvatar::sDebugAvatarRotation)); | 1423 | menu->append(new LLMenuItemToggleGL( "Debug Rotation", &LLVOAvatar::sDebugAvatarRotation)); |
1424 | menu->append(new LLMenuItemCallGL("Dump Attachments", handle_dump_attachments)); | 1424 | menu->append(new LLMenuItemCallGL("Dump Attachments", handle_dump_attachments)); |
1425 | menu->append(new LLMenuItemCallGL("Refresh Appearance", handle_rebake_textures, NULL, NULL, 'R', MASK_ALT | MASK_CONTROL )); | 1425 | menu->append(new LLMenuItemCallGL("Refresh Appearance", handle_rebake_textures, NULL, NULL, 'R', MASK_ALT | MASK_CONTROL )); |
@@ -10463,7 +10463,7 @@ class LLAdvancedCheckShowCollisionPlane : public view_listener_t | |||
10463 | // SHOW COLLISION SKELETON // | 10463 | // SHOW COLLISION SKELETON // |
10464 | ///////////////////////////// | 10464 | ///////////////////////////// |
10465 | 10465 | ||
10466 | /* | 10466 | |
10467 | class LLAdvancedToggleShowCollisionSkeleton : public view_listener_t | 10467 | class LLAdvancedToggleShowCollisionSkeleton : public view_listener_t |
10468 | { | 10468 | { |
10469 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) | 10469 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) |
@@ -10484,13 +10484,13 @@ class LLAdvancedCheckShowCollisionSkeleton : public view_listener_t | |||
10484 | } | 10484 | } |
10485 | }; | 10485 | }; |
10486 | 10486 | ||
10487 | */ | 10487 | |
10488 | 10488 | ||
10489 | ////////////////////////// | 10489 | ////////////////////////// |
10490 | // DISPLAY AGENT TARGET // | 10490 | // DISPLAY AGENT TARGET // |
10491 | ////////////////////////// | 10491 | ////////////////////////// |
10492 | 10492 | ||
10493 | /* | 10493 | |
10494 | class LLAdvancedToggleDisplayAgentTarget : public view_listener_t | 10494 | class LLAdvancedToggleDisplayAgentTarget : public view_listener_t |
10495 | { | 10495 | { |
10496 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) | 10496 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) |
@@ -10511,7 +10511,7 @@ class LLAdvancedCheckDisplayAgentTarget : public view_listener_t | |||
10511 | } | 10511 | } |
10512 | }; | 10512 | }; |
10513 | 10513 | ||
10514 | */ | 10514 | |
10515 | 10515 | ||
10516 | /////////////////////////// | 10516 | /////////////////////////// |
10517 | // DEBUG AVATAR ROTATION // | 10517 | // DEBUG AVATAR ROTATION // |
@@ -11378,10 +11378,10 @@ void initialize_menus() | |||
11378 | addMenu(new LLAdvancedCheckDebugCharacterVis(), "Advanced.CheckDebugCharacterVis"); | 11378 | addMenu(new LLAdvancedCheckDebugCharacterVis(), "Advanced.CheckDebugCharacterVis"); |
11379 | // addMenu(new LLAdvancedToggleShowCollisionPlane(), "Advanced.ToggleShowCollisionPlane"); | 11379 | // addMenu(new LLAdvancedToggleShowCollisionPlane(), "Advanced.ToggleShowCollisionPlane"); |
11380 | // addMenu(new LLAdvancedCheckShowCollisionPlane(), "Advanced.CheckShowCollisionPlane"); | 11380 | // addMenu(new LLAdvancedCheckShowCollisionPlane(), "Advanced.CheckShowCollisionPlane"); |
11381 | // addMenu(new LLAdvancedToggleShowCollisionSkeleton(), "Advanced.ToggleShowCollisionSkeleton"); | 11381 | addMenu(new LLAdvancedToggleShowCollisionSkeleton(), "Advanced.ToggleShowCollisionSkeleton"); |
11382 | // addMenu(new LLAdvancedCheckShowCollisionSkeleton(), "Advanced.CheckShowCollisionSkeleton"); | 11382 | addMenu(new LLAdvancedCheckShowCollisionSkeleton(), "Advanced.CheckShowCollisionSkeleton"); |
11383 | // addMenu(new LLAdvancedToggleDisplayAgentTarget(), "Advanced.ToggleDisplayAgentTarget"); | 11383 | addMenu(new LLAdvancedToggleDisplayAgentTarget(), "Advanced.ToggleDisplayAgentTarget"); |
11384 | // addMenu(new LLAdvancedCheckDisplayAgentTarget(), "Advanced.CheckDisplayAgentTarget"); | 11384 | addMenu(new LLAdvancedCheckDisplayAgentTarget(), "Advanced.CheckDisplayAgentTarget"); |
11385 | addMenu(new LLAdvancedToggleDebugAvatarRotation(), "Advanced.ToggleDebugAvatarRotation"); | 11385 | addMenu(new LLAdvancedToggleDebugAvatarRotation(), "Advanced.ToggleDebugAvatarRotation"); |
11386 | addMenu(new LLAdvancedCheckDebugAvatarRotation(), "Advanced.CheckDebugAvatarRotation"); | 11386 | addMenu(new LLAdvancedCheckDebugAvatarRotation(), "Advanced.CheckDebugAvatarRotation"); |
11387 | addMenu(new LLAdvancedDumpAttachments(), "Advanced.DumpAttachments"); | 11387 | addMenu(new LLAdvancedDumpAttachments(), "Advanced.DumpAttachments"); |
diff --git a/linden/indra/newview/llviewerobject.cpp b/linden/indra/newview/llviewerobject.cpp index bd5abe2..4ab0957 100644 --- a/linden/indra/newview/llviewerobject.cpp +++ b/linden/indra/newview/llviewerobject.cpp | |||
@@ -2787,11 +2787,6 @@ BOOL LLViewerObject::updateGeometry(LLDrawable *drawable) | |||
2787 | return TRUE; | 2787 | return TRUE; |
2788 | } | 2788 | } |
2789 | 2789 | ||
2790 | void LLViewerObject::updateGL() | ||
2791 | { | ||
2792 | |||
2793 | } | ||
2794 | |||
2795 | void LLViewerObject::updateFaceSize(S32 idx) | 2790 | void LLViewerObject::updateFaceSize(S32 idx) |
2796 | { | 2791 | { |
2797 | 2792 | ||
@@ -2896,7 +2891,7 @@ F32 LLViewerObject::getMidScale() const | |||
2896 | } | 2891 | } |
2897 | 2892 | ||
2898 | 2893 | ||
2899 | void LLViewerObject::updateTextures(LLAgent &agent) | 2894 | void LLViewerObject::updateTextures() |
2900 | { | 2895 | { |
2901 | } | 2896 | } |
2902 | 2897 | ||
@@ -3741,7 +3736,6 @@ S32 LLViewerObject::setTEColor(const U8 te, const LLColor4& color) | |||
3741 | else if (color != tep->getColor()) | 3736 | else if (color != tep->getColor()) |
3742 | { | 3737 | { |
3743 | retval = LLPrimitive::setTEColor(te, color); | 3738 | retval = LLPrimitive::setTEColor(te, color); |
3744 | //setChanged(TEXTURE); | ||
3745 | if (mDrawable.notNull() && retval) | 3739 | if (mDrawable.notNull() && retval) |
3746 | { | 3740 | { |
3747 | // These should only happen on updates which are not the initial update. | 3741 | // These should only happen on updates which are not the initial update. |
@@ -3980,7 +3974,7 @@ LLViewerImage *LLViewerObject::getTEImage(const U8 face) const | |||
3980 | } | 3974 | } |
3981 | } | 3975 | } |
3982 | 3976 | ||
3983 | llwarns << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << llendl; | 3977 | llerrs << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << llendl; |
3984 | 3978 | ||
3985 | return NULL; | 3979 | return NULL; |
3986 | } | 3980 | } |
@@ -4166,11 +4160,6 @@ void LLViewerObject::updateText() | |||
4166 | } | 4160 | } |
4167 | } | 4161 | } |
4168 | 4162 | ||
4169 | LLVOAvatar* LLViewerObject::asAvatar() | ||
4170 | { | ||
4171 | return NULL; | ||
4172 | } | ||
4173 | |||
4174 | BOOL LLViewerObject::isParticleSource() const | 4163 | BOOL LLViewerObject::isParticleSource() const |
4175 | { | 4164 | { |
4176 | return !mPartSourcep.isNull() && !mPartSourcep->isDead(); | 4165 | return !mPartSourcep.isNull() && !mPartSourcep->isDead(); |
@@ -4385,14 +4374,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow | |||
4385 | gAudiop->cleanupAudioSource(mAudioSourcep); | 4374 | gAudiop->cleanupAudioSource(mAudioSourcep); |
4386 | mAudioSourcep = NULL; | 4375 | mAudioSourcep = NULL; |
4387 | } | 4376 | } |
4388 | /* | 4377 | |
4389 | if (mAudioSourcep && mAudioSourcep->isMuted() && | ||
4390 | mAudioSourcep->getCurrentData() && mAudioSourcep->getCurrentData()->getID() == audio_uuid) | ||
4391 | { | ||
4392 | //llinfos << "Already having this sound as muted sound, ignoring" << llendl; | ||
4393 | return; | ||
4394 | } | ||
4395 | */ | ||
4396 | getAudioSource(owner_id); | 4378 | getAudioSource(owner_id); |
4397 | 4379 | ||
4398 | if (mAudioSourcep) | 4380 | if (mAudioSourcep) |
@@ -4486,11 +4468,7 @@ LLViewerObject::ExtraParameter* LLViewerObject::createNewParameterEntry(U16 para | |||
4486 | new_block = new LLSculptParams(); | 4468 | new_block = new LLSculptParams(); |
4487 | break; | 4469 | break; |
4488 | } | 4470 | } |
4489 | case LLNetworkData::PARAMS_LIGHT_IMAGE: | 4471 | |
4490 | { | ||
4491 | new_block = new LLLightImageParams(); | ||
4492 | break; | ||
4493 | } | ||
4494 | default: | 4472 | default: |
4495 | { | 4473 | { |
4496 | llinfos << "Unknown param type." << llendl; | 4474 | llinfos << "Unknown param type." << llendl; |
@@ -4581,7 +4559,7 @@ bool LLViewerObject::setParameterEntry(U16 param_type, const LLNetworkData& new_ | |||
4581 | bool LLViewerObject::setParameterEntryInUse(U16 param_type, BOOL in_use, bool local_origin) | 4559 | bool LLViewerObject::setParameterEntryInUse(U16 param_type, BOOL in_use, bool local_origin) |
4582 | { | 4560 | { |
4583 | ExtraParameter* param = getExtraParameterEntryCreate(param_type); | 4561 | ExtraParameter* param = getExtraParameterEntryCreate(param_type); |
4584 | if (param && param->in_use != in_use) | 4562 | if (param->in_use != in_use) |
4585 | { | 4563 | { |
4586 | param->in_use = in_use; | 4564 | param->in_use = in_use; |
4587 | parameterChanged(param_type, param->data, in_use, local_origin); | 4565 | parameterChanged(param_type, param->data, in_use, local_origin); |
@@ -4997,7 +4975,7 @@ U32 LLViewerObject::getPartitionType() const | |||
4997 | return LLViewerRegion::PARTITION_NONE; | 4975 | return LLViewerRegion::PARTITION_NONE; |
4998 | } | 4976 | } |
4999 | 4977 | ||
5000 | void LLViewerObject::dirtySpatialGroup(BOOL priority) const | 4978 | void LLViewerObject::dirtySpatialGroup() const |
5001 | { | 4979 | { |
5002 | if (mDrawable) | 4980 | if (mDrawable) |
5003 | { | 4981 | { |
@@ -5005,7 +4983,6 @@ void LLViewerObject::dirtySpatialGroup(BOOL priority) const | |||
5005 | if (group) | 4983 | if (group) |
5006 | { | 4984 | { |
5007 | group->dirtyGeom(); | 4985 | group->dirtyGeom(); |
5008 | gPipeline.markRebuild(group, priority); | ||
5009 | } | 4986 | } |
5010 | } | 4987 | } |
5011 | } | 4988 | } |
diff --git a/linden/indra/newview/llviewerobject.h b/linden/indra/newview/llviewerobject.h index a227f2d..33e8da2 100644 --- a/linden/indra/newview/llviewerobject.h +++ b/linden/indra/newview/llviewerobject.h | |||
@@ -74,7 +74,6 @@ class LLViewerPartSourceScript; | |||
74 | class LLViewerRegion; | 74 | class LLViewerRegion; |
75 | class LLViewerObjectMedia; | 75 | class LLViewerObjectMedia; |
76 | class LLVOInventoryListener; | 76 | class LLVOInventoryListener; |
77 | class LLVOAvatar; | ||
78 | 77 | ||
79 | typedef enum e_object_update_type | 78 | typedef enum e_object_update_type |
80 | { | 79 | { |
@@ -117,7 +116,7 @@ public: | |||
117 | 116 | ||
118 | //============================================================================ | 117 | //============================================================================ |
119 | 118 | ||
120 | class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate | 119 | class LLViewerObject : public LLPrimitive, public LLRefCount |
121 | { | 120 | { |
122 | protected: | 121 | protected: |
123 | ~LLViewerObject(); // use unref() | 122 | ~LLViewerObject(); // use unref() |
@@ -144,8 +143,6 @@ public: | |||
144 | BOOL isOrphaned() const { return mOrphaned; } | 143 | BOOL isOrphaned() const { return mOrphaned; } |
145 | BOOL isParticleSource() const; | 144 | BOOL isParticleSource() const; |
146 | 145 | ||
147 | virtual LLVOAvatar* asAvatar(); | ||
148 | |||
149 | static void initVOClasses(); | 146 | static void initVOClasses(); |
150 | static void cleanupVOClasses(); | 147 | static void cleanupVOClasses(); |
151 | 148 | ||
@@ -192,12 +189,11 @@ public: | |||
192 | S32 getNumFaces() const { return mNumFaces; } | 189 | S32 getNumFaces() const { return mNumFaces; } |
193 | 190 | ||
194 | // Graphical stuff for objects - maybe broken out into render class later? | 191 | // Graphical stuff for objects - maybe broken out into render class later? |
195 | virtual void updateTextures(LLAgent &agent); | 192 | virtual void updateTextures(); |
196 | virtual void boostTexturePriority(BOOL boost_children = TRUE); // When you just want to boost priority of this object | 193 | virtual void boostTexturePriority(BOOL boost_children = TRUE); // When you just want to boost priority of this object |
197 | 194 | ||
198 | virtual LLDrawable* createDrawable(LLPipeline *pipeline); | 195 | virtual LLDrawable* createDrawable(LLPipeline *pipeline); |
199 | virtual BOOL updateGeometry(LLDrawable *drawable); | 196 | virtual BOOL updateGeometry(LLDrawable *drawable); |
200 | virtual void updateGL(); | ||
201 | virtual void updateFaceSize(S32 idx); | 197 | virtual void updateFaceSize(S32 idx); |
202 | virtual BOOL updateLOD(); | 198 | virtual BOOL updateLOD(); |
203 | virtual BOOL setDrawableParent(LLDrawable* parentp); | 199 | virtual BOOL setDrawableParent(LLDrawable* parentp); |
@@ -222,7 +218,6 @@ public: | |||
222 | 218 | ||
223 | virtual BOOL isFlexible() const { return FALSE; } | 219 | virtual BOOL isFlexible() const { return FALSE; } |
224 | virtual BOOL isSculpted() const { return FALSE; } | 220 | virtual BOOL isSculpted() const { return FALSE; } |
225 | virtual BOOL hasLightTexture() const { return FALSE; } | ||
226 | 221 | ||
227 | // This method returns true if the object is over land owned by | 222 | // This method returns true if the object is over land owned by |
228 | // the agent. | 223 | // the agent. |
@@ -473,7 +468,7 @@ public: | |||
473 | 468 | ||
474 | virtual S32 getLOD() const { return 3; } | 469 | virtual S32 getLOD() const { return 3; } |
475 | virtual U32 getPartitionType() const; | 470 | virtual U32 getPartitionType() const; |
476 | virtual void dirtySpatialGroup(BOOL priority = FALSE) const; | 471 | virtual void dirtySpatialGroup() const; |
477 | virtual void dirtyMesh(); | 472 | virtual void dirtyMesh(); |
478 | 473 | ||
479 | virtual LLNetworkData* getParameterEntry(U16 param_type) const; | 474 | virtual LLNetworkData* getParameterEntry(U16 param_type) const; |
diff --git a/linden/indra/newview/llviewerobjectlist.cpp b/linden/indra/newview/llviewerobjectlist.cpp index 517bb86..78ce247 100644 --- a/linden/indra/newview/llviewerobjectlist.cpp +++ b/linden/indra/newview/llviewerobjectlist.cpp | |||
@@ -629,7 +629,7 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent) | |||
629 | 629 | ||
630 | // Update distance & gpw | 630 | // Update distance & gpw |
631 | objectp->setPixelAreaAndAngle(agent); // Also sets the approx. pixel area | 631 | objectp->setPixelAreaAndAngle(agent); // Also sets the approx. pixel area |
632 | objectp->updateTextures(agent); // Update the image levels of textures for this object. | 632 | objectp->updateTextures(); // Update the image levels of textures for this object. |
633 | } | 633 | } |
634 | } | 634 | } |
635 | 635 | ||
diff --git a/linden/indra/newview/llviewerobjectlist.h b/linden/indra/newview/llviewerobjectlist.h index a77c33d..07920cb 100644 --- a/linden/indra/newview/llviewerobjectlist.h +++ b/linden/indra/newview/llviewerobjectlist.h | |||
@@ -44,6 +44,7 @@ | |||
44 | // project includes | 44 | // project includes |
45 | #include "llviewerobject.h" | 45 | #include "llviewerobject.h" |
46 | 46 | ||
47 | class LLCamera; | ||
47 | class LLNetMap; | 48 | class LLNetMap; |
48 | class LLDebugBeacon; | 49 | class LLDebugBeacon; |
49 | 50 | ||
diff --git a/linden/indra/newview/llviewerparceloverlay.cpp b/linden/indra/newview/llviewerparceloverlay.cpp index 935e3e6..0bcd8f3 100644 --- a/linden/indra/newview/llviewerparceloverlay.cpp +++ b/linden/indra/newview/llviewerparceloverlay.cpp | |||
@@ -71,7 +71,7 @@ LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_ | |||
71 | // Use mipmaps = FALSE, clamped, NEAREST filter, for sharp edges | 71 | // Use mipmaps = FALSE, clamped, NEAREST filter, for sharp edges |
72 | mTexture = new LLImageGL(FALSE); | 72 | mTexture = new LLImageGL(FALSE); |
73 | mImageRaw = new LLImageRaw(mParcelGridsPerEdge, mParcelGridsPerEdge, OVERLAY_IMG_COMPONENTS); | 73 | mImageRaw = new LLImageRaw(mParcelGridsPerEdge, mParcelGridsPerEdge, OVERLAY_IMG_COMPONENTS); |
74 | mTexture->createGLTexture(0, mImageRaw, 0); | 74 | mTexture->createGLTexture(0, mImageRaw, 0, TRUE, LLViewerImageBoostLevel::OTHER); |
75 | gGL.getTexUnit(0)->activate(); | 75 | gGL.getTexUnit(0)->activate(); |
76 | gGL.getTexUnit(0)->bind(mTexture); | 76 | gGL.getTexUnit(0)->bind(mTexture); |
77 | mTexture->setAddressMode(LLTexUnit::TAM_CLAMP); | 77 | mTexture->setAddressMode(LLTexUnit::TAM_CLAMP); |
@@ -593,7 +593,7 @@ void LLViewerParcelOverlay::addPropertyLine( | |||
593 | break; | 593 | break; |
594 | 594 | ||
595 | default: | 595 | default: |
596 | llwarns << "Invalid edge in addPropertyLine" << llendl; | 596 | llerrs << "Invalid edge in addPropertyLine" << llendl; |
597 | return; | 597 | return; |
598 | } | 598 | } |
599 | 599 | ||
diff --git a/linden/indra/newview/llviewershadermgr.cpp b/linden/indra/newview/llviewershadermgr.cpp index 8648271..69f7bd8 100644 --- a/linden/indra/newview/llviewershadermgr.cpp +++ b/linden/indra/newview/llviewershadermgr.cpp | |||
@@ -113,8 +113,6 @@ LLGLSLShader gDeferredAvatarProgram; | |||
113 | LLGLSLShader gDeferredAvatarAlphaProgram; | 113 | LLGLSLShader gDeferredAvatarAlphaProgram; |
114 | LLGLSLShader gDeferredLightProgram; | 114 | LLGLSLShader gDeferredLightProgram; |
115 | LLGLSLShader gDeferredMultiLightProgram; | 115 | LLGLSLShader gDeferredMultiLightProgram; |
116 | LLGLSLShader gDeferredSpotLightProgram; | ||
117 | LLGLSLShader gDeferredMultiSpotLightProgram; | ||
118 | LLGLSLShader gDeferredSunProgram; | 116 | LLGLSLShader gDeferredSunProgram; |
119 | LLGLSLShader gDeferredBlurLightProgram; | 117 | LLGLSLShader gDeferredBlurLightProgram; |
120 | LLGLSLShader gDeferredSoftenProgram; | 118 | LLGLSLShader gDeferredSoftenProgram; |
@@ -122,12 +120,6 @@ LLGLSLShader gDeferredShadowProgram; | |||
122 | LLGLSLShader gDeferredAvatarShadowProgram; | 120 | LLGLSLShader gDeferredAvatarShadowProgram; |
123 | LLGLSLShader gDeferredAlphaProgram; | 121 | LLGLSLShader gDeferredAlphaProgram; |
124 | LLGLSLShader gDeferredFullbrightProgram; | 122 | LLGLSLShader gDeferredFullbrightProgram; |
125 | LLGLSLShader gDeferredGIProgram; | ||
126 | LLGLSLShader gDeferredPostGIProgram; | ||
127 | LLGLSLShader gDeferredPostProgram; | ||
128 | |||
129 | LLGLSLShader gLuminanceGatherProgram; | ||
130 | |||
131 | 123 | ||
132 | //current avatar shader parameter pointer | 124 | //current avatar shader parameter pointer |
133 | GLint gAvatarMatrixParam; | 125 | GLint gAvatarMatrixParam; |
@@ -159,9 +151,6 @@ LLViewerShaderMgr::LLViewerShaderMgr() : | |||
159 | mShaderList.push_back(&gDeferredMultiLightProgram); | 151 | mShaderList.push_back(&gDeferredMultiLightProgram); |
160 | mShaderList.push_back(&gDeferredAlphaProgram); | 152 | mShaderList.push_back(&gDeferredAlphaProgram); |
161 | mShaderList.push_back(&gDeferredFullbrightProgram); | 153 | mShaderList.push_back(&gDeferredFullbrightProgram); |
162 | mShaderList.push_back(&gDeferredPostGIProgram); | ||
163 | mShaderList.push_back(&gDeferredPostProgram); | ||
164 | mShaderList.push_back(&gDeferredGIProgram); | ||
165 | mShaderList.push_back(&gDeferredWaterProgram); | 154 | mShaderList.push_back(&gDeferredWaterProgram); |
166 | mShaderList.push_back(&gDeferredAvatarAlphaProgram); | 155 | mShaderList.push_back(&gDeferredAvatarAlphaProgram); |
167 | } | 156 | } |
@@ -231,32 +220,13 @@ void LLViewerShaderMgr::initAttribsAndUniforms(void) | |||
231 | mReservedUniforms.push_back("shadowMap1"); | 220 | mReservedUniforms.push_back("shadowMap1"); |
232 | mReservedUniforms.push_back("shadowMap2"); | 221 | mReservedUniforms.push_back("shadowMap2"); |
233 | mReservedUniforms.push_back("shadowMap3"); | 222 | mReservedUniforms.push_back("shadowMap3"); |
234 | mReservedUniforms.push_back("shadowMap4"); | ||
235 | mReservedUniforms.push_back("shadowMap5"); | ||
236 | |||
237 | mReservedUniforms.push_back("normalMap"); | 223 | mReservedUniforms.push_back("normalMap"); |
238 | mReservedUniforms.push_back("positionMap"); | 224 | mReservedUniforms.push_back("positionMap"); |
239 | mReservedUniforms.push_back("diffuseRect"); | 225 | mReservedUniforms.push_back("diffuseRect"); |
240 | mReservedUniforms.push_back("specularRect"); | 226 | mReservedUniforms.push_back("specularRect"); |
241 | mReservedUniforms.push_back("noiseMap"); | 227 | mReservedUniforms.push_back("noiseMap"); |
242 | mReservedUniforms.push_back("lightFunc"); | ||
243 | mReservedUniforms.push_back("lightMap"); | 228 | mReservedUniforms.push_back("lightMap"); |
244 | mReservedUniforms.push_back("luminanceMap"); | 229 | |
245 | mReservedUniforms.push_back("giLightMap"); | ||
246 | mReservedUniforms.push_back("sunLightMap"); | ||
247 | mReservedUniforms.push_back("localLightMap"); | ||
248 | mReservedUniforms.push_back("projectionMap"); | ||
249 | mReservedUniforms.push_back("diffuseGIMap"); | ||
250 | mReservedUniforms.push_back("specularGIMap"); | ||
251 | mReservedUniforms.push_back("normalGIMap"); | ||
252 | mReservedUniforms.push_back("minpGIMap"); | ||
253 | mReservedUniforms.push_back("maxpGIMap"); | ||
254 | mReservedUniforms.push_back("depthGIMap"); | ||
255 | mReservedUniforms.push_back("lastDiffuseGIMap"); | ||
256 | mReservedUniforms.push_back("lastNormalGIMap"); | ||
257 | mReservedUniforms.push_back("lastMinpGIMap"); | ||
258 | mReservedUniforms.push_back("lastMaxpGIMap"); | ||
259 | |||
260 | mWLUniforms.push_back("camPosLocal"); | 230 | mWLUniforms.push_back("camPosLocal"); |
261 | 231 | ||
262 | mTerrainUniforms.reserve(5); | 232 | mTerrainUniforms.reserve(5); |
@@ -784,9 +754,9 @@ BOOL LLViewerShaderMgr::loadShadersEffects() | |||
784 | } | 754 | } |
785 | } | 755 | } |
786 | 756 | ||
787 | 757 | #if 0 | |
788 | // KL enabling loading of postprocess shaders until we fix | 758 | // disabling loading of postprocess shaders until we fix |
789 | // ATI may still have issues | 759 | // ATI sampler2DRect compatibility. |
790 | 760 | ||
791 | //load Color Filter Shader | 761 | //load Color Filter Shader |
792 | if (success) | 762 | if (success) |
@@ -827,7 +797,7 @@ BOOL LLViewerShaderMgr::loadShadersEffects() | |||
827 | gPostNightVisionProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT]; | 797 | gPostNightVisionProgram.mShaderLevel = mVertexShaderLevel[SHADER_EFFECT]; |
828 | success = gPostNightVisionProgram.createShader(NULL, &shaderUniforms); | 798 | success = gPostNightVisionProgram.createShader(NULL, &shaderUniforms); |
829 | } | 799 | } |
830 | 800 | #endif | |
831 | 801 | ||
832 | return success; | 802 | return success; |
833 | 803 | ||
@@ -844,8 +814,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() | |||
844 | gDeferredTerrainProgram.unload(); | 814 | gDeferredTerrainProgram.unload(); |
845 | gDeferredLightProgram.unload(); | 815 | gDeferredLightProgram.unload(); |
846 | gDeferredMultiLightProgram.unload(); | 816 | gDeferredMultiLightProgram.unload(); |
847 | gDeferredSpotLightProgram.unload(); | ||
848 | gDeferredMultiSpotLightProgram.unload(); | ||
849 | gDeferredSunProgram.unload(); | 817 | gDeferredSunProgram.unload(); |
850 | gDeferredBlurLightProgram.unload(); | 818 | gDeferredBlurLightProgram.unload(); |
851 | gDeferredSoftenProgram.unload(); | 819 | gDeferredSoftenProgram.unload(); |
@@ -855,10 +823,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() | |||
855 | gDeferredAvatarAlphaProgram.unload(); | 823 | gDeferredAvatarAlphaProgram.unload(); |
856 | gDeferredAlphaProgram.unload(); | 824 | gDeferredAlphaProgram.unload(); |
857 | gDeferredFullbrightProgram.unload(); | 825 | gDeferredFullbrightProgram.unload(); |
858 | gDeferredPostGIProgram.unload(); | ||
859 | gDeferredPostProgram.unload(); | ||
860 | gLuminanceGatherProgram.unload(); | ||
861 | gDeferredGIProgram.unload(); | ||
862 | gDeferredWaterProgram.unload(); | 826 | gDeferredWaterProgram.unload(); |
863 | return FALSE; | 827 | return FALSE; |
864 | } | 828 | } |
@@ -929,26 +893,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() | |||
929 | 893 | ||
930 | if (success) | 894 | if (success) |
931 | { | 895 | { |
932 | gDeferredSpotLightProgram.mName = "Deferred SpotLight Shader"; | ||
933 | gDeferredSpotLightProgram.mShaderFiles.clear(); | ||
934 | gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB)); | ||
935 | gDeferredSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiSpotLightF.glsl", GL_FRAGMENT_SHADER_ARB)); | ||
936 | gDeferredSpotLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; | ||
937 | success = gDeferredSpotLightProgram.createShader(NULL, NULL); | ||
938 | } | ||
939 | |||
940 | if (success) | ||
941 | { | ||
942 | gDeferredMultiSpotLightProgram.mName = "Deferred MultiSpotLight Shader"; | ||
943 | gDeferredMultiSpotLightProgram.mShaderFiles.clear(); | ||
944 | gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/pointLightV.glsl", GL_VERTEX_SHADER_ARB)); | ||
945 | gDeferredMultiSpotLightProgram.mShaderFiles.push_back(make_pair("deferred/multiSpotLightF.glsl", GL_FRAGMENT_SHADER_ARB)); | ||
946 | gDeferredMultiSpotLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; | ||
947 | success = gDeferredMultiSpotLightProgram.createShader(NULL, NULL); | ||
948 | } | ||
949 | |||
950 | if (success) | ||
951 | { | ||
952 | gDeferredSunProgram.mName = "Deferred Sun Shader"; | 896 | gDeferredSunProgram.mName = "Deferred Sun Shader"; |
953 | gDeferredSunProgram.mShaderFiles.clear(); | 897 | gDeferredSunProgram.mShaderFiles.clear(); |
954 | gDeferredSunProgram.mShaderFiles.push_back(make_pair("deferred/sunLightV.glsl", GL_VERTEX_SHADER_ARB)); | 898 | gDeferredSunProgram.mShaderFiles.push_back(make_pair("deferred/sunLightV.glsl", GL_VERTEX_SHADER_ARB)); |
@@ -998,36 +942,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() | |||
998 | 942 | ||
999 | if (success) | 943 | if (success) |
1000 | { | 944 | { |
1001 | gDeferredPostGIProgram.mName = "Deferred Post GI Shader"; | ||
1002 | gDeferredPostGIProgram.mShaderFiles.clear(); | ||
1003 | gDeferredPostGIProgram.mShaderFiles.push_back(make_pair("deferred/postgiV.glsl", GL_VERTEX_SHADER_ARB)); | ||
1004 | gDeferredPostGIProgram.mShaderFiles.push_back(make_pair("deferred/postgiF.glsl", GL_FRAGMENT_SHADER_ARB)); | ||
1005 | gDeferredPostGIProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; | ||
1006 | success = gDeferredPostGIProgram.createShader(NULL, NULL); | ||
1007 | } | ||
1008 | |||
1009 | if (success) | ||
1010 | { | ||
1011 | gDeferredPostProgram.mName = "Deferred Post Shader"; | ||
1012 | gDeferredPostProgram.mShaderFiles.clear(); | ||
1013 | gDeferredPostProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredV.glsl", GL_VERTEX_SHADER_ARB)); | ||
1014 | gDeferredPostProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredF.glsl", GL_FRAGMENT_SHADER_ARB)); | ||
1015 | gDeferredPostProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; | ||
1016 | success = gDeferredPostProgram.createShader(NULL, NULL); | ||
1017 | } | ||
1018 | |||
1019 | if (success) | ||
1020 | { | ||
1021 | gDeferredGIProgram.mName = "Deferred GI Shader"; | ||
1022 | gDeferredGIProgram.mShaderFiles.clear(); | ||
1023 | gDeferredGIProgram.mShaderFiles.push_back(make_pair("deferred/giV.glsl", GL_VERTEX_SHADER_ARB)); | ||
1024 | gDeferredGIProgram.mShaderFiles.push_back(make_pair("deferred/giF.glsl", GL_FRAGMENT_SHADER_ARB)); | ||
1025 | gDeferredGIProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; | ||
1026 | success = gDeferredGIProgram.createShader(NULL, NULL); | ||
1027 | } | ||
1028 | |||
1029 | if (success) | ||
1030 | { | ||
1031 | // load water shader | 945 | // load water shader |
1032 | gDeferredWaterProgram.mName = "Deferred Water Shader"; | 946 | gDeferredWaterProgram.mName = "Deferred Water Shader"; |
1033 | gDeferredWaterProgram.mFeatures.calculatesAtmospherics = true; | 947 | gDeferredWaterProgram.mFeatures.calculatesAtmospherics = true; |
@@ -1108,16 +1022,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() | |||
1108 | success = gDeferredAvatarAlphaProgram.createShader(&mAvatarAttribs, &mAvatarUniforms); | 1022 | success = gDeferredAvatarAlphaProgram.createShader(&mAvatarAttribs, &mAvatarUniforms); |
1109 | } | 1023 | } |
1110 | 1024 | ||
1111 | if (success) | ||
1112 | { | ||
1113 | gLuminanceGatherProgram.mName = "Luminance Gather Shader"; | ||
1114 | gLuminanceGatherProgram.mShaderFiles.clear(); | ||
1115 | gLuminanceGatherProgram.mShaderFiles.push_back(make_pair("deferred/luminanceV.glsl", GL_VERTEX_SHADER_ARB)); | ||
1116 | gLuminanceGatherProgram.mShaderFiles.push_back(make_pair("deferred/luminanceF.glsl", GL_FRAGMENT_SHADER_ARB)); | ||
1117 | gLuminanceGatherProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; | ||
1118 | success = gLuminanceGatherProgram.createShader(NULL, NULL); | ||
1119 | } | ||
1120 | |||
1121 | return success; | 1025 | return success; |
1122 | } | 1026 | } |
1123 | 1027 | ||
diff --git a/linden/indra/newview/llviewershadermgr.h b/linden/indra/newview/llviewershadermgr.h index bb50779..a743966 100644 --- a/linden/indra/newview/llviewershadermgr.h +++ b/linden/indra/newview/llviewershadermgr.h | |||
@@ -116,30 +116,12 @@ public: | |||
116 | DEFERRED_SHADOW1, | 116 | DEFERRED_SHADOW1, |
117 | DEFERRED_SHADOW2, | 117 | DEFERRED_SHADOW2, |
118 | DEFERRED_SHADOW3, | 118 | DEFERRED_SHADOW3, |
119 | DEFERRED_SHADOW4, | ||
120 | DEFERRED_SHADOW5, | ||
121 | DEFERRED_NORMAL, | 119 | DEFERRED_NORMAL, |
122 | DEFERRED_POSITION, | 120 | DEFERRED_POSITION, |
123 | DEFERRED_DIFFUSE, | 121 | DEFERRED_DIFFUSE, |
124 | DEFERRED_SPECULAR, | 122 | DEFERRED_SPECULAR, |
125 | DEFERRED_NOISE, | 123 | DEFERRED_NOISE, |
126 | DEFERRED_LIGHTFUNC, | ||
127 | DEFERRED_LIGHT, | 124 | DEFERRED_LIGHT, |
128 | DEFERRED_LUMINANCE, | ||
129 | DEFERRED_GI_LIGHT, | ||
130 | DEFERRED_SUN_LIGHT, | ||
131 | DEFERRED_LOCAL_LIGHT, | ||
132 | DEFERRED_PROJECTION, | ||
133 | DEFERRED_GI_DIFFUSE, | ||
134 | DEFERRED_GI_SPECULAR, | ||
135 | DEFERRED_GI_NORMAL, | ||
136 | DEFERRED_GI_MIN_POS, | ||
137 | DEFERRED_GI_MAX_POS, | ||
138 | DEFERRED_GI_DEPTH, | ||
139 | DEFERRED_GI_LAST_DIFFUSE, | ||
140 | DEFERRED_GI_LAST_NORMAL, | ||
141 | DEFERRED_GI_LAST_MIN_POS, | ||
142 | DEFERRED_GI_LAST_MAX_POS, | ||
143 | END_RESERVED_UNIFORMS | 125 | END_RESERVED_UNIFORMS |
144 | } eGLSLReservedUniforms; | 126 | } eGLSLReservedUniforms; |
145 | 127 | ||
@@ -344,23 +326,16 @@ extern LLGLSLShader gDeferredTerrainProgram; | |||
344 | extern LLGLSLShader gDeferredTreeProgram; | 326 | extern LLGLSLShader gDeferredTreeProgram; |
345 | extern LLGLSLShader gDeferredLightProgram; | 327 | extern LLGLSLShader gDeferredLightProgram; |
346 | extern LLGLSLShader gDeferredMultiLightProgram; | 328 | extern LLGLSLShader gDeferredMultiLightProgram; |
347 | extern LLGLSLShader gDeferredSpotLightProgram; | ||
348 | extern LLGLSLShader gDeferredMultiSpotLightProgram; | ||
349 | extern LLGLSLShader gDeferredSunProgram; | 329 | extern LLGLSLShader gDeferredSunProgram; |
350 | extern LLGLSLShader gDeferredGIProgram; | ||
351 | extern LLGLSLShader gDeferredBlurLightProgram; | 330 | extern LLGLSLShader gDeferredBlurLightProgram; |
352 | extern LLGLSLShader gDeferredAvatarProgram; | 331 | extern LLGLSLShader gDeferredAvatarProgram; |
353 | extern LLGLSLShader gDeferredSoftenProgram; | 332 | extern LLGLSLShader gDeferredSoftenProgram; |
354 | extern LLGLSLShader gDeferredShadowProgram; | 333 | extern LLGLSLShader gDeferredShadowProgram; |
355 | extern LLGLSLShader gDeferredPostGIProgram; | ||
356 | extern LLGLSLShader gDeferredPostProgram; | ||
357 | extern LLGLSLShader gDeferredAvatarShadowProgram; | 334 | extern LLGLSLShader gDeferredAvatarShadowProgram; |
358 | extern LLGLSLShader gDeferredAlphaProgram; | 335 | extern LLGLSLShader gDeferredAlphaProgram; |
359 | extern LLGLSLShader gDeferredFullbrightProgram; | 336 | extern LLGLSLShader gDeferredFullbrightProgram; |
360 | extern LLGLSLShader gDeferredAvatarAlphaProgram; | 337 | extern LLGLSLShader gDeferredAvatarAlphaProgram; |
361 | 338 | ||
362 | extern LLGLSLShader gLuminanceGatherProgram; | ||
363 | |||
364 | //current avatar shader parameter pointer | 339 | //current avatar shader parameter pointer |
365 | extern GLint gAvatarMatrixParam; | 340 | extern GLint gAvatarMatrixParam; |
366 | 341 | ||
diff --git a/linden/indra/newview/llviewerstats.h b/linden/indra/newview/llviewerstats.h index 9107ad6..b176632 100644 --- a/linden/indra/newview/llviewerstats.h +++ b/linden/indra/newview/llviewerstats.h | |||
@@ -196,7 +196,7 @@ private: | |||
196 | F64 mLastTimeDiff; // used for time stat updates | 196 | F64 mLastTimeDiff; // used for time stat updates |
197 | }; | 197 | }; |
198 | 198 | ||
199 | static const F32 SEND_STATS_PERIOD = 3000.0f; | 199 | static const F32 SEND_STATS_PERIOD = 300.0f; |
200 | 200 | ||
201 | // The following are from (older?) statistics code found in appviewer. | 201 | // The following are from (older?) statistics code found in appviewer. |
202 | void init_statistics(); | 202 | void init_statistics(); |
diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp index 2ed2f37..f4b738f 100644 --- a/linden/indra/newview/llviewerwindow.cpp +++ b/linden/indra/newview/llviewerwindow.cpp | |||
@@ -473,27 +473,6 @@ public: | |||
473 | 473 | ||
474 | ypos += y_inc; | 474 | ypos += y_inc; |
475 | 475 | ||
476 | { | ||
477 | std::ostringstream ostr; | ||
478 | ostr << "Shadow error: " << gPipeline.mShadowError; | ||
479 | addText(xpos, ypos, ostr.str()); | ||
480 | ypos += y_inc; | ||
481 | } | ||
482 | |||
483 | { | ||
484 | std::ostringstream ostr; | ||
485 | ostr << "Shadow FOV: " << gPipeline.mShadowFOV; | ||
486 | addText(xpos, ypos, ostr.str()); | ||
487 | ypos += y_inc; | ||
488 | } | ||
489 | |||
490 | { | ||
491 | std::ostringstream ostr; | ||
492 | ostr << "Shadow Splits: " << gPipeline.mSunClipPlanes; | ||
493 | addText(xpos, ypos, ostr.str()); | ||
494 | ypos += y_inc; | ||
495 | } | ||
496 | |||
497 | LLVertexBuffer::sBindCount = LLImageGL::sBindCount = | 476 | LLVertexBuffer::sBindCount = LLImageGL::sBindCount = |
498 | LLVertexBuffer::sSetCount = LLImageGL::sUniqueCount = | 477 | LLVertexBuffer::sSetCount = LLImageGL::sUniqueCount = |
499 | gPipeline.mNumVisibleNodes = LLPipeline::sVisibleLightCount = 0; | 478 | gPipeline.mNumVisibleNodes = LLPipeline::sVisibleLightCount = 0; |
@@ -1351,6 +1330,7 @@ LLViewerWindow::LLViewerWindow( | |||
1351 | 1330 | ||
1352 | // Init the image list. Must happen after GL is initialized and before the images that | 1331 | // Init the image list. Must happen after GL is initialized and before the images that |
1353 | // LLViewerWindow needs are requested. | 1332 | // LLViewerWindow needs are requested. |
1333 | LLImageGL::initClass(LLViewerImageBoostLevel::MAX_GL_IMAGE_CATEGORY) ; | ||
1354 | gImageList.init(); | 1334 | gImageList.init(); |
1355 | LLViewerImage::initClass(); | 1335 | LLViewerImage::initClass(); |
1356 | gBumpImageList.init(); | 1336 | gBumpImageList.init(); |
@@ -1463,7 +1443,7 @@ void LLViewerWindow::initBase() | |||
1463 | llassert( !gConsole ); | 1443 | llassert( !gConsole ); |
1464 | gConsole = new LLConsole( | 1444 | gConsole = new LLConsole( |
1465 | "console", | 1445 | "console", |
1466 | //gSavedSettings.getS32("ConsoleBufferSize"), | 1446 | gSavedSettings.getS32("ConsoleBufferSize"), |
1467 | getChatConsoleRect(), | 1447 | getChatConsoleRect(), |
1468 | gSavedSettings.getS32("ChatFontSize"), | 1448 | gSavedSettings.getS32("ChatFontSize"), |
1469 | gSavedSettings.getF32("ChatPersistTime") ); | 1449 | gSavedSettings.getF32("ChatPersistTime") ); |
@@ -2546,6 +2526,7 @@ BOOL LLViewerWindow::handlePerFrameHover() | |||
2546 | mMouseInWindow = TRUE; | 2526 | mMouseInWindow = TRUE; |
2547 | } | 2527 | } |
2548 | 2528 | ||
2529 | |||
2549 | S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::sGLScaleFactor.mV[VX]); | 2530 | S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::sGLScaleFactor.mV[VX]); |
2550 | S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::sGLScaleFactor.mV[VY]); | 2531 | S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::sGLScaleFactor.mV[VY]); |
2551 | 2532 | ||
@@ -2570,7 +2551,7 @@ BOOL LLViewerWindow::handlePerFrameHover() | |||
2570 | mCurrentMouseDelta.set(dx, dy); | 2551 | mCurrentMouseDelta.set(dx, dy); |
2571 | mouse_vel.setVec((F32) dx, (F32) dy); | 2552 | mouse_vel.setVec((F32) dx, (F32) dy); |
2572 | } | 2553 | } |
2573 | 2554 | ||
2574 | mMouseVelocityStat.addValue(mouse_vel.magVec()); | 2555 | mMouseVelocityStat.addValue(mouse_vel.magVec()); |
2575 | 2556 | ||
2576 | if (gNoRender) | 2557 | if (gNoRender) |
@@ -2833,21 +2814,16 @@ BOOL LLViewerWindow::handlePerFrameHover() | |||
2833 | gFloaterView->setRect(floater_rect); | 2814 | gFloaterView->setRect(floater_rect); |
2834 | } | 2815 | } |
2835 | 2816 | ||
2836 | { | ||
2837 | // snap floaters to top of chat bar/button strip | 2817 | // snap floaters to top of chat bar/button strip |
2838 | LLView* chatbar_and_buttons = gOverlayBar->getChild<LLView>("chatbar_and_buttons", TRUE); | 2818 | LLView* chatbar_and_buttons = gOverlayBar->getChild<LLView>("chatbar_and_buttons", TRUE); |
2839 | S32 top, left; | ||
2840 | S32 chatbar_and_buttons_x = chatbar_and_buttons->getLocalBoundingRect().mLeft; | ||
2841 | S32 chatbar_and_buttons_y = chatbar_and_buttons->getLocalBoundingRect().mTop; | ||
2842 | |||
2843 | // find top of chatbar and state buttons, if either are visible | 2819 | // find top of chatbar and state buttons, if either are visible |
2844 | if (chatbar_and_buttons && !chatbar_and_buttons->getLocalBoundingRect().isNull()) | 2820 | if (chatbar_and_buttons && !chatbar_and_buttons->getLocalBoundingRect().isNull()) |
2845 | { | 2821 | { |
2846 | // convert top/left corner of chatbar/buttons container to | 2822 | // convert top/left corner of chatbar/buttons container to gFloaterView-relative coordinates |
2847 | // gFloaterView-relative coordinates | 2823 | S32 top, left; |
2848 | chatbar_and_buttons->localPointToOtherView( | 2824 | chatbar_and_buttons->localPointToOtherView( |
2849 | chatbar_and_buttons_x, | 2825 | chatbar_and_buttons->getLocalBoundingRect().mLeft, |
2850 | chatbar_and_buttons_y, | 2826 | chatbar_and_buttons->getLocalBoundingRect().mTop, |
2851 | &left, | 2827 | &left, |
2852 | &top, | 2828 | &top, |
2853 | gFloaterView); | 2829 | gFloaterView); |
@@ -2855,9 +2831,10 @@ BOOL LLViewerWindow::handlePerFrameHover() | |||
2855 | } | 2831 | } |
2856 | else if (gToolBar->getVisible()) | 2832 | else if (gToolBar->getVisible()) |
2857 | { | 2833 | { |
2834 | S32 top, left; | ||
2858 | gToolBar->localPointToOtherView( | 2835 | gToolBar->localPointToOtherView( |
2859 | chatbar_and_buttons_x, | 2836 | gToolBar->getLocalBoundingRect().mLeft, |
2860 | chatbar_and_buttons_y, | 2837 | gToolBar->getLocalBoundingRect().mTop, |
2861 | &left, | 2838 | &left, |
2862 | &top, | 2839 | &top, |
2863 | gFloaterView); | 2840 | gFloaterView); |
@@ -2867,7 +2844,7 @@ BOOL LLViewerWindow::handlePerFrameHover() | |||
2867 | { | 2844 | { |
2868 | gFloaterView->setSnapOffsetBottom(0); | 2845 | gFloaterView->setSnapOffsetBottom(0); |
2869 | } | 2846 | } |
2870 | } | 2847 | |
2871 | // Always update console | 2848 | // Always update console |
2872 | LLRect console_rect = getChatConsoleRect(); | 2849 | LLRect console_rect = getChatConsoleRect(); |
2873 | console_rect.mBottom = gHUDView->getRect().mBottom + getChatConsoleBottomPad(); | 2850 | console_rect.mBottom = gHUDView->getRect().mBottom + getChatConsoleBottomPad(); |
@@ -2875,8 +2852,8 @@ BOOL LLViewerWindow::handlePerFrameHover() | |||
2875 | gConsole->setRect(console_rect); | 2852 | gConsole->setRect(console_rect); |
2876 | } | 2853 | } |
2877 | 2854 | ||
2878 | |||
2879 | mLastMousePoint = mCurrentMousePoint; | 2855 | mLastMousePoint = mCurrentMousePoint; |
2856 | |||
2880 | // last ditch force of edit menu to selection manager | 2857 | // last ditch force of edit menu to selection manager |
2881 | if (LLEditMenuHandler::gEditMenuHandler == NULL && LLSelectMgr::getInstance()->getSelection()->getObjectCount()) | 2858 | if (LLEditMenuHandler::gEditMenuHandler == NULL && LLSelectMgr::getInstance()->getSelection()->getObjectCount()) |
2882 | { | 2859 | { |
@@ -2939,6 +2916,7 @@ BOOL LLViewerWindow::handlePerFrameHover() | |||
2939 | &gDebugRaycastBinormal); | 2916 | &gDebugRaycastBinormal); |
2940 | } | 2917 | } |
2941 | 2918 | ||
2919 | |||
2942 | // per frame picking - for tooltips and changing cursor over interactive objects | 2920 | // per frame picking - for tooltips and changing cursor over interactive objects |
2943 | static S32 previous_x = -1; | 2921 | static S32 previous_x = -1; |
2944 | static S32 previous_y = -1; | 2922 | static S32 previous_y = -1; |
@@ -2981,6 +2959,7 @@ BOOL LLViewerWindow::handlePerFrameHover() | |||
2981 | 2959 | ||
2982 | previous_x = x; | 2960 | previous_x = x; |
2983 | previous_y = y; | 2961 | previous_y = y; |
2962 | |||
2984 | return handled; | 2963 | return handled; |
2985 | } | 2964 | } |
2986 | 2965 | ||
@@ -4078,7 +4057,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei | |||
4078 | { | 4057 | { |
4079 | if(image_width > window_width || image_height > window_height) //need to enlarge the scene | 4058 | if(image_width > window_width || image_height > window_height) //need to enlarge the scene |
4080 | { | 4059 | { |
4081 | if (!LLPipeline::sRenderDeferred && gGLManager.mHasFramebufferObject && !show_ui) | 4060 | if (gGLManager.mHasFramebufferObject && !show_ui) |
4082 | { | 4061 | { |
4083 | GLint max_size = 0; | 4062 | GLint max_size = 0; |
4084 | glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE_EXT, &max_size); | 4063 | glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE_EXT, &max_size); |
@@ -4167,17 +4146,10 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei | |||
4167 | else | 4146 | else |
4168 | { | 4147 | { |
4169 | const U32 subfield = subimage_x+(subimage_y*llceil(scale_factor)); | 4148 | const U32 subfield = subimage_x+(subimage_y*llceil(scale_factor)); |
4170 | if (LLPipeline::sRenderDeferred) | ||
4171 | { | ||
4172 | display(do_rebuild, scale_factor, subfield, FALSE); | ||
4173 | } | ||
4174 | else | ||
4175 | { | ||
4176 | display(do_rebuild, scale_factor, subfield, TRUE); | 4149 | display(do_rebuild, scale_factor, subfield, TRUE); |
4177 | // Required for showing the GUI in snapshots? See DEV-16350 for details. JC | 4150 | // Required for showing the GUI in snapshots? See DEV-16350 for details. JC |
4178 | render_ui(scale_factor, subfield); | 4151 | render_ui(scale_factor, subfield); |
4179 | } | 4152 | } |
4180 | } | ||
4181 | 4153 | ||
4182 | S32 subimage_x_offset = llclamp(buffer_x_offset - (subimage_x * window_width), 0, window_width); | 4154 | S32 subimage_x_offset = llclamp(buffer_x_offset - (subimage_x * window_width), 0, window_width); |
4183 | // handle fractional rows | 4155 | // handle fractional rows |
diff --git a/linden/indra/newview/llvlcomposition.cpp b/linden/indra/newview/llvlcomposition.cpp index f96665b..535c504 100644 --- a/linden/indra/newview/llvlcomposition.cpp +++ b/linden/indra/newview/llvlcomposition.cpp | |||
@@ -460,10 +460,6 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y, | |||
460 | } | 460 | } |
461 | } | 461 | } |
462 | 462 | ||
463 | if (!texturep->getHasGLTexture()) | ||
464 | { | ||
465 | texturep->createGLTexture(0, raw); | ||
466 | } | ||
467 | texturep->setSubImage(raw, tex_x_begin, tex_y_begin, tex_x_end - tex_x_begin, tex_y_end - tex_y_begin); | 463 | texturep->setSubImage(raw, tex_x_begin, tex_y_begin, tex_x_end - tex_x_begin, tex_y_end - tex_y_begin); |
468 | LLSurface::sTextureUpdateTime += gen_timer.getElapsedTimeF32(); | 464 | LLSurface::sTextureUpdateTime += gen_timer.getElapsedTimeF32(); |
469 | LLSurface::sTexelsUpdated += (tex_x_end - tex_x_begin) * (tex_y_end - tex_y_begin); | 465 | LLSurface::sTexelsUpdated += (tex_x_end - tex_x_begin) * (tex_y_end - tex_y_begin); |
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp index cd90c59..6522a8b 100644 --- a/linden/indra/newview/llvoavatar.cpp +++ b/linden/indra/newview/llvoavatar.cpp | |||
@@ -704,7 +704,6 @@ BOOL LLVOAvatar::sDebugInvisible = FALSE; | |||
704 | BOOL LLVOAvatar::sShowAttachmentPoints = FALSE; | 704 | BOOL LLVOAvatar::sShowAttachmentPoints = FALSE; |
705 | BOOL LLVOAvatar::sShowAnimationDebug = FALSE; | 705 | BOOL LLVOAvatar::sShowAnimationDebug = FALSE; |
706 | BOOL LLVOAvatar::sShowFootPlane = FALSE; | 706 | BOOL LLVOAvatar::sShowFootPlane = FALSE; |
707 | BOOL LLVOAvatar::sShowCollisionVolumes = FALSE; | ||
708 | BOOL LLVOAvatar::sVisibleInFirstPerson = FALSE; | 707 | BOOL LLVOAvatar::sVisibleInFirstPerson = FALSE; |
709 | F32 LLVOAvatar::sLODFactor = 1.f; | 708 | F32 LLVOAvatar::sLODFactor = 1.f; |
710 | BOOL LLVOAvatar::sUseImpostors = FALSE; | 709 | BOOL LLVOAvatar::sUseImpostors = FALSE; |
@@ -741,7 +740,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, | |||
741 | mTyping(FALSE), | 740 | mTyping(FALSE), |
742 | mMeshValid(FALSE), | 741 | mMeshValid(FALSE), |
743 | mVisible(FALSE), | 742 | mVisible(FALSE), |
744 | mMeshTexturesDirty(FALSE), | ||
745 | mWindFreq(0.f), | 743 | mWindFreq(0.f), |
746 | mRipplePhase( 0.f ), | 744 | mRipplePhase( 0.f ), |
747 | mBelowWater(FALSE), | 745 | mBelowWater(FALSE), |
@@ -802,7 +800,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, | |||
802 | mBakedTextureData[i].mLastTextureIndex = IMG_DEFAULT_AVATAR; | 800 | mBakedTextureData[i].mLastTextureIndex = IMG_DEFAULT_AVATAR; |
803 | mBakedTextureData[i].mTexLayerSet = NULL; | 801 | mBakedTextureData[i].mTexLayerSet = NULL; |
804 | mBakedTextureData[i].mIsLoaded = false; | 802 | mBakedTextureData[i].mIsLoaded = false; |
805 | //mBakedTextureData[i].mIsUsed = false; // KL SG | 803 | mBakedTextureData[i].mIsUsed = false; |
806 | mBakedTextureData[i].mMaskTexName = 0; | 804 | mBakedTextureData[i].mMaskTexName = 0; |
807 | mBakedTextureData[i].mTextureIndex = getTextureIndex((EBakedTextureIndex)i); | 805 | mBakedTextureData[i].mTextureIndex = getTextureIndex((EBakedTextureIndex)i); |
808 | } | 806 | } |
@@ -858,11 +856,9 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, | |||
858 | mRippleTimeLast = 0.f; | 856 | mRippleTimeLast = 0.f; |
859 | 857 | ||
860 | mShadowImagep = gImageList.getImageFromFile("foot_shadow.j2c"); | 858 | mShadowImagep = gImageList.getImageFromFile("foot_shadow.j2c"); |
861 | 859 | gGL.getTexUnit(0)->bind(mShadowImagep.get()); | |
862 | // GL NOT ACTIVE HERE | 860 | mShadowImagep->setAddressMode(LLTexUnit::TAM_CLAMP); |
863 | //gGL.getTexUnit(0)->bind(mShadowImagep.get()); | 861 | |
864 | //mShadowImagep->setAddressMode(LLTexUnit::TAM_CLAMP); | ||
865 | |||
866 | mInAir = FALSE; | 862 | mInAir = FALSE; |
867 | 863 | ||
868 | mStepOnLand = TRUE; | 864 | mStepOnLand = TRUE; |
@@ -1299,7 +1295,7 @@ void LLVOAvatar::resetImpostors() | |||
1299 | // static | 1295 | // static |
1300 | void LLVOAvatar::deleteCachedImages(bool clearAll) | 1296 | void LLVOAvatar::deleteCachedImages(bool clearAll) |
1301 | { | 1297 | { |
1302 | /* if(gAuditTexture) | 1298 | if(gAuditTexture) |
1303 | { | 1299 | { |
1304 | S32 total_tex_size = sScratchTexBytes ; | 1300 | S32 total_tex_size = sScratchTexBytes ; |
1305 | S32 tex_size = SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT ; | 1301 | S32 tex_size = SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT ; |
@@ -1341,7 +1337,7 @@ void LLVOAvatar::deleteCachedImages(bool clearAll) | |||
1341 | total_tex_size -= 4 * tex_size ; | 1337 | total_tex_size -= 4 * tex_size ; |
1342 | } | 1338 | } |
1343 | } | 1339 | } |
1344 | */ | 1340 | |
1345 | if (LLTexLayerSet::sHasCaches) | 1341 | if (LLTexLayerSet::sHasCaches) |
1346 | { | 1342 | { |
1347 | lldebugs << "Deleting layer set caches" << llendl; | 1343 | lldebugs << "Deleting layer set caches" << llendl; |
@@ -1866,11 +1862,6 @@ BOOL LLVOAvatar::buildSkeleton(const LLVOAvatarSkeletonInfo *info) | |||
1866 | return TRUE; | 1862 | return TRUE; |
1867 | } | 1863 | } |
1868 | 1864 | ||
1869 | LLVOAvatar* LLVOAvatar::asAvatar() // KL SD | ||
1870 | { | ||
1871 | return this; | ||
1872 | } | ||
1873 | |||
1874 | //----------------------------------------------------------------------------- | 1865 | //----------------------------------------------------------------------------- |
1875 | // LLVOAvatar::startDefaultMotions() | 1866 | // LLVOAvatar::startDefaultMotions() |
1876 | //----------------------------------------------------------------------------- | 1867 | //----------------------------------------------------------------------------- |
@@ -1933,7 +1924,7 @@ void LLVOAvatar::buildCharacter() | |||
1933 | LLTimer timer; | 1924 | LLTimer timer; |
1934 | 1925 | ||
1935 | BOOL status = loadAvatar(); | 1926 | BOOL status = loadAvatar(); |
1936 | // stop_glerror(); | 1927 | stop_glerror(); |
1937 | 1928 | ||
1938 | if (gNoRender) | 1929 | if (gNoRender) |
1939 | { | 1930 | { |
@@ -2043,7 +2034,7 @@ void LLVOAvatar::buildCharacter() | |||
2043 | processAnimationStateChanges(); | 2034 | processAnimationStateChanges(); |
2044 | 2035 | ||
2045 | mIsBuilt = TRUE; | 2036 | mIsBuilt = TRUE; |
2046 | // stop_glerror(); | 2037 | stop_glerror(); |
2047 | 2038 | ||
2048 | //------------------------------------------------------------------------- | 2039 | //------------------------------------------------------------------------- |
2049 | // build the attach and detach menus | 2040 | // build the attach and detach menus |
@@ -5050,7 +5041,7 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color) | |||
5050 | //------------------------------------------------------------------------ | 5041 | //------------------------------------------------------------------------ |
5051 | // LLVOAvatar::updateTextures() | 5042 | // LLVOAvatar::updateTextures() |
5052 | //------------------------------------------------------------------------ | 5043 | //------------------------------------------------------------------------ |
5053 | void LLVOAvatar::updateTextures(LLAgent &agent) // KL SD version | 5044 | void LLVOAvatar::updateTextures() |
5054 | { | 5045 | { |
5055 | BOOL render_avatar = TRUE; | 5046 | BOOL render_avatar = TRUE; |
5056 | 5047 | ||
@@ -5069,7 +5060,6 @@ void LLVOAvatar::updateTextures(LLAgent &agent) // KL SD version | |||
5069 | } | 5060 | } |
5070 | 5061 | ||
5071 | std::vector<bool> layer_baked; | 5062 | std::vector<bool> layer_baked; |
5072 | // GL NOT ACTIVE HERE - *TODO | ||
5073 | for (U32 i = 0; i < mBakedTextureData.size(); i++) | 5063 | for (U32 i = 0; i < mBakedTextureData.size(); i++) |
5074 | { | 5064 | { |
5075 | layer_baked.push_back(isTextureDefined(mBakedTextureData[i].mTextureIndex)); | 5065 | layer_baked.push_back(isTextureDefined(mBakedTextureData[i].mTextureIndex)); |
@@ -5152,7 +5142,13 @@ void LLVOAvatar::updateTextures(LLAgent &agent) // KL SD version | |||
5152 | if (texture_dict->mIsLocalTexture) | 5142 | if (texture_dict->mIsLocalTexture) |
5153 | { | 5143 | { |
5154 | addLocalTextureStats((ETextureIndex)index, imagep, texel_area_ratio, render_avatar, layer_baked[baked_index]); | 5144 | addLocalTextureStats((ETextureIndex)index, imagep, texel_area_ratio, render_avatar, layer_baked[baked_index]); |
5145 | // SNOW-8 : temporary snowglobe1.0 fix for baked textures | ||
5146 | if (render_avatar && !gGLManager.mIsDisabled ) | ||
5147 | { | ||
5148 | // bind the texture so that its boost level won't be slammed | ||
5149 | gGL.getTexUnit(0)->bind(imagep); | ||
5155 | } | 5150 | } |
5151 | } | ||
5156 | else if (texture_dict->mIsBakedTexture) | 5152 | else if (texture_dict->mIsBakedTexture) |
5157 | { | 5153 | { |
5158 | if (layer_baked[baked_index]) | 5154 | if (layer_baked[baked_index]) |
@@ -5398,7 +5394,7 @@ void LLVOAvatar::processAnimationStateChanges() | |||
5398 | } | 5394 | } |
5399 | } | 5395 | } |
5400 | 5396 | ||
5401 | //stop_glerror(); | 5397 | stop_glerror(); |
5402 | } | 5398 | } |
5403 | 5399 | ||
5404 | 5400 | ||
@@ -6383,15 +6379,6 @@ LLDrawable *LLVOAvatar::createDrawable(LLPipeline *pipeline) | |||
6383 | } | 6379 | } |
6384 | 6380 | ||
6385 | 6381 | ||
6386 | void LLVOAvatar::updateGL() | ||
6387 | { | ||
6388 | if (mMeshTexturesDirty) | ||
6389 | { | ||
6390 | updateMeshTextures(); | ||
6391 | mMeshTexturesDirty = FALSE; | ||
6392 | } | ||
6393 | } | ||
6394 | |||
6395 | //----------------------------------------------------------------------------- | 6382 | //----------------------------------------------------------------------------- |
6396 | // updateGeometry() | 6383 | // updateGeometry() |
6397 | //----------------------------------------------------------------------------- | 6384 | //----------------------------------------------------------------------------- |
@@ -7429,20 +7416,12 @@ BOOL LLVOAvatar::bindScratchTexture( LLGLenum format ) | |||
7429 | if( *last_bind_time != LLImageGL::sLastFrameTime ) | 7416 | if( *last_bind_time != LLImageGL::sLastFrameTime ) |
7430 | { | 7417 | { |
7431 | *last_bind_time = LLImageGL::sLastFrameTime; | 7418 | *last_bind_time = LLImageGL::sLastFrameTime; |
7432 | // #if !LL_RELEASE_FOR_DOWNLOAD | 7419 | LLImageGL::updateBoundTexMemStatic(texture_bytes, SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT, LLViewerImageBoostLevel::AVATAR_SCRATCH_TEX) ; |
7433 | // LLImageGL::updateBoundTexMem(texture_bytes, SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT) ; | ||
7434 | // #else | ||
7435 | LLImageGL::updateBoundTexMem(texture_bytes); | ||
7436 | // #endif | ||
7437 | } | 7420 | } |
7438 | } | 7421 | } |
7439 | else | 7422 | else |
7440 | { | 7423 | { |
7441 | // #if !LL_RELEASE_FOR_DOWNLOAD | 7424 | LLImageGL::updateBoundTexMemStatic(texture_bytes, SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT, LLViewerImageBoostLevel::AVATAR_SCRATCH_TEX) ; |
7442 | // LLImageGL::updateBoundTexMem(texture_bytes, SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT) ; | ||
7443 | // #else | ||
7444 | LLImageGL::updateBoundTexMem(texture_bytes); | ||
7445 | // #endif | ||
7446 | LLVOAvatar::sScratchTexLastBindTime.addData( format, new F32(LLImageGL::sLastFrameTime) ); | 7425 | LLVOAvatar::sScratchTexLastBindTime.addData( format, new F32(LLImageGL::sLastFrameTime) ); |
7447 | } | 7426 | } |
7448 | 7427 | ||
@@ -7464,8 +7443,7 @@ LLGLuint LLVOAvatar::getScratchTexName( LLGLenum format, U32* texture_bytes ) | |||
7464 | { | 7443 | { |
7465 | case GL_LUMINANCE: components = 1; internal_format = GL_LUMINANCE8; break; | 7444 | case GL_LUMINANCE: components = 1; internal_format = GL_LUMINANCE8; break; |
7466 | case GL_ALPHA: components = 1; internal_format = GL_ALPHA8; break; | 7445 | case GL_ALPHA: components = 1; internal_format = GL_ALPHA8; break; |
7467 | // Support for GL_EXT_paletted_texture is deprecated | 7446 | case GL_COLOR_INDEX: components = 1; internal_format = GL_COLOR_INDEX8_EXT; break; |
7468 | // case GL_COLOR_INDEX: components = 1; internal_format = GL_COLOR_INDEX8_EXT; break; | ||
7469 | case GL_LUMINANCE_ALPHA: components = 2; internal_format = GL_LUMINANCE8_ALPHA8; break; | 7447 | case GL_LUMINANCE_ALPHA: components = 2; internal_format = GL_LUMINANCE8_ALPHA8; break; |
7470 | case GL_RGB: components = 3; internal_format = GL_RGB8; break; | 7448 | case GL_RGB: components = 3; internal_format = GL_RGB8; break; |
7471 | case GL_RGBA: components = 4; internal_format = GL_RGBA8; break; | 7449 | case GL_RGBA: components = 4; internal_format = GL_RGBA8; break; |
@@ -7507,11 +7485,11 @@ LLGLuint LLVOAvatar::getScratchTexName( LLGLenum format, U32* texture_bytes ) | |||
7507 | 7485 | ||
7508 | LLVOAvatar::sScratchTexBytes += *texture_bytes; | 7486 | LLVOAvatar::sScratchTexBytes += *texture_bytes; |
7509 | LLImageGL::sGlobalTextureMemoryInBytes += *texture_bytes; | 7487 | LLImageGL::sGlobalTextureMemoryInBytes += *texture_bytes; |
7510 | /* | 7488 | |
7511 | if(gAuditTexture) | 7489 | if(gAuditTexture) |
7512 | { | 7490 | { |
7513 | LLImageGL::incTextureCounterStatic(SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT, components, LLViewerImageBoostLevel::AVATAR_SCRATCH_TEX) ; | 7491 | LLImageGL::incTextureCounterStatic(SCRATCH_TEX_WIDTH * SCRATCH_TEX_HEIGHT, components, LLViewerImageBoostLevel::AVATAR_SCRATCH_TEX) ; |
7514 | }*/ | 7492 | } |
7515 | 7493 | ||
7516 | return name; | 7494 | return name; |
7517 | } | 7495 | } |
@@ -7614,7 +7592,6 @@ void LLVOAvatar::updateMeshTextures() | |||
7614 | use_lkg_baked_layer[i] = (!is_layer_baked[i] | 7592 | use_lkg_baked_layer[i] = (!is_layer_baked[i] |
7615 | && (mBakedTextureData[i].mLastTextureIndex != IMG_DEFAULT_AVATAR) | 7593 | && (mBakedTextureData[i].mLastTextureIndex != IMG_DEFAULT_AVATAR) |
7616 | && mBakedTextureData[i].mTexLayerSet | 7594 | && mBakedTextureData[i].mTexLayerSet |
7617 | && mBakedTextureData[i].mTexLayerSet->getComposite() // KL SD | ||
7618 | && !mBakedTextureData[i].mTexLayerSet->getComposite()->isInitialized()); | 7595 | && !mBakedTextureData[i].mTexLayerSet->getComposite()->isInitialized()); |
7619 | if (use_lkg_baked_layer[i]) | 7596 | if (use_lkg_baked_layer[i]) |
7620 | { | 7597 | { |
@@ -7648,7 +7625,7 @@ void LLVOAvatar::updateMeshTextures() | |||
7648 | if (use_lkg_baked_layer[i] && !self_customizing ) | 7625 | if (use_lkg_baked_layer[i] && !self_customizing ) |
7649 | { | 7626 | { |
7650 | LLViewerImage* baked_img = gImageList.getImageFromHost( mBakedTextureData[i].mLastTextureIndex, target_host ); | 7627 | LLViewerImage* baked_img = gImageList.getImageFromHost( mBakedTextureData[i].mLastTextureIndex, target_host ); |
7651 | //mBakedTextureData[i].mIsUsed = TRUE; | 7628 | mBakedTextureData[i].mIsUsed = TRUE; |
7652 | for (U32 k=0; k < mBakedTextureData[i].mMeshes.size(); k++) | 7629 | for (U32 k=0; k < mBakedTextureData[i].mMeshes.size(); k++) |
7653 | { | 7630 | { |
7654 | mBakedTextureData[i].mMeshes[k]->setTexture( baked_img ); | 7631 | mBakedTextureData[i].mMeshes[k]->setTexture( baked_img ); |
@@ -7678,7 +7655,7 @@ void LLVOAvatar::updateMeshTextures() | |||
7678 | { | 7655 | { |
7679 | mBakedTextureData[i].mTexLayerSet->createComposite(); | 7656 | mBakedTextureData[i].mTexLayerSet->createComposite(); |
7680 | mBakedTextureData[i].mTexLayerSet->setUpdatesEnabled( TRUE ); | 7657 | mBakedTextureData[i].mTexLayerSet->setUpdatesEnabled( TRUE ); |
7681 | // mBakedTextureData[i].mIsUsed = FALSE; | 7658 | mBakedTextureData[i].mIsUsed = FALSE; |
7682 | for (U32 k=0; k < mBakedTextureData[i].mMeshes.size(); k++) | 7659 | for (U32 k=0; k < mBakedTextureData[i].mMeshes.size(); k++) |
7683 | { | 7660 | { |
7684 | mBakedTextureData[i].mMeshes[k]->setLayerSet( mBakedTextureData[i].mTexLayerSet ); | 7661 | mBakedTextureData[i].mMeshes[k]->setLayerSet( mBakedTextureData[i].mTexLayerSet ); |
@@ -7699,13 +7676,9 @@ void LLVOAvatar::updateMeshTextures() | |||
7699 | mBakedTextureData[BAKED_HAIR].mMeshes[i]->setTexture( hair_img ); | 7676 | mBakedTextureData[BAKED_HAIR].mMeshes[i]->setTexture( hair_img ); |
7700 | } | 7677 | } |
7701 | mHasBakedHair = FALSE; | 7678 | mHasBakedHair = FALSE; |
7702 | } | ||
7703 | else | ||
7704 | { | ||
7705 | for (U32 i = 0; i < mBakedTextureData[BAKED_HAIR].mMeshes.size(); i++) | ||
7706 | { | ||
7707 | mBakedTextureData[BAKED_HAIR].mMeshes[i]->setColor( 1.f, 1.f, 1.f, 1.f ); | ||
7708 | } | 7679 | } |
7680 | else | ||
7681 | { | ||
7709 | mHasBakedHair = TRUE; | 7682 | mHasBakedHair = TRUE; |
7710 | } | 7683 | } |
7711 | 7684 | ||
@@ -7837,7 +7810,7 @@ void LLVOAvatar::clearChat() | |||
7837 | S32 LLVOAvatar::getLocalDiscardLevel( ETextureIndex index ) | 7810 | S32 LLVOAvatar::getLocalDiscardLevel( ETextureIndex index ) |
7838 | { | 7811 | { |
7839 | // If the texture is not local, we don't care and treat it as fully loaded | 7812 | // If the texture is not local, we don't care and treat it as fully loaded |
7840 | if (!isIndexLocalTexture(index)) return FALSE; // KL SD version | 7813 | if (!isIndexLocalTexture(index)) return 0; |
7841 | 7814 | ||
7842 | LocalTextureData &local_tex_data = mLocalTextureData[index]; | 7815 | LocalTextureData &local_tex_data = mLocalTextureData[index]; |
7843 | if (index >= 0 | 7816 | if (index >= 0 |
@@ -7979,7 +7952,7 @@ bool LLVOAvatar::hasPendingBakedUploads() | |||
7979 | { | 7952 | { |
7980 | for (U32 i = 0; i < mBakedTextureData.size(); i++) | 7953 | for (U32 i = 0; i < mBakedTextureData.size(); i++) |
7981 | { | 7954 | { |
7982 | bool upload_pending = (mBakedTextureData[i].mTexLayerSet && mBakedTextureData[i].mTexLayerSet->getComposite() && mBakedTextureData[i].mTexLayerSet->getComposite()->uploadPending()); | 7955 | bool upload_pending = (mBakedTextureData[i].mTexLayerSet && mBakedTextureData[i].mTexLayerSet->getComposite()->uploadPending()); |
7983 | if (upload_pending) | 7956 | if (upload_pending) |
7984 | { | 7957 | { |
7985 | return true; | 7958 | return true; |
@@ -8514,8 +8487,7 @@ void LLVOAvatar::onFirstTEMessageReceived() | |||
8514 | } | 8487 | } |
8515 | } | 8488 | } |
8516 | 8489 | ||
8517 | mMeshTexturesDirty = TRUE; // updateMeshTextures(); | 8490 | updateMeshTextures(); |
8518 | gPipeline.markGLRebuild(this); | ||
8519 | } | 8491 | } |
8520 | } | 8492 | } |
8521 | 8493 | ||
@@ -8578,22 +8550,20 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) | |||
8578 | // (isTextureDefined(TEX_SKIRT_BAKED) ? "SKIRT " : "skirt " ) << (getTEImage(TEX_SKIRT_BAKED)->getID()) << std::endl << | 8550 | // (isTextureDefined(TEX_SKIRT_BAKED) ? "SKIRT " : "skirt " ) << (getTEImage(TEX_SKIRT_BAKED)->getID()) << std::endl << |
8579 | // (isTextureDefined(TEX_HAIR_BAKED) ? "HAIR" : "hair " ) << (getTEImage(TEX_HAIR_BAKED)->getID()) << std::endl << | 8551 | // (isTextureDefined(TEX_HAIR_BAKED) ? "HAIR" : "hair " ) << (getTEImage(TEX_HAIR_BAKED)->getID()) << std::endl << |
8580 | // (isTextureDefined(TEX_EYES_BAKED) ? "EYES" : "eyes" ) << (getTEImage(TEX_EYES_BAKED)->getID()) << llendl ; | 8552 | // (isTextureDefined(TEX_EYES_BAKED) ? "EYES" : "eyes" ) << (getTEImage(TEX_EYES_BAKED)->getID()) << llendl ; |
8581 | 8553 | ||
8582 | if( !mFirstTEMessageReceived ) | 8554 | if( !mFirstTEMessageReceived ) |
8583 | { | 8555 | { |
8584 | onFirstTEMessageReceived(); | 8556 | onFirstTEMessageReceived(); |
8585 | } | 8557 | } |
8586 | 8558 | ||
8587 | setCompositeUpdatesEnabled( FALSE ); | 8559 | setCompositeUpdatesEnabled( FALSE ); |
8588 | mMeshTexturesDirty = TRUE; | ||
8589 | gPipeline.markGLRebuild(this); // KL SD needing work in S19? | ||
8590 | 8560 | ||
8591 | if (!mIsSelf) | 8561 | if (!mIsSelf) |
8592 | { | 8562 | { |
8593 | releaseUnnecessaryTextures(); | 8563 | releaseUnnecessaryTextures(); |
8594 | } | 8564 | } |
8595 | 8565 | ||
8596 | //updateMeshTextures(); // enables updates for laysets without baked textures. | 8566 | updateMeshTextures(); // enables updates for laysets without baked textures. |
8597 | 8567 | ||
8598 | // parse visual params | 8568 | // parse visual params |
8599 | S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); | 8569 | S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); |
@@ -8879,7 +8849,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) | |||
8879 | if (id == image_baked->getID()) | 8849 | if (id == image_baked->getID()) |
8880 | { | 8850 | { |
8881 | mBakedTextureData[i].mIsLoaded = true; | 8851 | mBakedTextureData[i].mIsLoaded = true; |
8882 | //mBakedTextureData[i].mIsUsed = true; | 8852 | mBakedTextureData[i].mIsUsed = true; |
8883 | mBakedTextureData[i].mLastTextureIndex = id; | 8853 | mBakedTextureData[i].mLastTextureIndex = id; |
8884 | for (U32 k = 0; k < mBakedTextureData[i].mMeshes.size(); k++) | 8854 | for (U32 k = 0; k < mBakedTextureData[i].mMeshes.size(); k++) |
8885 | { | 8855 | { |
@@ -9788,9 +9758,9 @@ BOOL LLVOAvatar::updateLOD() | |||
9788 | 9758 | ||
9789 | LLFace* facep = mDrawable->getFace(0); | 9759 | LLFace* facep = mDrawable->getFace(0); |
9790 | if (facep->mVertexBuffer.isNull() || | 9760 | if (facep->mVertexBuffer.isNull() || |
9791 | (LLVertexBuffer::sEnableVBOs && | 9761 | LLVertexBuffer::sEnableVBOs && |
9792 | ((facep->mVertexBuffer->getUsage() == GL_STATIC_DRAW ? TRUE : FALSE) != | 9762 | ((facep->mVertexBuffer->getUsage() == GL_STATIC_DRAW ? TRUE : FALSE) != |
9793 | (facep->getPool()->getVertexShaderLevel() > 0 ? TRUE : FALSE)))) | 9763 | (facep->getPool()->getVertexShaderLevel() > 0 ? TRUE : FALSE))) |
9794 | { | 9764 | { |
9795 | mDirtyMesh = TRUE; | 9765 | mDirtyMesh = TRUE; |
9796 | } | 9766 | } |
diff --git a/linden/indra/newview/llvoavatar.h b/linden/indra/newview/llvoavatar.h index ff07d81..0c32244 100644 --- a/linden/indra/newview/llvoavatar.h +++ b/linden/indra/newview/llvoavatar.h | |||
@@ -88,8 +88,6 @@ public: | |||
88 | /*virtual*/ void markDead(); | 88 | /*virtual*/ void markDead(); |
89 | void startDefaultMotions(); | 89 | void startDefaultMotions(); |
90 | 90 | ||
91 | /*virtual*/ LLVOAvatar* asAvatar(); // KL SD | ||
92 | |||
93 | static void updateImpostors(); | 91 | static void updateImpostors(); |
94 | 92 | ||
95 | //-------------------------------------------------------------------- | 93 | //-------------------------------------------------------------------- |
@@ -139,7 +137,7 @@ public: | |||
139 | LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point | 137 | LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point |
140 | ); | 138 | ); |
141 | 139 | ||
142 | /*virtual*/ void updateTextures(LLAgent &agent); // KL SD | 140 | /*virtual*/ void updateTextures(); |
143 | // If setting a baked texture, need to request it from a non-local sim. | 141 | // If setting a baked texture, need to request it from a non-local sim. |
144 | /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); | 142 | /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); |
145 | /*virtual*/ void onShift(const LLVector3& shift_vector); | 143 | /*virtual*/ void onShift(const LLVector3& shift_vector); |
@@ -157,8 +155,6 @@ public: | |||
157 | 155 | ||
158 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); | 156 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); |
159 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); | 157 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); |
160 | /*virtual*/ void updateGL(); | ||
161 | |||
162 | 158 | ||
163 | /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); | 159 | /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); |
164 | BOOL updateJointLODs(); | 160 | BOOL updateJointLODs(); |
@@ -478,7 +474,6 @@ private: | |||
478 | LLFrameTimer mTypingTimer; | 474 | LLFrameTimer mTypingTimer; |
479 | 475 | ||
480 | //-------------------------------------------------------------------- | 476 | //-------------------------------------------------------------------- |
481 | BOOL mMeshTexturesDirty; | ||
482 | // wind rippling in clothes | 477 | // wind rippling in clothes |
483 | //-------------------------------------------------------------------- | 478 | //-------------------------------------------------------------------- |
484 | public: | 479 | public: |
@@ -575,7 +570,6 @@ public: | |||
575 | static BOOL sShowAnimationDebug; // show animation debug info | 570 | static BOOL sShowAnimationDebug; // show animation debug info |
576 | static BOOL sUseImpostors; //use impostors for far away avatars | 571 | static BOOL sUseImpostors; //use impostors for far away avatars |
577 | static BOOL sShowFootPlane; // show foot collision plane reported by server | 572 | static BOOL sShowFootPlane; // show foot collision plane reported by server |
578 | static BOOL sShowCollisionVolumes; // show skeletal collision volumes // KL SD | ||
579 | static BOOL sVisibleInFirstPerson; | 573 | static BOOL sVisibleInFirstPerson; |
580 | static S32 sNumLODChangesThisFrame; | 574 | static S32 sNumLODChangesThisFrame; |
581 | static S32 sNumVisibleChatBubbles; | 575 | static S32 sNumVisibleChatBubbles; |
@@ -777,7 +771,7 @@ private: | |||
777 | LLUUID mLastTextureIndex; | 771 | LLUUID mLastTextureIndex; |
778 | LLTexLayerSet* mTexLayerSet; | 772 | LLTexLayerSet* mTexLayerSet; |
779 | bool mIsLoaded; | 773 | bool mIsLoaded; |
780 | //bool mIsUsed; // KL SG | 774 | bool mIsUsed; |
781 | LLVOAvatarDefines::ETextureIndex mTextureIndex; | 775 | LLVOAvatarDefines::ETextureIndex mTextureIndex; |
782 | U32 mMaskTexName; | 776 | U32 mMaskTexName; |
783 | // Stores pointers to the joint meshes that this baked texture deals with | 777 | // Stores pointers to the joint meshes that this baked texture deals with |
diff --git a/linden/indra/newview/llvoclouds.cpp b/linden/indra/newview/llvoclouds.cpp index 019b6b4..a489f91 100644 --- a/linden/indra/newview/llvoclouds.cpp +++ b/linden/indra/newview/llvoclouds.cpp | |||
@@ -101,7 +101,7 @@ void LLVOClouds::setPixelAreaAndAngle(LLAgent &agent) | |||
101 | mPixelArea = 1500*100; | 101 | mPixelArea = 1500*100; |
102 | } | 102 | } |
103 | 103 | ||
104 | void LLVOClouds::updateTextures(LLAgent &agent) | 104 | void LLVOClouds::updateTextures() |
105 | { | 105 | { |
106 | getTEImage(0)->addTextureStats(mPixelArea); | 106 | getTEImage(0)->addTextureStats(mPixelArea); |
107 | } | 107 | } |
@@ -123,10 +123,7 @@ BOOL LLVOClouds::updateGeometry(LLDrawable *drawable) | |||
123 | return TRUE; | 123 | return TRUE; |
124 | } | 124 | } |
125 | 125 | ||
126 | if (drawable->isVisible()) | 126 | dirtySpatialGroup(); |
127 | { | ||
128 | dirtySpatialGroup(TRUE); | ||
129 | } | ||
130 | 127 | ||
131 | LLFace *facep; | 128 | LLFace *facep; |
132 | 129 | ||
diff --git a/linden/indra/newview/llvoclouds.h b/linden/indra/newview/llvoclouds.h index f70ea5b..52e5a68 100644 --- a/linden/indra/newview/llvoclouds.h +++ b/linden/indra/newview/llvoclouds.h | |||
@@ -65,7 +65,7 @@ public: | |||
65 | /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. | 65 | /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. |
66 | F32 getPartSize(S32 idx); | 66 | F32 getPartSize(S32 idx); |
67 | 67 | ||
68 | /*virtual*/ void updateTextures(LLAgent &agent); | 68 | /*virtual*/ void updateTextures(); |
69 | /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area | 69 | /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area |
70 | 70 | ||
71 | void updateFaceSize(S32 idx) { } | 71 | void updateFaceSize(S32 idx) { } |
diff --git a/linden/indra/newview/llvograss.cpp b/linden/indra/newview/llvograss.cpp index 8f4c0de..f738872 100644 --- a/linden/indra/newview/llvograss.cpp +++ b/linden/indra/newview/llvograss.cpp | |||
@@ -337,7 +337,7 @@ void LLVOGrass::setPixelAreaAndAngle(LLAgent &agent) | |||
337 | 337 | ||
338 | 338 | ||
339 | // BUG could speed this up by caching the relative_position and range calculations | 339 | // BUG could speed this up by caching the relative_position and range calculations |
340 | void LLVOGrass::updateTextures(LLAgent &agent) | 340 | void LLVOGrass::updateTextures() |
341 | { | 341 | { |
342 | if (getTEImage(0)) | 342 | if (getTEImage(0)) |
343 | { | 343 | { |
diff --git a/linden/indra/newview/llvograss.h b/linden/indra/newview/llvograss.h index 86e4b95..25fa04c 100644 --- a/linden/indra/newview/llvograss.h +++ b/linden/indra/newview/llvograss.h | |||
@@ -72,7 +72,7 @@ public: | |||
72 | LLStrider<U16>& indicesp); | 72 | LLStrider<U16>& indicesp); |
73 | 73 | ||
74 | void updateFaceSize(S32 idx) { } | 74 | void updateFaceSize(S32 idx) { } |
75 | /*virtual*/ void updateTextures(LLAgent &agent); | 75 | /*virtual*/ void updateTextures(); |
76 | /*virtual*/ BOOL updateLOD(); | 76 | /*virtual*/ BOOL updateLOD(); |
77 | /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area | 77 | /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area |
78 | 78 | ||
diff --git a/linden/indra/newview/llvoground.cpp b/linden/indra/newview/llvoground.cpp index fe19e18..0ef0196 100644 --- a/linden/indra/newview/llvoground.cpp +++ b/linden/indra/newview/llvoground.cpp | |||
@@ -71,7 +71,7 @@ BOOL LLVOGround::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
71 | } | 71 | } |
72 | 72 | ||
73 | 73 | ||
74 | void LLVOGround::updateTextures(LLAgent &agent) | 74 | void LLVOGround::updateTextures() |
75 | { | 75 | { |
76 | } | 76 | } |
77 | 77 | ||
diff --git a/linden/indra/newview/llvoground.h b/linden/indra/newview/llvoground.h index f485bd0..b58ebae 100644 --- a/linden/indra/newview/llvoground.h +++ b/linden/indra/newview/llvoground.h | |||
@@ -51,7 +51,7 @@ public: | |||
51 | 51 | ||
52 | // Graphical stuff for objects - maybe broken out into render class | 52 | // Graphical stuff for objects - maybe broken out into render class |
53 | // later? | 53 | // later? |
54 | /*virtual*/ void updateTextures(LLAgent &agent); | 54 | /*virtual*/ void updateTextures(); |
55 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); | 55 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); |
56 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); | 56 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); |
57 | 57 | ||
diff --git a/linden/indra/newview/llvopartgroup.cpp b/linden/indra/newview/llvopartgroup.cpp index b040366..a0f8068 100644 --- a/linden/indra/newview/llvopartgroup.cpp +++ b/linden/indra/newview/llvopartgroup.cpp | |||
@@ -108,7 +108,7 @@ void LLVOPartGroup::setPixelAreaAndAngle(LLAgent &agent) | |||
108 | } | 108 | } |
109 | } | 109 | } |
110 | 110 | ||
111 | void LLVOPartGroup::updateTextures(LLAgent &agent) | 111 | void LLVOPartGroup::updateTextures() |
112 | { | 112 | { |
113 | // Texture stats for particles need to be updated in a different way... | 113 | // Texture stats for particles need to be updated in a different way... |
114 | } | 114 | } |
@@ -154,11 +154,6 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) | |||
154 | group = drawable->getSpatialGroup(); | 154 | group = drawable->getSpatialGroup(); |
155 | } | 155 | } |
156 | 156 | ||
157 | if (group && group->isVisible()) | ||
158 | { | ||
159 | dirtySpatialGroup(TRUE); | ||
160 | } | ||
161 | |||
162 | if (!num_parts) | 157 | if (!num_parts) |
163 | { | 158 | { |
164 | if (group && drawable->getNumFaces()) | 159 | if (group && drawable->getNumFaces()) |
@@ -191,12 +186,13 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) | |||
191 | S32 count=0; | 186 | S32 count=0; |
192 | mDepth = 0.f; | 187 | mDepth = 0.f; |
193 | S32 i = 0 ; | 188 | S32 i = 0 ; |
189 | LLVector3 camera_agent = getCameraPosition(); | ||
194 | for (i = 0 ; i < (S32)mViewerPartGroupp->mParticles.size(); i++) | 190 | for (i = 0 ; i < (S32)mViewerPartGroupp->mParticles.size(); i++) |
195 | { | 191 | { |
196 | const LLViewerPart *part = mViewerPartGroupp->mParticles[i]; | 192 | const LLViewerPart *part = mViewerPartGroupp->mParticles[i]; |
197 | 193 | ||
198 | LLVector3 part_pos_agent(part->mPosAgent); | 194 | LLVector3 part_pos_agent(part->mPosAgent); |
199 | LLVector3 at(part_pos_agent - LLViewerCamera::getInstance()->getOrigin()); | 195 | LLVector3 at(part_pos_agent - camera_agent); |
200 | 196 | ||
201 | F32 camera_dist_squared = at.lengthSquared(); | 197 | F32 camera_dist_squared = at.lengthSquared(); |
202 | F32 inv_camera_dist_squared; | 198 | F32 inv_camera_dist_squared; |
@@ -319,7 +315,7 @@ void LLVOPartGroup::getGeometry(S32 idx, | |||
319 | up *= 0.5f*part.mScale.mV[1]; | 315 | up *= 0.5f*part.mScale.mV[1]; |
320 | 316 | ||
321 | 317 | ||
322 | const LLVector3& normal = -LLViewerCamera::getInstance()->getXAxis(); | 318 | LLVector3 normal = -LLViewerCamera::getInstance()->getXAxis(); |
323 | 319 | ||
324 | *verticesp++ = part_pos_agent + up - right; | 320 | *verticesp++ = part_pos_agent + up - right; |
325 | *verticesp++ = part_pos_agent - up - right; | 321 | *verticesp++ = part_pos_agent - up - right; |
@@ -356,12 +352,12 @@ U32 LLVOPartGroup::getPartitionType() const | |||
356 | } | 352 | } |
357 | 353 | ||
358 | LLParticlePartition::LLParticlePartition() | 354 | LLParticlePartition::LLParticlePartition() |
359 | : LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK, TRUE, GL_DYNAMIC_DRAW_ARB) | 355 | : LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK) |
360 | { | 356 | { |
361 | mRenderPass = LLRenderPass::PASS_ALPHA; | 357 | mRenderPass = LLRenderPass::PASS_ALPHA; |
362 | mDrawableType = LLPipeline::RENDER_TYPE_PARTICLES; | 358 | mDrawableType = LLPipeline::RENDER_TYPE_PARTICLES; |
363 | mPartitionType = LLViewerRegion::PARTITION_PARTICLE; | 359 | mPartitionType = LLViewerRegion::PARTITION_PARTICLE; |
364 | // mBufferUsage = GL_DYNAMIC_DRAW_ARB; // KL SD hybrid code | 360 | mBufferUsage = GL_DYNAMIC_DRAW_ARB; |
365 | mSlopRatio = 0.f; | 361 | mSlopRatio = 0.f; |
366 | mLODPeriod = 1; | 362 | mLODPeriod = 1; |
367 | } | 363 | } |
@@ -485,9 +481,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) | |||
485 | U32 end = start + facep->getGeomCount()-1; | 481 | U32 end = start + facep->getGeomCount()-1; |
486 | U32 offset = facep->getIndicesStart(); | 482 | U32 offset = facep->getIndicesStart(); |
487 | U32 count = facep->getIndicesCount(); | 483 | U32 count = facep->getIndicesCount(); |
488 | LLDrawInfo* info = new LLDrawInfo(start,end,count,offset,facep->getTexture(), | 484 | LLDrawInfo* info = new LLDrawInfo(start,end,count,offset,facep->getTexture(), buffer, fullbright); |
489 | facep->getTexture(), | ||
490 | buffer, fullbright); | ||
491 | info->mExtents[0] = group->mObjectExtents[0]; | 485 | info->mExtents[0] = group->mObjectExtents[0]; |
492 | info->mExtents[1] = group->mObjectExtents[1]; | 486 | info->mExtents[1] = group->mObjectExtents[1]; |
493 | info->mVSize = vsize; | 487 | info->mVSize = vsize; |
diff --git a/linden/indra/newview/llvopartgroup.h b/linden/indra/newview/llvopartgroup.h index 3dc3292..18583b4 100644 --- a/linden/indra/newview/llvopartgroup.h +++ b/linden/indra/newview/llvopartgroup.h | |||
@@ -61,7 +61,7 @@ public: | |||
61 | virtual U32 getPartitionType() const; | 61 | virtual U32 getPartitionType() const; |
62 | 62 | ||
63 | /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); | 63 | /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); |
64 | /*virtual*/ void updateTextures(LLAgent &agent); | 64 | /*virtual*/ void updateTextures(); |
65 | 65 | ||
66 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); | 66 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); |
67 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); | 67 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); |
diff --git a/linden/indra/newview/llvosky.cpp b/linden/indra/newview/llvosky.cpp index 817a510..8639b60 100644 --- a/linden/indra/newview/llvosky.cpp +++ b/linden/indra/newview/llvosky.cpp | |||
@@ -293,7 +293,7 @@ void LLSkyTex::create(const F32 brightness) | |||
293 | 293 | ||
294 | void LLSkyTex::createGLImage(S32 which) | 294 | void LLSkyTex::createGLImage(S32 which) |
295 | { | 295 | { |
296 | mImageGL[which]->createGLTexture(0, mImageRaw[which]); | 296 | mImageGL[which]->createGLTexture(0, mImageRaw[which], 0, TRUE, LLViewerImageBoostLevel::OTHER); |
297 | mImageGL[which]->setAddressMode(LLTexUnit::TAM_CLAMP); | 297 | mImageGL[which]->setAddressMode(LLTexUnit::TAM_CLAMP); |
298 | } | 298 | } |
299 | 299 | ||
@@ -1102,10 +1102,10 @@ BOOL LLVOSky::updateSky() | |||
1102 | mLastTotalAmbient.mV[2] - mTotalAmbient.mV[2]); | 1102 | mLastTotalAmbient.mV[2] - mTotalAmbient.mV[2]); |
1103 | 1103 | ||
1104 | if ( mForceUpdate | 1104 | if ( mForceUpdate |
1105 | || (((dot_lighting < LIGHT_DIRECTION_THRESHOLD) | 1105 | || ((dot_lighting < LIGHT_DIRECTION_THRESHOLD) |
1106 | || (delta_color.length() > COLOR_CHANGE_THRESHOLD) | 1106 | || (delta_color.length() > COLOR_CHANGE_THRESHOLD) |
1107 | || !mInitialized) | 1107 | || !mInitialized) |
1108 | && !direction.isExactlyZero())) | 1108 | && !direction.isExactlyZero()) |
1109 | { | 1109 | { |
1110 | mLastLightingDirection = direction; | 1110 | mLastLightingDirection = direction; |
1111 | mLastTotalAmbient = mTotalAmbient; | 1111 | mLastTotalAmbient = mTotalAmbient; |
@@ -1187,7 +1187,7 @@ BOOL LLVOSky::updateSky() | |||
1187 | return TRUE; | 1187 | return TRUE; |
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | void LLVOSky::updateTextures(LLAgent &agent) | 1190 | void LLVOSky::updateTextures() |
1191 | { | 1191 | { |
1192 | if (mSunTexturep) | 1192 | if (mSunTexturep) |
1193 | { | 1193 | { |
diff --git a/linden/indra/newview/llvosky.h b/linden/indra/newview/llvosky.h index 492557f..1370824 100644 --- a/linden/indra/newview/llvosky.h +++ b/linden/indra/newview/llvosky.h | |||
@@ -493,7 +493,7 @@ public: | |||
493 | 493 | ||
494 | // Graphical stuff for objects - maybe broken out into render class | 494 | // Graphical stuff for objects - maybe broken out into render class |
495 | // later? | 495 | // later? |
496 | /*virtual*/ void updateTextures(LLAgent &agent); | 496 | /*virtual*/ void updateTextures(); |
497 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); | 497 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); |
498 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); | 498 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); |
499 | 499 | ||
diff --git a/linden/indra/newview/llvosurfacepatch.cpp b/linden/indra/newview/llvosurfacepatch.cpp index 7aa5739..1671880 100644 --- a/linden/indra/newview/llvosurfacepatch.cpp +++ b/linden/indra/newview/llvosurfacepatch.cpp | |||
@@ -134,7 +134,7 @@ void LLVOSurfacePatch::setPixelAreaAndAngle(LLAgent &agent) | |||
134 | } | 134 | } |
135 | 135 | ||
136 | 136 | ||
137 | void LLVOSurfacePatch::updateTextures(LLAgent &agent) | 137 | void LLVOSurfacePatch::updateTextures() |
138 | { | 138 | { |
139 | } | 139 | } |
140 | 140 | ||
@@ -177,19 +177,11 @@ LLDrawable *LLVOSurfacePatch::createDrawable(LLPipeline *pipeline) | |||
177 | } | 177 | } |
178 | 178 | ||
179 | 179 | ||
180 | void LLVOSurfacePatch::updateGL() | ||
181 | { | ||
182 | if (mPatchp) | ||
183 | { | ||
184 | mPatchp->updateGL(); | ||
185 | } | ||
186 | } | ||
187 | |||
188 | BOOL LLVOSurfacePatch::updateGeometry(LLDrawable *drawable) | 180 | BOOL LLVOSurfacePatch::updateGeometry(LLDrawable *drawable) |
189 | { | 181 | { |
190 | LLFastTimer ftm(LLFastTimer::FTM_UPDATE_TERRAIN); | 182 | LLFastTimer ftm(LLFastTimer::FTM_UPDATE_TERRAIN); |
191 | 183 | ||
192 | dirtySpatialGroup(TRUE); | 184 | dirtySpatialGroup(); |
193 | 185 | ||
194 | S32 min_comp, max_comp, range; | 186 | S32 min_comp, max_comp, range; |
195 | min_comp = lltrunc(mPatchp->getMinComposition()); | 187 | min_comp = lltrunc(mPatchp->getMinComposition()); |
@@ -1021,12 +1013,12 @@ U32 LLVOSurfacePatch::getPartitionType() const | |||
1021 | } | 1013 | } |
1022 | 1014 | ||
1023 | LLTerrainPartition::LLTerrainPartition() | 1015 | LLTerrainPartition::LLTerrainPartition() |
1024 | : LLSpatialPartition(LLDrawPoolTerrain::VERTEX_DATA_MASK, FALSE, GL_DYNAMIC_DRAW_ARB) | 1016 | : LLSpatialPartition(LLDrawPoolTerrain::VERTEX_DATA_MASK) |
1025 | { | 1017 | { |
1026 | mOcclusionEnabled = FALSE; | 1018 | mOcclusionEnabled = FALSE; |
1027 | //mRenderByGroup = FALSE; // KL not for SD hybrid code | 1019 | mRenderByGroup = FALSE; |
1028 | mInfiniteFarClip = TRUE; | 1020 | mInfiniteFarClip = TRUE; |
1029 | //mBufferUsage = GL_DYNAMIC_DRAW_ARB; // and here too! | 1021 | mBufferUsage = GL_DYNAMIC_DRAW_ARB; |
1030 | mDrawableType = LLPipeline::RENDER_TYPE_TERRAIN; | 1022 | mDrawableType = LLPipeline::RENDER_TYPE_TERRAIN; |
1031 | mPartitionType = LLViewerRegion::PARTITION_TERRAIN; | 1023 | mPartitionType = LLViewerRegion::PARTITION_TERRAIN; |
1032 | } | 1024 | } |
diff --git a/linden/indra/newview/llvosurfacepatch.h b/linden/indra/newview/llvosurfacepatch.h index aaf4d41..d3b1447 100644 --- a/linden/indra/newview/llvosurfacepatch.h +++ b/linden/indra/newview/llvosurfacepatch.h | |||
@@ -64,7 +64,6 @@ public: | |||
64 | virtual U32 getPartitionType() const; | 64 | virtual U32 getPartitionType() const; |
65 | 65 | ||
66 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); | 66 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); |
67 | /*virtual*/ void updateGL(); | ||
68 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); | 67 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); |
69 | /*virtual*/ BOOL updateLOD(); | 68 | /*virtual*/ BOOL updateLOD(); |
70 | /*virtual*/ void updateFaceSize(S32 idx); | 69 | /*virtual*/ void updateFaceSize(S32 idx); |
@@ -75,7 +74,7 @@ public: | |||
75 | LLStrider<LLVector2> &texCoords1p, | 74 | LLStrider<LLVector2> &texCoords1p, |
76 | LLStrider<U16> &indicesp); | 75 | LLStrider<U16> &indicesp); |
77 | 76 | ||
78 | /*virtual*/ void updateTextures(LLAgent &agent); | 77 | /*virtual*/ void updateTextures(); |
79 | /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area | 78 | /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area |
80 | 79 | ||
81 | /*virtual*/ void updateSpatialExtents(LLVector3& newMin, LLVector3& newMax); | 80 | /*virtual*/ void updateSpatialExtents(LLVector3& newMin, LLVector3& newMax); |
diff --git a/linden/indra/newview/llvotextbubble.cpp b/linden/indra/newview/llvotextbubble.cpp index de69aac..5943f9b 100644 --- a/linden/indra/newview/llvotextbubble.cpp +++ b/linden/indra/newview/llvotextbubble.cpp | |||
@@ -116,7 +116,7 @@ BOOL LLVOTextBubble::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
116 | } | 116 | } |
117 | 117 | ||
118 | 118 | ||
119 | void LLVOTextBubble::updateTextures(LLAgent &agent) | 119 | void LLVOTextBubble::updateTextures() |
120 | { | 120 | { |
121 | // Update the image levels of all textures... | 121 | // Update the image levels of all textures... |
122 | 122 | ||
diff --git a/linden/indra/newview/llvotextbubble.h b/linden/indra/newview/llvotextbubble.h index 45d4df2..7f84dbf 100644 --- a/linden/indra/newview/llvotextbubble.h +++ b/linden/indra/newview/llvotextbubble.h | |||
@@ -44,7 +44,7 @@ public: | |||
44 | /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. | 44 | /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. |
45 | /*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); | 45 | /*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); |
46 | 46 | ||
47 | /*virtual*/ void updateTextures(LLAgent &agent); | 47 | /*virtual*/ void updateTextures(); |
48 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); | 48 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); |
49 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); | 49 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); |
50 | /*virtual*/ BOOL updateLOD(); | 50 | /*virtual*/ BOOL updateLOD(); |
diff --git a/linden/indra/newview/llvotree.cpp b/linden/indra/newview/llvotree.cpp index 9ec002d..6a59253 100644 --- a/linden/indra/newview/llvotree.cpp +++ b/linden/indra/newview/llvotree.cpp | |||
@@ -482,7 +482,7 @@ void LLVOTree::setPixelAreaAndAngle(LLAgent &agent) | |||
482 | #endif | 482 | #endif |
483 | } | 483 | } |
484 | 484 | ||
485 | void LLVOTree::updateTextures(LLAgent &agent) | 485 | void LLVOTree::updateTextures() |
486 | { | 486 | { |
487 | if (mTreeImagep) | 487 | if (mTreeImagep) |
488 | { | 488 | { |
@@ -1318,9 +1318,9 @@ U32 LLVOTree::getPartitionType() const | |||
1318 | } | 1318 | } |
1319 | 1319 | ||
1320 | LLTreePartition::LLTreePartition() | 1320 | LLTreePartition::LLTreePartition() |
1321 | : LLSpatialPartition(0, FALSE, 0) | 1321 | : LLSpatialPartition(0) |
1322 | { | 1322 | { |
1323 | // mRenderByGroup = FALSE; // SD hybrid | 1323 | mRenderByGroup = FALSE; |
1324 | mDrawableType = LLPipeline::RENDER_TYPE_TREE; | 1324 | mDrawableType = LLPipeline::RENDER_TYPE_TREE; |
1325 | mPartitionType = LLViewerRegion::PARTITION_TREE; | 1325 | mPartitionType = LLViewerRegion::PARTITION_TREE; |
1326 | mSlopRatio = 0.f; | 1326 | mSlopRatio = 0.f; |
diff --git a/linden/indra/newview/llvotree.h b/linden/indra/newview/llvotree.h index 7804ab3..855c612 100644 --- a/linden/indra/newview/llvotree.h +++ b/linden/indra/newview/llvotree.h | |||
@@ -69,7 +69,7 @@ public: | |||
69 | // Graphical stuff for objects - maybe broken out into render class later? | 69 | // Graphical stuff for objects - maybe broken out into render class later? |
70 | /*virtual*/ void render(LLAgent &agent); | 70 | /*virtual*/ void render(LLAgent &agent); |
71 | /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); | 71 | /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); |
72 | /*virtual*/ void updateTextures(LLAgent &agent); | 72 | /*virtual*/ void updateTextures(); |
73 | 73 | ||
74 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); | 74 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); |
75 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); | 75 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); |
diff --git a/linden/indra/newview/llvotreenew.h b/linden/indra/newview/llvotreenew.h index 02f6d3a..4960d90 100644 --- a/linden/indra/newview/llvotreenew.h +++ b/linden/indra/newview/llvotreenew.h | |||
@@ -156,7 +156,7 @@ public: | |||
156 | /*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); | 156 | /*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); |
157 | 157 | ||
158 | /*virtual*/ void render(LLAgent &agent); | 158 | /*virtual*/ void render(LLAgent &agent); |
159 | /*virtual*/ void updateTextures(LLAgent &agent); | 159 | /*virtual*/ void updateTextures(); |
160 | 160 | ||
161 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); | 161 | /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); |
162 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); | 162 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); |
diff --git a/linden/indra/newview/llvovolume.cpp b/linden/indra/newview/llvovolume.cpp index 77c9c33..13a0704 100644 --- a/linden/indra/newview/llvovolume.cpp +++ b/linden/indra/newview/llvovolume.cpp | |||
@@ -54,7 +54,6 @@ | |||
54 | #include "llspatialpartition.h" | 54 | #include "llspatialpartition.h" |
55 | #include "llhudmanager.h" | 55 | #include "llhudmanager.h" |
56 | #include "llflexibleobject.h" | 56 | #include "llflexibleobject.h" |
57 | |||
58 | #include "llsky.h" | 57 | #include "llsky.h" |
59 | #include "lltexturefetch.h" | 58 | #include "lltexturefetch.h" |
60 | #include "llviewercamera.h" | 59 | #include "llviewercamera.h" |
@@ -68,9 +67,6 @@ | |||
68 | const S32 MIN_QUIET_FRAMES_COALESCE = 30; | 67 | const S32 MIN_QUIET_FRAMES_COALESCE = 30; |
69 | const F32 FORCE_SIMPLE_RENDER_AREA = 512.f; | 68 | const F32 FORCE_SIMPLE_RENDER_AREA = 512.f; |
70 | const F32 FORCE_CULL_AREA = 8.f; | 69 | const F32 FORCE_CULL_AREA = 8.f; |
71 | const F32 MAX_LOD_DISTANCE = 24.f; | ||
72 | const S32 MAX_SCULPT_REZ = 128; | ||
73 | |||
74 | 70 | ||
75 | BOOL gAnimateTextures = TRUE; | 71 | BOOL gAnimateTextures = TRUE; |
76 | extern BOOL gHideSelectedObjects; | 72 | extern BOOL gHideSelectedObjects; |
@@ -95,7 +91,6 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re | |||
95 | mNumFaces = 0; | 91 | mNumFaces = 0; |
96 | mLODChanged = FALSE; | 92 | mLODChanged = FALSE; |
97 | mSculptChanged = FALSE; | 93 | mSculptChanged = FALSE; |
98 | mSpotLightPriority = 0.f; | ||
99 | } | 94 | } |
100 | 95 | ||
101 | LLVOVolume::~LLVOVolume() | 96 | LLVOVolume::~LLVOVolume() |
@@ -219,7 +214,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, | |||
219 | std::string mask; | 214 | std::string mask; |
220 | mask = gDirUtilp->getDirDelimiter() + "*.slc"; | 215 | mask = gDirUtilp->getDirDelimiter() + "*.slc"; |
221 | gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), mask); | 216 | gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), mask); |
222 | // llwarns << "Bogus TE data in " << getID() << ", crashing!" << llendl; | 217 | // llerrs << "Bogus TE data in " << getID() << ", crashing!" << llendl; |
223 | llwarns << "Bogus TE data in " << getID() << llendl; | 218 | llwarns << "Bogus TE data in " << getID() << llendl; |
224 | } | 219 | } |
225 | else if (res2 & (TEM_CHANGE_TEXTURE|TEM_CHANGE_COLOR)) | 220 | else if (res2 & (TEM_CHANGE_TEXTURE|TEM_CHANGE_COLOR)) |
@@ -319,6 +314,11 @@ void LLVOVolume::animateTextures() | |||
319 | te->getScale(&scale_s, &scale_t); | 314 | te->getScale(&scale_s, &scale_t); |
320 | } | 315 | } |
321 | 316 | ||
317 | LLVector3 scale(scale_s, scale_t, 1.f); | ||
318 | LLVector3 trans(off_s+0.5f, off_t+0.5f, 0.f); | ||
319 | LLQuaternion quat; | ||
320 | quat.setQuat(rot, 0, 0, -1.f); | ||
321 | |||
322 | if (!facep->mTextureMatrix) | 322 | if (!facep->mTextureMatrix) |
323 | { | 323 | { |
324 | facep->mTextureMatrix = new LLMatrix4(); | 324 | facep->mTextureMatrix = new LLMatrix4(); |
@@ -326,43 +326,7 @@ void LLVOVolume::animateTextures() | |||
326 | 326 | ||
327 | LLMatrix4& tex_mat = *facep->mTextureMatrix; | 327 | LLMatrix4& tex_mat = *facep->mTextureMatrix; |
328 | tex_mat.setIdentity(); | 328 | tex_mat.setIdentity(); |
329 | LLVector3 trans ; | 329 | tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f)); |
330 | |||
331 | if(facep->isAtlasInUse()) | ||
332 | { | ||
333 | // | ||
334 | //if use atlas for animated texture | ||
335 | //apply the following transform to the animation matrix. | ||
336 | // | ||
337 | |||
338 | F32 tcoord_xoffset = 0.f ; | ||
339 | F32 tcoord_yoffset = 0.f ; | ||
340 | F32 tcoord_xscale = 1.f ; | ||
341 | F32 tcoord_yscale = 1.f ; | ||
342 | if(facep->isAtlasInUse()) | ||
343 | { | ||
344 | const LLVector2* tmp = facep->getTexCoordOffset() ; | ||
345 | tcoord_xoffset = tmp->mV[0] ; | ||
346 | tcoord_yoffset = tmp->mV[1] ; | ||
347 | |||
348 | tmp = facep->getTexCoordScale() ; | ||
349 | tcoord_xscale = tmp->mV[0] ; | ||
350 | tcoord_yscale = tmp->mV[1] ; | ||
351 | } | ||
352 | trans.set(LLVector3(tcoord_xoffset + tcoord_xscale * (off_s+0.5f), tcoord_yoffset + tcoord_yscale * (off_t+0.5f), 0.f)); | ||
353 | |||
354 | tex_mat.translate(LLVector3(-(tcoord_xoffset + tcoord_xscale * 0.5f), -(tcoord_yoffset + tcoord_yscale * 0.5f), 0.f)); | ||
355 | } | ||
356 | else //non atlas | ||
357 | { | ||
358 | trans.set(LLVector3(off_s+0.5f, off_t+0.5f, 0.f)); | ||
359 | tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f)); | ||
360 | } | ||
361 | |||
362 | LLVector3 scale(scale_s, scale_t, 1.f); | ||
363 | LLQuaternion quat; | ||
364 | quat.setQuat(rot, 0, 0, -1.f); | ||
365 | |||
366 | tex_mat.rotate(quat); | 330 | tex_mat.rotate(quat); |
367 | 331 | ||
368 | LLMatrix4 mat; | 332 | LLMatrix4 mat; |
@@ -439,28 +403,30 @@ BOOL LLVOVolume::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
439 | return TRUE; | 403 | return TRUE; |
440 | } | 404 | } |
441 | 405 | ||
442 | void LLVOVolume::updateTextures(LLAgent &agent) // KL sd | 406 | void LLVOVolume::updateTextures() |
443 | { | 407 | { |
444 | const F32 TEXTURE_AREA_REFRESH_TIME = 5.f; // seconds | 408 | const F32 TEXTURE_AREA_REFRESH_TIME = 5.f; // seconds |
445 | if (mDrawable.notNull() && mTextureUpdateTimer.getElapsedTimeF32() > TEXTURE_AREA_REFRESH_TIME) | 409 | if (mTextureUpdateTimer.getElapsedTimeF32() > TEXTURE_AREA_REFRESH_TIME) |
446 | { | 410 | { |
447 | if (mDrawable->isVisible()) | 411 | updateTextureVirtualSize(); |
448 | { | ||
449 | updateTextures(); | ||
450 | } | ||
451 | } | 412 | } |
452 | } | 413 | } |
453 | 414 | ||
454 | void LLVOVolume::updateTextures() | 415 | void LLVOVolume::updateTextureVirtualSize() |
455 | { | 416 | { |
456 | // Update the pixel area of all faces | 417 | // Update the pixel area of all faces |
457 | 418 | ||
419 | if(mDrawable.isNull() || !mDrawable->isVisible()) | ||
420 | { | ||
421 | return ; | ||
422 | } | ||
423 | |||
458 | if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SIMPLE)) | 424 | if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SIMPLE)) |
459 | { | 425 | { |
460 | return; | 426 | return; |
461 | } | 427 | } |
462 | 428 | ||
463 | if (LLViewerImage::sDontLoadVolumeTextures || mDrawable.isNull()) // || !mDrawable->isVisible()) | 429 | if (LLViewerImage::sDontLoadVolumeTextures || LLAppViewer::getTextureFetch()->mDebugPause) |
464 | { | 430 | { |
465 | return; | 431 | return; |
466 | } | 432 | } |
@@ -477,14 +443,15 @@ void LLVOVolume::updateTextures() | |||
477 | LLFace* face = mDrawable->getFace(i); | 443 | LLFace* face = mDrawable->getFace(i); |
478 | const LLTextureEntry *te = face->getTextureEntry(); | 444 | const LLTextureEntry *te = face->getTextureEntry(); |
479 | LLViewerImage *imagep = face->getTexture(); | 445 | LLViewerImage *imagep = face->getTexture(); |
480 | if (!imagep || !te || | 446 | if (!imagep || !te || |
481 | face->mExtents[0] == face->mExtents[1]) | 447 | face->mExtents[0] == face->mExtents[1]) |
482 | { | 448 | { |
483 | continue; | 449 | continue; |
484 | } | 450 | } |
485 | 451 | ||
486 | F32 vsize; | 452 | F32 vsize; |
487 | 453 | F32 old_size = face->getVirtualSize(); | |
454 | |||
488 | if (isHUDAttachment()) | 455 | if (isHUDAttachment()) |
489 | { | 456 | { |
490 | F32 area = (F32) LLViewerCamera::getInstance()->getScreenPixelArea(); | 457 | F32 area = (F32) LLViewerCamera::getInstance()->getScreenPixelArea(); |
@@ -494,24 +461,21 @@ void LLVOVolume::updateTextures() | |||
494 | } | 461 | } |
495 | else | 462 | else |
496 | { | 463 | { |
497 | vsize = getTextureVirtualSize(face); | 464 | vsize = face->getTextureVirtualSize(); |
498 | } | 465 | } |
499 | 466 | ||
500 | mPixelArea = llmax(mPixelArea, face->getPixelArea()); | 467 | mPixelArea = llmax(mPixelArea, face->getPixelArea()); |
501 | |||
502 | F32 old_size = face->getVirtualSize(); | ||
503 | 468 | ||
504 | if (face->mTextureMatrix != NULL) | 469 | if (face->mTextureMatrix != NULL) |
505 | { | 470 | { |
506 | if (vsize < MIN_TEX_ANIM_SIZE && old_size > MIN_TEX_ANIM_SIZE || | 471 | if ((vsize < MIN_TEX_ANIM_SIZE && old_size > MIN_TEX_ANIM_SIZE) || |
507 | vsize > MIN_TEX_ANIM_SIZE && old_size < MIN_TEX_ANIM_SIZE) | 472 | (vsize > MIN_TEX_ANIM_SIZE && old_size < MIN_TEX_ANIM_SIZE)) |
508 | { | 473 | { |
509 | gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD, FALSE); | 474 | gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD, FALSE); |
510 | } | 475 | } |
511 | } | 476 | } |
512 | 477 | ||
513 | face->setVirtualSize(vsize); | 478 | face->setVirtualSize(vsize); |
514 | // imagep->addTextureStats(vsize); | ||
515 | if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA)) | 479 | if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA)) |
516 | { | 480 | { |
517 | if (vsize < min_vsize) min_vsize = vsize; | 481 | if (vsize < min_vsize) min_vsize = vsize; |
@@ -539,46 +503,46 @@ void LLVOVolume::updateTextures() | |||
539 | mSculptTexture = gImageList.getImage(id); | 503 | mSculptTexture = gImageList.getImage(id); |
540 | if (mSculptTexture.notNull()) | 504 | if (mSculptTexture.notNull()) |
541 | { | 505 | { |
542 | S32 lod = llmin(mLOD, 3); | ||
543 | F32 lodf = ((F32)(lod + 1.0f)/4.f); | ||
544 | F32 tex_size = lodf * MAX_SCULPT_REZ; | ||
545 | mSculptTexture->addTextureStats(2.f * tex_size * tex_size); | ||
546 | mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(), | 506 | mSculptTexture->setBoostLevel(llmax((S32)mSculptTexture->getBoostLevel(), |
547 | (S32)LLViewerImageBoostLevel::BOOST_SCULPTED)); | 507 | (S32)LLViewerImageBoostLevel::BOOST_SCULPTED)); |
548 | } | 508 | mSculptTexture->setForSculpt() ; |
549 | 509 | ||
550 | S32 texture_discard = mSculptTexture->getDiscardLevel(); //try to match the texture | 510 | if(!mSculptTexture->isCachedRawImageReady()) |
551 | S32 current_discard = mSculptLevel; | 511 | { |
512 | S32 lod = llmin(mLOD, 3); | ||
513 | F32 lodf = ((F32)(lod + 1.0f)/4.f); | ||
514 | F32 tex_size = lodf * LLViewerImage::sMaxSculptRez ; | ||
515 | mSculptTexture->addTextureStats(2.f * tex_size * tex_size, FALSE); | ||
516 | |||
517 | //if the sculpty very close to the view point, load first | ||
518 | { | ||
519 | LLVector3 lookAt = getPositionAgent() - LLViewerCamera::getInstance()->getOrigin(); | ||
520 | F32 dist = lookAt.normVec() ; | ||
521 | F32 cos_angle_to_view_dir = lookAt * LLViewerCamera::getInstance()->getXAxis() ; | ||
522 | mSculptTexture->setAdditionalDecodePriority(0.8f * LLFace::calcImportanceToCamera(cos_angle_to_view_dir, dist)) ; | ||
523 | } | ||
524 | } | ||
525 | |||
526 | S32 texture_discard = mSculptTexture->getCachedRawImageLevel(); //try to match the texture | ||
527 | S32 current_discard = mSculptLevel; | ||
552 | 528 | ||
553 | if (texture_discard >= 0 && //texture has some data available | 529 | if (texture_discard >= 0 && //texture has some data available |
554 | (texture_discard < current_discard || //texture has more data than last rebuild | 530 | (texture_discard < current_discard || //texture has more data than last rebuild |
555 | current_discard < 0)) //no previous rebuild | 531 | current_discard < 0)) //no previous rebuild |
556 | { | 532 | { |
557 | gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, FALSE); | 533 | gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, FALSE); |
558 | mSculptChanged = TRUE; | 534 | mSculptChanged = TRUE; |
559 | } | 535 | } |
560 | 536 | ||
561 | if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SCULPTED)) | 537 | if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SCULPTED)) |
562 | { | 538 | { |
563 | setDebugText(llformat("T%d C%d V%d\n%dx%d", | 539 | setDebugText(llformat("T%d C%d V%d\n%dx%d", |
564 | texture_discard, current_discard, getVolume()->getSculptLevel(), | 540 | texture_discard, current_discard, getVolume()->getSculptLevel(), |
565 | mSculptTexture->getHeight(), mSculptTexture->getWidth())); | 541 | mSculptTexture->getHeight(), mSculptTexture->getWidth())); |
566 | } | 542 | } |
543 | } | ||
567 | } | 544 | } |
568 | 545 | ||
569 | if (getLightTextureID().notNull()) | ||
570 | { | ||
571 | LLLightImageParams* params = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); | ||
572 | LLUUID id = params->getLightTexture(); | ||
573 | mLightTexture = gImageList.getImage(id); | ||
574 | if (mLightTexture.notNull()) | ||
575 | { | ||
576 | F32 rad = getLightRadius(); | ||
577 | mLightTexture->addTextureStats(gPipeline.calcPixelArea(getPositionAgent(), | ||
578 | LLVector3(rad,rad,rad), | ||
579 | *LLViewerCamera::getInstance())); | ||
580 | } | ||
581 | } | ||
582 | 546 | ||
583 | if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA)) | 547 | if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA)) |
584 | { | 548 | { |
@@ -599,36 +563,6 @@ void LLVOVolume::updateTextures() | |||
599 | } | 563 | } |
600 | } | 564 | } |
601 | 565 | ||
602 | F32 LLVOVolume::getTextureVirtualSize(LLFace* face) | ||
603 | { | ||
604 | //get area of circle around face | ||
605 | LLVector3 center = face->getPositionAgent(); | ||
606 | LLVector3 size = (face->mExtents[1] - face->mExtents[0]) * 0.5f; | ||
607 | |||
608 | F32 face_area = LLPipeline::calcPixelArea(center, size, *LLViewerCamera::getInstance()); | ||
609 | |||
610 | face->setPixelArea(face_area); | ||
611 | |||
612 | if (face_area <= 0) | ||
613 | { | ||
614 | return 0.f; | ||
615 | } | ||
616 | |||
617 | //get area of circle in texture space | ||
618 | LLVector2 tdim = face->mTexExtents[1] - face->mTexExtents[0]; | ||
619 | F32 texel_area = (tdim * 0.5f).lengthSquared()*3.14159f; | ||
620 | if (texel_area <= 0) | ||
621 | { | ||
622 | // Probably animated, use default | ||
623 | texel_area = 1.f; | ||
624 | } | ||
625 | |||
626 | //apply texel area to face area to get accurate ratio | ||
627 | face_area /= llclamp(texel_area, 1.f/64.f, 16.f); | ||
628 | |||
629 | return face_area; | ||
630 | } | ||
631 | |||
632 | BOOL LLVOVolume::isActive() const | 566 | BOOL LLVOVolume::isActive() const |
633 | { | 567 | { |
634 | return !mStatic || mTextureAnimp || (mVolumeImpl && mVolumeImpl->isActive()); | 568 | return !mStatic || mTextureAnimp || (mVolumeImpl && mVolumeImpl->isActive()); |
@@ -765,31 +699,21 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams &volume_params, const S32 detail | |||
765 | 699 | ||
766 | // sculpt replaces generate() for sculpted surfaces | 700 | // sculpt replaces generate() for sculpted surfaces |
767 | void LLVOVolume::sculpt() | 701 | void LLVOVolume::sculpt() |
768 | { | 702 | { |
769 | U16 sculpt_height = 0; | ||
770 | U16 sculpt_width = 0; | ||
771 | S8 sculpt_components = 0; | ||
772 | const U8* sculpt_data = NULL; | ||
773 | |||
774 | if (mSculptTexture.notNull()) | 703 | if (mSculptTexture.notNull()) |
775 | { | 704 | { |
776 | S32 discard_level; | 705 | U16 sculpt_height = 0; |
777 | S32 desired_discard = 0; // lower discard levels have MUCH less resolution | 706 | U16 sculpt_width = 0; |
778 | 707 | S8 sculpt_components = 0; | |
779 | discard_level = desired_discard; | 708 | const U8* sculpt_data = NULL; |
709 | |||
710 | S32 discard_level = mSculptTexture->getCachedRawImageLevel() ; | ||
711 | LLImageRaw* raw_image = mSculptTexture->getCachedRawImage() ; | ||
780 | 712 | ||
781 | S32 max_discard = mSculptTexture->getMaxDiscardLevel(); | 713 | S32 max_discard = mSculptTexture->getMaxDiscardLevel(); |
782 | if (discard_level > max_discard) | 714 | if (discard_level > max_discard) |
783 | discard_level = max_discard; // clamp to the best we can do | 715 | discard_level = max_discard; // clamp to the best we can do |
784 | 716 | ||
785 | S32 best_discard = mSculptTexture->getDiscardLevel(); | ||
786 | if (discard_level < best_discard) | ||
787 | discard_level = best_discard; // clamp to what we have | ||
788 | |||
789 | if (best_discard == -1) | ||
790 | discard_level = -1; // and if we have nothing, set to nothing | ||
791 | |||
792 | |||
793 | S32 current_discard = getVolume()->getSculptLevel(); | 717 | S32 current_discard = getVolume()->getSculptLevel(); |
794 | if(current_discard < -2) | 718 | if(current_discard < -2) |
795 | { | 719 | { |
@@ -811,28 +735,17 @@ void LLVOVolume::sculpt() | |||
811 | if (current_discard == discard_level) // no work to do here | 735 | if (current_discard == discard_level) // no work to do here |
812 | return; | 736 | return; |
813 | 737 | ||
814 | LLPointer<LLImageRaw> raw_image = new LLImageRaw(); | 738 | if(!raw_image) |
815 | BOOL is_valid = mSculptTexture->readBackRaw(discard_level, raw_image, FALSE); | ||
816 | |||
817 | sculpt_height = raw_image->getHeight(); | ||
818 | sculpt_width = raw_image->getWidth(); | ||
819 | sculpt_components = raw_image->getComponents(); | ||
820 | |||
821 | if(is_valid) | ||
822 | { | ||
823 | is_valid = mSculptTexture->isValidForSculpt(discard_level, sculpt_width, sculpt_height, sculpt_components) ; | ||
824 | } | ||
825 | if(!is_valid) | ||
826 | { | 739 | { |
827 | sculpt_width = 0; | 740 | sculpt_width = 0; |
828 | sculpt_height = 0; | 741 | sculpt_height = 0; |
829 | sculpt_data = NULL ; | 742 | sculpt_data = NULL ; |
830 | } | 743 | } |
831 | else | 744 | else |
832 | { | 745 | { |
833 | if (raw_image->getDataSize() < sculpt_height * sculpt_width * sculpt_components) | 746 | sculpt_height = raw_image->getHeight(); |
834 | llwarns << "Sculpt: image data size = " << raw_image->getDataSize() | 747 | sculpt_width = raw_image->getWidth(); |
835 | << " < " << sculpt_height << " x " << sculpt_width << " x " <<sculpt_components << llendl; | 748 | sculpt_components = raw_image->getComponents(); |
836 | 749 | ||
837 | sculpt_data = raw_image->getData(); | 750 | sculpt_data = raw_image->getData(); |
838 | } | 751 | } |
@@ -864,7 +777,7 @@ BOOL LLVOVolume::calcLOD() | |||
864 | } | 777 | } |
865 | 778 | ||
866 | //update face texture sizes on lod calculation | 779 | //update face texture sizes on lod calculation |
867 | // updateTextureVirtualSize(); | 780 | updateTextureVirtualSize(); |
868 | 781 | ||
869 | S32 cur_detail = 0; | 782 | S32 cur_detail = 0; |
870 | 783 | ||
@@ -1318,15 +1231,28 @@ S32 LLVOVolume::setTEColor(const U8 te, const LLColor3& color) | |||
1318 | 1231 | ||
1319 | S32 LLVOVolume::setTEColor(const U8 te, const LLColor4& color) | 1232 | S32 LLVOVolume::setTEColor(const U8 te, const LLColor4& color) |
1320 | { | 1233 | { |
1321 | S32 res = LLViewerObject::setTEColor(te, color); | 1234 | S32 retval = 0; |
1322 | if (res && mDrawable.notNull()) | 1235 | const LLTextureEntry *tep = getTE(te); |
1236 | if (!tep) | ||
1323 | { | 1237 | { |
1324 | //gPipeline.markTextured(mDrawable); | 1238 | llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; |
1325 | mDrawable->setState(LLDrawable::REBUILD_COLOR); | ||
1326 | dirtyMesh(); | ||
1327 | //mFaceMappingChanged = TRUE; | ||
1328 | } | 1239 | } |
1329 | return res; | 1240 | else if (color != tep->getColor()) |
1241 | { | ||
1242 | if (color.mV[3] != tep->getColor().mV[3]) | ||
1243 | { | ||
1244 | gPipeline.markTextured(mDrawable); | ||
1245 | } | ||
1246 | retval = LLPrimitive::setTEColor(te, color); | ||
1247 | if (mDrawable.notNull() && retval) | ||
1248 | { | ||
1249 | // These should only happen on updates which are not the initial update. | ||
1250 | mDrawable->setState(LLDrawable::REBUILD_COLOR); | ||
1251 | dirtyMesh(); | ||
1252 | } | ||
1253 | } | ||
1254 | |||
1255 | return retval; | ||
1330 | } | 1256 | } |
1331 | 1257 | ||
1332 | S32 LLVOVolume::setTEBumpmap(const U8 te, const U8 bumpmap) | 1258 | S32 LLVOVolume::setTEBumpmap(const U8 te, const U8 bumpmap) |
@@ -1392,7 +1318,7 @@ S32 LLVOVolume::setTEBumpShinyFullbright(const U8 te, const U8 bump) | |||
1392 | gPipeline.markTextured(mDrawable); | 1318 | gPipeline.markTextured(mDrawable); |
1393 | mFaceMappingChanged = TRUE; | 1319 | mFaceMappingChanged = TRUE; |
1394 | } | 1320 | } |
1395 | return res; | 1321 | return res; |
1396 | } | 1322 | } |
1397 | 1323 | ||
1398 | S32 LLVOVolume::setTEMediaFlags(const U8 te, const U8 media_flags) | 1324 | S32 LLVOVolume::setTEMediaFlags(const U8 te, const U8 media_flags) |
@@ -1461,40 +1387,6 @@ void LLVOVolume::updateTEData() | |||
1461 | 1387 | ||
1462 | //---------------------------------------------------------------------------- | 1388 | //---------------------------------------------------------------------------- |
1463 | 1389 | ||
1464 | void LLVOVolume::setLightTextureID(LLUUID id) | ||
1465 | { | ||
1466 | if (id.notNull()) | ||
1467 | { | ||
1468 | if (!hasLightTexture()) | ||
1469 | { | ||
1470 | setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, TRUE, true); | ||
1471 | } | ||
1472 | LLLightImageParams* param_block = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); | ||
1473 | if (param_block && param_block->getLightTexture() != id) | ||
1474 | { | ||
1475 | param_block->setLightTexture(id); | ||
1476 | parameterChanged(LLNetworkData::PARAMS_LIGHT_IMAGE, true); | ||
1477 | } | ||
1478 | } | ||
1479 | else | ||
1480 | { | ||
1481 | if (hasLightTexture()) | ||
1482 | { | ||
1483 | setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, FALSE, true); | ||
1484 | } | ||
1485 | } | ||
1486 | } | ||
1487 | |||
1488 | void LLVOVolume::setSpotLightParams(LLVector3 params) | ||
1489 | { | ||
1490 | LLLightImageParams* param_block = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); | ||
1491 | if (param_block && param_block->getParams() != params) | ||
1492 | { | ||
1493 | param_block->setParams(params); | ||
1494 | parameterChanged(LLNetworkData::PARAMS_LIGHT_IMAGE, true); | ||
1495 | } | ||
1496 | } | ||
1497 | |||
1498 | void LLVOVolume::setIsLight(BOOL is_light) | 1390 | void LLVOVolume::setIsLight(BOOL is_light) |
1499 | { | 1391 | { |
1500 | if (is_light != getIsLight()) | 1392 | if (is_light != getIsLight()) |
@@ -1621,77 +1513,6 @@ LLColor3 LLVOVolume::getLightColor() const | |||
1621 | } | 1513 | } |
1622 | } | 1514 | } |
1623 | 1515 | ||
1624 | LLUUID LLVOVolume::getLightTextureID() const | ||
1625 | { | ||
1626 | const LLLightImageParams *param_block = (const LLLightImageParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); | ||
1627 | if (param_block) | ||
1628 | { | ||
1629 | return param_block->getLightTexture(); | ||
1630 | } | ||
1631 | |||
1632 | return LLUUID::null; | ||
1633 | } | ||
1634 | |||
1635 | |||
1636 | LLVector3 LLVOVolume::getSpotLightParams() const | ||
1637 | { | ||
1638 | const LLLightImageParams *param_block = (const LLLightImageParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); | ||
1639 | if (param_block) | ||
1640 | { | ||
1641 | return param_block->getParams(); | ||
1642 | } | ||
1643 | |||
1644 | return LLVector3(); | ||
1645 | } | ||
1646 | |||
1647 | F32 LLVOVolume::getSpotLightPriority() const | ||
1648 | { | ||
1649 | return mSpotLightPriority; | ||
1650 | } | ||
1651 | |||
1652 | void LLVOVolume::updateSpotLightPriority() | ||
1653 | { | ||
1654 | LLVector3 pos = mDrawable->getPositionAgent(); | ||
1655 | LLVector3 at(0,0,-1); | ||
1656 | at *= getRenderRotation(); | ||
1657 | |||
1658 | F32 r = getLightRadius()*0.5f; | ||
1659 | |||
1660 | pos += at * r; | ||
1661 | |||
1662 | at = LLViewerCamera::getInstance()->getAtAxis(); | ||
1663 | |||
1664 | pos -= at * r; | ||
1665 | |||
1666 | mSpotLightPriority = gPipeline.calcPixelArea(pos, LLVector3(r,r,r), *LLViewerCamera::getInstance()); | ||
1667 | // KL needed for S19? | ||
1668 | if (mLightTexture.notNull()) | ||
1669 | { | ||
1670 | mLightTexture->addTextureStats(mSpotLightPriority); | ||
1671 | mLightTexture->setBoostLevel(LLViewerImageBoostLevel::BOOST_CLOUDS); | ||
1672 | } | ||
1673 | } | ||
1674 | |||
1675 | |||
1676 | LLViewerImage* LLVOVolume::getLightTexture() | ||
1677 | { | ||
1678 | LLUUID id = getLightTextureID(); | ||
1679 | |||
1680 | if (id.notNull()) | ||
1681 | { | ||
1682 | if (mLightTexture.isNull() || id != mLightTexture->getID()) | ||
1683 | { | ||
1684 | mLightTexture = gImageList.getImage(id); | ||
1685 | } | ||
1686 | } | ||
1687 | else | ||
1688 | { | ||
1689 | mLightTexture = NULL; | ||
1690 | } | ||
1691 | |||
1692 | return mLightTexture; | ||
1693 | } | ||
1694 | |||
1695 | F32 LLVOVolume::getLightIntensity() const | 1516 | F32 LLVOVolume::getLightIntensity() const |
1696 | { | 1517 | { |
1697 | const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); | 1518 | const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); |
@@ -1783,16 +1604,6 @@ BOOL LLVOVolume::isSculpted() const | |||
1783 | return FALSE; | 1604 | return FALSE; |
1784 | } | 1605 | } |
1785 | 1606 | ||
1786 | BOOL LLVOVolume::hasLightTexture() const | ||
1787 | { | ||
1788 | if (getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE)) | ||
1789 | { | ||
1790 | return TRUE; | ||
1791 | } | ||
1792 | |||
1793 | return FALSE; | ||
1794 | } | ||
1795 | |||
1796 | BOOL LLVOVolume::isVolumeGlobal() const | 1607 | BOOL LLVOVolume::isVolumeGlobal() const |
1797 | { | 1608 | { |
1798 | if (mVolumeImpl) | 1609 | if (mVolumeImpl) |
@@ -2245,9 +2056,9 @@ U32 LLVOVolume::getPartitionType() const | |||
2245 | } | 2056 | } |
2246 | 2057 | ||
2247 | LLVolumePartition::LLVolumePartition() | 2058 | LLVolumePartition::LLVolumePartition() |
2248 | : LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, TRUE, GL_DYNAMIC_DRAW_ARB) // KL | 2059 | : LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, FALSE) |
2249 | { | 2060 | { |
2250 | mLODPeriod = 32; // KL 32 in SD | 2061 | mLODPeriod = 16; |
2251 | mDepthMask = FALSE; | 2062 | mDepthMask = FALSE; |
2252 | mDrawableType = LLPipeline::RENDER_TYPE_VOLUME; | 2063 | mDrawableType = LLPipeline::RENDER_TYPE_VOLUME; |
2253 | mPartitionType = LLViewerRegion::PARTITION_VOLUME; | 2064 | mPartitionType = LLViewerRegion::PARTITION_VOLUME; |
@@ -2256,10 +2067,10 @@ LLVolumePartition::LLVolumePartition() | |||
2256 | } | 2067 | } |
2257 | 2068 | ||
2258 | LLVolumeBridge::LLVolumeBridge(LLDrawable* drawablep) | 2069 | LLVolumeBridge::LLVolumeBridge(LLDrawable* drawablep) |
2259 | : LLSpatialBridge(drawablep, TRUE, LLVOVolume::VERTEX_DATA_MASK) // KL SD | 2070 | : LLSpatialBridge(drawablep, LLVOVolume::VERTEX_DATA_MASK) |
2260 | { | 2071 | { |
2261 | mDepthMask = FALSE; | 2072 | mDepthMask = FALSE; |
2262 | mLODPeriod = 32; // KL 32 in SD | 2073 | mLODPeriod = 16; |
2263 | mDrawableType = LLPipeline::RENDER_TYPE_VOLUME; | 2074 | mDrawableType = LLPipeline::RENDER_TYPE_VOLUME; |
2264 | mPartitionType = LLViewerRegion::PARTITION_BRIDGE; | 2075 | mPartitionType = LLViewerRegion::PARTITION_BRIDGE; |
2265 | 2076 | ||
@@ -2314,7 +2125,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, | |||
2314 | 2125 | ||
2315 | U8 bump = (type == LLRenderPass::PASS_BUMP ? facep->getTextureEntry()->getBumpmap() : 0); | 2126 | U8 bump = (type == LLRenderPass::PASS_BUMP ? facep->getTextureEntry()->getBumpmap() : 0); |
2316 | 2127 | ||
2317 | LLImageGL* tex = facep->getGLTexture(); // LLViewerImage* tex = facep->getTexture(); // KL SD | 2128 | LLViewerImage* tex = facep->getTexture(); |
2318 | 2129 | ||
2319 | U8 glow = 0; | 2130 | U8 glow = 0; |
2320 | 2131 | ||
@@ -2325,7 +2136,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, | |||
2325 | 2136 | ||
2326 | if (facep->mVertexBuffer.isNull()) | 2137 | if (facep->mVertexBuffer.isNull()) |
2327 | { | 2138 | { |
2328 | llwarns << "WTF?" << llendl; | 2139 | llerrs << "WTF?" << llendl; |
2329 | } | 2140 | } |
2330 | 2141 | ||
2331 | if (idx >= 0 && | 2142 | if (idx >= 0 && |
@@ -2356,7 +2167,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, | |||
2356 | U32 offset = facep->getIndicesStart(); | 2167 | U32 offset = facep->getIndicesStart(); |
2357 | U32 count = facep->getIndicesCount(); | 2168 | U32 count = facep->getIndicesCount(); |
2358 | LLPointer<LLDrawInfo> draw_info = new LLDrawInfo(start,end,count,offset,tex, | 2169 | LLPointer<LLDrawInfo> draw_info = new LLDrawInfo(start,end,count,offset,tex, |
2359 | (LLImageGL*)facep->getTexture() == tex ? facep->getTexture() : NULL, | ||
2360 | facep->mVertexBuffer, fullbright, bump); | 2170 | facep->mVertexBuffer, fullbright, bump); |
2361 | draw_info->mGroup = group; | 2171 | draw_info->mGroup = group; |
2362 | draw_info->mVSize = facep->getVirtualSize(); | 2172 | draw_info->mVSize = facep->getVirtualSize(); |
@@ -2449,11 +2259,9 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) | |||
2449 | 2259 | ||
2450 | LLVOVolume* vobj = drawablep->getVOVolume(); | 2260 | LLVOVolume* vobj = drawablep->getVOVolume(); |
2451 | llassert_always(vobj); | 2261 | llassert_always(vobj); |
2452 | vobj->updateTextures(); | 2262 | vobj->updateTextureVirtualSize(); |
2453 | vobj->preRebuild(); | 2263 | vobj->preRebuild(); |
2454 | 2264 | ||
2455 | drawablep->clearState(LLDrawable::HAS_ALPHA); // KL SD | ||
2456 | |||
2457 | //for each face | 2265 | //for each face |
2458 | for (S32 i = 0; i < drawablep->getNumFaces(); i++) | 2266 | for (S32 i = 0; i < drawablep->getNumFaces(); i++) |
2459 | { | 2267 | { |
@@ -2522,7 +2330,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) | |||
2522 | } | 2330 | } |
2523 | else | 2331 | else |
2524 | { | 2332 | { |
2525 | drawablep->setState(LLDrawable::HAS_ALPHA); // KL SD | ||
2526 | alpha_faces.push_back(facep); | 2333 | alpha_faces.push_back(facep); |
2527 | } | 2334 | } |
2528 | } | 2335 | } |
@@ -2546,7 +2353,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) | |||
2546 | } | 2353 | } |
2547 | else | 2354 | else |
2548 | { //doesn't need normal | 2355 | { //doesn't need normal |
2549 | //facep->setState(LLFace::FULLBRIGHT); | 2356 | facep->setState(LLFace::FULLBRIGHT); |
2550 | fullbright_faces.push_back(facep); | 2357 | fullbright_faces.push_back(facep); |
2551 | } | 2358 | } |
2552 | } | 2359 | } |
@@ -2556,14 +2363,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) | |||
2556 | { //needs normal + binormal | 2363 | { //needs normal + binormal |
2557 | bump_faces.push_back(facep); | 2364 | bump_faces.push_back(facep); |
2558 | } | 2365 | } |
2559 | else if (te->getShiny() && LLPipeline::sRenderBump || | 2366 | else if ((te->getShiny() && LLPipeline::sRenderBump) || |
2560 | !te->getFullbright()) | 2367 | !te->getFullbright()) |
2561 | { //needs normal | 2368 | { //needs normal |
2562 | simple_faces.push_back(facep); | 2369 | simple_faces.push_back(facep); |
2563 | } | 2370 | } |
2564 | else | 2371 | else |
2565 | { //doesn't need normal | 2372 | { //doesn't need normal |
2566 | // facep->setState(LLFace::FULLBRIGHT); | 2373 | facep->setState(LLFace::FULLBRIGHT); |
2567 | fullbright_faces.push_back(facep); | 2374 | fullbright_faces.push_back(facep); |
2568 | } | 2375 | } |
2569 | } | 2376 | } |
@@ -2611,7 +2418,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) | |||
2611 | 2418 | ||
2612 | if (LLPipeline::sDelayVBUpdate) | 2419 | if (LLPipeline::sDelayVBUpdate) |
2613 | { | 2420 | { |
2614 | group->setState(LLSpatialGroup::MESH_DIRTY | LLSpatialGroup::NEW_DRAWINFO); // KL SD | 2421 | group->setState(LLSpatialGroup::MESH_DIRTY); |
2615 | } | 2422 | } |
2616 | 2423 | ||
2617 | mFaceList.clear(); | 2424 | mFaceList.clear(); |
@@ -2619,7 +2426,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) | |||
2619 | 2426 | ||
2620 | void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) | 2427 | void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) |
2621 | { | 2428 | { |
2622 | if (group->isState(LLSpatialGroup::MESH_DIRTY) && !group->isState(LLSpatialGroup::GEOM_DIRTY)) // KL SD | 2429 | if (group->isState(LLSpatialGroup::MESH_DIRTY)) |
2623 | { | 2430 | { |
2624 | S32 num_mapped_veretx_buffer = LLVertexBuffer::sMappedCount ; | 2431 | S32 num_mapped_veretx_buffer = LLVertexBuffer::sMappedCount ; |
2625 | 2432 | ||
@@ -2697,7 +2504,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) | |||
2697 | } | 2504 | } |
2698 | } | 2505 | } |
2699 | 2506 | ||
2700 | group->clearState(LLSpatialGroup::MESH_DIRTY | LLSpatialGroup::NEW_DRAWINFO); // KL SD | 2507 | group->clearState(LLSpatialGroup::MESH_DIRTY); |
2701 | } | 2508 | } |
2702 | } | 2509 | } |
2703 | 2510 | ||
@@ -2723,7 +2530,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: | |||
2723 | 2530 | ||
2724 | LLSpatialGroup::buffer_map_t buffer_map; | 2531 | LLSpatialGroup::buffer_map_t buffer_map; |
2725 | 2532 | ||
2726 | LLImageGL* last_tex = NULL;// LLViewerImage* last_tex = NULL; // KL SD | 2533 | LLViewerImage* last_tex = NULL; |
2727 | S32 buffer_index = 0; | 2534 | S32 buffer_index = 0; |
2728 | 2535 | ||
2729 | if (distance_sort) | 2536 | if (distance_sort) |
@@ -2735,7 +2542,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: | |||
2735 | { | 2542 | { |
2736 | //pull off next face | 2543 | //pull off next face |
2737 | LLFace* facep = *face_iter; | 2544 | LLFace* facep = *face_iter; |
2738 | LLImageGL* tex = facep->getGLTexture(); // LLViewerImage* tex = facep->getTexture(); // KL SD | 2545 | LLViewerImage* tex = facep->getTexture(); |
2739 | 2546 | ||
2740 | if (distance_sort) | 2547 | if (distance_sort) |
2741 | { | 2548 | { |
@@ -2760,7 +2567,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: | |||
2760 | ++i; | 2567 | ++i; |
2761 | 2568 | ||
2762 | while (i != faces.end() && | 2569 | while (i != faces.end() && |
2763 | (LLPipeline::sTextureBindTest || (distance_sort || (*i)->getGLTexture() == tex))) // KL SD getTexture | 2570 | (LLPipeline::sTextureBindTest || (distance_sort || (*i)->getTexture() == tex))) |
2764 | { | 2571 | { |
2765 | facep = *i; | 2572 | facep = *i; |
2766 | 2573 | ||
@@ -2843,11 +2650,6 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: | |||
2843 | 2650 | ||
2844 | BOOL force_simple = facep->mPixelArea < FORCE_SIMPLE_RENDER_AREA; | 2651 | BOOL force_simple = facep->mPixelArea < FORCE_SIMPLE_RENDER_AREA; |
2845 | BOOL fullbright = facep->isState(LLFace::FULLBRIGHT); | 2652 | BOOL fullbright = facep->isState(LLFace::FULLBRIGHT); |
2846 | if ((mask & LLVertexBuffer::MAP_NORMAL) == 0) // KL SD | ||
2847 | { //paranoia check to make sure GL doesn't try to read non-existant normals | ||
2848 | fullbright = TRUE; | ||
2849 | } | ||
2850 | |||
2851 | const LLTextureEntry* te = facep->getTextureEntry(); | 2653 | const LLTextureEntry* te = facep->getTextureEntry(); |
2852 | 2654 | ||
2853 | BOOL is_alpha = facep->getPoolType() == LLDrawPool::POOL_ALPHA ? TRUE : FALSE; | 2655 | BOOL is_alpha = facep->getPoolType() == LLDrawPool::POOL_ALPHA ? TRUE : FALSE; |
@@ -2899,7 +2701,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: | |||
2899 | } | 2701 | } |
2900 | else | 2702 | else |
2901 | { | 2703 | { |
2902 | // llassert(mask & LLVertexBuffer::MAP_NORMAL); | 2704 | llassert(mask & LLVertexBuffer::MAP_NORMAL); |
2903 | registerFace(group, facep, LLRenderPass::PASS_SIMPLE); | 2705 | registerFace(group, facep, LLRenderPass::PASS_SIMPLE); |
2904 | } | 2706 | } |
2905 | } | 2707 | } |
@@ -2930,7 +2732,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: | |||
2930 | } | 2732 | } |
2931 | else | 2733 | else |
2932 | { | 2734 | { |
2933 | // llassert(mask & LLVertexBuffer::MAP_NORMAL); | 2735 | llassert(mask & LLVertexBuffer::MAP_NORMAL); |
2934 | registerFace(group, facep, LLRenderPass::PASS_SIMPLE); | 2736 | registerFace(group, facep, LLRenderPass::PASS_SIMPLE); |
2935 | } | 2737 | } |
2936 | } | 2738 | } |
@@ -2943,8 +2745,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: | |||
2943 | 2745 | ||
2944 | if (!is_alpha && !LLPipeline::sRenderDeferred) | 2746 | if (!is_alpha && !LLPipeline::sRenderDeferred) |
2945 | { | 2747 | { |
2946 | // llassert((mask & LLVertexBuffer::MAP_NORMAL) || fullbright); | 2748 | llassert((mask & LLVertexBuffer::MAP_NORMAL) || fullbright); |
2947 | facep->setPoolType(LLDrawPool::POOL_SIMPLE); // facep->setPoolType((fullbright) ? LLDrawPool::POOL_FULLBRIGHT : LLDrawPool::POOL_SIMPLE); | 2749 | facep->setPoolType((fullbright) ? LLDrawPool::POOL_FULLBRIGHT : LLDrawPool::POOL_SIMPLE); |
2948 | 2750 | ||
2949 | if (!force_simple && te->getBumpmap()) | 2751 | if (!force_simple && te->getBumpmap()) |
2950 | { | 2752 | { |
@@ -3023,7 +2825,7 @@ LLHUDPartition::LLHUDPartition() | |||
3023 | mPartitionType = LLViewerRegion::PARTITION_HUD; | 2825 | mPartitionType = LLViewerRegion::PARTITION_HUD; |
3024 | mDrawableType = LLPipeline::RENDER_TYPE_HUD; | 2826 | mDrawableType = LLPipeline::RENDER_TYPE_HUD; |
3025 | mSlopRatio = 0.f; | 2827 | mSlopRatio = 0.f; |
3026 | mLODPeriod = 32; // KL 32 in SD | 2828 | mLODPeriod = 1; |
3027 | } | 2829 | } |
3028 | 2830 | ||
3029 | void LLHUDPartition::shift(const LLVector3 &offset) | 2831 | void LLHUDPartition::shift(const LLVector3 &offset) |
diff --git a/linden/indra/newview/llvovolume.h b/linden/indra/newview/llvovolume.h index 4c6ad9a..a78aa37 100644 --- a/linden/indra/newview/llvovolume.h +++ b/linden/indra/newview/llvovolume.h | |||
@@ -130,7 +130,7 @@ public: | |||
130 | 130 | ||
131 | 131 | ||
132 | BOOL getVolumeChanged() const { return mVolumeChanged; } | 132 | BOOL getVolumeChanged() const { return mVolumeChanged; } |
133 | F32 getTextureVirtualSize(LLFace* face); | 133 | |
134 | /*virtual*/ F32 getRadius() const { return mVObjRadius; }; | 134 | /*virtual*/ F32 getRadius() const { return mVObjRadius; }; |
135 | const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const; | 135 | const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const; |
136 | 136 | ||
@@ -158,14 +158,14 @@ public: | |||
158 | /*virtual*/ S32 setTEBumpmap(const U8 te, const U8 bump); | 158 | /*virtual*/ S32 setTEBumpmap(const U8 te, const U8 bump); |
159 | /*virtual*/ S32 setTEShiny(const U8 te, const U8 shiny); | 159 | /*virtual*/ S32 setTEShiny(const U8 te, const U8 shiny); |
160 | /*virtual*/ S32 setTEFullbright(const U8 te, const U8 fullbright); | 160 | /*virtual*/ S32 setTEFullbright(const U8 te, const U8 fullbright); |
161 | /*virtual*/ S32 setTEBumpShinyFullbright(const U8 te, const U8 bump); // KL S19? | 161 | /*virtual*/ S32 setTEBumpShinyFullbright(const U8 te, const U8 bump); |
162 | /*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags); | 162 | /*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags); |
163 | /*virtual*/ S32 setTEGlow(const U8 te, const F32 glow); | 163 | /*virtual*/ S32 setTEGlow(const U8 te, const F32 glow); |
164 | /*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t); | 164 | /*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t); |
165 | /*virtual*/ S32 setTEScaleS(const U8 te, const F32 s); | 165 | /*virtual*/ S32 setTEScaleS(const U8 te, const F32 s); |
166 | /*virtual*/ S32 setTEScaleT(const U8 te, const F32 t); | 166 | /*virtual*/ S32 setTEScaleT(const U8 te, const F32 t); |
167 | /*virtual*/ S32 setTETexGen(const U8 te, const U8 texgen); | 167 | /*virtual*/ S32 setTETexGen(const U8 te, const U8 texgen); |
168 | /*virtual*/ S32 setTEMediaTexGen(const U8 te, const U8 media); // KL S19 | 168 | /*virtual*/ S32 setTEMediaTexGen(const U8 te, const U8 media); |
169 | /*virtual*/ BOOL setMaterial(const U8 material); | 169 | /*virtual*/ BOOL setMaterial(const U8 material); |
170 | 170 | ||
171 | void setTexture(const S32 face); | 171 | void setTexture(const S32 face); |
@@ -177,8 +177,8 @@ public: | |||
177 | /*virtual*/ void updateFaceSize(S32 idx); | 177 | /*virtual*/ void updateFaceSize(S32 idx); |
178 | /*virtual*/ BOOL updateLOD(); | 178 | /*virtual*/ BOOL updateLOD(); |
179 | void updateRadius(); | 179 | void updateRadius(); |
180 | /*virtual*/ void updateTextures(LLAgent &agent); | 180 | /*virtual*/ void updateTextures(); |
181 | void updateTextures(); | 181 | void updateTextureVirtualSize(); |
182 | 182 | ||
183 | void updateFaceFlags(); | 183 | void updateFaceFlags(); |
184 | void regenFaces(); | 184 | void regenFaces(); |
@@ -196,18 +196,9 @@ public: | |||
196 | void setLightRadius(F32 radius); | 196 | void setLightRadius(F32 radius); |
197 | void setLightFalloff(F32 falloff); | 197 | void setLightFalloff(F32 falloff); |
198 | void setLightCutoff(F32 cutoff); | 198 | void setLightCutoff(F32 cutoff); |
199 | void setLightTextureID(LLUUID id); | ||
200 | void setSpotLightParams(LLVector3 params); | ||
201 | |||
202 | BOOL getIsLight() const; | 199 | BOOL getIsLight() const; |
203 | LLColor3 getLightBaseColor() const; // not scaled by intensity | 200 | LLColor3 getLightBaseColor() const; // not scaled by intensity |
204 | LLColor3 getLightColor() const; // scaled by intensity | 201 | LLColor3 getLightColor() const; // scaled by intensity |
205 | LLUUID getLightTextureID() const; | ||
206 | LLVector3 getSpotLightParams() const; | ||
207 | void updateSpotLightPriority(); | ||
208 | F32 getSpotLightPriority() const; | ||
209 | |||
210 | LLViewerImage* getLightTexture(); | ||
211 | F32 getLightIntensity() const; | 202 | F32 getLightIntensity() const; |
212 | F32 getLightRadius() const; | 203 | F32 getLightRadius() const; |
213 | F32 getLightFalloff() const; | 204 | F32 getLightFalloff() const; |
@@ -217,8 +208,6 @@ public: | |||
217 | U32 getVolumeInterfaceID() const; | 208 | U32 getVolumeInterfaceID() const; |
218 | virtual BOOL isFlexible() const; | 209 | virtual BOOL isFlexible() const; |
219 | virtual BOOL isSculpted() const; | 210 | virtual BOOL isSculpted() const; |
220 | virtual BOOL hasLightTexture() const; | ||
221 | |||
222 | BOOL isVolumeGlobal() const; | 211 | BOOL isVolumeGlobal() const; |
223 | BOOL canBeFlexible() const; | 212 | BOOL canBeFlexible() const; |
224 | BOOL setIsFlexible(BOOL is_flexible); | 213 | BOOL setIsFlexible(BOOL is_flexible); |
@@ -244,14 +233,12 @@ private: | |||
244 | BOOL mLODChanged; | 233 | BOOL mLODChanged; |
245 | S32 mSculptLevel; | 234 | S32 mSculptLevel; |
246 | BOOL mSculptChanged; | 235 | BOOL mSculptChanged; |
247 | F32 mSpotLightPriority; | ||
248 | LLMatrix4 mRelativeXform; | 236 | LLMatrix4 mRelativeXform; |
249 | LLMatrix3 mRelativeXformInvTrans; | 237 | LLMatrix3 mRelativeXformInvTrans; |
250 | BOOL mVolumeChanged; | 238 | BOOL mVolumeChanged; |
251 | F32 mVObjRadius; | 239 | F32 mVObjRadius; |
252 | LLVolumeInterface *mVolumeImpl; | 240 | LLVolumeInterface *mVolumeImpl; |
253 | LLPointer<LLViewerImage> mSculptTexture; | 241 | LLPointer<LLViewerImage> mSculptTexture; |
254 | LLPointer<LLViewerImage> mLightTexture; | ||
255 | 242 | ||
256 | // statics | 243 | // statics |
257 | public: | 244 | public: |
diff --git a/linden/indra/newview/llvowater.cpp b/linden/indra/newview/llvowater.cpp index 251667c..c66295a 100644 --- a/linden/indra/newview/llvowater.cpp +++ b/linden/indra/newview/llvowater.cpp | |||
@@ -101,7 +101,7 @@ void LLVOWater::setPixelAreaAndAngle(LLAgent &agent) | |||
101 | 101 | ||
102 | 102 | ||
103 | // virtual | 103 | // virtual |
104 | void LLVOWater::updateTextures(LLAgent &agent) | 104 | void LLVOWater::updateTextures() |
105 | { | 105 | { |
106 | } | 106 | } |
107 | 107 | ||
@@ -281,9 +281,9 @@ U32 LLVOVoidWater::getPartitionType() const | |||
281 | } | 281 | } |
282 | 282 | ||
283 | LLWaterPartition::LLWaterPartition() | 283 | LLWaterPartition::LLWaterPartition() |
284 | : LLSpatialPartition(0, FALSE, 0) | 284 | : LLSpatialPartition(0) |
285 | { | 285 | { |
286 | // mRenderByGroup = FALSE; // KL specified const SG branch not req here | 286 | mRenderByGroup = FALSE; |
287 | mInfiniteFarClip = TRUE; | 287 | mInfiniteFarClip = TRUE; |
288 | mDrawableType = LLPipeline::RENDER_TYPE_WATER; | 288 | mDrawableType = LLPipeline::RENDER_TYPE_WATER; |
289 | mPartitionType = LLViewerRegion::PARTITION_WATER; | 289 | mPartitionType = LLViewerRegion::PARTITION_WATER; |
diff --git a/linden/indra/newview/llvowater.h b/linden/indra/newview/llvowater.h index de2cb3e..55ce6d7 100644 --- a/linden/indra/newview/llvowater.h +++ b/linden/indra/newview/llvowater.h | |||
@@ -69,7 +69,7 @@ public: | |||
69 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); | 69 | /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); |
70 | /*virtual*/ void updateSpatialExtents(LLVector3& newMin, LLVector3& newMax); | 70 | /*virtual*/ void updateSpatialExtents(LLVector3& newMin, LLVector3& newMax); |
71 | 71 | ||
72 | /*virtual*/ void updateTextures(LLAgent &agent); | 72 | /*virtual*/ void updateTextures(); |
73 | /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area | 73 | /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area |
74 | 74 | ||
75 | /*virtual*/ U32 getPartitionType() const; | 75 | /*virtual*/ U32 getPartitionType() const; |
diff --git a/linden/indra/newview/llwaterparammanager.cpp b/linden/indra/newview/llwaterparammanager.cpp index 8ef11be..e01506e 100644 --- a/linden/indra/newview/llwaterparammanager.cpp +++ b/linden/indra/newview/llwaterparammanager.cpp | |||
@@ -407,7 +407,8 @@ void LLWaterParamManager::update(LLViewerCamera * cam) | |||
407 | LLFloaterWater::instance()->syncMenu(); | 407 | LLFloaterWater::instance()->syncMenu(); |
408 | } | 408 | } |
409 | 409 | ||
410 | //stop_glerror(); | 410 | stop_glerror(); |
411 | |||
411 | // only do this if we're dealing with shaders | 412 | // only do this if we're dealing with shaders |
412 | if(gPipeline.canUseVertexShaders()) | 413 | if(gPipeline.canUseVertexShaders()) |
413 | { | 414 | { |
diff --git a/linden/indra/newview/llwlparammanager.cpp b/linden/indra/newview/llwlparammanager.cpp index 09f7d01..31471d7 100644 --- a/linden/indra/newview/llwlparammanager.cpp +++ b/linden/indra/newview/llwlparammanager.cpp | |||
@@ -539,7 +539,8 @@ void LLWLParamManager::update(LLViewerCamera * cam) | |||
539 | 539 | ||
540 | F32 camYaw = cam->getYaw(); | 540 | F32 camYaw = cam->getYaw(); |
541 | 541 | ||
542 | //stop_glerror(); | 542 | stop_glerror(); |
543 | |||
543 | // *TODO: potential optimization - this block may only need to be | 544 | // *TODO: potential optimization - this block may only need to be |
544 | // executed some of the time. For example for water shaders only. | 545 | // executed some of the time. For example for water shaders only. |
545 | { | 546 | { |
diff --git a/linden/indra/newview/llworld.h b/linden/indra/newview/llworld.h index 62374d5..2c5815c 100644 --- a/linden/indra/newview/llworld.h +++ b/linden/indra/newview/llworld.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * @file llworld.h | 2 | * @file llworld.h |
3 | * @brief Collection of viewer regions in the vacinity of the user. | 3 | * @brief Collection of viewer regions in the vacinity of the user. |
4 | * | 4 | * |
5 | * Represents the whole world, so far as 3D functionality is concerned. | 5 | * Represents the whole world, so far as 3D functionality is conserned. |
6 | * Always contains the region that the user's avatar is in along with | 6 | * Always contains the region that the user's avatar is in along with |
7 | * neighboring regions. As the user crosses region boundaries, new | 7 | * neighboring regions. As the user crosses region boundaries, new |
8 | * regions are added to the world and distant ones are rolled up. | 8 | * regions are added to the world and distant ones are rolled up. |
@@ -152,8 +152,7 @@ public: | |||
152 | 152 | ||
153 | public: | 153 | public: |
154 | typedef std::list<LLViewerRegion*> region_list_t; | 154 | typedef std::list<LLViewerRegion*> region_list_t; |
155 | region_list_t mActiveRegionList; // KL SD branch public not private | 155 | const region_list_t& getRegionList() const { return mActiveRegionList; } |
156 | region_list_t& getRegionList() { return mActiveRegionList; } | ||
157 | 156 | ||
158 | // Returns lists of avatar IDs and their world-space positions within a given distance of a point. | 157 | // Returns lists of avatar IDs and their world-space positions within a given distance of a point. |
159 | // All arguments are optional. Given containers will be emptied and then filled. | 158 | // All arguments are optional. Given containers will be emptied and then filled. |
@@ -164,6 +163,7 @@ public: | |||
164 | const LLVector3d& relative_to = LLVector3d(), F32 radius = FLT_MAX) const; | 163 | const LLVector3d& relative_to = LLVector3d(), F32 radius = FLT_MAX) const; |
165 | 164 | ||
166 | private: | 165 | private: |
166 | region_list_t mActiveRegionList; | ||
167 | region_list_t mRegionList; | 167 | region_list_t mRegionList; |
168 | region_list_t mVisibleRegionList; | 168 | region_list_t mVisibleRegionList; |
169 | region_list_t mCulledRegionList; | 169 | region_list_t mCulledRegionList; |
diff --git a/linden/indra/newview/pipeline.cpp b/linden/indra/newview/pipeline.cpp index 53d7e49..8dce5cf 100644 --- a/linden/indra/newview/pipeline.cpp +++ b/linden/indra/newview/pipeline.cpp | |||
@@ -159,8 +159,6 @@ std::string gPoolNames[] = | |||
159 | "POOL_ALPHA", | 159 | "POOL_ALPHA", |
160 | }; | 160 | }; |
161 | 161 | ||
162 | void drawBox(const LLVector3& c, const LLVector3& r); | ||
163 | |||
164 | U32 nhpo2(U32 v) | 162 | U32 nhpo2(U32 v) |
165 | { | 163 | { |
166 | U32 r = 1; | 164 | U32 r = 1; |
@@ -269,11 +267,11 @@ static const U32 gl_cube_face[] = | |||
269 | 267 | ||
270 | void validate_framebuffer_object(); | 268 | void validate_framebuffer_object(); |
271 | 269 | ||
272 | |||
273 | void addDeferredAttachments(LLRenderTarget& target) | 270 | void addDeferredAttachments(LLRenderTarget& target) |
274 | { | 271 | { |
275 | target.addColorAttachment(GL_RGBA); //specular //target.addColorAttachment(GL_RGBA16F_ARB); //specular // KL | 272 | target.addColorAttachment(GL_RGBA16F_ARB); //specular |
276 | target.addColorAttachment(GL_RGBA); //normal+z //target.addColorAttachment(GL_RGBA16F_ARB); //normal+z | 273 | target.addColorAttachment(GL_RGBA16F_ARB); //normal+z |
274 | target.addColorAttachment(GL_RGBA16F_ARB); //position | ||
277 | } | 275 | } |
278 | 276 | ||
279 | LLPipeline::LLPipeline() : | 277 | LLPipeline::LLPipeline() : |
@@ -315,8 +313,6 @@ LLPipeline::LLPipeline() : | |||
315 | mLightingDetail(0) | 313 | mLightingDetail(0) |
316 | { | 314 | { |
317 | mNoiseMap = 0; | 315 | mNoiseMap = 0; |
318 | //mTrueNoiseMap = 0; // KL SD | ||
319 | mLightFunc = 0; // KL SD | ||
320 | } | 316 | } |
321 | 317 | ||
322 | void LLPipeline::init() | 318 | void LLPipeline::init() |
@@ -366,11 +362,6 @@ void LLPipeline::init() | |||
366 | LLViewerShaderMgr::instance()->setShaders(); | 362 | LLViewerShaderMgr::instance()->setShaders(); |
367 | 363 | ||
368 | stop_glerror(); | 364 | stop_glerror(); |
369 | |||
370 | for (U32 i = 0; i < 2; ++i) | ||
371 | { | ||
372 | mSpotLightFade[i] = 1.f; | ||
373 | } | ||
374 | } | 365 | } |
375 | 366 | ||
376 | LLPipeline::~LLPipeline() | 367 | LLPipeline::~LLPipeline() |
@@ -382,9 +373,6 @@ void LLPipeline::cleanup() | |||
382 | { | 373 | { |
383 | assertInitialized(); | 374 | assertInitialized(); |
384 | 375 | ||
385 | mGroupQ1.clear() ; | ||
386 | mGroupQ2.clear() ; | ||
387 | |||
388 | for(pool_set_t::iterator iter = mPools.begin(); | 376 | for(pool_set_t::iterator iter = mPools.begin(); |
389 | iter != mPools.end(); ) | 377 | iter != mPools.end(); ) |
390 | { | 378 | { |
@@ -481,69 +469,33 @@ void LLPipeline::resizeScreenTexture() | |||
481 | GLuint resX = gViewerWindow->getWindowDisplayWidth(); | 469 | GLuint resX = gViewerWindow->getWindowDisplayWidth(); |
482 | GLuint resY = gViewerWindow->getWindowDisplayHeight(); | 470 | GLuint resY = gViewerWindow->getWindowDisplayHeight(); |
483 | 471 | ||
484 | allocateScreenBuffer(resX,resY); | ||
485 | } | ||
486 | } | ||
487 | |||
488 | void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) | ||
489 | { | ||
490 | |||
491 | U32 samples = gSavedSettings.getU32("RenderFSAASamples"); | ||
492 | U32 res_mod = gSavedSettings.getU32("RenderResolutionDivisor"); | 472 | U32 res_mod = gSavedSettings.getU32("RenderResolutionDivisor"); |
493 | |||
494 | if (res_mod > 1 && res_mod < resX && res_mod < resY) | 473 | if (res_mod > 1 && res_mod < resX && res_mod < resY) |
495 | { | 474 | { |
496 | resX /= res_mod; | 475 | resX /= res_mod; |
497 | resY /= res_mod; | 476 | resY /= res_mod; |
498 | } | 477 | } |
499 | 478 | ||
500 | if (gSavedSettings.getBOOL("RenderUIBuffer")) | 479 | allocateScreenBuffer(resX,resY); |
501 | { | ||
502 | //mUIScreen.allocate(resX,resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE); | ||
503 | } | ||
504 | 480 | ||
481 | llinfos << "RESIZED SCREEN TEXTURE: " << resX << "x" << resY << llendl; | ||
482 | } | ||
483 | } | ||
484 | |||
485 | void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) | ||
486 | { | ||
487 | U32 samples = gSavedSettings.getU32("RenderFSAASamples"); | ||
505 | if (LLPipeline::sRenderDeferred) | 488 | if (LLPipeline::sRenderDeferred) |
506 | { | 489 | { |
507 | //allocate deferred rendering color buffers | 490 | //allocate deferred rendering color buffers |
508 | mDeferredScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE); | 491 | mDeferredScreen.allocate(resX, resY, GL_RGBA16F_ARB, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE); |
509 | mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE); | ||
510 | addDeferredAttachments(mDeferredScreen); | 492 | addDeferredAttachments(mDeferredScreen); |
493 | mScreen.allocate(resX, resY, GL_RGBA16F_ARB, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE); | ||
511 | 494 | ||
512 | // always set viewport to desired size, since allocate resets the viewport | ||
513 | |||
514 | mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE); | ||
515 | |||
516 | for (U32 i = 0; i < 3; i++) | ||
517 | { | ||
518 | mDeferredLight[i].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE); | ||
519 | } | ||
520 | |||
521 | for (U32 i = 0; i < 2; i++) | 495 | for (U32 i = 0; i < 2; i++) |
522 | { | 496 | { |
523 | mGIMapPost[i].allocate(resX,resY, GL_RGB, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE); | 497 | mDeferredLight[i].allocate(resX, resY, GL_RGB, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE); |
524 | } | ||
525 | |||
526 | F32 scale = gSavedSettings.getF32("RenderShadowResolutionScale"); | ||
527 | |||
528 | for (U32 i = 0; i < 4; i++) | ||
529 | { | ||
530 | mShadow[i].allocate(U32(resX*scale),U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE); | ||
531 | } | ||
532 | |||
533 | |||
534 | U32 width = nhpo2(U32(resX*scale))/2; | ||
535 | U32 height = width; | ||
536 | |||
537 | for (U32 i = 4; i < 6; i++) | ||
538 | { | ||
539 | mShadow[i].allocate(width, height, 0, TRUE, FALSE); | ||
540 | } | 498 | } |
541 | |||
542 | |||
543 | |||
544 | width = nhpo2(resX)/2; | ||
545 | height = nhpo2(resY)/2; | ||
546 | mLuminanceMap.allocate(width,height, GL_RGBA, FALSE, FALSE); | ||
547 | } | 499 | } |
548 | else | 500 | else |
549 | { | 501 | { |
@@ -553,23 +505,25 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) | |||
553 | 505 | ||
554 | if (gGLManager.mHasFramebufferMultisample && samples > 1) | 506 | if (gGLManager.mHasFramebufferMultisample && samples > 1) |
555 | { | 507 | { |
556 | mSampleBuffer.allocate(resX,resY,GL_RGBA,TRUE,TRUE,LLTexUnit::TT_RECT_TEXTURE,FALSE,samples); | ||
557 | if (LLPipeline::sRenderDeferred) | 508 | if (LLPipeline::sRenderDeferred) |
558 | { | 509 | { |
510 | mSampleBuffer.allocate(resX,resY,GL_RGBA16F_ARB,TRUE,TRUE,LLTexUnit::TT_RECT_TEXTURE,FALSE,samples); | ||
559 | addDeferredAttachments(mSampleBuffer); | 511 | addDeferredAttachments(mSampleBuffer); |
560 | mDeferredScreen.setSampleBuffer(&mSampleBuffer); | 512 | mDeferredScreen.setSampleBuffer(&mSampleBuffer); |
561 | } | 513 | } |
514 | else | ||
515 | { | ||
516 | mSampleBuffer.allocate(resX,resY,GL_RGBA,TRUE,TRUE,LLTexUnit::TT_RECT_TEXTURE,FALSE,samples); | ||
517 | } | ||
562 | 518 | ||
563 | mScreen.setSampleBuffer(&mSampleBuffer); | 519 | mScreen.setSampleBuffer(&mSampleBuffer); |
564 | |||
565 | stop_glerror(); | 520 | stop_glerror(); |
566 | } | 521 | } |
567 | 522 | else if (LLPipeline::sRenderDeferred) | |
568 | if (LLPipeline::sRenderDeferred) | ||
569 | { //share depth buffer between deferred targets | 523 | { //share depth buffer between deferred targets |
570 | mDeferredScreen.shareDepthBuffer(mScreen); | 524 | mDeferredScreen.shareDepthBuffer(mScreen); |
571 | for (U32 i = 0; i < 3; i++) | 525 | for (U32 i = 0; i < 2; i++) |
572 | { //share stencil buffer with screen space lightmap to stencil out sky | 526 | { |
573 | mDeferredScreen.shareDepthBuffer(mDeferredLight[i]); | 527 | mDeferredScreen.shareDepthBuffer(mDeferredLight[i]); |
574 | } | 528 | } |
575 | } | 529 | } |
@@ -602,40 +556,17 @@ void LLPipeline::releaseGLBuffers() | |||
602 | mNoiseMap = 0; | 556 | mNoiseMap = 0; |
603 | } | 557 | } |
604 | 558 | ||
605 | /* if (mTrueNoiseMap) | ||
606 | { | ||
607 | LLImageGL::deleteTextures(1, &mTrueNoiseMap); | ||
608 | mTrueNoiseMap = 0; | ||
609 | } | ||
610 | */ | ||
611 | if (mLightFunc) | ||
612 | { | ||
613 | LLImageGL::deleteTextures(1, &mLightFunc); | ||
614 | mLightFunc = 0; | ||
615 | } | ||
616 | |||
617 | mWaterRef.release(); | 559 | mWaterRef.release(); |
618 | mWaterDis.release(); | 560 | mWaterDis.release(); |
619 | mScreen.release(); | 561 | mScreen.release(); |
620 | mSampleBuffer.releaseSampleBuffer(); | 562 | mSampleBuffer.releaseSampleBuffer(); |
621 | mDeferredScreen.release(); | 563 | mDeferredScreen.release(); |
622 | mDeferredDepth.release(); | ||
623 | for (U32 i = 0; i < 3; i++) | ||
624 | { | ||
625 | mDeferredLight[i].release(); | ||
626 | } | ||
627 | |||
628 | mGIMap.release(); | ||
629 | mGIMapPost[0].release(); | ||
630 | mGIMapPost[1].release(); | ||
631 | mHighlight.release(); | ||
632 | // mLuminanceMap.release(); | ||
633 | 564 | ||
634 | for (U32 i = 0; i < 6; i++) // KL 6 in SD | 565 | |
566 | for (U32 i = 0; i < 4; i++) | ||
635 | { | 567 | { |
636 | mShadow[i].release(); | 568 | mSunShadow[i].release(); |
637 | } | 569 | } |
638 | |||
639 | for (U32 i = 0; i < 3; i++) | 570 | for (U32 i = 0; i < 3; i++) |
640 | { | 571 | { |
641 | mGlow[i].release(); | 572 | mGlow[i].release(); |
@@ -658,13 +589,9 @@ void LLPipeline::createGLBuffers() | |||
658 | mWaterDis.allocate(res,res,GL_RGBA,TRUE,FALSE); | 589 | mWaterDis.allocate(res,res,GL_RGBA,TRUE,FALSE); |
659 | } | 590 | } |
660 | 591 | ||
661 | mHighlight.allocate(256,256,GL_RGBA, FALSE, FALSE); | ||
662 | 592 | ||
663 | stop_glerror(); | 593 | stop_glerror(); |
664 | 594 | ||
665 | GLuint resX = gViewerWindow->getWindowDisplayWidth(); | ||
666 | GLuint resY = gViewerWindow->getWindowDisplayHeight(); | ||
667 | |||
668 | if (LLPipeline::sRenderGlow) | 595 | if (LLPipeline::sRenderGlow) |
669 | { //screen space glow buffers | 596 | { //screen space glow buffers |
670 | const U32 glow_res = llmax(1, | 597 | const U32 glow_res = llmax(1, |
@@ -674,13 +601,20 @@ void LLPipeline::createGLBuffers() | |||
674 | { | 601 | { |
675 | mGlow[i].allocate(512,glow_res,GL_RGBA,FALSE,FALSE); | 602 | mGlow[i].allocate(512,glow_res,GL_RGBA,FALSE,FALSE); |
676 | } | 603 | } |
604 | } | ||
677 | 605 | ||
606 | GLuint resX = gViewerWindow->getWindowDisplayWidth(); | ||
607 | GLuint resY = gViewerWindow->getWindowDisplayHeight(); | ||
608 | |||
678 | allocateScreenBuffer(resX,resY); | 609 | allocateScreenBuffer(resX,resY); |
679 | 610 | ||
680 | } | ||
681 | |||
682 | if (sRenderDeferred) | 611 | if (sRenderDeferred) |
683 | { | 612 | { |
613 | mSunShadow[0].allocate(1024,1024, 0, TRUE, FALSE); | ||
614 | mSunShadow[1].allocate(1024,1024, 0, TRUE, FALSE); | ||
615 | mSunShadow[2].allocate(1024,1024, 0, TRUE, FALSE); | ||
616 | mSunShadow[3].allocate(1024,1024, 0, TRUE, FALSE); | ||
617 | |||
684 | if (!mNoiseMap) | 618 | if (!mNoiseMap) |
685 | { | 619 | { |
686 | const U32 noiseRes = 128; | 620 | const U32 noiseRes = 128; |
@@ -700,83 +634,7 @@ void LLPipeline::createGLBuffers() | |||
700 | LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F_ARB, noiseRes, noiseRes, GL_RGB, GL_FLOAT, noise); | 634 | LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F_ARB, noiseRes, noiseRes, GL_RGB, GL_FLOAT, noise); |
701 | gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); | 635 | gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); |
702 | } | 636 | } |
703 | |||
704 | /* if (!mTrueNoiseMap) | ||
705 | { | ||
706 | const U32 noiseRes = 128; | ||
707 | F32 noise[noiseRes*noiseRes*3]; | ||
708 | for (U32 i = 0; i < noiseRes*noiseRes*3; i++) | ||
709 | { | ||
710 | noise[i] = ll_frand()*2.0-1.0; | ||
711 | } | 637 | } |
712 | |||
713 | LLImageGL::generateTextures(1, &mTrueNoiseMap); | ||
714 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mTrueNoiseMap); | ||
715 | LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F_ARB, noiseRes, noiseRes, GL_RGB,GL_FLOAT, noise); | ||
716 | gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); | ||
717 | } | ||
718 | */ | ||
719 | if (!mLightFunc) | ||
720 | { | ||
721 | U32 lightResX = gSavedSettings.getU32("RenderSpecularResX"); | ||
722 | U32 lightResY = gSavedSettings.getU32("RenderSpecularResY"); | ||
723 | U8* lg = new U8[lightResX*lightResY]; | ||
724 | |||
725 | for (U32 y = 0; y < lightResY; ++y) | ||
726 | { | ||
727 | for (U32 x = 0; x < lightResX; ++x) | ||
728 | { | ||
729 | //spec func | ||
730 | F32 sa = (F32) x/(lightResX-1); | ||
731 | F32 spec = (F32) y/(lightResY-1); | ||
732 | //lg[y*lightResX+x] = (U8) (powf(sa, 128.f*spec*spec)*255); | ||
733 | |||
734 | //F32 sp = acosf(sa)/(1.f-spec); | ||
735 | |||
736 | sa = powf(sa, gSavedSettings.getF32("RenderSpecularExponent")); | ||
737 | F32 a = acosf(sa*0.25f+0.75f); | ||
738 | F32 m = llmax(0.5f-spec*0.5f, 0.001f); | ||
739 | F32 t2 = tanf(a)/m; | ||
740 | t2 *= t2; | ||
741 | |||
742 | F32 c4a = (3.f+4.f*cosf(2.f*a)+cosf(4.f*a))/8.f; | ||
743 | F32 bd = 1.f/(4.f*m*m*c4a)*powf(F_E, -t2); | ||
744 | |||
745 | lg[y*lightResX+x] = (U8) (llclamp(bd, 0.f, 1.f)*255); | ||
746 | } | ||
747 | } | ||
748 | |||
749 | LLImageGL::generateTextures(1, &mLightFunc); | ||
750 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLightFunc); | ||
751 | LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_ALPHA, lightResX, lightResY, GL_ALPHA, GL_UNSIGNED_BYTE, lg); | ||
752 | gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); | ||
753 | gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR); | ||
754 | |||
755 | delete [] lg; | ||
756 | /* } | ||
757 | |||
758 | if (gSavedSettings.getBOOL("RenderDeferredGI")) | ||
759 | { */ | ||
760 | mGIMap.allocate(1024,1024,GL_RGBA, TRUE, FALSE); | ||
761 | addDeferredAttachments(mGIMap); | ||
762 | |||
763 | { | ||
764 | LLGLDepthTest depth(GL_TRUE); | ||
765 | gGL.setColorMask(true, true); | ||
766 | for (U32 i = 0; i < 2; i++) | ||
767 | { | ||
768 | mGIMapPost[i].allocate(128,128,GL_RGB16F_ARB, FALSE, FALSE); | ||
769 | mGIMapPost[i].addColorAttachment(GL_RGB16F_ARB); | ||
770 | mGIMapPost[i].addColorAttachment(GL_RGB16F_ARB); | ||
771 | mGIMapPost[i].addColorAttachment(GL_RGB16F_ARB); | ||
772 | |||
773 | mGIMapPost[i].bindTarget(); | ||
774 | mGIMapPost[i].clear(); | ||
775 | mGIMapPost[i].flush(); | ||
776 | } | ||
777 | } | ||
778 | } | ||
779 | } //mLuminanceMap.allocate(128,128, GL_RGBA, FALSE, FALSE); | ||
780 | } | 638 | } |
781 | 639 | ||
782 | void LLPipeline::restoreGL() | 640 | void LLPipeline::restoreGL() |
@@ -788,7 +646,7 @@ void LLPipeline::restoreGL() | |||
788 | LLViewerShaderMgr::instance()->setShaders(); | 646 | LLViewerShaderMgr::instance()->setShaders(); |
789 | } | 647 | } |
790 | 648 | ||
791 | for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); | 649 | for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); |
792 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) | 650 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) |
793 | { | 651 | { |
794 | LLViewerRegion* region = *iter; | 652 | LLViewerRegion* region = *iter; |
@@ -842,7 +700,7 @@ void LLPipeline::unloadShaders() | |||
842 | 700 | ||
843 | void LLPipeline::assertInitializedDoError() | 701 | void LLPipeline::assertInitializedDoError() |
844 | { | 702 | { |
845 | llwarns << "LLPipeline used when uninitialized." << llendl; | 703 | llerrs << "LLPipeline used when uninitialized." << llendl; |
846 | } | 704 | } |
847 | 705 | ||
848 | //============================================================================ | 706 | //============================================================================ |
@@ -905,7 +763,7 @@ public: | |||
905 | for (LLSpatialGroup::drawmap_elem_t::iterator j = i->second.begin(); j != i->second.end(); ++j) | 763 | for (LLSpatialGroup::drawmap_elem_t::iterator j = i->second.begin(); j != i->second.end(); ++j) |
906 | { | 764 | { |
907 | LLDrawInfo* params = *j; | 765 | LLDrawInfo* params = *j; |
908 | if (mTextures.find(params->mViewerTexture) != mTextures.end()) | 766 | if (mTextures.find(params->mTexture) != mTextures.end()) |
909 | { | 767 | { |
910 | group->setState(LLSpatialGroup::GEOM_DIRTY); | 768 | group->setState(LLSpatialGroup::GEOM_DIRTY); |
911 | } | 769 | } |
@@ -939,7 +797,7 @@ void LLPipeline::dirtyPoolObjectTextures(const std::set<LLViewerImage*>& texture | |||
939 | } | 797 | } |
940 | 798 | ||
941 | LLOctreeDirtyTexture dirty(textures); | 799 | LLOctreeDirtyTexture dirty(textures); |
942 | for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); | 800 | for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); |
943 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) | 801 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) |
944 | { | 802 | { |
945 | LLViewerRegion* region = *iter; | 803 | LLViewerRegion* region = *iter; |
@@ -1018,7 +876,7 @@ LLDrawPool *LLPipeline::findPool(const U32 type, LLViewerImage *tex0) | |||
1018 | 876 | ||
1019 | default: | 877 | default: |
1020 | llassert(0); | 878 | llassert(0); |
1021 | llwarns << "Invalid Pool Type in LLPipeline::findPool() type=" << type << llendl; | 879 | llerrs << "Invalid Pool Type in LLPipeline::findPool() type=" << type << llendl; |
1022 | break; | 880 | break; |
1023 | } | 881 | } |
1024 | 882 | ||
@@ -1133,7 +991,7 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable) | |||
1133 | #ifdef LL_RELEASE_FOR_DOWNLOAD | 991 | #ifdef LL_RELEASE_FOR_DOWNLOAD |
1134 | llwarns << "Couldn't remove object from spatial group!" << llendl; | 992 | llwarns << "Couldn't remove object from spatial group!" << llendl; |
1135 | #else | 993 | #else |
1136 | llwarns << "Couldn't remove object from spatial group!" << llendl; | 994 | llerrs << "Couldn't remove object from spatial group!" << llendl; |
1137 | #endif | 995 | #endif |
1138 | } | 996 | } |
1139 | } | 997 | } |
@@ -1148,31 +1006,6 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable) | |||
1148 | break; | 1006 | break; |
1149 | } | 1007 | } |
1150 | } | 1008 | } |
1151 | |||
1152 | { | ||
1153 | HighlightItem item(drawablep); | ||
1154 | mHighlightSet.erase(item); | ||
1155 | |||
1156 | if (mHighlightObject == drawablep) | ||
1157 | { | ||
1158 | mHighlightObject = NULL; | ||
1159 | } | ||
1160 | } | ||
1161 | |||
1162 | for (U32 i = 0; i < 2; ++i) | ||
1163 | { | ||
1164 | if (mShadowSpotLight[i] == drawablep) | ||
1165 | { | ||
1166 | mShadowSpotLight[i] = NULL; | ||
1167 | } | ||
1168 | |||
1169 | if (mTargetShadowSpotLight[i] == drawablep) | ||
1170 | { | ||
1171 | mTargetShadowSpotLight[i] = NULL; | ||
1172 | } | ||
1173 | } | ||
1174 | |||
1175 | |||
1176 | } | 1009 | } |
1177 | 1010 | ||
1178 | U32 LLPipeline::addObject(LLViewerObject *vobj) | 1011 | U32 LLPipeline::addObject(LLViewerObject *vobj) |
@@ -1229,7 +1062,7 @@ void LLPipeline::createObject(LLViewerObject* vobj) | |||
1229 | } | 1062 | } |
1230 | else | 1063 | else |
1231 | { | 1064 | { |
1232 | llwarns << "Redundant drawable creation!" << llendl; | 1065 | llerrs << "Redundant drawable creation!" << llendl; |
1233 | } | 1066 | } |
1234 | 1067 | ||
1235 | llassert(drawablep); | 1068 | llassert(drawablep); |
@@ -1293,7 +1126,7 @@ void LLPipeline::updateMoveDampedAsync(LLDrawable* drawablep) | |||
1293 | } | 1126 | } |
1294 | if (!drawablep) | 1127 | if (!drawablep) |
1295 | { | 1128 | { |
1296 | llwarns << "updateMove called with NULL drawablep" << llendl; | 1129 | llerrs << "updateMove called with NULL drawablep" << llendl; |
1297 | return; | 1130 | return; |
1298 | } | 1131 | } |
1299 | if (drawablep->isState(LLDrawable::EARLY_MOVE)) | 1132 | if (drawablep->isState(LLDrawable::EARLY_MOVE)) |
@@ -1324,8 +1157,7 @@ void LLPipeline::updateMoveNormalAsync(LLDrawable* drawablep) | |||
1324 | } | 1157 | } |
1325 | if (!drawablep) | 1158 | if (!drawablep) |
1326 | { | 1159 | { |
1327 | llwarns << "updateMove called with NULL drawablep" << llendl; | 1160 | llerrs << "updateMove called with NULL drawablep" << llendl; |
1328 | return; | ||
1329 | } | 1161 | } |
1330 | if (drawablep->isState(LLDrawable::EARLY_MOVE)) | 1162 | if (drawablep->isState(LLDrawable::EARLY_MOVE)) |
1331 | { | 1163 | { |
@@ -1418,7 +1250,7 @@ void LLPipeline::updateMove() | |||
1418 | { | 1250 | { |
1419 | LLFastTimer ot(LLFastTimer::FTM_OCTREE_BALANCE); | 1251 | LLFastTimer ot(LLFastTimer::FTM_OCTREE_BALANCE); |
1420 | 1252 | ||
1421 | for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); | 1253 | for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); |
1422 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) | 1254 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) |
1423 | { | 1255 | { |
1424 | LLViewerRegion* region = *iter; | 1256 | LLViewerRegion* region = *iter; |
@@ -1445,6 +1277,7 @@ F32 LLPipeline::calcPixelArea(LLVector3 center, LLVector3 size, LLCamera &camera | |||
1445 | F32 dist = lookAt.length(); | 1277 | F32 dist = lookAt.length(); |
1446 | 1278 | ||
1447 | //ramp down distance for nearby objects | 1279 | //ramp down distance for nearby objects |
1280 | //shrink dist by dist/16. | ||
1448 | if (dist < 16.f) | 1281 | if (dist < 16.f) |
1449 | { | 1282 | { |
1450 | dist /= 16.f; | 1283 | dist /= 16.f; |
@@ -1465,7 +1298,7 @@ void LLPipeline::grabReferences(LLCullResult& result) | |||
1465 | 1298 | ||
1466 | BOOL LLPipeline::visibleObjectsInFrustum(LLCamera& camera) | 1299 | BOOL LLPipeline::visibleObjectsInFrustum(LLCamera& camera) |
1467 | { | 1300 | { |
1468 | for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); | 1301 | for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); |
1469 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) | 1302 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) |
1470 | { | 1303 | { |
1471 | LLViewerRegion* region = *iter; | 1304 | LLViewerRegion* region = *iter; |
@@ -1497,7 +1330,7 @@ BOOL LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3& | |||
1497 | 1330 | ||
1498 | BOOL res = TRUE; | 1331 | BOOL res = TRUE; |
1499 | 1332 | ||
1500 | for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); | 1333 | for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); |
1501 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) | 1334 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) |
1502 | { | 1335 | { |
1503 | LLViewerRegion* region = *iter; | 1336 | LLViewerRegion* region = *iter; |
@@ -1560,7 +1393,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl | |||
1560 | 1393 | ||
1561 | LLGLDepthTest depth(GL_TRUE, GL_FALSE); | 1394 | LLGLDepthTest depth(GL_TRUE, GL_FALSE); |
1562 | 1395 | ||
1563 | for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); | 1396 | for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); |
1564 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) | 1397 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) |
1565 | { | 1398 | { |
1566 | LLViewerRegion* region = *iter; | 1399 | LLViewerRegion* region = *iter; |
@@ -1637,7 +1470,7 @@ void LLPipeline::markNotCulled(LLSpatialGroup* group, LLCamera& camera) | |||
1637 | 1470 | ||
1638 | group->setVisible(); | 1471 | group->setVisible(); |
1639 | 1472 | ||
1640 | if (!sSkipUpdate) // && !sShadowRender) KL? | 1473 | if (!sSkipUpdate) |
1641 | { | 1474 | { |
1642 | group->updateDistance(camera); | 1475 | group->updateDistance(camera); |
1643 | } | 1476 | } |
@@ -1728,78 +1561,6 @@ BOOL LLPipeline::updateDrawableGeom(LLDrawable* drawablep, BOOL priority) | |||
1728 | return update_complete; | 1561 | return update_complete; |
1729 | } | 1562 | } |
1730 | 1563 | ||
1731 | void LLPipeline::updateGL() // KL SD | ||
1732 | { | ||
1733 | while (!LLGLUpdate::sGLQ.empty()) | ||
1734 | { | ||
1735 | LLGLUpdate* glu = LLGLUpdate::sGLQ.front(); | ||
1736 | glu->updateGL(); | ||
1737 | glu->mInQ = FALSE; | ||
1738 | LLGLUpdate::sGLQ.pop_front(); | ||
1739 | } | ||
1740 | } // KL updateGL SD | ||
1741 | |||
1742 | void LLPipeline::rebuildPriorityGroups() | ||
1743 | { | ||
1744 | LLTimer update_timer; | ||
1745 | LLMemType mt(LLMemType::MTYPE_PIPELINE); | ||
1746 | |||
1747 | assertInitialized(); | ||
1748 | |||
1749 | // Iterate through all drawables on the priority build queue, | ||
1750 | for (LLSpatialGroup::sg_list_t::iterator iter = mGroupQ1.begin(); | ||
1751 | iter != mGroupQ1.end(); ++iter) | ||
1752 | { | ||
1753 | LLSpatialGroup* group = *iter; | ||
1754 | group->rebuildGeom(); | ||
1755 | group->clearState(LLSpatialGroup::IN_BUILD_Q1); | ||
1756 | } | ||
1757 | |||
1758 | mGroupQ1.clear(); | ||
1759 | } | ||
1760 | |||
1761 | void LLPipeline::rebuildGroups() | ||
1762 | { | ||
1763 | // Iterate through some drawables on the non-priority build queue | ||
1764 | S32 size = (S32) mGroupQ2.size(); | ||
1765 | S32 min_count = llclamp((S32) ((F32) (size * size)/4096*0.25f), 1, size); | ||
1766 | |||
1767 | S32 count = 0; | ||
1768 | |||
1769 | std::sort(mGroupQ2.begin(), mGroupQ2.end(), LLSpatialGroup::CompareUpdateUrgency()); // KL | ||
1770 | |||
1771 | LLSpatialGroup::sg_vector_t::iterator iter; | ||
1772 | for (iter = mGroupQ2.begin(); | ||
1773 | iter != mGroupQ2.end(); ++iter) | ||
1774 | { | ||
1775 | LLSpatialGroup* group = *iter; | ||
1776 | |||
1777 | if (group->isDead()) | ||
1778 | { | ||
1779 | continue; | ||
1780 | } | ||
1781 | |||
1782 | group->rebuildGeom(); | ||
1783 | |||
1784 | if (group->mSpatialPartition->mRenderByGroup) | ||
1785 | { | ||
1786 | count++; | ||
1787 | } | ||
1788 | |||
1789 | group->clearState(LLSpatialGroup::IN_BUILD_Q2); | ||
1790 | |||
1791 | if (count > min_count) | ||
1792 | { | ||
1793 | ++iter; | ||
1794 | break; | ||
1795 | } | ||
1796 | } | ||
1797 | |||
1798 | mGroupQ2.erase(mGroupQ2.begin(), iter); | ||
1799 | |||
1800 | updateMovedList(mMovedBridge); | ||
1801 | } | ||
1802 | |||
1803 | void LLPipeline::updateGeom(F32 max_dtime) | 1564 | void LLPipeline::updateGeom(F32 max_dtime) |
1804 | { | 1565 | { |
1805 | LLTimer update_timer; | 1566 | LLTimer update_timer; |
@@ -1914,16 +1675,6 @@ void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera) | |||
1914 | 1675 | ||
1915 | if (drawablep->isSpatialBridge()) | 1676 | if (drawablep->isSpatialBridge()) |
1916 | { | 1677 | { |
1917 | LLDrawable* root = ((LLSpatialBridge*) drawablep)->mDrawable; | ||
1918 | |||
1919 | if (root && root->getParent() && root->getVObj() && root->getVObj()->isAttachment()) | ||
1920 | { | ||
1921 | LLVOAvatar* av = root->getParent()->getVObj()->asAvatar(); | ||
1922 | if (av->isImpostor()) | ||
1923 | { | ||
1924 | return; | ||
1925 | } | ||
1926 | } | ||
1927 | sCull->pushBridge((LLSpatialBridge*) drawablep); | 1678 | sCull->pushBridge((LLSpatialBridge*) drawablep); |
1928 | } | 1679 | } |
1929 | else | 1680 | else |
@@ -1940,7 +1691,7 @@ void LLPipeline::markMoved(LLDrawable *drawablep, BOOL damped_motion) | |||
1940 | 1691 | ||
1941 | if (!drawablep) | 1692 | if (!drawablep) |
1942 | { | 1693 | { |
1943 | //llwarns << "Sending null drawable to moved list!" << llendl; | 1694 | //llerrs << "Sending null drawable to moved list!" << llendl; |
1944 | return; | 1695 | return; |
1945 | } | 1696 | } |
1946 | 1697 | ||
@@ -2025,7 +1776,7 @@ void LLPipeline::shiftObjects(const LLVector3 &offset) | |||
2025 | } | 1776 | } |
2026 | mShiftList.resize(0); | 1777 | mShiftList.resize(0); |
2027 | 1778 | ||
2028 | for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); | 1779 | for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); |
2029 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) | 1780 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) |
2030 | { | 1781 | { |
2031 | LLViewerRegion* region = *iter; | 1782 | LLViewerRegion* region = *iter; |
@@ -2053,54 +1804,6 @@ void LLPipeline::markTextured(LLDrawable *drawablep) | |||
2053 | } | 1804 | } |
2054 | } | 1805 | } |
2055 | 1806 | ||
2056 | void LLPipeline::markGLRebuild(LLGLUpdate* glu) | ||
2057 | { | ||
2058 | if (glu && !glu->mInQ) | ||
2059 | { | ||
2060 | LLGLUpdate::sGLQ.push_back(glu); | ||
2061 | glu->mInQ = TRUE; | ||
2062 | } | ||
2063 | } | ||
2064 | |||
2065 | void LLPipeline::markRebuild(LLSpatialGroup* group, BOOL priority) | ||
2066 | { | ||
2067 | LLMemType mt(LLMemType::MTYPE_PIPELINE); | ||
2068 | //assert_main_thread(); | ||
2069 | |||
2070 | if (group && !group->isDead() && group->mSpatialPartition) | ||
2071 | { | ||
2072 | if (priority) | ||
2073 | { | ||
2074 | if (!group->isState(LLSpatialGroup::IN_BUILD_Q1)) | ||
2075 | { | ||
2076 | mGroupQ1.push_back(group); | ||
2077 | group->setState(LLSpatialGroup::IN_BUILD_Q1); | ||
2078 | |||
2079 | if (group->isState(LLSpatialGroup::IN_BUILD_Q2)) | ||
2080 | { | ||
2081 | LLSpatialGroup::sg_vector_t::iterator iter = std::find(mGroupQ2.begin(), mGroupQ2.end(), group); | ||
2082 | if (iter != mGroupQ2.end()) | ||
2083 | { | ||
2084 | mGroupQ2.erase(iter); | ||
2085 | } | ||
2086 | group->clearState(LLSpatialGroup::IN_BUILD_Q2); | ||
2087 | } | ||
2088 | } | ||
2089 | } | ||
2090 | else if (!group->isState(LLSpatialGroup::IN_BUILD_Q2 | LLSpatialGroup::IN_BUILD_Q1)) | ||
2091 | { | ||
2092 | //llwarns << "Non-priority updates not yet supported!" << llendl; | ||
2093 | if (std::find(mGroupQ2.begin(), mGroupQ2.end(), group) != mGroupQ2.end()) | ||
2094 | { | ||
2095 | llwarns << "WTF?" << llendl; | ||
2096 | } | ||
2097 | mGroupQ2.push_back(group); | ||
2098 | group->setState(LLSpatialGroup::IN_BUILD_Q2); | ||
2099 | |||
2100 | } | ||
2101 | } | ||
2102 | } | ||
2103 | |||
2104 | void LLPipeline::markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag, BOOL priority) | 1807 | void LLPipeline::markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag, BOOL priority) |
2105 | { | 1808 | { |
2106 | LLMemType mt(LLMemType::MTYPE_PIPELINE); | 1809 | LLMemType mt(LLMemType::MTYPE_PIPELINE); |
@@ -2156,13 +1859,12 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) | |||
2156 | 1859 | ||
2157 | grabReferences(result); | 1860 | grabReferences(result); |
2158 | 1861 | ||
2159 | //if (!LLPipeline::sShadowRender) | ||
2160 | { | 1862 | { |
2161 | for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) | 1863 | for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) |
2162 | { | 1864 | { |
2163 | LLSpatialGroup* group = *iter; | 1865 | LLSpatialGroup* group = *iter; |
2164 | group->checkOcclusion(); | 1866 | group->checkOcclusion(); |
2165 | if (sUseOcclusion > 1 && group->isState(LLSpatialGroup::OCCLUDED)) | 1867 | if (sUseOcclusion && group->isState(LLSpatialGroup::OCCLUDED)) |
2166 | { | 1868 | { |
2167 | markOccluder(group); | 1869 | markOccluder(group); |
2168 | } | 1870 | } |
@@ -2175,15 +1877,12 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) | |||
2175 | } | 1877 | } |
2176 | } | 1878 | } |
2177 | } | 1879 | } |
2178 | } | ||
2179 | 1880 | ||
2180 | if (!LLPipeline::sShadowRender) | ||
2181 | { | ||
2182 | for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) | 1881 | for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) |
2183 | { | 1882 | { |
2184 | LLSpatialGroup* group = *iter; | 1883 | LLSpatialGroup* group = *iter; |
2185 | group->checkOcclusion(); | 1884 | group->checkOcclusion(); |
2186 | if (sUseOcclusion > 1 && group->isState(LLSpatialGroup::OCCLUDED)) | 1885 | if (sUseOcclusion && group->isState(LLSpatialGroup::OCCLUDED)) |
2187 | { | 1886 | { |
2188 | markOccluder(group); | 1887 | markOccluder(group); |
2189 | } | 1888 | } |
@@ -2195,7 +1894,6 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) | |||
2195 | } | 1894 | } |
2196 | } | 1895 | } |
2197 | 1896 | ||
2198 | if (!LLPipeline::sShadowRender) | ||
2199 | { | 1897 | { |
2200 | for (LLCullResult::bridge_list_t::iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) | 1898 | for (LLCullResult::bridge_list_t::iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) |
2201 | { | 1899 | { |
@@ -2247,7 +1945,7 @@ void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera) | |||
2247 | void LLPipeline::stateSort(LLSpatialBridge* bridge, LLCamera& camera) | 1945 | void LLPipeline::stateSort(LLSpatialBridge* bridge, LLCamera& camera) |
2248 | { | 1946 | { |
2249 | LLMemType mt(LLMemType::MTYPE_PIPELINE); | 1947 | LLMemType mt(LLMemType::MTYPE_PIPELINE); |
2250 | if (!sSkipUpdate && !sShadowRender && bridge->getSpatialGroup()->changeLOD()) | 1948 | if (!sSkipUpdate && bridge->getSpatialGroup()->changeLOD()) |
2251 | { | 1949 | { |
2252 | bool force_update = false; | 1950 | bool force_update = false; |
2253 | bridge->updateDistance(camera, force_update); | 1951 | bridge->updateDistance(camera, force_update); |
@@ -2309,8 +2007,6 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) | |||
2309 | } | 2007 | } |
2310 | } | 2008 | } |
2311 | 2009 | ||
2312 | if (!sShadowRender) | ||
2313 | { | ||
2314 | LLSpatialGroup* group = drawablep->getSpatialGroup(); | 2010 | LLSpatialGroup* group = drawablep->getSpatialGroup(); |
2315 | if (!group || group->changeLOD()) | 2011 | if (!group || group->changeLOD()) |
2316 | { | 2012 | { |
@@ -2318,18 +2014,17 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) | |||
2318 | { | 2014 | { |
2319 | if (!drawablep->isActive()) | 2015 | if (!drawablep->isActive()) |
2320 | { | 2016 | { |
2321 | drawablep->updateDistance(camera, TRUE); | 2017 | bool force_update = false; |
2018 | drawablep->updateDistance(camera, force_update); | ||
2322 | } | 2019 | } |
2323 | else if (drawablep->isAvatar()) | 2020 | else if (drawablep->isAvatar()) |
2324 | { | 2021 | { |
2325 | drawablep->updateDistance(camera, TRUE); // calls vobj->updateLOD() which calls LLVOAvatar::updateVisibility() | 2022 | bool force_update = false; |
2023 | drawablep->updateDistance(camera, force_update); // calls vobj->updateLOD() which calls LLVOAvatar::updateVisibility() | ||
2326 | } | 2024 | } |
2327 | } | 2025 | } |
2328 | } | 2026 | } |
2329 | } | ||
2330 | 2027 | ||
2331 | if (!drawablep->getVOVolume()) | ||
2332 | { | ||
2333 | for (LLDrawable::face_list_t::iterator iter = drawablep->mFaces.begin(); | 2028 | for (LLDrawable::face_list_t::iterator iter = drawablep->mFaces.begin(); |
2334 | iter != drawablep->mFaces.end(); iter++) | 2029 | iter != drawablep->mFaces.end(); iter++) |
2335 | { | 2030 | { |
@@ -2347,8 +2042,6 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) | |||
2347 | } | 2042 | } |
2348 | } | 2043 | } |
2349 | } | 2044 | } |
2350 | } | ||
2351 | |||
2352 | 2045 | ||
2353 | mNumVisibleFaces += drawablep->getNumFaces(); | 2046 | mNumVisibleFaces += drawablep->getNumFaces(); |
2354 | } | 2047 | } |
@@ -2514,7 +2207,7 @@ void LLPipeline::postSort(LLCamera& camera) | |||
2514 | //rebuild groups | 2207 | //rebuild groups |
2515 | sCull->assertDrawMapsEmpty(); | 2208 | sCull->assertDrawMapsEmpty(); |
2516 | 2209 | ||
2517 | /*LLSpatialGroup::sNoDelete = FALSE; | 2210 | LLSpatialGroup::sNoDelete = FALSE; |
2518 | for (LLCullResult::sg_list_t::iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) | 2211 | for (LLCullResult::sg_list_t::iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) |
2519 | { | 2212 | { |
2520 | LLSpatialGroup* group = *i; | 2213 | LLSpatialGroup* group = *i; |
@@ -2526,11 +2219,9 @@ void LLPipeline::postSort(LLCamera& camera) | |||
2526 | 2219 | ||
2527 | group->rebuildGeom(); | 2220 | group->rebuildGeom(); |
2528 | } | 2221 | } |
2529 | LLSpatialGroup::sNoDelete = TRUE;*/ | 2222 | LLSpatialGroup::sNoDelete = TRUE; |
2530 | 2223 | ||
2531 | 2224 | ||
2532 | rebuildPriorityGroups(); | ||
2533 | |||
2534 | const S32 bin_count = 1024*8; | 2225 | const S32 bin_count = 1024*8; |
2535 | 2226 | ||
2536 | static LLCullResult::drawinfo_list_t alpha_bins[bin_count]; | 2227 | static LLCullResult::drawinfo_list_t alpha_bins[bin_count]; |
@@ -2555,28 +2246,17 @@ void LLPipeline::postSort(LLCamera& camera) | |||
2555 | { | 2246 | { |
2556 | continue; | 2247 | continue; |
2557 | } | 2248 | } |
2558 | 2249 | ||
2559 | if (group->isState(LLSpatialGroup::NEW_DRAWINFO) && group->isState(LLSpatialGroup::GEOM_DIRTY)) | ||
2560 | { //no way this group is going to be drawable without a rebuild | ||
2561 | group->rebuildGeom(); | ||
2562 | } | ||
2563 | |||
2564 | for (LLSpatialGroup::draw_map_t::iterator j = group->mDrawMap.begin(); j != group->mDrawMap.end(); ++j) | 2250 | for (LLSpatialGroup::draw_map_t::iterator j = group->mDrawMap.begin(); j != group->mDrawMap.end(); ++j) |
2565 | { | 2251 | { |
2566 | LLSpatialGroup::drawmap_elem_t& src_vec = j->second; | 2252 | LLSpatialGroup::drawmap_elem_t& src_vec = j->second; |
2567 | if (!hasRenderType(j->first)) | 2253 | |
2568 | { | ||
2569 | continue; | ||
2570 | } | ||
2571 | |||
2572 | for (LLSpatialGroup::drawmap_elem_t::iterator k = src_vec.begin(); k != src_vec.end(); ++k) | 2254 | for (LLSpatialGroup::drawmap_elem_t::iterator k = src_vec.begin(); k != src_vec.end(); ++k) |
2573 | { | 2255 | { |
2574 | sCull->pushDrawInfo(j->first, *k); | 2256 | sCull->pushDrawInfo(j->first, *k); |
2575 | } | 2257 | } |
2576 | } | 2258 | } |
2577 | 2259 | ||
2578 | if (hasRenderType(LLPipeline::RENDER_TYPE_PASS_ALPHA)) | ||
2579 | { | ||
2580 | LLSpatialGroup::draw_map_t::iterator alpha = group->mDrawMap.find(LLRenderPass::PASS_ALPHA); | 2260 | LLSpatialGroup::draw_map_t::iterator alpha = group->mDrawMap.find(LLRenderPass::PASS_ALPHA); |
2581 | 2261 | ||
2582 | if (alpha != group->mDrawMap.end()) | 2262 | if (alpha != group->mDrawMap.end()) |
@@ -2601,7 +2281,6 @@ void LLPipeline::postSort(LLCamera& camera) | |||
2601 | } | 2281 | } |
2602 | } | 2282 | } |
2603 | } | 2283 | } |
2604 | } | ||
2605 | 2284 | ||
2606 | if (!sShadowRender) | 2285 | if (!sShadowRender) |
2607 | { | 2286 | { |
@@ -2699,7 +2378,7 @@ void LLPipeline::postSort(LLCamera& camera) | |||
2699 | } | 2378 | } |
2700 | } | 2379 | } |
2701 | 2380 | ||
2702 | //LLSpatialGroup::sNoDelete = FALSE; | 2381 | LLSpatialGroup::sNoDelete = FALSE; |
2703 | } | 2382 | } |
2704 | 2383 | ||
2705 | 2384 | ||
@@ -2760,103 +2439,6 @@ void LLPipeline::renderHighlights() | |||
2760 | LLGLEnable color_mat(GL_COLOR_MATERIAL); | 2439 | LLGLEnable color_mat(GL_COLOR_MATERIAL); |
2761 | disableLights(); | 2440 | disableLights(); |
2762 | 2441 | ||
2763 | if (!hasRenderType(LLPipeline::RENDER_TYPE_HUD) && !mHighlightSet.empty()) | ||
2764 | { //draw blurry highlight image over screen | ||
2765 | LLGLEnable blend(GL_BLEND); | ||
2766 | LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS); | ||
2767 | LLGLDisable test(GL_ALPHA_TEST); | ||
2768 | |||
2769 | LLGLEnable stencil(GL_STENCIL_TEST); | ||
2770 | gGL.flush(); | ||
2771 | glStencilMask(0xFFFFFFFF); | ||
2772 | glClearStencil(1); | ||
2773 | glClear(GL_STENCIL_BUFFER_BIT); | ||
2774 | |||
2775 | glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFF); | ||
2776 | glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); | ||
2777 | |||
2778 | gGL.setColorMask(false, false); | ||
2779 | for (std::set<HighlightItem>::iterator iter = mHighlightSet.begin(); iter != mHighlightSet.end(); ++iter) | ||
2780 | { | ||
2781 | renderHighlight(iter->mItem->getVObj(), 1.f); | ||
2782 | } | ||
2783 | gGL.setColorMask(true, false); | ||
2784 | |||
2785 | glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); | ||
2786 | glStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF); | ||
2787 | |||
2788 | //gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); | ||
2789 | |||
2790 | gGL.pushMatrix(); | ||
2791 | glLoadIdentity(); | ||
2792 | glMatrixMode(GL_PROJECTION); | ||
2793 | gGL.pushMatrix(); | ||
2794 | glLoadIdentity(); | ||
2795 | |||
2796 | gGL.getTexUnit(0)->bind(&mHighlight); | ||
2797 | |||
2798 | LLVector2 tc1; | ||
2799 | LLVector2 tc2; | ||
2800 | |||
2801 | tc1.setVec(0,0); | ||
2802 | tc2.setVec(2,2); | ||
2803 | |||
2804 | gGL.begin(LLRender::TRIANGLES); | ||
2805 | |||
2806 | F32 scale = gSavedSettings.getF32("RenderHighlightBrightness"); | ||
2807 | LLColor4 color = gSavedSettings.getColor4("RenderHighlightColor"); | ||
2808 | F32 thickness = gSavedSettings.getF32("RenderHighlightThickness"); | ||
2809 | |||
2810 | for (S32 pass = 0; pass < 2; ++pass) | ||
2811 | { | ||
2812 | if (pass == 0) | ||
2813 | { | ||
2814 | gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); | ||
2815 | } | ||
2816 | else | ||
2817 | { | ||
2818 | gGL.setSceneBlendType(LLRender::BT_ALPHA); | ||
2819 | } | ||
2820 | |||
2821 | for (S32 i = 0; i < 8; ++i) | ||
2822 | { | ||
2823 | for (S32 j = 0; j < 8; ++j) | ||
2824 | { | ||
2825 | LLVector2 tc(i-4+0.5f, j-4+0.5f); | ||
2826 | |||
2827 | F32 dist = 1.f-(tc.length()/sqrtf(32.f)); | ||
2828 | dist *= scale/64.f; | ||
2829 | |||
2830 | tc *= thickness; | ||
2831 | tc.mV[0] = (tc.mV[0])/mHighlight.getWidth(); | ||
2832 | tc.mV[1] = (tc.mV[1])/mHighlight.getHeight(); | ||
2833 | |||
2834 | gGL.color4f(color.mV[0], | ||
2835 | color.mV[1], | ||
2836 | color.mV[2], | ||
2837 | color.mV[3]*dist); | ||
2838 | |||
2839 | gGL.texCoord2f(tc.mV[0]+tc1.mV[0], tc.mV[1]+tc2.mV[1]); | ||
2840 | gGL.vertex2f(-1,3); | ||
2841 | |||
2842 | gGL.texCoord2f(tc.mV[0]+tc1.mV[0], tc.mV[1]+tc1.mV[1]); | ||
2843 | gGL.vertex2f(-1,-1); | ||
2844 | |||
2845 | gGL.texCoord2f(tc.mV[0]+tc2.mV[0], tc.mV[1]+tc1.mV[1]); | ||
2846 | gGL.vertex2f(3,-1); | ||
2847 | } | ||
2848 | } | ||
2849 | } | ||
2850 | |||
2851 | gGL.end(); | ||
2852 | |||
2853 | gGL.popMatrix(); | ||
2854 | glMatrixMode(GL_MODELVIEW); | ||
2855 | gGL.popMatrix(); | ||
2856 | |||
2857 | //gGL.setSceneBlendType(LLRender::BT_ALPHA); | ||
2858 | } | ||
2859 | |||
2860 | if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) | 2442 | if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) |
2861 | { | 2443 | { |
2862 | gHighlightProgram.bind(); | 2444 | gHighlightProgram.bind(); |
@@ -2879,7 +2461,7 @@ void LLPipeline::renderHighlights() | |||
2879 | LLFace *facep = mSelectedFaces[i]; | 2461 | LLFace *facep = mSelectedFaces[i]; |
2880 | if (!facep || facep->getDrawable()->isDead()) | 2462 | if (!facep || facep->getDrawable()->isDead()) |
2881 | { | 2463 | { |
2882 | llwarns << "Bad face on selection" << llendl; | 2464 | llerrs << "Bad face on selection" << llendl; |
2883 | return; | 2465 | return; |
2884 | } | 2466 | } |
2885 | 2467 | ||
@@ -2952,7 +2534,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) | |||
2952 | { | 2534 | { |
2953 | if (!verify()) | 2535 | if (!verify()) |
2954 | { | 2536 | { |
2955 | llwarns << "Pipeline verification failed!" << llendl; | 2537 | llerrs << "Pipeline verification failed!" << llendl; |
2956 | } | 2538 | } |
2957 | } | 2539 | } |
2958 | 2540 | ||
@@ -3001,9 +2583,6 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) | |||
3001 | stop_glerror(); | 2583 | stop_glerror(); |
3002 | 2584 | ||
3003 | LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderDrawPools"); | 2585 | LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderDrawPools"); |
3004 | LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderForSelect"); | ||
3005 | LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderDeferred"); | ||
3006 | |||
3007 | for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter) | 2586 | for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter) |
3008 | { | 2587 | { |
3009 | LLDrawPool *poolp = *iter; | 2588 | LLDrawPool *poolp = *iter; |
@@ -3015,6 +2594,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) | |||
3015 | 2594 | ||
3016 | if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PICKING)) | 2595 | if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PICKING)) |
3017 | { | 2596 | { |
2597 | LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderForSelect"); | ||
3018 | gObjectList.renderObjectsForSelect(camera, gViewerWindow->getVirtualWindowRect()); | 2598 | gObjectList.renderObjectsForSelect(camera, gViewerWindow->getVirtualWindowRect()); |
3019 | } | 2599 | } |
3020 | else | 2600 | else |
@@ -3078,8 +2658,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) | |||
3078 | glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &depth); | 2658 | glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &depth); |
3079 | if (depth > 3) | 2659 | if (depth > 3) |
3080 | { | 2660 | { |
3081 | 2661 | llerrs << "GL matrix stack corrupted!" << llendl; | |
3082 | llwarns << "GL matrix stack corrupted!" << llendl; | ||
3083 | } | 2662 | } |
3084 | std::string msg = llformat("%s pass %d", gPoolNames[cur_type].c_str(), i); | 2663 | std::string msg = llformat("%s pass %d", gPoolNames[cur_type].c_str(), i); |
3085 | LLGLState::checkStates(msg); | 2664 | LLGLState::checkStates(msg); |
@@ -3150,13 +2729,21 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) | |||
3150 | 2729 | ||
3151 | LLVertexBuffer::unbind(); | 2730 | LLVertexBuffer::unbind(); |
3152 | 2731 | ||
3153 | if (!LLPipeline::sReflectionRender && !LLPipeline::sRenderDeferred && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) | 2732 | if (!LLPipeline::sReflectionRender && !LLPipeline::sRenderDeferred) |
3154 | { | 2733 | { |
2734 | if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) | ||
2735 | { | ||
3155 | // Render debugging beacons. | 2736 | // Render debugging beacons. |
3156 | gObjectList.renderObjectBeacons(); | 2737 | gObjectList.renderObjectBeacons(); |
3157 | LLHUDObject::renderAll(); | 2738 | LLHUDObject::renderAll(); |
3158 | gObjectList.resetObjectBeacons(); | 2739 | gObjectList.resetObjectBeacons(); |
3159 | } | 2740 | } |
2741 | else | ||
2742 | { | ||
2743 | // Make sure particle effects disappear | ||
2744 | LLHUDObject::renderAllForTimer(); | ||
2745 | } | ||
2746 | } | ||
3160 | 2747 | ||
3161 | LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderGeomEnd"); | 2748 | LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderGeomEnd"); |
3162 | 2749 | ||
@@ -3179,6 +2766,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) | |||
3179 | 2766 | ||
3180 | void LLPipeline::renderGeomDeferred(LLCamera& camera) | 2767 | void LLPipeline::renderGeomDeferred(LLCamera& camera) |
3181 | { | 2768 | { |
2769 | LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderGeomDeferred"); | ||
3182 | LLFastTimer t(LLFastTimer::FTM_RENDER_GEOMETRY); | 2770 | LLFastTimer t(LLFastTimer::FTM_RENDER_GEOMETRY); |
3183 | 2771 | ||
3184 | LLFastTimer t2(LLFastTimer::FTM_POOLS); | 2772 | LLFastTimer t2(LLFastTimer::FTM_POOLS); |
@@ -3245,20 +2833,17 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera) | |||
3245 | poolp->endDeferredPass(i); | 2833 | poolp->endDeferredPass(i); |
3246 | LLVertexBuffer::unbind(); | 2834 | LLVertexBuffer::unbind(); |
3247 | 2835 | ||
3248 | if (gDebugGL || gDebugPipeline) | ||
3249 | { | ||
3250 | GLint depth; | 2836 | GLint depth; |
3251 | glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &depth); | 2837 | glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &depth); |
3252 | if (depth > 3) | 2838 | if (depth > 3) |
3253 | { | 2839 | { |
3254 | llwarns << "GL matrix stack corrupted!" << llendl; | 2840 | llerrs << "GL matrix stack corrupted!" << llendl; |
3255 | } | 2841 | } |
3256 | LLGLState::checkStates(); | 2842 | LLGLState::checkStates(); |
3257 | LLGLState::checkTextureChannels(); | 2843 | LLGLState::checkTextureChannels(); |
3258 | LLGLState::checkClientArrays(); | 2844 | LLGLState::checkClientArrays(); |
3259 | } | 2845 | } |
3260 | } | 2846 | } |
3261 | } | ||
3262 | else | 2847 | else |
3263 | { | 2848 | { |
3264 | // Skip all pools of this type | 2849 | // Skip all pools of this type |
@@ -3338,20 +2923,17 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera) | |||
3338 | poolp->endPostDeferredPass(i); | 2923 | poolp->endPostDeferredPass(i); |
3339 | LLVertexBuffer::unbind(); | 2924 | LLVertexBuffer::unbind(); |
3340 | 2925 | ||
3341 | if (gDebugGL || gDebugPipeline) | ||
3342 | { | ||
3343 | GLint depth; | 2926 | GLint depth; |
3344 | glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &depth); | 2927 | glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &depth); |
3345 | if (depth > 3) | 2928 | if (depth > 3) |
3346 | { | 2929 | { |
3347 | llwarns << "GL matrix stack corrupted!" << llendl; | 2930 | llerrs << "GL matrix stack corrupted!" << llendl; |
3348 | } | 2931 | } |
3349 | LLGLState::checkStates(); | 2932 | LLGLState::checkStates(); |
3350 | LLGLState::checkTextureChannels(); | 2933 | LLGLState::checkTextureChannels(); |
3351 | LLGLState::checkClientArrays(); | 2934 | LLGLState::checkClientArrays(); |
3352 | } | 2935 | } |
3353 | } | 2936 | } |
3354 | } | ||
3355 | else | 2937 | else |
3356 | { | 2938 | { |
3357 | // Skip all pools of this type | 2939 | // Skip all pools of this type |
@@ -3385,6 +2967,11 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera) | |||
3385 | LLHUDObject::renderAll(); | 2967 | LLHUDObject::renderAll(); |
3386 | gObjectList.resetObjectBeacons(); | 2968 | gObjectList.resetObjectBeacons(); |
3387 | } | 2969 | } |
2970 | else | ||
2971 | { | ||
2972 | // Make sure particle effects disappear | ||
2973 | LLHUDObject::renderAllForTimer(); | ||
2974 | } | ||
3388 | 2975 | ||
3389 | if (occlude) | 2976 | if (occlude) |
3390 | { | 2977 | { |
@@ -3488,7 +3075,7 @@ void LLPipeline::renderDebug() | |||
3488 | gGL.setColorMask(true, false); | 3075 | gGL.setColorMask(true, false); |
3489 | 3076 | ||
3490 | // Debug stuff. | 3077 | // Debug stuff. |
3491 | for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); | 3078 | for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); |
3492 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) | 3079 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) |
3493 | { | 3080 | { |
3494 | LLViewerRegion* region = *iter; | 3081 | LLViewerRegion* region = *iter; |
@@ -3505,7 +3092,7 @@ void LLPipeline::renderDebug() | |||
3505 | } | 3092 | } |
3506 | } | 3093 | } |
3507 | 3094 | ||
3508 | for (LLCullResult::bridge_list_t::iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) | 3095 | for (LLCullResult::bridge_list_t::const_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) |
3509 | { | 3096 | { |
3510 | LLSpatialBridge* bridge = *i; | 3097 | LLSpatialBridge* bridge = *i; |
3511 | if (!bridge->isDead() && !bridge->isState(LLSpatialGroup::OCCLUDED) && hasRenderType(bridge->mDrawableType)) | 3098 | if (!bridge->isDead() && !bridge->isState(LLSpatialGroup::OCCLUDED) && hasRenderType(bridge->mDrawableType)) |
@@ -3519,91 +3106,96 @@ void LLPipeline::renderDebug() | |||
3519 | 3106 | ||
3520 | if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) | 3107 | if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) |
3521 | { | 3108 | { |
3522 | LLGLEnable blend(GL_BLEND); // kl sd | ||
3523 | LLGLDepthTest depth(TRUE, FALSE); | ||
3524 | LLGLDisable cull(GL_CULL_FACE); // kl | ||
3525 | |||
3526 | gGL.color4f(1,1,1,1); | 3109 | gGL.color4f(1,1,1,1); |
3527 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); | 3110 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); |
3528 | 3111 | ||
3529 | F32 a = 0.1f; | ||
3530 | |||
3531 | F32 col[] = | 3112 | F32 col[] = |
3532 | { | 3113 | { |
3533 | 1,0,0,a, | 3114 | 1,1,0, |
3534 | 0,1,0,a, | 3115 | 0,1,1, |
3535 | 0,0,1,a, | 3116 | 1,0,1, |
3536 | 1,0,1,a, | 3117 | 1,1,1, |
3537 | 3118 | 1,0,0, | |
3538 | 1,1,0,a, | 3119 | 0,1,0, |
3539 | 0,1,1,a, | 3120 | 0,0,1, |
3540 | 1,1,1,a, | 3121 | 0,0,0 |
3541 | 1,0,1,a, | ||
3542 | }; | 3122 | }; |
3543 | 3123 | ||
3544 | for (U32 i = 0; i < 8; i++) | 3124 | for (U32 i = 0; i < 8; i++) |
3545 | { | 3125 | { |
3546 | if (i > 3) | 3126 | gGL.color3fv(col+i*3); |
3547 | { | 3127 | |
3548 | gGL.color4fv(col+(i-4)*4); | 3128 | gGL.begin(LLRender::LINES); |
3549 | 3129 | ||
3550 | LLVector3* frust = mShadowCamera[i].mAgentFrustum; | 3130 | LLVector3* frust = mShadowCamera[i].mAgentFrustum; |
3551 | 3131 | ||
3552 | gGL.begin(LLRender::TRIANGLE_STRIP); | 3132 | gGL.vertex3fv(frust[0].mV); gGL.vertex3fv(frust[1].mV); |
3133 | gGL.vertex3fv(frust[1].mV); gGL.vertex3fv(frust[2].mV); | ||
3134 | gGL.vertex3fv(frust[2].mV); gGL.vertex3fv(frust[3].mV); | ||
3135 | gGL.vertex3fv(frust[3].mV); gGL.vertex3fv(frust[0].mV); | ||
3136 | |||
3137 | gGL.vertex3fv(frust[4].mV); gGL.vertex3fv(frust[5].mV); | ||
3138 | gGL.vertex3fv(frust[5].mV); gGL.vertex3fv(frust[6].mV); | ||
3139 | gGL.vertex3fv(frust[6].mV); gGL.vertex3fv(frust[7].mV); | ||
3140 | gGL.vertex3fv(frust[7].mV); gGL.vertex3fv(frust[4].mV); | ||
3141 | |||
3553 | gGL.vertex3fv(frust[0].mV); gGL.vertex3fv(frust[4].mV); | 3142 | gGL.vertex3fv(frust[0].mV); gGL.vertex3fv(frust[4].mV); |
3554 | gGL.vertex3fv(frust[1].mV); gGL.vertex3fv(frust[5].mV); | 3143 | gGL.vertex3fv(frust[1].mV); gGL.vertex3fv(frust[5].mV); |
3555 | gGL.vertex3fv(frust[2].mV); gGL.vertex3fv(frust[6].mV); | 3144 | gGL.vertex3fv(frust[2].mV); gGL.vertex3fv(frust[6].mV); |
3556 | gGL.vertex3fv(frust[3].mV); gGL.vertex3fv(frust[7].mV); | 3145 | gGL.vertex3fv(frust[3].mV); gGL.vertex3fv(frust[7].mV); |
3557 | gGL.vertex3fv(frust[0].mV); gGL.vertex3fv(frust[4].mV); | ||
3558 | gGL.end(); | ||
3559 | 3146 | ||
3147 | if (i < 4) | ||
3148 | { | ||
3149 | LLVector3* ext = mShadowExtents[i]; | ||
3560 | 3150 | ||
3561 | gGL.begin(LLRender::TRIANGLE_STRIP); | 3151 | LLVector3 box[] = |
3562 | gGL.vertex3fv(frust[0].mV); | 3152 | { |
3563 | gGL.vertex3fv(frust[1].mV); | 3153 | LLVector3(ext[0][0], ext[0][1], ext[0][2]), |
3564 | gGL.vertex3fv(frust[3].mV); | 3154 | LLVector3(ext[1][0], ext[0][1], ext[0][2]), |
3565 | gGL.vertex3fv(frust[2].mV); | 3155 | LLVector3(ext[1][0], ext[1][1], ext[0][2]), |
3566 | gGL.end(); | 3156 | LLVector3(ext[0][0], ext[1][1], ext[0][2]), |
3157 | LLVector3(ext[0][0], ext[0][1], ext[1][2]), | ||
3158 | LLVector3(ext[1][0], ext[0][1], ext[1][2]), | ||
3159 | LLVector3(ext[1][0], ext[1][1], ext[1][2]), | ||
3160 | LLVector3(ext[0][0], ext[1][1], ext[1][2]), | ||
3161 | }; | ||
3567 | 3162 | ||
3568 | gGL.begin(LLRender::TRIANGLE_STRIP); | 3163 | gGL.vertex3fv(box[0].mV); gGL.vertex3fv(box[1].mV); |
3569 | gGL.vertex3fv(frust[4].mV); | 3164 | gGL.vertex3fv(box[1].mV); gGL.vertex3fv(box[2].mV); |
3570 | gGL.vertex3fv(frust[5].mV); | 3165 | gGL.vertex3fv(box[2].mV); gGL.vertex3fv(box[3].mV); |
3571 | gGL.vertex3fv(frust[7].mV); | 3166 | gGL.vertex3fv(box[3].mV); gGL.vertex3fv(box[0].mV); |
3572 | gGL.vertex3fv(frust[6].mV); | 3167 | |
3573 | gGL.end(); | 3168 | gGL.vertex3fv(box[4].mV); gGL.vertex3fv(box[5].mV); |
3169 | gGL.vertex3fv(box[5].mV); gGL.vertex3fv(box[6].mV); | ||
3170 | gGL.vertex3fv(box[6].mV); gGL.vertex3fv(box[7].mV); | ||
3171 | gGL.vertex3fv(box[7].mV); gGL.vertex3fv(box[4].mV); | ||
3172 | |||
3173 | gGL.vertex3fv(box[0].mV); gGL.vertex3fv(box[4].mV); | ||
3174 | gGL.vertex3fv(box[1].mV); gGL.vertex3fv(box[5].mV); | ||
3175 | gGL.vertex3fv(box[2].mV); gGL.vertex3fv(box[6].mV); | ||
3176 | gGL.vertex3fv(box[3].mV); gGL.vertex3fv(box[7].mV); | ||
3574 | } | 3177 | } |
3575 | 3178 | ||
3179 | gGL.end(); | ||
3576 | 3180 | ||
3577 | if (i < 4) | 3181 | for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); |
3182 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) | ||
3578 | { | 3183 | { |
3579 | gGL.begin(LLRender::LINES); | 3184 | LLViewerRegion* region = *iter; |
3580 | 3185 | for (U32 j = 0; j < LLViewerRegion::NUM_PARTITIONS; j++) | |
3581 | F32* c = col+i*4; | ||
3582 | for (U32 j = 0; j < mShadowFrustPoints[i].size(); ++j) | ||
3583 | { | 3186 | { |
3584 | 3187 | LLSpatialPartition* part = region->getSpatialPartition(j); | |
3585 | gGL.color3fv(c); | 3188 | if (part) |
3586 | |||
3587 | for (U32 k = 0; k < mShadowFrustPoints[i].size(); ++k) | ||
3588 | { | 3189 | { |
3589 | if (j != k) | 3190 | if (hasRenderType(part->mDrawableType)) |
3590 | { | 3191 | { |
3591 | gGL.vertex3fv(mShadowFrustPoints[i][j].mV); | 3192 | part->renderIntersectingBBoxes(&mShadowCamera[i]); |
3592 | gGL.vertex3fv(mShadowFrustPoints[i][k].mV); | ||
3593 | } | 3193 | } |
3594 | } | 3194 | } |
3595 | |||
3596 | if (!mShadowFrustOrigin[i].isExactlyZero()) | ||
3597 | { | ||
3598 | gGL.vertex3fv(mShadowFrustPoints[i][j].mV); | ||
3599 | gGL.color4f(1,1,1,1); | ||
3600 | gGL.vertex3fv(mShadowFrustOrigin[i].mV); | ||
3601 | } | 3195 | } |
3602 | } | 3196 | } |
3603 | gGL.end(); | ||
3604 | } | 3197 | } |
3605 | } | 3198 | } |
3606 | } | ||
3607 | 3199 | ||
3608 | if (mRenderDebugMask & RENDER_DEBUG_COMPOSITION) | 3200 | if (mRenderDebugMask & RENDER_DEBUG_COMPOSITION) |
3609 | { | 3201 | { |
@@ -3638,55 +3230,6 @@ void LLPipeline::renderDebug() | |||
3638 | } | 3230 | } |
3639 | } | 3231 | } |
3640 | 3232 | ||
3641 | if (mRenderDebugMask & LLPipeline::RENDER_DEBUG_BUILD_QUEUE) | ||
3642 | { | ||
3643 | U32 count = 0; | ||
3644 | U32 size = mBuildQ2.size(); | ||
3645 | LLColor4 col; | ||
3646 | |||
3647 | LLGLEnable blend(GL_BLEND); | ||
3648 | LLGLDepthTest depth(GL_TRUE, GL_FALSE); | ||
3649 | gGL.getTexUnit(0)->bind(LLViewerImage::sWhiteImagep); | ||
3650 | |||
3651 | for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ2.begin(); iter != mGroupQ2.end(); ++iter) | ||
3652 | { | ||
3653 | LLSpatialGroup* group = *iter; | ||
3654 | if (group->isDead()) | ||
3655 | { | ||
3656 | continue; | ||
3657 | } | ||
3658 | |||
3659 | LLSpatialBridge* bridge = group->mSpatialPartition->asBridge(); | ||
3660 | |||
3661 | if (bridge && (!bridge->mDrawable || bridge->mDrawable->isDead())) | ||
3662 | { | ||
3663 | continue; | ||
3664 | } | ||
3665 | |||
3666 | if (bridge) | ||
3667 | { | ||
3668 | gGL.pushMatrix(); | ||
3669 | glMultMatrixf((F32*)bridge->mDrawable->getRenderMatrix().mMatrix); | ||
3670 | } | ||
3671 | |||
3672 | F32 alpha = (F32) (size-count)/size; | ||
3673 | |||
3674 | |||
3675 | LLVector2 c(1.f-alpha, alpha); | ||
3676 | c.normVec(); | ||
3677 | |||
3678 | |||
3679 | ++count; | ||
3680 | col.set(c.mV[0], c.mV[1], 0, alpha*0.5f+0.1f); | ||
3681 | group->drawObjectBox(col); | ||
3682 | |||
3683 | if (bridge) | ||
3684 | { | ||
3685 | gGL.popMatrix(); | ||
3686 | } | ||
3687 | } | ||
3688 | } | ||
3689 | |||
3690 | gGL.flush(); | 3233 | gGL.flush(); |
3691 | } | 3234 | } |
3692 | 3235 | ||
@@ -5120,7 +4663,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector3& start, | |||
5120 | 4663 | ||
5121 | sPickAvatar = FALSE; //LLToolMgr::getInstance()->inBuildMode() ? FALSE : TRUE; | 4664 | sPickAvatar = FALSE; //LLToolMgr::getInstance()->inBuildMode() ? FALSE : TRUE; |
5122 | 4665 | ||
5123 | for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); | 4666 | for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); |
5124 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) | 4667 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) |
5125 | { | 4668 | { |
5126 | LLViewerRegion* region = *iter; | 4669 | LLViewerRegion* region = *iter; |
@@ -5177,7 +4720,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector3& start, | |||
5177 | 4720 | ||
5178 | //check against avatars | 4721 | //check against avatars |
5179 | sPickAvatar = TRUE; | 4722 | sPickAvatar = TRUE; |
5180 | for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); | 4723 | for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); |
5181 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) | 4724 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) |
5182 | { | 4725 | { |
5183 | LLViewerRegion* region = *iter; | 4726 | LLViewerRegion* region = *iter; |
@@ -5254,7 +4797,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInHUD(const LLVector3& start, co | |||
5254 | { | 4797 | { |
5255 | LLDrawable* drawable = NULL; | 4798 | LLDrawable* drawable = NULL; |
5256 | 4799 | ||
5257 | for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); | 4800 | for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); |
5258 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) | 4801 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) |
5259 | { | 4802 | { |
5260 | LLViewerRegion* region = *iter; | 4803 | LLViewerRegion* region = *iter; |
@@ -5317,7 +4860,7 @@ void LLPipeline::resetVertexBuffers() | |||
5317 | { | 4860 | { |
5318 | sRenderBump = gSavedSettings.getBOOL("RenderObjectBump"); | 4861 | sRenderBump = gSavedSettings.getBOOL("RenderObjectBump"); |
5319 | 4862 | ||
5320 | for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); | 4863 | for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); |
5321 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) | 4864 | iter != LLWorld::getInstance()->getRegionList().end(); ++iter) |
5322 | { | 4865 | { |
5323 | LLViewerRegion* region = *iter; | 4866 | LLViewerRegion* region = *iter; |
@@ -5428,18 +4971,18 @@ void validate_framebuffer_object() | |||
5428 | break; | 4971 | break; |
5429 | case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: | 4972 | case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: |
5430 | // frame buffer not OK: probably means unsupported depth buffer format | 4973 | // frame buffer not OK: probably means unsupported depth buffer format |
5431 | llwarns << "Framebuffer Incomplete Dimensions." << llendl; | 4974 | llerrs << "Framebuffer Incomplete Dimensions." << llendl; |
5432 | break; | 4975 | break; |
5433 | case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT: | 4976 | case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT: |
5434 | // frame buffer not OK: probably means unsupported depth buffer format | 4977 | // frame buffer not OK: probably means unsupported depth buffer format |
5435 | llwarns << "Framebuffer Incomplete Attachment." << llendl; | 4978 | llerrs << "Framebuffer Incomplete Attachment." << llendl; |
5436 | break; | 4979 | break; |
5437 | case GL_FRAMEBUFFER_UNSUPPORTED_EXT: | 4980 | case GL_FRAMEBUFFER_UNSUPPORTED_EXT: |
5438 | /* choose different formats */ | 4981 | /* choose different formats */ |
5439 | llwarns << "Framebuffer unsupported." << llendl; | 4982 | llerrs << "Framebuffer unsupported." << llendl; |
5440 | break; | 4983 | break; |
5441 | default: | 4984 | default: |
5442 | llwarns << "Unknown framebuffer status." << llendl; | 4985 | llerrs << "Unknown framebuffer status." << llendl; |
5443 | break; | 4986 | break; |
5444 | } | 4987 | } |
5445 | } | 4988 | } |
@@ -5757,202 +5300,46 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) | |||
5757 | 5300 | ||
5758 | } | 5301 | } |
5759 | 5302 | ||
5760 | void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRenderTarget* gi_source, LLRenderTarget* last_gi_post) //, U32 noise_map) | 5303 | void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index) |
5761 | { | 5304 | { |
5762 | /* if (noise_map == 0xFFFFFFFF) | ||
5763 | { | ||
5764 | noise_map = mNoiseMap; | ||
5765 | } | ||
5766 | */ | ||
5767 | LLFastTimer ftm(LLFastTimer::FTM_TEMP3); | ||
5768 | LLGLState::checkTextureChannels(); | ||
5769 | |||
5770 | shader.bind(); | 5305 | shader.bind(); |
5771 | S32 channel = 0; | 5306 | S32 channel = 0; |
5772 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, LLTexUnit::TT_RECT_TEXTURE); | 5307 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, LLTexUnit::TT_RECT_TEXTURE); |
5773 | if (channel > -1) | 5308 | if (channel > -1) |
5774 | { | 5309 | { |
5775 | mDeferredScreen.bindTexture(0,channel); | 5310 | mDeferredScreen.bindTexture(0,channel); |
5776 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); | 5311 | //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
5312 | //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | ||
5777 | } | 5313 | } |
5778 | 5314 | ||
5779 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_SPECULAR, LLTexUnit::TT_RECT_TEXTURE); | 5315 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_SPECULAR, LLTexUnit::TT_RECT_TEXTURE); |
5780 | if (channel > -1) | 5316 | if (channel > -1) |
5781 | { | 5317 | { |
5782 | mDeferredScreen.bindTexture(1, channel); | 5318 | mDeferredScreen.bindTexture(1, channel); |
5783 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); | ||
5784 | } | 5319 | } |
5785 | 5320 | ||
5786 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_NORMAL, LLTexUnit::TT_RECT_TEXTURE); | 5321 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_NORMAL, LLTexUnit::TT_RECT_TEXTURE); |
5787 | if (channel > -1) | 5322 | if (channel > -1) |
5788 | { | 5323 | { |
5789 | mDeferredScreen.bindTexture(2, channel); | 5324 | mDeferredScreen.bindTexture(2, channel); |
5790 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); | ||
5791 | } | 5325 | } |
5792 | 5326 | ||
5793 | if (gi_source) | 5327 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_POSITION, LLTexUnit::TT_RECT_TEXTURE); |
5794 | { | ||
5795 | BOOL has_gi = FALSE; | ||
5796 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_DIFFUSE); | ||
5797 | if (channel > -1) | 5328 | if (channel > -1) |
5798 | { | 5329 | { |
5799 | has_gi = TRUE; | 5330 | mDeferredScreen.bindTexture(3, channel); |
5800 | gi_source->bindTexture(0, channel); | ||
5801 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); | ||
5802 | } | ||
5803 | |||
5804 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_SPECULAR); | ||
5805 | if (channel > -1) | ||
5806 | { | ||
5807 | has_gi = TRUE; | ||
5808 | gi_source->bindTexture(1, channel); | ||
5809 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); | ||
5810 | } | ||
5811 | |||
5812 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_NORMAL); | ||
5813 | if (channel > -1) | ||
5814 | { | ||
5815 | has_gi = TRUE; | ||
5816 | gi_source->bindTexture(2, channel); | ||
5817 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); | ||
5818 | } | ||
5819 | |||
5820 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_MIN_POS); | ||
5821 | if (channel > -1) | ||
5822 | { | ||
5823 | has_gi = TRUE; | ||
5824 | gi_source->bindTexture(1, channel); | ||
5825 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); | ||
5826 | } | ||
5827 | |||
5828 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_MAX_POS); | ||
5829 | if (channel > -1) | ||
5830 | { | ||
5831 | has_gi = TRUE; | ||
5832 | gi_source->bindTexture(3, channel); | ||
5833 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); | ||
5834 | } | ||
5835 | |||
5836 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_LAST_DIFFUSE); | ||
5837 | if (channel > -1) | ||
5838 | { | ||
5839 | has_gi = TRUE; | ||
5840 | last_gi_post->bindTexture(0, channel); | ||
5841 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); | ||
5842 | } | ||
5843 | |||
5844 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_LAST_NORMAL); | ||
5845 | if (channel > -1) | ||
5846 | { | ||
5847 | has_gi = TRUE; | ||
5848 | last_gi_post->bindTexture(2, channel); | ||
5849 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); | ||
5850 | } | ||
5851 | |||
5852 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_LAST_MAX_POS); | ||
5853 | if (channel > -1) | ||
5854 | { | ||
5855 | has_gi = TRUE; | ||
5856 | last_gi_post->bindTexture(1, channel); | ||
5857 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); | ||
5858 | } | ||
5859 | |||
5860 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_LAST_MIN_POS); | ||
5861 | if (channel > -1) | ||
5862 | { | ||
5863 | has_gi = TRUE; | ||
5864 | last_gi_post->bindTexture(3, channel); | ||
5865 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); | ||
5866 | } | ||
5867 | |||
5868 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_DEPTH); | ||
5869 | if (channel > -1) | ||
5870 | { | ||
5871 | has_gi = TRUE; | ||
5872 | gGL.getTexUnit(channel)->bind(gi_source, TRUE); | ||
5873 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); | ||
5874 | stop_glerror(); | ||
5875 | |||
5876 | glTexParameteri(LLTexUnit::getInternalType(mGIMap.getUsage()), GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); | ||
5877 | glTexParameteri(LLTexUnit::getInternalType(mGIMap.getUsage()), GL_DEPTH_TEXTURE_MODE_ARB, GL_ALPHA); | ||
5878 | |||
5879 | stop_glerror(); | ||
5880 | } | ||
5881 | |||
5882 | if (has_gi) | ||
5883 | { | ||
5884 | U32 gi_samples = llclamp(gSavedSettings.getU32("RenderGISamples"), (U32) 1, (U32) 8); | ||
5885 | |||
5886 | F32 range_x = llmin(mGIRange.mV[0], 1.f); | ||
5887 | F32 range_y = llmin(mGIRange.mV[1], 1.f); | ||
5888 | |||
5889 | LLVector2 scale(range_x,range_y); | ||
5890 | |||
5891 | LLVector2 kern[25]; | ||
5892 | |||
5893 | for (S32 i = 0; i < 5; ++i) | ||
5894 | { | ||
5895 | for (S32 j = 0; j < 5; ++j) | ||
5896 | { | ||
5897 | S32 idx = i*5+j; | ||
5898 | kern[idx].mV[0] = (i-2)*0.5f; | ||
5899 | kern[idx].mV[1] = (j-2)*0.5f; | ||
5900 | kern[idx].scaleVec(scale); | ||
5901 | } | ||
5902 | } | ||
5903 | |||
5904 | F32 gi_radius = mGILightRadius; //gSavedSettings.getF32("RenderGILightRadius"); | ||
5905 | |||
5906 | shader.uniform2f("gi_scale", scale.mV[0], scale.mV[1]); | ||
5907 | shader.uniform2fv("gi_kern", 25, (F32*) kern); | ||
5908 | shader.uniformMatrix4fv("gi_mat", 1, FALSE, mGIMatrix.m); | ||
5909 | shader.uniformMatrix4fv("gi_mat_proj", 1, FALSE, mGIMatrixProj.m); | ||
5910 | shader.uniformMatrix4fv("gi_inv_proj", 1, FALSE, mGIInvProj.m); | ||
5911 | shader.uniformMatrix4fv("gi_norm_mat", 1, FALSE, mGINormalMatrix.m); | ||
5912 | shader.uniform1f("gi_radius", gi_radius); | ||
5913 | shader.uniform1i("gi_samples", (GLint) gSavedSettings.getU32("RenderGISamples")); | ||
5914 | shader.uniform1f("gi_intensity", gSavedSettings.getF32("RenderGIIntensity")/(gi_samples*gi_samples)); | ||
5915 | shader.uniform3fv("gi_quad", 1, gSavedSettings.getVector3("RenderGIColorCurve").mV); | ||
5916 | shader.uniform3fv("gi_spec", 1, gSavedSettings.getVector3("RenderGISpecularCurve").mV); | ||
5917 | shader.uniform1f("gi_direction_weight", gSavedSettings.getF32("RenderGIDirectionWeight")); | ||
5918 | shader.uniform1f("gi_light_offset", gSavedSettings.getF32("RenderGILightOffset")); | ||
5919 | shader.uniform1f("gi_blend", gFrameIntervalSeconds); | ||
5920 | } | ||
5921 | } | 5331 | } |
5922 | 5332 | ||
5923 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_DEPTH, LLTexUnit::TT_RECT_TEXTURE); | 5333 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_DEPTH, LLTexUnit::TT_RECT_TEXTURE); |
5924 | if (channel > -1) | 5334 | if (channel > -1) |
5925 | { | 5335 | { |
5926 | gGL.getTexUnit(channel)->bind(&mDeferredDepth, TRUE); | 5336 | gGL.getTexUnit(channel)->bind(&mDeferredScreen, TRUE); |
5927 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); | ||
5928 | stop_glerror(); | ||
5929 | |||
5930 | glTexParameteri(LLTexUnit::getInternalType(mDeferredDepth.getUsage()), GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); | ||
5931 | glTexParameteri(LLTexUnit::getInternalType(mDeferredDepth.getUsage()), GL_DEPTH_TEXTURE_MODE_ARB, GL_ALPHA); | ||
5932 | |||
5933 | stop_glerror(); | ||
5934 | |||
5935 | glh::matrix4f projection = glh_get_current_projection(); | ||
5936 | glh::matrix4f inv_proj = projection.inverse(); | ||
5937 | |||
5938 | shader.uniformMatrix4fv("inv_proj", 1, FALSE, inv_proj.m); | ||
5939 | shader.uniform4f("viewport", (F32) gGLViewport[0], | ||
5940 | (F32) gGLViewport[1], | ||
5941 | (F32) gGLViewport[2], | ||
5942 | (F32) gGLViewport[3]); | ||
5943 | } | 5337 | } |
5944 | 5338 | ||
5945 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_NOISE); | 5339 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_NOISE); |
5946 | if (channel > -1) | 5340 | if (channel > -1) |
5947 | { | 5341 | { |
5948 | gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseMap); // was noise_map KL | 5342 | gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseMap); |
5949 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); | ||
5950 | } | ||
5951 | |||
5952 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_LIGHTFUNC); | ||
5953 | if (channel > -1) | ||
5954 | { | ||
5955 | gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE, mLightFunc); | ||
5956 | } | 5343 | } |
5957 | 5344 | ||
5958 | stop_glerror(); | 5345 | stop_glerror(); |
@@ -5961,68 +5348,19 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen | |||
5961 | if (channel > -1) | 5348 | if (channel > -1) |
5962 | { | 5349 | { |
5963 | mDeferredLight[light_index].bindTexture(0, channel); | 5350 | mDeferredLight[light_index].bindTexture(0, channel); |
5964 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); | ||
5965 | } | ||
5966 | |||
5967 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_LUMINANCE); | ||
5968 | if (channel > -1) | ||
5969 | { | ||
5970 | gGL.getTexUnit(channel)->bindManual(LLTexUnit::TT_TEXTURE, mLuminanceMap.getTexture(), true); | ||
5971 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR); | ||
5972 | } | ||
5973 | |||
5974 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_GI_LIGHT, LLTexUnit::TT_RECT_TEXTURE); | ||
5975 | if (channel > -1) | ||
5976 | { | ||
5977 | gi_source->bindTexture(0, channel); | ||
5978 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); | ||
5979 | } | ||
5980 | |||
5981 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_SUN_LIGHT, LLTexUnit::TT_RECT_TEXTURE); | ||
5982 | if (channel > -1) | ||
5983 | { | ||
5984 | mDeferredLight[1].bindTexture(0, channel); | ||
5985 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); | ||
5986 | } | ||
5987 | |||
5988 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_LOCAL_LIGHT, LLTexUnit::TT_RECT_TEXTURE); | ||
5989 | if (channel > -1) | ||
5990 | { | ||
5991 | mDeferredLight[2].bindTexture(0, channel); | ||
5992 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_POINT); | ||
5993 | } | 5351 | } |
5994 | 5352 | ||
5995 | |||
5996 | stop_glerror(); | 5353 | stop_glerror(); |
5997 | 5354 | ||
5998 | for (U32 i = 0; i < 4; i++) | 5355 | for (U32 i = 0; i < 4; i++) |
5999 | { | 5356 | { |
6000 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_SHADOW0+i, LLTexUnit::TT_RECT_TEXTURE); | ||
6001 | stop_glerror(); | ||
6002 | if (channel > -1) | ||
6003 | { | ||
6004 | stop_glerror(); | ||
6005 | gGL.getTexUnit(channel)->bind(&mShadow[i], TRUE); | ||
6006 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); | ||
6007 | gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); | ||
6008 | stop_glerror(); | ||
6009 | |||
6010 | glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); | ||
6011 | glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL); | ||
6012 | stop_glerror(); | ||
6013 | } | ||
6014 | } | ||
6015 | |||
6016 | for (U32 i = 4; i < 6; i++) | ||
6017 | { | ||
6018 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_SHADOW0+i); | 5357 | channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_SHADOW0+i); |
6019 | stop_glerror(); | 5358 | stop_glerror(); |
6020 | if (channel > -1) | 5359 | if (channel > -1) |
6021 | { | 5360 | { |
6022 | stop_glerror(); | 5361 | stop_glerror(); |
6023 | gGL.getTexUnit(channel)->bind(&mShadow[i], TRUE); | 5362 | gGL.getTexUnit(channel)->bind(&mSunShadow[i], TRUE); |
6024 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); | 5363 | gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); |
6025 | gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); | ||
6026 | stop_glerror(); | 5364 | stop_glerror(); |
6027 | 5365 | ||
6028 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); | 5366 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); |
@@ -6033,19 +5371,17 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen | |||
6033 | 5371 | ||
6034 | stop_glerror(); | 5372 | stop_glerror(); |
6035 | 5373 | ||
6036 | F32 mat[16*6]; | 5374 | F32 mat[64]; |
6037 | for (U32 i = 0; i < 16; i++) | 5375 | for (U32 i = 0; i < 16; i++) |
6038 | { | 5376 | { |
6039 | mat[i] = mSunShadowMatrix[0].m[i]; | 5377 | mat[i] = mSunShadowMatrix[0].m[i]; |
6040 | mat[i+16] = mSunShadowMatrix[1].m[i]; | 5378 | mat[i+16] = mSunShadowMatrix[1].m[i]; |
6041 | mat[i+32] = mSunShadowMatrix[2].m[i]; | 5379 | mat[i+32] = mSunShadowMatrix[2].m[i]; |
6042 | mat[i+48] = mSunShadowMatrix[3].m[i]; | 5380 | mat[i+48] = mSunShadowMatrix[3].m[i]; |
6043 | mat[i+64] = mSunShadowMatrix[4].m[i]; | ||
6044 | mat[i+80] = mSunShadowMatrix[5].m[i]; | ||
6045 | } | 5381 | } |
6046 | 5382 | ||
6047 | shader.uniformMatrix4fv("shadow_matrix[0]", 6, FALSE, mat); | 5383 | shader.uniformMatrix4fv("shadow_matrix[0]", 4, FALSE, mat); |
6048 | shader.uniformMatrix4fv("shadow_matrix", 6, FALSE, mat); | 5384 | shader.uniformMatrix4fv("shadow_matrix", 4, FALSE, mat); |
6049 | 5385 | ||
6050 | stop_glerror(); | 5386 | stop_glerror(); |
6051 | 5387 | ||
@@ -6094,23 +5430,8 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, LLRen | |||
6094 | shader.uniform2f("screen_res", mDeferredScreen.getWidth(), mDeferredScreen.getHeight()); | 5430 | shader.uniform2f("screen_res", mDeferredScreen.getWidth(), mDeferredScreen.getHeight()); |
6095 | shader.uniform1f("near_clip", LLViewerCamera::getInstance()->getNear()*2.f); | 5431 | shader.uniform1f("near_clip", LLViewerCamera::getInstance()->getNear()*2.f); |
6096 | shader.uniform1f("alpha_soften", gSavedSettings.getF32("RenderDeferredAlphaSoften")); | 5432 | shader.uniform1f("alpha_soften", gSavedSettings.getF32("RenderDeferredAlphaSoften")); |
6097 | shader.uniform1f ("shadow_offset", gSavedSettings.getF32("RenderShadowOffset")); | ||
6098 | shader.uniform1f("shadow_bias", gSavedSettings.getF32("RenderShadowBias")); | ||
6099 | /* shader.uniform3fv("gi_quad", 1, gSavedSettings.getVector3("RenderGIColorCurve").mV); | ||
6100 | shader.uniform3fv("lum_quad", 1, gSavedSettings.getVector3("RenderLuminanceColorCurve").mV); | ||
6101 | shader.uniform3fv("gi_lum_quad", 1, gSavedSettings.getVector3("RenderGILuminanceColorCurve").mV); | ||
6102 | shader.uniform3fv("sun_lum_quad", 1, gSavedSettings.getVector3("RenderSunLuminanceColorCurve").mV); | ||
6103 | shader.uniform1f("lum_lod", gSavedSettings.getF32("RenderLuminanceDetail")); | ||
6104 | shader.uniform1f("gi_range", gSavedSettings.getF32("RenderGIRange")); | ||
6105 | |||
6106 | if (shader.getUniformLocation("norm_mat") >= 0) | ||
6107 | { | ||
6108 | glh::matrix4f norm_mat = glh_get_current_modelview().inverse().transpose(); | ||
6109 | shader.uniformMatrix4fv("norm_mat", 1, FALSE, norm_mat.m); | ||
6110 | } */ | ||
6111 | } | 5433 | } |
6112 | 5434 | ||
6113 | // KL The Deffered Pipeline begins here! | ||
6114 | void LLPipeline::renderDeferredLighting() | 5435 | void LLPipeline::renderDeferredLighting() |
6115 | { | 5436 | { |
6116 | if (!sCull) | 5437 | if (!sCull) |
@@ -6118,12 +5439,6 @@ void LLPipeline::renderDeferredLighting() | |||
6118 | return; | 5439 | return; |
6119 | } | 5440 | } |
6120 | 5441 | ||
6121 | { | ||
6122 | LLGLDepthTest depth(GL_TRUE); | ||
6123 | mDeferredDepth.copyContents(mDeferredScreen, 0, 0, mDeferredScreen.getWidth(), mDeferredScreen.getHeight(), | ||
6124 | 0, 0, mDeferredDepth.getWidth(), mDeferredDepth.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST); | ||
6125 | } | ||
6126 | |||
6127 | LLGLEnable multisample(GL_MULTISAMPLE_ARB); | 5442 | LLGLEnable multisample(GL_MULTISAMPLE_ARB); |
6128 | 5443 | ||
6129 | if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD)) | 5444 | if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD)) |
@@ -6137,10 +5452,16 @@ void LLPipeline::renderDeferredLighting() | |||
6137 | glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); | 5452 | glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); |
6138 | 5453 | ||
6139 | gGL.setColorMask(true, true); | 5454 | gGL.setColorMask(true, true); |
5455 | |||
5456 | mDeferredLight[0].bindTarget(); | ||
5457 | |||
5458 | //mDeferredLight[0].copyContents(mDeferredScreen, 0, 0, mDeferredScreen.getWidth(), mDeferredScreen.getHeight(), | ||
5459 | // 0, 0, mDeferredLight[0].getWidth(), mDeferredLight[0].getHeight(), GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_NEAREST); | ||
6140 | 5460 | ||
6141 | //draw a cube around every light | 5461 | //draw a cube around every light |
6142 | LLVertexBuffer::unbind(); | 5462 | LLVertexBuffer::unbind(); |
6143 | 5463 | ||
5464 | glBlendFunc(GL_ONE, GL_ONE); | ||
6144 | LLGLEnable cull(GL_CULL_FACE); | 5465 | LLGLEnable cull(GL_CULL_FACE); |
6145 | LLGLEnable blend(GL_BLEND); | 5466 | LLGLEnable blend(GL_BLEND); |
6146 | 5467 | ||
@@ -6152,34 +5473,8 @@ void LLPipeline::renderDeferredLighting() | |||
6152 | -1,-3, | 5473 | -1,-3, |
6153 | 3,1, | 5474 | 3,1, |
6154 | }; | 5475 | }; |
6155 | glVertexPointer(2, GL_FLOAT, 0, vert); | ||
6156 | glColor3f(1,1,1); | ||
6157 | //Set mSunDir KL This makes sense to have it here. Still calculated EVEN if Deferred Sun is FALSE! | ||
6158 | { | ||
6159 | setupHWLights(NULL); //to set mSunDir; | ||
6160 | LLVector4 dir(mSunDir, 0.f); | ||
6161 | glh::vec4f tc(dir.mV); | ||
6162 | mat.mult_matrix_vec(tc); | ||
6163 | glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], 0); | ||
6164 | } | ||
6165 | |||
6166 | if (gSavedSettings.getBOOL("RenderDeferredShadow")) | ||
6167 | { | ||
6168 | glPushMatrix(); | ||
6169 | glLoadIdentity(); | ||
6170 | glMatrixMode(GL_PROJECTION); | ||
6171 | glPushMatrix(); | ||
6172 | glLoadIdentity(); | ||
6173 | 5476 | ||
6174 | mDeferredLight[0].bindTarget(); | 5477 | bindDeferredShader(gDeferredSunProgram); |
6175 | // KL Bind to 0 next section Deferred Sun ! | ||
6176 | if (gSavedSettings.getBOOL("RenderDeferredSun")) | ||
6177 | { //paint shadow/SSAO light map (direct lighting lightmap) | ||
6178 | bindDeferredShader(gDeferredSunProgram, 0); | ||
6179 | |||
6180 | glClearColor(1,1,1,1); | ||
6181 | mDeferredLight[0].clear(GL_COLOR_BUFFER_BIT); | ||
6182 | glClearColor(0,0,0,0); | ||
6183 | 5478 | ||
6184 | glh::matrix4f inv_trans = glh_get_current_modelview().inverse().transpose(); | 5479 | glh::matrix4f inv_trans = glh_get_current_modelview().inverse().transpose(); |
6185 | 5480 | ||
@@ -6202,115 +5497,24 @@ void LLPipeline::renderDeferredLighting() | |||
6202 | 5497 | ||
6203 | gDeferredSunProgram.uniform3fv("offset", slice, offset); | 5498 | gDeferredSunProgram.uniform3fv("offset", slice, offset); |
6204 | gDeferredSunProgram.uniform2f("screenRes", mDeferredLight[0].getWidth(), mDeferredLight[0].getHeight()); | 5499 | gDeferredSunProgram.uniform2f("screenRes", mDeferredLight[0].getWidth(), mDeferredLight[0].getHeight()); |
6205 | |||
6206 | { | ||
6207 | LLGLDisable blend(GL_BLEND); | ||
6208 | LLGLDepthTest depth(GL_FALSE); | ||
6209 | stop_glerror(); | ||
6210 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); | ||
6211 | stop_glerror(); | ||
6212 | } | ||
6213 | |||
6214 | unbindDeferredShader(gDeferredSunProgram); | ||
6215 | } | ||
6216 | else | ||
6217 | { | ||
6218 | mDeferredLight[0].clear(); | ||
6219 | } | ||
6220 | |||
6221 | mDeferredLight[0].flush(); | ||
6222 | mDeferredLight[1].bindTarget(); | ||
6223 | } | ||
6224 | // KL Bind to 1 next section GI | ||
6225 | /* if (gSavedSettings.getBOOL("RenderDeferredGI")) | ||
6226 | { | ||
6227 | { //get luminance map from previous frame's light map | ||
6228 | LLGLEnable blend(GL_BLEND); | ||
6229 | LLGLDisable test(GL_ALPHA_TEST); | ||
6230 | LLGLDepthTest depth(GL_FALSE); | ||
6231 | LLGLDisable stencil(GL_STENCIL_TEST); | ||
6232 | 5500 | ||
6233 | //static F32 fade = 1.f; | 5501 | setupHWLights(NULL); //to set mSunDir; |
6234 | 5502 | ||
6235 | F32 fade = gSavedSettings.getF32("RenderLuminanceFade"); | 5503 | glPushMatrix(); |
6236 | { | 5504 | glLoadIdentity(); |
6237 | gGL.setSceneBlendType(LLRender::BT_ALPHA); | 5505 | glMatrixMode(GL_PROJECTION); |
6238 | gLuminanceGatherProgram.bind(); | 5506 | glPushMatrix(); |
6239 | gLuminanceGatherProgram.uniform2f("screen_res", mDeferredLight[0].getWidth(), mDeferredLight[0].getHeight()); | 5507 | glLoadIdentity(); |
6240 | gLuminanceGatherProgram.uniform1f("fade", llclamp(fade, 0.f, 1.f)); | ||
6241 | mLuminanceMap.bindTarget(); | ||
6242 | gGL.getTexUnit(0)->bind(&mDeferredLight[0]); | ||
6243 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); | ||
6244 | gLuminanceGatherProgram.unbind(); | ||
6245 | mLuminanceMap.flush(); | ||
6246 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLuminanceMap.getTexture(), true); | ||
6247 | gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR); | ||
6248 | glGenerateMipmapEXT(GL_TEXTURE_2D); | ||
6249 | } | ||
6250 | |||
6251 | } | ||
6252 | |||
6253 | { //paint noisy GI map (bounce lighting lightmap) | ||
6254 | LLGLDisable blend(GL_BLEND); | ||
6255 | LLGLDepthTest depth(GL_FALSE); | ||
6256 | LLGLDisable test(GL_ALPHA_TEST); | ||
6257 | |||
6258 | mGIMapPost[0].bindTarget(); | ||
6259 | |||
6260 | bindDeferredShader(gDeferredGIProgram, 0, &mGIMap, 0);//, mTrueNoiseMap); | ||
6261 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); | ||
6262 | unbindDeferredShader(gDeferredGIProgram); | ||
6263 | mGIMapPost[0].flush(); | ||
6264 | 5508 | ||
5509 | LLVector4 dir(mSunDir, 0.f); | ||
6265 | 5510 | ||
6266 | } | 5511 | glh::vec4f tc(dir.mV); |
5512 | mat.mult_matrix_vec(tc); | ||
5513 | glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], 0); | ||
5514 | glColor3f(1,1,1); | ||
6267 | 5515 | ||
6268 | U32 pass_count = 0; | 5516 | glVertexPointer(2, GL_FLOAT, 0, vert); |
6269 | if (gSavedSettings.getBOOL("RenderDeferredBlurLight")) | ||
6270 | { | 5517 | { |
6271 | pass_count = llclamp(gSavedSettings.getU32("RenderGIBlurPasses"), (U32) 1, (U32) 128); | ||
6272 | } | ||
6273 | |||
6274 | for (U32 i = 0; i < pass_count; ++i) | ||
6275 | { //gather/soften indirect lighting map | ||
6276 | bindDeferredShader(gDeferredPostGIProgram, 0, &mGIMapPost[0], NULL); //, mTrueNoiseMap); | ||
6277 | |||
6278 | LLVector2 gauss[32]; // xweight, yweight, offset | ||
6279 | |||
6280 | F32 sc = 1.f; | ||
6281 | |||
6282 | F32 go = gSavedSettings.getF32("RenderGIGaussian"); | ||
6283 | U32 kern_length = llclamp(gSavedSettings.getU32("RenderGIBlurSamples"), (U32) 1, (U32) 16)*2 - 1; | ||
6284 | F32 blur_size = gSavedSettings.getF32("RenderGIBlurSize")*sc; | ||
6285 | F32 dist_factor = gSavedSettings.getF32("RenderGIBlurDistFactor"); | ||
6286 | |||
6287 | // sample symmetrically with the middle sample falling exactly on 0.0 | ||
6288 | F32 x = -(kern_length/2.0f) + 0.5f; | ||
6289 | |||
6290 | for (U32 i = 0; i < kern_length; i++) | ||
6291 | { | ||
6292 | gauss[i].mV[0] = llgaussian(x, go); | ||
6293 | gauss[i].mV[1] = x; | ||
6294 | x += 1.f; | ||
6295 | } | ||
6296 | // swap the x=0 position to the start of gauss[] so we can | ||
6297 | // treat it specially as an optimization. | ||
6298 | LLVector2 swap; | ||
6299 | swap = gauss[kern_length/2]; | ||
6300 | gauss[kern_length/2] = gauss[0]; | ||
6301 | gauss[0] = swap; | ||
6302 | llassert(gauss[0].mV[2] == 0.0f); | ||
6303 | |||
6304 | gDeferredPostGIProgram.uniform2f("delta", 1.f, 0.f); | ||
6305 | gDeferredPostGIProgram.uniform1f("dist_factor", dist_factor); | ||
6306 | gDeferredPostGIProgram.uniform2fv("kern[0]", kern_length, gauss[0].mV); | ||
6307 | gDeferredPostGIProgram.uniform2fv("kern", kern_length, gauss[0].mV); | ||
6308 | gDeferredPostGIProgram.uniform1i("kern_length", kern_length); | ||
6309 | gDeferredPostGIProgram.uniform1f("kern_scale", blur_size * (kern_length/2.f - 0.5f)); | ||
6310 | gDeferredPostGIProgram.uniform3fv("blur_quad", 1, gSavedSettings.getVector3("RenderGIBlurColorCurve").mV); | ||
6311 | |||
6312 | mGIMapPost[1].bindTarget(); | ||
6313 | { | ||
6314 | LLGLDisable blend(GL_BLEND); | 5518 | LLGLDisable blend(GL_BLEND); |
6315 | LLGLDepthTest depth(GL_FALSE); | 5519 | LLGLDepthTest depth(GL_FALSE); |
6316 | stop_glerror(); | 5520 | stop_glerror(); |
@@ -6318,39 +5522,15 @@ void LLPipeline::renderDeferredLighting() | |||
6318 | stop_glerror(); | 5522 | stop_glerror(); |
6319 | } | 5523 | } |
6320 | 5524 | ||
6321 | mGIMapPost[1].flush(); | 5525 | unbindDeferredShader(gDeferredSunProgram); |
6322 | unbindDeferredShader(gDeferredPostGIProgram); | ||
6323 | |||
6324 | bindDeferredShader(gDeferredPostGIProgram, 0, &mGIMapPost[1], NULL);//, mTrueNoiseMap); | ||
6325 | mGIMapPost[0].bindTarget(); | ||
6326 | |||
6327 | gDeferredPostGIProgram.uniform2f("delta", 0.f, 1.f); | ||
6328 | gDeferredBlurLightProgram.uniform1f("dist_factor", dist_factor); | ||
6329 | gDeferredBlurLightProgram.uniform3fv("kern[0]", kern_length, gauss[0].mV); | ||
6330 | gDeferredBlurLightProgram.uniform3fv("kern", kern_length, gauss[0].mV); | ||
6331 | gDeferredBlurLightProgram.uniform1i("kern_length", kern_length); | ||
6332 | gDeferredBlurLightProgram.uniform1f("kern_scale", blur_size * (kern_length/2.f - 0.5f)); | ||
6333 | 5526 | ||
6334 | { | 5527 | mDeferredLight[0].flush(); |
6335 | LLGLDisable blend(GL_BLEND); | ||
6336 | LLGLDepthTest depth(GL_FALSE); | ||
6337 | stop_glerror(); | ||
6338 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); | ||
6339 | stop_glerror(); | ||
6340 | } | ||
6341 | mGIMapPost[0].flush(); | ||
6342 | unbindDeferredShader(gDeferredPostGIProgram); | ||
6343 | } | ||
6344 | } */ | ||
6345 | 5528 | ||
6346 | if (gSavedSettings.getBOOL("RenderDeferredBlurLight")) | ||
6347 | { //soften direct lighting lightmap | ||
6348 | //blur lightmap | 5529 | //blur lightmap |
6349 | mDeferredLight[1].bindTarget(); | 5530 | mDeferredLight[1].bindTarget(); |
6350 | 5531 | ||
6351 | glClearColor(1,1,1,1); | 5532 | //mDeferredLight[1].copyContents(mDeferredScreen, 0, 0, mDeferredScreen.getWidth(), mDeferredScreen.getHeight(), |
6352 | mDeferredLight[1].clear(GL_COLOR_BUFFER_BIT); | 5533 | // 0, 0, mDeferredLight[0].getWidth(), mDeferredLight[0].getHeight(), GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_NEAREST); |
6353 | glClearColor(0,0,0,0); | ||
6354 | 5534 | ||
6355 | bindDeferredShader(gDeferredBlurLightProgram); | 5535 | bindDeferredShader(gDeferredBlurLightProgram); |
6356 | 5536 | ||
@@ -6359,7 +5539,6 @@ void LLPipeline::renderDeferredLighting() | |||
6359 | LLVector3 go = gSavedSettings.getVector3("RenderShadowGaussian"); | 5539 | LLVector3 go = gSavedSettings.getVector3("RenderShadowGaussian"); |
6360 | U32 kern_length = llclamp(gSavedSettings.getU32("RenderShadowBlurSamples"), (U32) 1, (U32) 16)*2 - 1; | 5540 | U32 kern_length = llclamp(gSavedSettings.getU32("RenderShadowBlurSamples"), (U32) 1, (U32) 16)*2 - 1; |
6361 | F32 blur_size = gSavedSettings.getF32("RenderShadowBlurSize"); | 5541 | F32 blur_size = gSavedSettings.getF32("RenderShadowBlurSize"); |
6362 | F32 dist_factor = gSavedSettings.getF32("RenderShadowBlurDistFactor"); | ||
6363 | 5542 | ||
6364 | // sample symmetrically with the middle sample falling exactly on 0.0 | 5543 | // sample symmetrically with the middle sample falling exactly on 0.0 |
6365 | F32 x = -(kern_length/2.0f) + 0.5f; | 5544 | F32 x = -(kern_length/2.0f) + 0.5f; |
@@ -6380,12 +5559,11 @@ void LLPipeline::renderDeferredLighting() | |||
6380 | llassert(gauss[0].mV[2] == 0.0f); | 5559 | llassert(gauss[0].mV[2] == 0.0f); |
6381 | 5560 | ||
6382 | gDeferredBlurLightProgram.uniform2f("delta", 1.f, 0.f); | 5561 | gDeferredBlurLightProgram.uniform2f("delta", 1.f, 0.f); |
6383 | gDeferredBlurLightProgram.uniform1f("dist_factor", dist_factor); | ||
6384 | gDeferredBlurLightProgram.uniform3fv("kern[0]", kern_length, gauss[0].mV); | 5562 | gDeferredBlurLightProgram.uniform3fv("kern[0]", kern_length, gauss[0].mV); |
6385 | gDeferredBlurLightProgram.uniform3fv("kern", kern_length, gauss[0].mV); | 5563 | gDeferredBlurLightProgram.uniform3fv("kern", kern_length, gauss[0].mV); |
6386 | gDeferredBlurLightProgram.uniform1i("kern_length", kern_length); | 5564 | gDeferredBlurLightProgram.uniform1i("kern_length", kern_length); |
6387 | gDeferredBlurLightProgram.uniform1f("kern_scale", blur_size * (kern_length/2.f - 0.5f)); | 5565 | gDeferredBlurLightProgram.uniform1f("kern_scale", blur_size * (kern_length/2.f - 0.5f)); |
6388 | 5566 | ||
6389 | { | 5567 | { |
6390 | LLGLDisable blend(GL_BLEND); | 5568 | LLGLDisable blend(GL_BLEND); |
6391 | LLGLDepthTest depth(GL_FALSE); | 5569 | LLGLDepthTest depth(GL_FALSE); |
@@ -6401,7 +5579,6 @@ void LLPipeline::renderDeferredLighting() | |||
6401 | mDeferredLight[0].bindTarget(); | 5579 | mDeferredLight[0].bindTarget(); |
6402 | 5580 | ||
6403 | gDeferredBlurLightProgram.uniform2f("delta", 0.f, 1.f); | 5581 | gDeferredBlurLightProgram.uniform2f("delta", 0.f, 1.f); |
6404 | gDeferredBlurLightProgram.uniform1f("dist_factor", dist_factor); | ||
6405 | gDeferredBlurLightProgram.uniform3fv("kern[0]", kern_length, gauss[0].mV); | 5582 | gDeferredBlurLightProgram.uniform3fv("kern[0]", kern_length, gauss[0].mV); |
6406 | gDeferredBlurLightProgram.uniform3fv("kern", kern_length, gauss[0].mV); | 5583 | gDeferredBlurLightProgram.uniform3fv("kern", kern_length, gauss[0].mV); |
6407 | gDeferredBlurLightProgram.uniform1i("kern_length", kern_length); | 5584 | gDeferredBlurLightProgram.uniform1i("kern_length", kern_length); |
@@ -6411,12 +5588,11 @@ void LLPipeline::renderDeferredLighting() | |||
6411 | LLGLDisable blend(GL_BLEND); | 5588 | LLGLDisable blend(GL_BLEND); |
6412 | LLGLDepthTest depth(GL_FALSE); | 5589 | LLGLDepthTest depth(GL_FALSE); |
6413 | stop_glerror(); | 5590 | stop_glerror(); |
6414 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); // KL 4? | 5591 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); |
6415 | stop_glerror(); | 5592 | stop_glerror(); |
6416 | } | 5593 | } |
6417 | mDeferredLight[0].flush(); | 5594 | mDeferredLight[0].flush(); |
6418 | unbindDeferredShader(gDeferredBlurLightProgram); | 5595 | unbindDeferredShader(gDeferredBlurLightProgram); |
6419 | } | ||
6420 | 5596 | ||
6421 | stop_glerror(); | 5597 | stop_glerror(); |
6422 | glPopMatrix(); | 5598 | glPopMatrix(); |
@@ -6425,26 +5601,15 @@ void LLPipeline::renderDeferredLighting() | |||
6425 | stop_glerror(); | 5601 | stop_glerror(); |
6426 | glPopMatrix(); | 5602 | glPopMatrix(); |
6427 | stop_glerror(); | 5603 | stop_glerror(); |
6428 | // } | ||
6429 | 5604 | ||
6430 | //copy depth and stencil from deferred screen | 5605 | //copy depth and stencil from deferred screen |
6431 | //mScreen.copyContents(mDeferredScreen, 0, 0, mDeferredScreen.getWidth(), mDeferredScreen.getHeight(), | 5606 | //mScreen.copyContents(mDeferredScreen, 0, 0, mDeferredScreen.getWidth(), mDeferredScreen.getHeight(), |
6432 | // 0, 0, mScreen.getWidth(), mScreen.getHeight(), GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_NEAREST); | 5607 | // 0, 0, mScreen.getWidth(), mScreen.getHeight(), GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_NEAREST); |
6433 | 5608 | ||
6434 | /* if (gSavedSettings.getBOOL("RenderDeferredGI")) | ||
6435 | { | ||
6436 | mDeferredLight[1].bindTarget(); | ||
6437 | mDeferredLight[1].clear(GL_COLOR_BUFFER_BIT); | ||
6438 | } | ||
6439 | else | ||
6440 | { */ | ||
6441 | mScreen.bindTarget(); | 5609 | mScreen.bindTarget(); |
6442 | mScreen.clear(GL_COLOR_BUFFER_BIT); | 5610 | mScreen.clear(GL_COLOR_BUFFER_BIT); |
6443 | // } | 5611 | |
6444 | 5612 | bindDeferredShader(gDeferredSoftenProgram); | |
6445 | if (gSavedSettings.getBOOL("RenderDeferredAtmospheric")) | ||
6446 | { //apply sunlight contribution | ||
6447 | bindDeferredShader(gDeferredSoftenProgram, 0, &mGIMapPost[0]); // may not be using GI but still need this KL | ||
6448 | { | 5613 | { |
6449 | LLGLDepthTest depth(GL_FALSE); | 5614 | LLGLDepthTest depth(GL_FALSE); |
6450 | LLGLDisable blend(GL_BLEND); | 5615 | LLGLDisable blend(GL_BLEND); |
@@ -6467,56 +5632,15 @@ void LLPipeline::renderDeferredLighting() | |||
6467 | } | 5632 | } |
6468 | 5633 | ||
6469 | unbindDeferredShader(gDeferredSoftenProgram); | 5634 | unbindDeferredShader(gDeferredSoftenProgram); |
6470 | } | ||
6471 | // KL this code is a tad buggered atm it obliterates local lights...... | ||
6472 | /* { //render sky/water/hair/skirts | ||
6473 | LLGLDisable blend(GL_BLEND); | ||
6474 | LLGLDisable stencil(GL_STENCIL_TEST); | ||
6475 | gGL.setSceneBlendType(LLRender::BT_ALPHA); | ||
6476 | 5635 | ||
6477 | U32 render_mask = mRenderTypeMask; | 5636 | bindDeferredShader(gDeferredLightProgram); |
6478 | mRenderTypeMask = mRenderTypeMask & | ||
6479 | ((1 << LLPipeline::RENDER_TYPE_SKY) | | ||
6480 | (1 << LLPipeline::RENDER_TYPE_CLOUDS) | | ||
6481 | (1 << LLPipeline::RENDER_TYPE_WL_SKY) | | ||
6482 | (1 << LLPipeline::RENDER_TYPE_AVATAR) | | ||
6483 | (1 << LLPipeline::RENDER_TYPE_WATER)); | ||
6484 | |||
6485 | renderGeomPostDeferred(*LLViewerCamera::getInstance()); | ||
6486 | mRenderTypeMask = render_mask; | ||
6487 | } */ | ||
6488 | 5637 | ||
6489 | BOOL render_local = gSavedSettings.getBOOL("RenderDeferredLocalLights"); | ||
6490 | BOOL render_fullscreen = gSavedSettings.getBOOL("RenderDeferredFullscreenLights"); | ||
6491 | |||
6492 | /* | ||
6493 | if (gSavedSettings.getBOOL("RenderDeferredGI")) | ||
6494 | { | ||
6495 | mDeferredLight[1].flush(); | ||
6496 | mDeferredLight[2].bindTarget(); | ||
6497 | mDeferredLight[2].clear(GL_COLOR_BUFFER_BIT); | ||
6498 | } | ||
6499 | */ | ||
6500 | if (render_local || render_fullscreen) | ||
6501 | { | ||
6502 | gGL.setSceneBlendType(LLRender::BT_ADD); | ||
6503 | std::list<LLVector4> fullscreen_lights; | 5638 | std::list<LLVector4> fullscreen_lights; |
6504 | LLDrawable::drawable_list_t spot_lights; | ||
6505 | LLDrawable::drawable_list_t fullscreen_spot_lights; | ||
6506 | |||
6507 | for (U32 i = 0; i < 2; i++) | ||
6508 | { | ||
6509 | mTargetShadowSpotLight[i] = NULL; | ||
6510 | } | ||
6511 | |||
6512 | std::list<LLVector4> light_colors; | 5639 | std::list<LLVector4> light_colors; |
6513 | 5640 | ||
6514 | F32 v[24]; | 5641 | F32 v[24]; |
6515 | glVertexPointer(3, GL_FLOAT, 0, v); | 5642 | glVertexPointer(3, GL_FLOAT, 0, v); |
6516 | BOOL render_local = gSavedSettings.getBOOL("RenderDeferredLocalLights"); | ||
6517 | |||
6518 | { | 5643 | { |
6519 | bindDeferredShader(gDeferredLightProgram); | ||
6520 | LLGLDepthTest depth(GL_TRUE, GL_FALSE); | 5644 | LLGLDepthTest depth(GL_TRUE, GL_FALSE); |
6521 | for (LLDrawable::drawable_set_t::iterator iter = mLights.begin(); iter != mLights.end(); ++iter) | 5645 | for (LLDrawable::drawable_set_t::iterator iter = mLights.begin(); iter != mLights.end(); ++iter) |
6522 | { | 5646 | { |
@@ -6532,29 +5656,18 @@ void LLPipeline::renderDeferredLighting() | |||
6532 | F32* c = center.mV; | 5656 | F32* c = center.mV; |
6533 | F32 s = volume->getLightRadius()*1.5f; | 5657 | F32 s = volume->getLightRadius()*1.5f; |
6534 | 5658 | ||
6535 | LLColor3 col = volume->getLightColor(); | ||
6536 | col *= volume->getLightIntensity(); | ||
6537 | |||
6538 | if (col.magVecSquared() < 0.001f) | ||
6539 | { | ||
6540 | continue; | ||
6541 | } | ||
6542 | |||
6543 | if (s <= 0.001f) | ||
6544 | { | ||
6545 | continue; | ||
6546 | } | ||
6547 | |||
6548 | if (LLViewerCamera::getInstance()->AABBInFrustumNoFarClip(center, LLVector3(s,s,s)) == 0) | 5659 | if (LLViewerCamera::getInstance()->AABBInFrustumNoFarClip(center, LLVector3(s,s,s)) == 0) |
6549 | { | 5660 | { |
6550 | continue; | 5661 | continue; |
6551 | } | 5662 | } |
6552 | 5663 | ||
6553 | sVisibleLightCount++; | 5664 | sVisibleLightCount++; |
6554 | |||
6555 | glh::vec3f tc(c); | 5665 | glh::vec3f tc(c); |
6556 | mat.mult_matrix_vec(tc); | 5666 | mat.mult_matrix_vec(tc); |
6557 | 5667 | ||
5668 | LLColor3 col = volume->getLightColor(); | ||
5669 | col *= volume->getLightIntensity(); | ||
5670 | |||
6558 | //vertex positions are encoded so the 3 bits of their vertex index | 5671 | //vertex positions are encoded so the 3 bits of their vertex index |
6559 | //correspond to their axis facing, with bit position 3,2,1 matching | 5672 | //correspond to their axis facing, with bit position 3,2,1 matching |
6560 | //axis facing x,y,z, bit set meaning positive facing, bit clear | 5673 | //axis facing x,y,z, bit set meaning positive facing, bit clear |
@@ -6576,90 +5689,24 @@ void LLPipeline::renderDeferredLighting() | |||
6576 | LLViewerCamera::getInstance()->getOrigin().mV[2] > c[2] + s + 0.2f || | 5689 | LLViewerCamera::getInstance()->getOrigin().mV[2] > c[2] + s + 0.2f || |
6577 | LLViewerCamera::getInstance()->getOrigin().mV[2] < c[2] - s - 0.2f) | 5690 | LLViewerCamera::getInstance()->getOrigin().mV[2] < c[2] - s - 0.2f) |
6578 | { //draw box if camera is outside box | 5691 | { //draw box if camera is outside box |
6579 | if (render_local) | ||
6580 | { | ||
6581 | if (volume->getLightTexture()) | ||
6582 | { | ||
6583 | drawablep->getVOVolume()->updateSpotLightPriority(); | ||
6584 | spot_lights.push_back(drawablep); | ||
6585 | continue; | ||
6586 | } | ||
6587 | |||
6588 | glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); | 5692 | glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); |
6589 | glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); | 5693 | glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); |
6590 | glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, | 5694 | glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, |
6591 | GL_UNSIGNED_BYTE, get_box_fan_indices(LLViewerCamera::getInstance(), center)); | 5695 | GL_UNSIGNED_BYTE, get_box_fan_indices(LLViewerCamera::getInstance(), center)); |
6592 | } | 5696 | } |
6593 | } | 5697 | else |
6594 | else if (render_fullscreen) | ||
6595 | { | 5698 | { |
6596 | if (volume->getLightTexture()) | ||
6597 | { | ||
6598 | drawablep->getVOVolume()->updateSpotLightPriority(); | ||
6599 | fullscreen_spot_lights.push_back(drawablep); | ||
6600 | continue; | ||
6601 | } | ||
6602 | |||
6603 | fullscreen_lights.push_back(LLVector4(tc.v[0], tc.v[1], tc.v[2], s*s)); | 5699 | fullscreen_lights.push_back(LLVector4(tc.v[0], tc.v[1], tc.v[2], s*s)); |
6604 | light_colors.push_back(LLVector4(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f)); | 5700 | light_colors.push_back(LLVector4(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f)); |
6605 | } | 5701 | } |
6606 | } | 5702 | } |
6607 | unbindDeferredShader(gDeferredLightProgram); | ||
6608 | } | 5703 | } |
6609 | 5704 | ||
6610 | if (!spot_lights.empty()) | 5705 | unbindDeferredShader(gDeferredLightProgram); |
6611 | { | ||
6612 | LLGLDepthTest depth(GL_TRUE, GL_FALSE); | ||
6613 | bindDeferredShader(gDeferredSpotLightProgram); | ||
6614 | 5706 | ||
6615 | gDeferredSpotLightProgram.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); | 5707 | if (!fullscreen_lights.empty()) |
6616 | |||
6617 | for (LLDrawable::drawable_list_t::iterator iter = spot_lights.begin(); iter != spot_lights.end(); ++iter) | ||
6618 | { | 5708 | { |
6619 | LLDrawable* drawablep = *iter; | ||
6620 | |||
6621 | LLVOVolume* volume = drawablep->getVOVolume(); | ||
6622 | |||
6623 | LLVector3 center = drawablep->getPositionAgent(); | ||
6624 | F32* c = center.mV; | ||
6625 | F32 s = volume->getLightRadius()*1.5f; | ||
6626 | |||
6627 | sVisibleLightCount++; | ||
6628 | |||
6629 | glh::vec3f tc(c); | ||
6630 | mat.mult_matrix_vec(tc); | ||
6631 | |||
6632 | setupSpotLight(gDeferredSpotLightProgram, drawablep); | ||
6633 | |||
6634 | LLColor3 col = volume->getLightColor(); | ||
6635 | col *= volume->getLightIntensity(); | ||
6636 | |||
6637 | //vertex positions are encoded so the 3 bits of their vertex index | ||
6638 | //correspond to their axis facing, with bit position 3,2,1 matching | ||
6639 | //axis facing x,y,z, bit set meaning positive facing, bit clear | ||
6640 | //meaning negative facing | ||
6641 | v[0] = c[0]-s; v[1] = c[1]-s; v[2] = c[2]-s; // 0 - 0000 | ||
6642 | v[3] = c[0]-s; v[4] = c[1]-s; v[5] = c[2]+s; // 1 - 0001 | ||
6643 | v[6] = c[0]-s; v[7] = c[1]+s; v[8] = c[2]-s; // 2 - 0010 | ||
6644 | v[9] = c[0]-s; v[10] = c[1]+s; v[11] = c[2]+s; // 3 - 0011 | ||
6645 | |||
6646 | v[12] = c[0]+s; v[13] = c[1]-s; v[14] = c[2]-s; // 4 - 0100 | ||
6647 | v[15] = c[0]+s; v[16] = c[1]-s; v[17] = c[2]+s; // 5 - 0101 | ||
6648 | v[18] = c[0]+s; v[19] = c[1]+s; v[20] = c[2]-s; // 6 - 0110 | ||
6649 | v[21] = c[0]+s; v[22] = c[1]+s; v[23] = c[2]+s; // 7 - 0111 | ||
6650 | |||
6651 | glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); | ||
6652 | glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); | ||
6653 | glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, | ||
6654 | GL_UNSIGNED_BYTE, get_box_fan_indices(LLViewerCamera::getInstance(), center)); | ||
6655 | } | ||
6656 | gDeferredSpotLightProgram.disableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); | ||
6657 | unbindDeferredShader(gDeferredSpotLightProgram); | ||
6658 | } | ||
6659 | |||
6660 | { | ||
6661 | bindDeferredShader(gDeferredMultiLightProgram); | 5709 | bindDeferredShader(gDeferredMultiLightProgram); |
6662 | |||
6663 | LLGLDepthTest depth(GL_FALSE); | 5710 | LLGLDepthTest depth(GL_FALSE); |
6664 | 5711 | ||
6665 | //full screen blit | 5712 | //full screen blit |
@@ -6671,14 +5718,11 @@ void LLPipeline::renderDeferredLighting() | |||
6671 | 5718 | ||
6672 | U32 count = 0; | 5719 | U32 count = 0; |
6673 | 5720 | ||
6674 | const U32 max_count = 8; // KL poss 16? | 5721 | LLVector4 light[16]; |
6675 | LLVector4 light[max_count]; | 5722 | LLVector4 col[16]; |
6676 | LLVector4 col[max_count]; | ||
6677 | 5723 | ||
6678 | glVertexPointer(2, GL_FLOAT, 0, vert); | 5724 | glVertexPointer(2, GL_FLOAT, 0, vert); |
6679 | 5725 | ||
6680 | F32 far_z = 0.f; | ||
6681 | |||
6682 | while (!fullscreen_lights.empty()) | 5726 | while (!fullscreen_lights.empty()) |
6683 | { | 5727 | { |
6684 | light[count] = fullscreen_lights.front(); | 5728 | light[count] = fullscreen_lights.front(); |
@@ -6686,111 +5730,32 @@ void LLPipeline::renderDeferredLighting() | |||
6686 | col[count] = light_colors.front(); | 5730 | col[count] = light_colors.front(); |
6687 | light_colors.pop_front(); | 5731 | light_colors.pop_front(); |
6688 | 5732 | ||
6689 | far_z = llmin(light[count].mV[2]-sqrtf(light[count].mV[3]), far_z); | ||
6690 | |||
6691 | count++; | 5733 | count++; |
6692 | if (count == max_count || fullscreen_lights.empty()) | 5734 | if (count == 16 || fullscreen_lights.empty()) |
6693 | { | 5735 | { |
6694 | gDeferredMultiLightProgram.uniform1i("light_count", count); | 5736 | gDeferredMultiLightProgram.uniform1i("light_count", count); |
6695 | gDeferredMultiLightProgram.uniform4fv("light[0]", count, (GLfloat*) light); | 5737 | gDeferredMultiLightProgram.uniform4fv("light[0]", count, (GLfloat*) light); |
6696 | gDeferredMultiLightProgram.uniform4fv("light", count, (GLfloat*) light); | 5738 | gDeferredMultiLightProgram.uniform4fv("light", count, (GLfloat*) light); |
6697 | gDeferredMultiLightProgram.uniform4fv("light_col[0]", count, (GLfloat*) col); | 5739 | gDeferredMultiLightProgram.uniform4fv("light_col[0]", count, (GLfloat*) col); |
6698 | gDeferredMultiLightProgram.uniform4fv("light_col", count, (GLfloat*) col); | 5740 | gDeferredMultiLightProgram.uniform4fv("light_col", count, (GLfloat*) col); |
6699 | gDeferredMultiLightProgram.uniform1f("far_z", far_z); | ||
6700 | far_z = 0.f; | ||
6701 | count = 0; | 5741 | count = 0; |
6702 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); | 5742 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); |
6703 | } | 5743 | } |
6704 | } | 5744 | } |
6705 | 5745 | ||
6706 | unbindDeferredShader(gDeferredMultiLightProgram); | ||
6707 | |||
6708 | bindDeferredShader(gDeferredMultiSpotLightProgram); | ||
6709 | |||
6710 | gDeferredMultiSpotLightProgram.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); | ||
6711 | |||
6712 | for (LLDrawable::drawable_list_t::iterator iter = fullscreen_spot_lights.begin(); iter != fullscreen_spot_lights.end(); ++iter) | ||
6713 | { | ||
6714 | LLDrawable* drawablep = *iter; | ||
6715 | 5746 | ||
6716 | LLVOVolume* volume = drawablep->getVOVolume(); | ||
6717 | |||
6718 | LLVector3 center = drawablep->getPositionAgent(); | ||
6719 | F32* c = center.mV; | ||
6720 | F32 s = volume->getLightRadius()*1.5f; | ||
6721 | |||
6722 | sVisibleLightCount++; | ||
6723 | |||
6724 | glh::vec3f tc(c); | ||
6725 | mat.mult_matrix_vec(tc); | ||
6726 | |||
6727 | setupSpotLight(gDeferredMultiSpotLightProgram, drawablep); | ||
6728 | |||
6729 | LLColor3 col = volume->getLightColor(); | ||
6730 | col *= volume->getLightIntensity(); | ||
6731 | |||
6732 | glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); | ||
6733 | glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); | ||
6734 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); | ||
6735 | } | ||
6736 | |||
6737 | gDeferredMultiSpotLightProgram.disableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); | ||
6738 | unbindDeferredShader(gDeferredMultiSpotLightProgram); | ||
6739 | |||
6740 | glPopMatrix(); | 5747 | glPopMatrix(); |
6741 | glMatrixMode(GL_MODELVIEW); | 5748 | glMatrixMode(GL_MODELVIEW); |
6742 | glPopMatrix(); | 5749 | glPopMatrix(); |
6743 | } | ||
6744 | } | ||
6745 | 5750 | ||
5751 | unbindDeferredShader(gDeferredMultiLightProgram); | ||
5752 | } | ||
6746 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | 5753 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
6747 | gGL.setColorMask(true, true); | ||
6748 | /* | ||
6749 | if (gSavedSettings.getBOOL("RenderDeferredGI")) | ||
6750 | { | ||
6751 | mDeferredLight[2].flush(); | ||
6752 | mScreen.bindTarget(); | ||
6753 | mScreen.clear(GL_COLOR_BUFFER_BIT); | ||
6754 | |||
6755 | gGL.setSceneBlendType(LLRender::BT_ALPHA); | ||
6756 | 5754 | ||
6757 | { //mix various light maps (local, sun, gi) | 5755 | { //render non-deferred geometry |
6758 | LLGLDisable blend(GL_BLEND); | 5756 | LLGLDisable blend(GL_BLEND); |
6759 | LLGLDisable test(GL_ALPHA_TEST); | ||
6760 | LLGLDepthTest depth(GL_FALSE); | ||
6761 | LLGLDisable stencil(GL_STENCIL_TEST); | 5757 | LLGLDisable stencil(GL_STENCIL_TEST); |
6762 | |||
6763 | gViewerWindow->setupViewport(); | ||
6764 | |||
6765 | bindDeferredShader(gDeferredPostProgram, 0, &mGIMapPost[0]); | ||
6766 | |||
6767 | gDeferredPostProgram.bind(); | ||
6768 | |||
6769 | LLVertexBuffer::unbind(); | ||
6770 | |||
6771 | glVertexPointer(2, GL_FLOAT, 0, vert); | ||
6772 | glColor3f(1,1,1); | ||
6773 | |||
6774 | glPushMatrix(); | ||
6775 | glLoadIdentity(); | ||
6776 | glMatrixMode(GL_PROJECTION); | ||
6777 | glPushMatrix(); | ||
6778 | glLoadIdentity(); | ||
6779 | |||
6780 | glDrawArrays(GL_TRIANGLES, 0, 3); | ||
6781 | |||
6782 | glPopMatrix(); | ||
6783 | glMatrixMode(GL_MODELVIEW); | ||
6784 | glPopMatrix(); | ||
6785 | 5758 | ||
6786 | unbindDeferredShader(gDeferredPostProgram); | ||
6787 | } | ||
6788 | } | ||
6789 | */ | ||
6790 | { //render non-deferred geometry (alpha, fullbright, glow) KL issues with render pipeline merge needs work.. here | ||
6791 | LLGLDisable blend(GL_BLEND); | ||
6792 | LLGLDisable stencil(GL_STENCIL_TEST); | ||
6793 | gGL.setSceneBlendType(LLRender::BT_ALPHA); | ||
6794 | U32 render_mask = mRenderTypeMask; | 5759 | U32 render_mask = mRenderTypeMask; |
6795 | mRenderTypeMask = mRenderTypeMask & | 5760 | mRenderTypeMask = mRenderTypeMask & |
6796 | ((1 << LLPipeline::RENDER_TYPE_SKY) | | 5761 | ((1 << LLPipeline::RENDER_TYPE_SKY) | |
@@ -6803,161 +5768,18 @@ void LLPipeline::renderDeferredLighting() | |||
6803 | (1 << LLPipeline::RENDER_TYPE_FULLBRIGHT) | | 5768 | (1 << LLPipeline::RENDER_TYPE_FULLBRIGHT) | |
6804 | (1 << LLPipeline::RENDER_TYPE_VOLUME) | | 5769 | (1 << LLPipeline::RENDER_TYPE_VOLUME) | |
6805 | (1 << LLPipeline::RENDER_TYPE_GLOW) | | 5770 | (1 << LLPipeline::RENDER_TYPE_GLOW) | |
6806 | (1 << LLPipeline::RENDER_TYPE_BUMP) | | 5771 | (1 << LLPipeline::RENDER_TYPE_BUMP)); |
6807 | (1 << LLPipeline::RENDER_TYPE_PASS_SIMPLE) | | ||
6808 | (1 << LLPipeline::RENDER_TYPE_PASS_ALPHA) | | ||
6809 | (1 << LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK) | | ||
6810 | (1 << LLPipeline::RENDER_TYPE_PASS_BUMP) | | ||
6811 | (1 << LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT) | | ||
6812 | (1 << LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK) | | ||
6813 | (1 << LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_SHINY) | | ||
6814 | (1 << LLPipeline::RENDER_TYPE_PASS_GLOW) | | ||
6815 | (1 << LLPipeline::RENDER_TYPE_PASS_GRASS) | | ||
6816 | (1 << LLPipeline::RENDER_TYPE_PASS_SHINY) | | ||
6817 | (1 << LLPipeline::RENDER_TYPE_PASS_INVISIBLE) | | ||
6818 | (1 << LLPipeline::RENDER_TYPE_PASS_INVISI_SHINY)); | ||
6819 | 5772 | ||
6820 | renderGeomPostDeferred(*LLViewerCamera::getInstance()); | 5773 | renderGeomPostDeferred(*LLViewerCamera::getInstance()); |
6821 | mRenderTypeMask = render_mask; | 5774 | mRenderTypeMask = render_mask; |
6822 | } | 5775 | } |
6823 | 5776 | ||
6824 | mScreen.flush(); // We are FLUSHED alright ! end of deferred render YAY! | 5777 | mScreen.flush(); |
6825 | 5778 | ||
6826 | } | 5779 | } |
6827 | 5780 | ||
6828 | void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep) | ||
6829 | { | ||
6830 | //construct frustum | ||
6831 | LLVOVolume* volume = drawablep->getVOVolume(); | ||
6832 | LLVector3 params = volume->getSpotLightParams(); | ||
6833 | |||
6834 | F32 fov = params.mV[0]; | ||
6835 | F32 focus = params.mV[1]; | ||
6836 | |||
6837 | LLVector3 pos = drawablep->getPositionAgent(); | ||
6838 | LLQuaternion quat = volume->getRenderRotation(); | ||
6839 | LLVector3 scale = volume->getScale(); | ||
6840 | |||
6841 | //get near clip plane | ||
6842 | LLVector3 at_axis(0,0,-scale.mV[2]*0.5f); | ||
6843 | at_axis *= quat; | ||
6844 | |||
6845 | LLVector3 np = pos+at_axis; | ||
6846 | at_axis.normVec(); | ||
6847 | |||
6848 | //get origin that has given fov for plane np, at_axis, and given scale | ||
6849 | F32 dist = (scale.mV[1]*0.5f)/tanf(fov*0.5f); | ||
6850 | |||
6851 | LLVector3 origin = np - at_axis*dist; | ||
6852 | |||
6853 | //matrix from volume space to agent space | ||
6854 | LLMatrix4 light_mat(quat, LLVector4(origin,1.f)); | ||
6855 | |||
6856 | glh::matrix4f light_to_agent((F32*) light_mat.mMatrix); | ||
6857 | glh::matrix4f light_to_screen = glh_get_current_modelview() * light_to_agent; | ||
6858 | |||
6859 | glh::matrix4f screen_to_light = light_to_screen.inverse(); | ||
6860 | |||
6861 | F32 s = volume->getLightRadius()*1.5f; | ||
6862 | F32 near_clip = dist; | ||
6863 | F32 width = scale.mV[VX]; | ||
6864 | F32 height = scale.mV[VY]; | ||
6865 | F32 far_clip = s+dist-scale.mV[VZ]; | ||
6866 | |||
6867 | F32 fovy = fov * RAD_TO_DEG; | ||
6868 | F32 aspect = width/height; | ||
6869 | |||
6870 | glh::matrix4f trans(0.5f, 0.f, 0.f, 0.5f, | ||
6871 | 0.f, 0.5f, 0.f, 0.5f, | ||
6872 | 0.f, 0.f, 0.5f, 0.5f, | ||
6873 | 0.f, 0.f, 0.f, 1.f); | ||
6874 | |||
6875 | glh::vec3f p1(0, 0, -(near_clip+0.01f)); | ||
6876 | glh::vec3f p2(0, 0, -(near_clip+1.f)); | ||
6877 | |||
6878 | glh::vec3f screen_origin(0, 0, 0); | ||
6879 | |||
6880 | light_to_screen.mult_matrix_vec(p1); | ||
6881 | light_to_screen.mult_matrix_vec(p2); | ||
6882 | light_to_screen.mult_matrix_vec(screen_origin); | ||
6883 | |||
6884 | glh::vec3f n = p2-p1; | ||
6885 | n.normalize(); | ||
6886 | |||
6887 | F32 proj_range = far_clip - near_clip; | ||
6888 | glh::matrix4f light_proj = gl_perspective(fovy, aspect, near_clip, far_clip); | ||
6889 | screen_to_light = trans * light_proj * screen_to_light; | ||
6890 | shader.uniformMatrix4fv("proj_mat", 1, FALSE, screen_to_light.m); | ||
6891 | shader.uniform1f("proj_near", near_clip); | ||
6892 | shader.uniform3fv("proj_p", 1, p1.v); | ||
6893 | shader.uniform3fv("proj_n", 1, n.v); | ||
6894 | shader.uniform3fv("proj_origin", 1, screen_origin.v); | ||
6895 | shader.uniform1f("proj_range", proj_range); | ||
6896 | shader.uniform1f("proj_ambiance", params.mV[2]); | ||
6897 | S32 s_idx = -1; | ||
6898 | |||
6899 | for (U32 i = 0; i < 2; i++) | ||
6900 | { | ||
6901 | if (mShadowSpotLight[i] == drawablep) | ||
6902 | { | ||
6903 | s_idx = i; | ||
6904 | } | ||
6905 | } | ||
6906 | |||
6907 | shader.uniform1i("proj_shadow_idx", s_idx); | ||
6908 | |||
6909 | if (s_idx >= 0) | ||
6910 | { | ||
6911 | shader.uniform1f("shadow_fade", 1.f-mSpotLightFade[s_idx]); | ||
6912 | } | ||
6913 | else | ||
6914 | { | ||
6915 | shader.uniform1f("shadow_fade", 1.f); | ||
6916 | } | ||
6917 | |||
6918 | { | ||
6919 | LLDrawable* potential = drawablep; | ||
6920 | //determine if this is a good light for casting shadows | ||
6921 | F32 m_pri = volume->getSpotLightPriority(); | ||
6922 | |||
6923 | for (U32 i = 0; i < 2; i++) | ||
6924 | { | ||
6925 | F32 pri = 0.f; | ||
6926 | |||
6927 | if (mTargetShadowSpotLight[i].notNull()) | ||
6928 | { | ||
6929 | pri = mTargetShadowSpotLight[i]->getVOVolume()->getSpotLightPriority(); | ||
6930 | } | ||
6931 | |||
6932 | if (m_pri > pri) | ||
6933 | { | ||
6934 | LLDrawable* temp = mTargetShadowSpotLight[i]; | ||
6935 | mTargetShadowSpotLight[i] = potential; | ||
6936 | potential = temp; | ||
6937 | m_pri = pri; | ||
6938 | } | ||
6939 | } | ||
6940 | } | ||
6941 | |||
6942 | LLViewerImage* img = volume->getLightTexture(); | ||
6943 | |||
6944 | S32 channel = shader.enableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); | ||
6945 | |||
6946 | if (channel > -1 && img) | ||
6947 | { | ||
6948 | gGL.getTexUnit(channel)->bind(img); | ||
6949 | |||
6950 | F32 lod_range = logf(img->getWidth())/logf(2.f); | ||
6951 | |||
6952 | shader.uniform1f("proj_focus", focus); | ||
6953 | shader.uniform1f("proj_lod", lod_range); | ||
6954 | shader.uniform1f("proj_ambient_lod", llclamp((proj_range-focus)/proj_range*lod_range, 0.f, 1.f)); | ||
6955 | } | ||
6956 | } | ||
6957 | |||
6958 | void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) | 5781 | void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) |
6959 | { | 5782 | { |
6960 | LLFastTimer ftm(LLFastTimer::FTM_TEMP4); | ||
6961 | stop_glerror(); | 5783 | stop_glerror(); |
6962 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_POSITION, LLTexUnit::TT_RECT_TEXTURE); | 5784 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_POSITION, LLTexUnit::TT_RECT_TEXTURE); |
6963 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_NORMAL, LLTexUnit::TT_RECT_TEXTURE); | 5785 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_NORMAL, LLTexUnit::TT_RECT_TEXTURE); |
@@ -6965,40 +5787,14 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) | |||
6965 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_SPECULAR, LLTexUnit::TT_RECT_TEXTURE); | 5787 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_SPECULAR, LLTexUnit::TT_RECT_TEXTURE); |
6966 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_DEPTH, LLTexUnit::TT_RECT_TEXTURE); | 5788 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_DEPTH, LLTexUnit::TT_RECT_TEXTURE); |
6967 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_LIGHT, LLTexUnit::TT_RECT_TEXTURE); | 5789 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_LIGHT, LLTexUnit::TT_RECT_TEXTURE); |
6968 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_LIGHT, LLTexUnit::TT_RECT_TEXTURE); | ||
6969 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_SUN_LIGHT, LLTexUnit::TT_RECT_TEXTURE); | ||
6970 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_LOCAL_LIGHT, LLTexUnit::TT_RECT_TEXTURE); | ||
6971 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_LUMINANCE); | ||
6972 | shader.disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); | ||
6973 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_NORMAL); | ||
6974 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_DIFFUSE); | ||
6975 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_SPECULAR); | ||
6976 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_DEPTH); | ||
6977 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_MIN_POS); | ||
6978 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_MAX_POS); | ||
6979 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_LAST_NORMAL); | ||
6980 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_LAST_DIFFUSE); | ||
6981 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_LAST_MIN_POS); | ||
6982 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_GI_LAST_MAX_POS); | ||
6983 | |||
6984 | for (U32 i = 0; i < 4; i++) | 5790 | for (U32 i = 0; i < 4; i++) |
6985 | { | 5791 | { |
6986 | if (shader.disableTexture(LLViewerShaderMgr::DEFERRED_SHADOW0+i, LLTexUnit::TT_RECT_TEXTURE) > -1) | ||
6987 | { | ||
6988 | glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); | ||
6989 | } | ||
6990 | } | ||
6991 | |||
6992 | for (U32 i = 4; i < 6; i++) | ||
6993 | { | ||
6994 | if (shader.disableTexture(LLViewerShaderMgr::DEFERRED_SHADOW0+i) > -1) | 5792 | if (shader.disableTexture(LLViewerShaderMgr::DEFERRED_SHADOW0+i) > -1) |
6995 | { | 5793 | { |
6996 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); | 5794 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); |
6997 | } | 5795 | } |
6998 | } | 5796 | } |
6999 | |||
7000 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_NOISE); | 5797 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_NOISE); |
7001 | shader.disableTexture(LLViewerShaderMgr::DEFERRED_LIGHTFUNC); | ||
7002 | 5798 | ||
7003 | S32 channel = shader.disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); | 5799 | S32 channel = shader.disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); |
7004 | if (channel > -1) | 5800 | if (channel > -1) |
@@ -7012,8 +5808,6 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader) | |||
7012 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); | 5808 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); |
7013 | gGL.getTexUnit(0)->activate(); | 5809 | gGL.getTexUnit(0)->activate(); |
7014 | shader.unbind(); | 5810 | shader.unbind(); |
7015 | |||
7016 | LLGLState::checkTextureChannels(); | ||
7017 | } | 5811 | } |
7018 | 5812 | ||
7019 | inline float sgn(float a) | 5813 | inline float sgn(float a) |
@@ -7153,15 +5947,15 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) | |||
7153 | } | 5947 | } |
7154 | } | 5948 | } |
7155 | 5949 | ||
7156 | //LLSpatialPartition::sFreezeState = TRUE; | 5950 | LLSpatialPartition::sFreezeState = TRUE; |
7157 | //LLPipeline::sSkipUpdate = TRUE; | 5951 | LLPipeline::sSkipUpdate = TRUE; |
7158 | LLGLUserClipPlane clip_plane(plane, mat, projection); | 5952 | LLGLUserClipPlane clip_plane(plane, mat, projection); |
7159 | static LLCullResult result; | 5953 | static LLCullResult result; |
7160 | updateCull(camera, result, 1); | 5954 | updateCull(camera, result, 1); |
7161 | stateSort(camera, result); | 5955 | stateSort(camera, result); |
7162 | renderGeom(camera); | 5956 | renderGeom(camera); |
7163 | //LLSpatialPartition::sFreezeState = FALSE; | 5957 | LLSpatialPartition::sFreezeState = FALSE; |
7164 | //LLPipeline::sSkipUpdate = FALSE; | 5958 | LLPipeline::sSkipUpdate = FALSE; |
7165 | } | 5959 | } |
7166 | } | 5960 | } |
7167 | glCullFace(GL_BACK); | 5961 | glCullFace(GL_BACK); |
@@ -7261,6 +6055,7 @@ glh::matrix4f look(const LLVector3 pos, const LLVector3 dir, const LLVector3 up) | |||
7261 | 6055 | ||
7262 | dirN = dir; | 6056 | dirN = dir; |
7263 | dirN.normVec(); | 6057 | dirN.normVec(); |
6058 | |||
7264 | 6059 | ||
7265 | ret.m[ 0] = lftN[0]; | 6060 | ret.m[ 0] = lftN[0]; |
7266 | ret.m[ 1] = upN[0]; | 6061 | ret.m[ 1] = upN[0]; |
@@ -7311,465 +6106,14 @@ glh::matrix4f scale_translate_to_fit(const LLVector3 min, const LLVector3 max) | |||
7311 | return ret; | 6106 | return ret; |
7312 | } | 6107 | } |
7313 | 6108 | ||
7314 | void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& shadow_cam, BOOL use_shader) | ||
7315 | { | ||
7316 | LLFastTimer t(LLFastTimer::FTM_SHADOW_RENDER); | ||
7317 | |||
7318 | //clip out geometry on the same side of water as the camera | ||
7319 | static LLCullResult result; | ||
7320 | S32 occlude = LLPipeline::sUseOcclusion; | ||
7321 | LLPipeline::sUseOcclusion = 1; | ||
7322 | LLPipeline::sShadowRender = TRUE; | ||
7323 | |||
7324 | updateCull(shadow_cam, result); | ||
7325 | stateSort(shadow_cam, result); | ||
7326 | |||
7327 | U32 types[] = { LLRenderPass::PASS_SIMPLE, LLRenderPass::PASS_FULLBRIGHT, LLRenderPass::PASS_SHINY, LLRenderPass::PASS_BUMP }; | ||
7328 | LLGLEnable cull(GL_CULL_FACE); | ||
7329 | |||
7330 | //generate shadow map | ||
7331 | glMatrixMode(GL_PROJECTION); | ||
7332 | glPushMatrix(); | ||
7333 | glLoadMatrixf(proj.m); | ||
7334 | glMatrixMode(GL_MODELVIEW); | ||
7335 | glPushMatrix(); | ||
7336 | glLoadMatrixf(view.m); | ||
7337 | |||
7338 | stop_glerror(); | ||
7339 | gGLLastMatrix = NULL; | ||
7340 | |||
7341 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); | ||
7342 | |||
7343 | glColor4f(1,1,1,1); | ||
7344 | |||
7345 | stop_glerror(); | ||
7346 | |||
7347 | gGL.setColorMask(false, false); | ||
7348 | |||
7349 | if (use_shader) | ||
7350 | { | ||
7351 | gDeferredShadowProgram.bind(); | ||
7352 | } | ||
7353 | |||
7354 | //glCullFace(GL_FRONT); | ||
7355 | |||
7356 | { | ||
7357 | LLFastTimer ftm(LLFastTimer::FTM_SHADOW_SIMPLE); | ||
7358 | LLGLDisable test(GL_ALPHA_TEST); | ||
7359 | gGL.getTexUnit(0)->disable(); | ||
7360 | for (U32 i = 0; i < sizeof(types)/sizeof(U32); ++i) | ||
7361 | { | ||
7362 | renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE); | ||
7363 | } | ||
7364 | gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); | ||
7365 | } | ||
7366 | |||
7367 | if (use_shader) | ||
7368 | { | ||
7369 | gDeferredShadowProgram.unbind(); | ||
7370 | renderGeomShadow(shadow_cam); | ||
7371 | gDeferredShadowProgram.bind(); | ||
7372 | } | ||
7373 | else | ||
7374 | { | ||
7375 | renderGeomShadow(shadow_cam); | ||
7376 | } | ||
7377 | |||
7378 | { | ||
7379 | LLFastTimer ftm(LLFastTimer::FTM_SHADOW_ALPHA); | ||
7380 | LLGLEnable test(GL_ALPHA_TEST); | ||
7381 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.6f); | ||
7382 | renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE); | ||
7383 | glColor4f(1,1,1,1); | ||
7384 | renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE); | ||
7385 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); | ||
7386 | } | ||
7387 | |||
7388 | //glCullFace(GL_BACK); | ||
7389 | |||
7390 | if (use_shader) | ||
7391 | { | ||
7392 | gDeferredShadowProgram.unbind(); | ||
7393 | } | ||
7394 | |||
7395 | gGL.setColorMask(true, true); | ||
7396 | |||
7397 | |||
7398 | glMatrixMode(GL_PROJECTION); | ||
7399 | glPopMatrix(); | ||
7400 | glMatrixMode(GL_MODELVIEW); | ||
7401 | glPopMatrix(); | ||
7402 | gGLLastMatrix = NULL; | ||
7403 | |||
7404 | LLPipeline::sUseOcclusion = occlude; | ||
7405 | LLPipeline::sShadowRender = FALSE; | ||
7406 | } | ||
7407 | |||
7408 | |||
7409 | BOOL LLPipeline::getVisiblePointCloud(LLCamera& camera, LLVector3& min, LLVector3& max, std::vector<LLVector3>& fp, LLVector3 light_dir) | ||
7410 | { | ||
7411 | LLFastTimer ftm(LLFastTimer::FTM_TEMP2); | ||
7412 | //get point cloud of intersection of frust and min, max | ||
7413 | |||
7414 | //get set of planes | ||
7415 | std::vector<LLPlane> ps; | ||
7416 | |||
7417 | if (getVisibleExtents(camera, min, max)) | ||
7418 | { | ||
7419 | return FALSE; | ||
7420 | } | ||
7421 | |||
7422 | ps.push_back(LLPlane(min, LLVector3(-1,0,0))); | ||
7423 | ps.push_back(LLPlane(min, LLVector3(0,-1,0))); | ||
7424 | ps.push_back(LLPlane(min, LLVector3(0,0,-1))); | ||
7425 | ps.push_back(LLPlane(max, LLVector3(1,0,0))); | ||
7426 | ps.push_back(LLPlane(max, LLVector3(0,1,0))); | ||
7427 | ps.push_back(LLPlane(max, LLVector3(0,0,1))); | ||
7428 | |||
7429 | if (!light_dir.isExactlyZero()) | ||
7430 | { | ||
7431 | LLPlane ucp; | ||
7432 | LLPlane mcp; | ||
7433 | |||
7434 | F32 maxd = -1.f; | ||
7435 | F32 mind = 1.f; | ||
7436 | |||
7437 | for (U32 i = 0; i < ps.size(); ++i) | ||
7438 | { //pick the plane most aligned to lightDir for user clip plane | ||
7439 | LLVector3 n(ps[i].mV); | ||
7440 | F32 da = n*light_dir; | ||
7441 | if (da > maxd) | ||
7442 | { | ||
7443 | maxd = da; | ||
7444 | ucp = ps[i]; | ||
7445 | } | ||
7446 | |||
7447 | if (da < mind) | ||
7448 | { | ||
7449 | mind = da; | ||
7450 | mcp = ps[i]; | ||
7451 | } | ||
7452 | } | ||
7453 | |||
7454 | camera.setUserClipPlane(ucp); | ||
7455 | |||
7456 | ps.clear(); | ||
7457 | ps.push_back(ucp); | ||
7458 | ps.push_back(mcp); | ||
7459 | } | ||
7460 | |||
7461 | for (U32 i = 0; i < 6; i++) | ||
7462 | { | ||
7463 | ps.push_back(camera.getAgentPlane(i)); | ||
7464 | } | ||
7465 | |||
7466 | //get set of points where planes intersect and points are not above any plane | ||
7467 | fp.clear(); | ||
7468 | |||
7469 | for (U32 i = 0; i < ps.size(); ++i) | ||
7470 | { | ||
7471 | for (U32 j = 0; j < ps.size(); ++j) | ||
7472 | { | ||
7473 | for (U32 k = 0; k < ps.size(); ++k) | ||
7474 | { | ||
7475 | if (i == j || | ||
7476 | i == k || | ||
7477 | k == j) | ||
7478 | { | ||
7479 | continue; | ||
7480 | } | ||
7481 | |||
7482 | LLVector3 n1,n2,n3; | ||
7483 | F32 d1,d2,d3; | ||
7484 | |||
7485 | n1.setVec(ps[i].mV); | ||
7486 | n2.setVec(ps[j].mV); | ||
7487 | n3.setVec(ps[k].mV); | ||
7488 | |||
7489 | d1 = ps[i].mV[3]; | ||
7490 | d2 = ps[j].mV[3]; | ||
7491 | d3 = ps[k].mV[3]; | ||
7492 | |||
7493 | //get point of intersection of 3 planes "p" | ||
7494 | LLVector3 p = (-d1*(n2%n3)-d2*(n3%n1)-d3*(n1%n2))/(n1*(n2%n3)); | ||
7495 | |||
7496 | if (llround(p*n1+d1, 0.0001f) == 0.f && | ||
7497 | llround(p*n2+d2, 0.0001f) == 0.f && | ||
7498 | llround(p*n3+d3, 0.0001f) == 0.f) | ||
7499 | { //point is on all three planes | ||
7500 | BOOL found = TRUE; | ||
7501 | for (U32 l = 0; l < ps.size() && found; ++l) | ||
7502 | { | ||
7503 | if (llround(ps[l].dist(p), 0.0001f) > 0.0f) | ||
7504 | { //point is above some plane, not contained | ||
7505 | found = FALSE; | ||
7506 | } | ||
7507 | } | ||
7508 | |||
7509 | if (found) | ||
7510 | { | ||
7511 | fp.push_back(p); | ||
7512 | } | ||
7513 | } | ||
7514 | } | ||
7515 | } | ||
7516 | } | ||
7517 | |||
7518 | if (fp.empty()) | ||
7519 | { | ||
7520 | return FALSE; | ||
7521 | } | ||
7522 | |||
7523 | return TRUE; | ||
7524 | } | ||
7525 | |||
7526 | void LLPipeline::generateGI(LLCamera& camera, LLVector3& lightDir, std::vector<LLVector3>& vpc) | ||
7527 | { | ||
7528 | /* if (!gSavedSettings.getBOOL("RenderDeferredGI")) | ||
7529 | { | ||
7530 | return; | ||
7531 | } */ | ||
7532 | |||
7533 | LLVector3 up; | ||
7534 | |||
7535 | if (lightDir.mV[2] > 0.5f) | ||
7536 | { | ||
7537 | up = LLVector3(1,0,0); | ||
7538 | } | ||
7539 | else | ||
7540 | { | ||
7541 | up = LLVector3(0, 0, 1); | ||
7542 | } | ||
7543 | |||
7544 | |||
7545 | F32 lrad = gSavedSettings.getF32("RenderGILightRadius"); | ||
7546 | |||
7547 | F32 samples = (F32) gSavedSettings.getU32("RenderGISamples"); | ||
7548 | |||
7549 | F32 gi_range = gSavedSettings.getF32("RenderGIRange"); | ||
7550 | |||
7551 | U32 res = 1024; | ||
7552 | |||
7553 | lrad = samples*gi_range/(res-samples)*0.5f; | ||
7554 | |||
7555 | F32 lrange = lrad+gi_range*0.5f; | ||
7556 | |||
7557 | LLVector3 pad(lrange,lrange,lrange); | ||
7558 | |||
7559 | glh::matrix4f view = look(LLVector3(128.f,128.f,128.f), lightDir, up); | ||
7560 | |||
7561 | LLVector3 cp = camera.getOrigin()+camera.getAtAxis()*(gi_range*0.5f); | ||
7562 | |||
7563 | glh::vec3f scp(cp.mV); | ||
7564 | view.mult_matrix_vec(scp); | ||
7565 | cp.setVec(scp.v); | ||
7566 | |||
7567 | F32 pix_width = lrange/(res*0.5f); | ||
7568 | |||
7569 | //lrad = llround(lrad, pix_width); | ||
7570 | |||
7571 | //move cp to the nearest pix_width | ||
7572 | for (U32 i = 0; i < 3; i++) | ||
7573 | { | ||
7574 | cp.mV[i] = llround(cp.mV[i], pix_width); | ||
7575 | } | ||
7576 | |||
7577 | LLVector3 min = cp-pad; | ||
7578 | LLVector3 max = cp+pad; | ||
7579 | |||
7580 | //set mGIRange to range in tc space[0,1] that covers texture block of intersecting lights around a point | ||
7581 | mGIRange.mV[0] = (max.mV[0]-min.mV[0])/res; | ||
7582 | mGIRange.mV[1] = (max.mV[1]-min.mV[1])/res; | ||
7583 | mGILightRadius = lrad; | ||
7584 | |||
7585 | glh::matrix4f proj = gl_ortho(min.mV[0], max.mV[0], | ||
7586 | min.mV[1], max.mV[1], | ||
7587 | -max.mV[2], -min.mV[2]); | ||
7588 | |||
7589 | LLCamera sun_cam = camera; | ||
7590 | |||
7591 | glh::matrix4f eye_view = glh_get_current_modelview(); | ||
7592 | |||
7593 | //get eye space to camera space matrix | ||
7594 | mGIMatrix = view*eye_view.inverse(); | ||
7595 | mGINormalMatrix = mGIMatrix.inverse().transpose(); | ||
7596 | mGIInvProj = proj.inverse(); | ||
7597 | mGIMatrixProj = proj*mGIMatrix; | ||
7598 | |||
7599 | //translate and scale to [0,1] | ||
7600 | glh::matrix4f trans(.5f, 0.f, 0.f, .5f, | ||
7601 | 0.f, 0.5f, 0.f, 0.5f, | ||
7602 | 0.f, 0.f, 0.5f, 0.5f, | ||
7603 | 0.f, 0.f, 0.f, 1.f); | ||
7604 | |||
7605 | mGIMatrixProj = trans*mGIMatrixProj; | ||
7606 | |||
7607 | glh_set_current_modelview(view); | ||
7608 | glh_set_current_projection(proj); | ||
7609 | |||
7610 | LLViewerCamera::updateFrustumPlanes(sun_cam, TRUE, FALSE, TRUE); | ||
7611 | |||
7612 | sun_cam.ignoreAgentFrustumPlane(LLCamera::AGENT_PLANE_NEAR); | ||
7613 | static LLCullResult result; | ||
7614 | |||
7615 | U32 type_mask = mRenderTypeMask; | ||
7616 | |||
7617 | mRenderTypeMask = type_mask & ((1<<LLPipeline::RENDER_TYPE_SIMPLE) | | ||
7618 | (1<<LLPipeline::RENDER_TYPE_FULLBRIGHT) | | ||
7619 | (1<<LLPipeline::RENDER_TYPE_BUMP) | | ||
7620 | (1<<LLPipeline::RENDER_TYPE_VOLUME) | | ||
7621 | (1<<LLPipeline::RENDER_TYPE_TREE) | | ||
7622 | (1<<LLPipeline::RENDER_TYPE_TERRAIN) | | ||
7623 | (1<<LLPipeline::RENDER_TYPE_WATER) | | ||
7624 | (1<<LLPipeline::RENDER_TYPE_PASS_ALPHA_SHADOW) | | ||
7625 | (1<<LLPipeline::RENDER_TYPE_AVATAR) | | ||
7626 | (1 << LLPipeline::RENDER_TYPE_PASS_SIMPLE) | | ||
7627 | (1 << LLPipeline::RENDER_TYPE_PASS_BUMP) | | ||
7628 | (1 << LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT) | | ||
7629 | (1 << LLPipeline::RENDER_TYPE_PASS_SHINY)); | ||
7630 | |||
7631 | |||
7632 | |||
7633 | S32 occlude = LLPipeline::sUseOcclusion; | ||
7634 | LLPipeline::sUseOcclusion = 0; | ||
7635 | LLPipeline::sShadowRender = TRUE; | ||
7636 | |||
7637 | updateCull(sun_cam, result); | ||
7638 | stateSort(sun_cam, result); | ||
7639 | |||
7640 | LLGLEnable cull(GL_CULL_FACE); | ||
7641 | |||
7642 | //generate GI map | ||
7643 | glMatrixMode(GL_PROJECTION); | ||
7644 | glPushMatrix(); | ||
7645 | glLoadMatrixf(proj.m); | ||
7646 | glMatrixMode(GL_MODELVIEW); | ||
7647 | glPushMatrix(); | ||
7648 | glLoadMatrixf(view.m); | ||
7649 | |||
7650 | stop_glerror(); | ||
7651 | gGLLastMatrix = NULL; | ||
7652 | |||
7653 | mGIMap.clear(); | ||
7654 | |||
7655 | { | ||
7656 | LLGLEnable enable(GL_DEPTH_CLAMP_NV); | ||
7657 | renderGeomDeferred(camera); | ||
7658 | } | ||
7659 | |||
7660 | mGIMap.flush(); | ||
7661 | |||
7662 | glMatrixMode(GL_PROJECTION); | ||
7663 | glPopMatrix(); | ||
7664 | glMatrixMode(GL_MODELVIEW); | ||
7665 | glPopMatrix(); | ||
7666 | gGLLastMatrix = NULL; | ||
7667 | |||
7668 | LLPipeline::sUseOcclusion = occlude; | ||
7669 | LLPipeline::sShadowRender = FALSE; | ||
7670 | |||
7671 | |||
7672 | mRenderTypeMask = type_mask; | ||
7673 | |||
7674 | } | ||
7675 | |||
7676 | void LLPipeline::renderHighlight(const LLViewerObject* obj, F32 fade) | ||
7677 | { | ||
7678 | if (!gSavedSettings.getBOOL("renderhighlights")) // KL need this to make the mouseover Highlights toggle ^^ | ||
7679 | { | ||
7680 | return; | ||
7681 | } | ||
7682 | |||
7683 | if (obj && obj->getVolume()) | ||
7684 | { | ||
7685 | for (LLViewerObject::child_list_t::const_iterator iter = obj->getChildren().begin(); iter != obj->getChildren().end(); ++iter) | ||
7686 | { | ||
7687 | renderHighlight(*iter, fade); | ||
7688 | } | ||
7689 | |||
7690 | LLDrawable* drawable = obj->mDrawable; | ||
7691 | if (drawable) | ||
7692 | { | ||
7693 | for (S32 i = 0; i < drawable->getNumFaces(); ++i) | ||
7694 | { | ||
7695 | LLFace* face = drawable->getFace(i); | ||
7696 | if (face) | ||
7697 | { | ||
7698 | face->renderSelected(LLViewerImage::sNullImagep, LLColor4(1,1,1,fade)); | ||
7699 | } | ||
7700 | } | ||
7701 | } | ||
7702 | } | ||
7703 | } | ||
7704 | |||
7705 | void LLPipeline::generateHighlight(LLCamera& camera) | ||
7706 | { | ||
7707 | if (!gSavedSettings.getBOOL("renderhighlights")) // KL need this to make the mouseover Highlights toggle ^^ | ||
7708 | { | ||
7709 | return; | ||
7710 | } | ||
7711 | //render highlighted object as white into offscreen render target | ||
7712 | |||
7713 | if (mHighlightObject.notNull()) | ||
7714 | { | ||
7715 | mHighlightSet.insert(HighlightItem(mHighlightObject)); | ||
7716 | } | ||
7717 | |||
7718 | if (!mHighlightSet.empty()) | ||
7719 | { | ||
7720 | F32 transition = gFrameIntervalSeconds/gSavedSettings.getF32("RenderHighlightFadeTime"); | ||
7721 | |||
7722 | LLGLDisable test(GL_ALPHA_TEST); | ||
7723 | LLGLDepthTest depth(GL_FALSE); | ||
7724 | mHighlight.bindTarget(); | ||
7725 | disableLights(); | ||
7726 | gGL.setColorMask(true, true); | ||
7727 | mHighlight.clear(); | ||
7728 | |||
7729 | gGL.getTexUnit(0)->bind(LLViewerImage::sWhiteImagep); | ||
7730 | for (std::set<HighlightItem>::iterator iter = mHighlightSet.begin(); iter != mHighlightSet.end(); ) | ||
7731 | { | ||
7732 | std::set<HighlightItem>::iterator cur_iter = iter++; | ||
7733 | |||
7734 | if (cur_iter->mItem.isNull()) | ||
7735 | { | ||
7736 | mHighlightSet.erase(cur_iter); | ||
7737 | continue; | ||
7738 | } | ||
7739 | |||
7740 | if (cur_iter->mItem == mHighlightObject) | ||
7741 | { | ||
7742 | cur_iter->incrFade(transition); | ||
7743 | } | ||
7744 | else | ||
7745 | { | ||
7746 | cur_iter->incrFade(-transition); | ||
7747 | if (cur_iter->mFade <= 0.f) | ||
7748 | { | ||
7749 | mHighlightSet.erase(cur_iter); | ||
7750 | continue; | ||
7751 | } | ||
7752 | } | ||
7753 | |||
7754 | renderHighlight(cur_iter->mItem->getVObj(), cur_iter->mFade); | ||
7755 | } | ||
7756 | |||
7757 | mHighlight.flush(); | ||
7758 | gGL.setColorMask(true, false); | ||
7759 | gViewerWindow->setupViewport(); | ||
7760 | } | ||
7761 | } | ||
7762 | |||
7763 | |||
7764 | void LLPipeline::generateSunShadow(LLCamera& camera) | 6109 | void LLPipeline::generateSunShadow(LLCamera& camera) |
7765 | { | 6110 | { |
6111 | |||
7766 | if (!sRenderDeferred) | 6112 | if (!sRenderDeferred) |
7767 | { | 6113 | { |
7768 | return; | 6114 | return; |
7769 | } | 6115 | } |
7770 | 6116 | ||
7771 | LLFastTimer ftm(LLFastTimer::FTM_TEMP1); | ||
7772 | |||
7773 | //temporary hack to disable shadows but keep local lights | 6117 | //temporary hack to disable shadows but keep local lights |
7774 | static BOOL clear = TRUE; | 6118 | static BOOL clear = TRUE; |
7775 | BOOL gen_shadow = gSavedSettings.getBOOL("RenderDeferredSunShadow"); | 6119 | BOOL gen_shadow = gSavedSettings.getBOOL("RenderDeferredSunShadow"); |
@@ -7778,162 +6122,98 @@ void LLPipeline::generateSunShadow(LLCamera& camera) | |||
7778 | if (clear) | 6122 | if (clear) |
7779 | { | 6123 | { |
7780 | clear = FALSE; | 6124 | clear = FALSE; |
7781 | for (U32 i = 0; i < 6; i++) | 6125 | for (U32 i = 0; i < 4; i++) |
7782 | { | 6126 | { |
7783 | mShadow[i].bindTarget(); | 6127 | mSunShadow[i].bindTarget(); |
7784 | mShadow[i].clear(); | 6128 | mSunShadow[i].clear(); |
7785 | mShadow[i].flush(); | 6129 | mSunShadow[i].flush(); |
7786 | } | 6130 | } |
7787 | } | 6131 | } |
7788 | return; | 6132 | return; |
7789 | } | 6133 | } |
7790 | clear = TRUE; | 6134 | clear = TRUE; |
7791 | 6135 | ||
7792 | U32 type_mask = mRenderTypeMask; | ||
7793 | mRenderTypeMask = type_mask & ((1<<LLPipeline::RENDER_TYPE_SIMPLE) | | ||
7794 | (1<<LLPipeline::RENDER_TYPE_ALPHA) | | ||
7795 | (1<<LLPipeline::RENDER_TYPE_GRASS) | | ||
7796 | (1<<LLPipeline::RENDER_TYPE_FULLBRIGHT) | | ||
7797 | (1<<LLPipeline::RENDER_TYPE_BUMP) | | ||
7798 | (1<<LLPipeline::RENDER_TYPE_VOLUME) | | ||
7799 | (1<<LLPipeline::RENDER_TYPE_AVATAR) | | ||
7800 | (1<<LLPipeline::RENDER_TYPE_TREE) | | ||
7801 | (1<<LLPipeline::RENDER_TYPE_TERRAIN) | | ||
7802 | (1<<LLPipeline::RENDER_TYPE_WATER) | | ||
7803 | (1<<LLPipeline::RENDER_TYPE_PASS_ALPHA_SHADOW) | | ||
7804 | (1 << LLPipeline::RENDER_TYPE_PASS_SIMPLE) | | ||
7805 | (1 << LLPipeline::RENDER_TYPE_PASS_BUMP) | | ||
7806 | (1 << LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT) | | ||
7807 | (1 << LLPipeline::RENDER_TYPE_PASS_SHINY)); | ||
7808 | |||
7809 | gGL.setColorMask(false, false); | 6136 | gGL.setColorMask(false, false); |
7810 | 6137 | ||
7811 | //get sun view matrix | 6138 | //get sun view matrix |
7812 | 6139 | ||
6140 | F32 range = 128.f; | ||
6141 | |||
7813 | //store current projection/modelview matrix | 6142 | //store current projection/modelview matrix |
7814 | glh::matrix4f saved_proj = glh_get_current_projection(); | 6143 | glh::matrix4f saved_proj = glh_get_current_projection(); |
7815 | glh::matrix4f saved_view = glh_get_current_modelview(); | 6144 | glh::matrix4f saved_view = glh_get_current_modelview(); |
7816 | glh::matrix4f inv_view = saved_view.inverse(); | 6145 | glh::matrix4f inv_view = saved_view.inverse(); |
7817 | 6146 | ||
7818 | glh::matrix4f view[6]; | 6147 | glh::matrix4f view[4]; |
7819 | glh::matrix4f proj[6]; | 6148 | glh::matrix4f proj[4]; |
7820 | 6149 | LLVector3 up; | |
6150 | |||
7821 | //clip contains parallel split distances for 3 splits | 6151 | //clip contains parallel split distances for 3 splits |
7822 | LLVector3 clip = gSavedSettings.getVector3("RenderShadowClipPlanes"); | 6152 | LLVector3 clip = gSavedSettings.getVector3("RenderShadowClipPlanes"); |
7823 | 6153 | ||
7824 | //F32 slope_threshold = gSavedSettings.getF32("RenderShadowSlopeThreshold"); | ||
7825 | |||
7826 | //far clip on last split is minimum of camera view distance and 128 | 6154 | //far clip on last split is minimum of camera view distance and 128 |
7827 | mSunClipPlanes = LLVector4(clip, clip.mV[2] * clip.mV[2]/clip.mV[1]); | 6155 | mSunClipPlanes = LLVector4(clip, clip.mV[2] * clip.mV[2]/clip.mV[1]); |
7828 | 6156 | ||
7829 | clip = gSavedSettings.getVector3("RenderShadowOrthoClipPlanes"); | 6157 | const LLPickInfo& pick_info = gViewerWindow->getLastPick(); |
7830 | mSunOrthoClipPlanes = LLVector4(clip, clip.mV[2]*clip.mV[2]/clip.mV[1]); | 6158 | |
6159 | if (!pick_info.mPosGlobal.isExactlyZero()) | ||
6160 | { //squish nearest frustum based on alt-zoom (tighten up nearest frustum when focusing on tiny object | ||
6161 | F32 focus_dist = (F32) (pick_info.mPosGlobal + LLVector3d(pick_info.mObjectOffset) - gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin())).magVec(); | ||
6162 | mSunClipPlanes.mV[0] = llclamp(focus_dist*focus_dist, 2.f, mSunClipPlanes.mV[0]); | ||
6163 | } | ||
6164 | |||
6165 | // convenience array of 4 near clip plane distances | ||
6166 | F32 dist[] = { 0.1f, mSunClipPlanes.mV[0], mSunClipPlanes.mV[1], mSunClipPlanes.mV[2], mSunClipPlanes.mV[3] }; | ||
7831 | 6167 | ||
7832 | //currently used for amount to extrude frusta corners for constructing shadow frusta | 6168 | //currently used for amount to extrude frusta corners for constructing shadow frusta |
7833 | LLVector3 n = gSavedSettings.getVector3("RenderShadowNearDist"); | 6169 | LLVector3 n = gSavedSettings.getVector3("RenderShadowNearDist"); |
7834 | //F32 nearDist[] = { n.mV[0], n.mV[1], n.mV[2], n.mV[2] }; | 6170 | F32 nearDist[] = { n.mV[0], n.mV[1], n.mV[2], n.mV[2] }; |
7835 | 6171 | ||
7836 | LLVector3 lightDir = -mSunDir; | 6172 | for (S32 j = 0; j < 4; j++) |
7837 | lightDir.normVec(); | ||
7838 | |||
7839 | glh::vec3f light_dir(lightDir.mV); | ||
7840 | |||
7841 | //create light space camera matrix | ||
7842 | |||
7843 | LLVector3 at = lightDir; | ||
7844 | |||
7845 | LLVector3 up = camera.getAtAxis(); | ||
7846 | |||
7847 | if (fabsf(up*lightDir) > 0.75f) | ||
7848 | { | 6173 | { |
7849 | up = camera.getUpAxis(); | 6174 | //restore render matrices |
7850 | } | 6175 | glh_set_current_modelview(saved_view); |
6176 | glh_set_current_projection(saved_proj); | ||
6177 | |||
6178 | //get center of far clip plane (for point of interest later) | ||
6179 | LLVector3 center = camera.getOrigin() + camera.getAtAxis() * range; | ||
7851 | 6180 | ||
7852 | /*LLVector3 left = up%at; | 6181 | LLVector3 eye = camera.getOrigin(); |
7853 | up = at%left;*/ | ||
7854 | 6182 | ||
7855 | up.normVec(); | 6183 | //camera used for shadow cull/render |
7856 | at.normVec(); | 6184 | LLCamera shadow_cam; |
7857 | 6185 | ||
6186 | // perspective shadow map | ||
6187 | glh::vec3f p[16]; //point cloud to be contained by shadow projection (light camera space) | ||
6188 | glh::vec3f wp[16]; //point cloud to be contained by shadow projection (world space) | ||
7858 | 6189 | ||
7859 | F32 near_clip = 0.f; | 6190 | LLVector3 lightDir = -mSunDir; |
7860 | { | 6191 | glh::vec3f light_dir(lightDir.mV); |
7861 | //get visible point cloud | ||
7862 | std::vector<LLVector3> fp; | ||
7863 | 6192 | ||
7864 | LLVector3 min,max; | 6193 | //create light space camera matrix |
7865 | getVisiblePointCloud(camera,min,max,fp); | 6194 | LLVector3 at; |
6195 | F32 dl = camera.getLeftAxis() * lightDir; | ||
6196 | F32 du = camera.getUpAxis() * lightDir; | ||
7866 | 6197 | ||
7867 | if (fp.empty()) | 6198 | //choose an at axis such that up will be most aligned with lightDir |
6199 | if (dl*dl < du*du) | ||
7868 | { | 6200 | { |
7869 | mRenderTypeMask = type_mask; | 6201 | at = lightDir%camera.getLeftAxis(); |
7870 | return; | ||
7871 | } | 6202 | } |
7872 | 6203 | else | |
7873 | generateGI(camera, lightDir, fp); | ||
7874 | |||
7875 | //get good split distances for frustum | ||
7876 | for (U32 i = 0; i < fp.size(); ++i) | ||
7877 | { | 6204 | { |
7878 | glh::vec3f v(fp[i].mV); | 6205 | at = lightDir%camera.getUpAxis(); |
7879 | saved_view.mult_matrix_vec(v); | ||
7880 | fp[i].setVec(v.v); | ||
7881 | } | 6206 | } |
7882 | 6207 | ||
7883 | min = fp[0]; | 6208 | if (at * camera.getAtAxis() < 0) |
7884 | max = fp[0]; | ||
7885 | |||
7886 | //get camera space bounding box | ||
7887 | for (U32 i = 1; i < fp.size(); ++i) | ||
7888 | { | 6209 | { |
7889 | update_min_max(min, max, fp[i]); | 6210 | at = -at; |
7890 | } | 6211 | } |
7891 | |||
7892 | near_clip = -max.mV[2]; | ||
7893 | F32 far_clip = -min.mV[2]*2.f; | ||
7894 | |||
7895 | far_clip = llmin(far_clip, 128.f); | ||
7896 | far_clip = llmin(far_clip, camera.getFar()); | ||
7897 | |||
7898 | F32 range = far_clip-near_clip; | ||
7899 | |||
7900 | LLVector3 split_exp = gSavedSettings.getVector3("RenderShadowSplitExponent"); | ||
7901 | |||
7902 | F32 da = 1.f-llmax( fabsf(lightDir*up), fabsf(lightDir*camera.getLeftAxis()) ); | ||
7903 | 6212 | ||
7904 | da = powf(da, split_exp.mV[2]); | 6213 | LLVector3 left = lightDir%at; |
7905 | 6214 | up = left%lightDir; | |
7906 | 6215 | up.normVec(); | |
7907 | F32 sxp = split_exp.mV[1] + (split_exp.mV[0]-split_exp.mV[1])*da; | ||
7908 | |||
7909 | |||
7910 | for (U32 i = 0; i < 4; ++i) | ||
7911 | { | ||
7912 | F32 x = (F32)(i+1)/4.f; | ||
7913 | x = powf(x, sxp); | ||
7914 | mSunClipPlanes.mV[i] = near_clip+range*x; | ||
7915 | } | ||
7916 | } | ||
7917 | |||
7918 | // convenience array of 4 near clip plane distances | ||
7919 | F32 dist[] = { near_clip, mSunClipPlanes.mV[0], mSunClipPlanes.mV[1], mSunClipPlanes.mV[2], mSunClipPlanes.mV[3] }; | ||
7920 | |||
7921 | for (S32 j = 0; j < 4; j++) | ||
7922 | { | ||
7923 | if (!hasRenderDebugMask(RENDER_DEBUG_SHADOW_FRUSTA)) | ||
7924 | { | ||
7925 | mShadowFrustPoints[j].clear(); | ||
7926 | } | ||
7927 | |||
7928 | //restore render matrices | ||
7929 | glh_set_current_modelview(saved_view); | ||
7930 | glh_set_current_projection(saved_proj); | ||
7931 | |||
7932 | LLVector3 eye = camera.getOrigin(); | ||
7933 | 6216 | ||
7934 | //camera used for shadow cull/render | ||
7935 | LLCamera shadow_cam; | ||
7936 | |||
7937 | //create world space camera frustum for this split | 6217 | //create world space camera frustum for this split |
7938 | shadow_cam = camera; | 6218 | shadow_cam = camera; |
7939 | shadow_cam.setFar(16.f); | 6219 | shadow_cam.setFar(16.f); |
@@ -7944,6 +6224,8 @@ void LLPipeline::generateSunShadow(LLCamera& camera) | |||
7944 | 6224 | ||
7945 | LLVector3 pn = shadow_cam.getAtAxis(); | 6225 | LLVector3 pn = shadow_cam.getAtAxis(); |
7946 | 6226 | ||
6227 | LLVector3 frust_center; | ||
6228 | |||
7947 | LLVector3 min, max; | 6229 | LLVector3 min, max; |
7948 | 6230 | ||
7949 | //construct 8 corners of split frustum section | 6231 | //construct 8 corners of split frustum section |
@@ -7954,19 +6236,21 @@ void LLPipeline::generateSunShadow(LLCamera& camera) | |||
7954 | F32 dp = delta*pn; | 6236 | F32 dp = delta*pn; |
7955 | frust[i] = eye + (delta*dist[j])/dp; | 6237 | frust[i] = eye + (delta*dist[j])/dp; |
7956 | frust[i+4] = eye + (delta*dist[j+1])/dp; | 6238 | frust[i+4] = eye + (delta*dist[j+1])/dp; |
6239 | frust_center += frust[i] + frust[i+4]; | ||
7957 | } | 6240 | } |
6241 | |||
6242 | //get frustum center | ||
6243 | frust_center /= 8.f; | ||
7958 | 6244 | ||
7959 | shadow_cam.calcAgentFrustumPlanes(frust); | 6245 | shadow_cam.calcAgentFrustumPlanes(frust); |
7960 | shadow_cam.mFrustumCornerDist = 0.f; | 6246 | |
7961 | 6247 | ||
7962 | if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) | 6248 | if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) |
7963 | { | 6249 | { |
7964 | mShadowCamera[j] = shadow_cam; | 6250 | mShadowCamera[j] = shadow_cam; |
7965 | } | 6251 | } |
7966 | 6252 | ||
7967 | std::vector<LLVector3> fp; | 6253 | if (gPipeline.getVisibleExtents(shadow_cam, min, max)) |
7968 | |||
7969 | if (!gPipeline.getVisiblePointCloud(shadow_cam, min, max, fp, lightDir)) | ||
7970 | { | 6254 | { |
7971 | //no possible shadow receivers | 6255 | //no possible shadow receivers |
7972 | if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) | 6256 | if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) |
@@ -7976,16 +6260,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera) | |||
7976 | mShadowCamera[j+4] = shadow_cam; | 6260 | mShadowCamera[j+4] = shadow_cam; |
7977 | } | 6261 | } |
7978 | 6262 | ||
7979 | mShadow[j].bindTarget(); | ||
7980 | { | ||
7981 | LLGLDepthTest depth(GL_TRUE); | ||
7982 | mShadow[j].clear(); | ||
7983 | } | ||
7984 | mShadow[j].flush(); | ||
7985 | |||
7986 | mShadowError.mV[j] = 0.f; | ||
7987 | mShadowFOV.mV[j] = 0.f; | ||
7988 | |||
7989 | continue; | 6263 | continue; |
7990 | } | 6264 | } |
7991 | 6265 | ||
@@ -7993,252 +6267,42 @@ void LLPipeline::generateSunShadow(LLCamera& camera) | |||
7993 | { | 6267 | { |
7994 | mShadowExtents[j][0] = min; | 6268 | mShadowExtents[j][0] = min; |
7995 | mShadowExtents[j][1] = max; | 6269 | mShadowExtents[j][1] = max; |
7996 | mShadowFrustPoints[j] = fp; | ||
7997 | } | 6270 | } |
7998 | 6271 | ||
6272 | view[j] = look(frust_center-lightDir*nearDist[j], lightDir, up); | ||
6273 | F32 shadow_dist = nearDist[j]; | ||
7999 | 6274 | ||
8000 | //find a good origin for shadow projection | 6275 | for (U32 i = 0; i < 8; i++) |
8001 | LLVector3 origin; | ||
8002 | |||
8003 | //get a temporary view projection | ||
8004 | view[j] = look(camera.getOrigin(), lightDir, -up); | ||
8005 | |||
8006 | std::vector<LLVector3> wpf; | ||
8007 | |||
8008 | for (U32 i = 0; i < fp.size(); i++) | ||
8009 | { | 6276 | { |
8010 | glh::vec3f p = glh::vec3f(fp[i].mV); | 6277 | //points in worldspace (wp) and light camera space (p) |
8011 | view[j].mult_matrix_vec(p); | 6278 | //that must be included in shadow generation |
8012 | wpf.push_back(LLVector3(p.v)); | 6279 | wp[i] = glh::vec3f(frust[i].mV); |
8013 | } | 6280 | wp[i+8] = wp[i] - light_dir*shadow_dist; |
8014 | 6281 | view[j].mult_matrix_vec(wp[i], p[i]); | |
8015 | min = wpf[0]; | 6282 | view[j].mult_matrix_vec(wp[i+8], p[i+8]); |
8016 | max = wpf[0]; | ||
8017 | |||
8018 | for (U32 i = 0; i < fp.size(); ++i) | ||
8019 | { //get AABB in camera space | ||
8020 | update_min_max(min, max, wpf[i]); | ||
8021 | } | 6283 | } |
8022 | |||
8023 | // Construct a perspective transform with perspective along y-axis that contains | ||
8024 | // points in wpf | ||
8025 | //Known: | ||
8026 | // - far clip plane | ||
8027 | // - near clip plane | ||
8028 | // - points in frustum | ||
8029 | //Find: | ||
8030 | // - origin | ||
8031 | |||
8032 | //get some "interesting" points of reference | ||
8033 | LLVector3 center = (min+max)*0.5f; | ||
8034 | LLVector3 size = (max-min)*0.5f; | ||
8035 | LLVector3 near_center = center; | ||
8036 | near_center.mV[1] += size.mV[1]*2.f; | ||
8037 | 6284 | ||
8038 | 6285 | min = LLVector3(p[0].v); | |
8039 | //put all points in wpf in quadrant 0, reletive to center of min/max | 6286 | max = LLVector3(p[0].v); |
8040 | //get the best fit line using least squares | ||
8041 | F32 bfm = 0.f; | ||
8042 | F32 bfb = 0.f; | ||
8043 | |||
8044 | for (U32 i = 0; i < wpf.size(); ++i) | ||
8045 | { | ||
8046 | wpf[i] -= center; | ||
8047 | wpf[i].mV[0] = fabsf(wpf[i].mV[0]); | ||
8048 | wpf[i].mV[2] = fabsf(wpf[i].mV[2]); | ||
8049 | } | ||
8050 | |||
8051 | if (!wpf.empty()) | ||
8052 | { | ||
8053 | F32 sx = 0.f; | ||
8054 | F32 sx2 = 0.f; | ||
8055 | F32 sy = 0.f; | ||
8056 | F32 sxy = 0.f; | ||
8057 | |||
8058 | for (U32 i = 0; i < wpf.size(); ++i) | ||
8059 | { | ||
8060 | sx += wpf[i].mV[0]; | ||
8061 | sx2 += wpf[i].mV[0]*wpf[i].mV[0]; | ||
8062 | sy += wpf[i].mV[1]; | ||
8063 | sxy += wpf[i].mV[0]*wpf[i].mV[1]; | ||
8064 | } | ||
8065 | 6287 | ||
8066 | bfm = (sy*sx-wpf.size()*sxy)/(sx*sx-wpf.size()*sx2); | 6288 | LLVector3 fmin = min; |
8067 | bfb = (sx*sxy-sy*sx2)/(sx*sx-bfm*sx2); | 6289 | LLVector3 fmax = max; |
8068 | } | ||
8069 | |||
8070 | { | ||
8071 | // best fit line is y=bfm*x+bfb | ||
8072 | |||
8073 | //find point that is furthest to the right of line | ||
8074 | F32 off_x = -1.f; | ||
8075 | LLVector3 lp; | ||
8076 | 6290 | ||
8077 | for (U32 i = 0; i < wpf.size(); ++i) | 6291 | for (U32 i = 1; i < 16; i++) |
6292 | { //find camera space AABB of frustum in light camera space | ||
6293 | update_min_max(min, max, LLVector3(p[i].v)); | ||
6294 | if (i < 8) | ||
8078 | { | 6295 | { |
8079 | //y = bfm*x+bfb | 6296 | update_min_max(fmin, fmax, LLVector3(p[i].v)); |
8080 | //x = (y-bfb)/bfm | ||
8081 | F32 lx = (wpf[i].mV[1]-bfb)/bfm; | ||
8082 | |||
8083 | lx = wpf[i].mV[0]-lx; | ||
8084 | |||
8085 | if (off_x < lx) | ||
8086 | { | ||
8087 | off_x = lx; | ||
8088 | lp = wpf[i]; | ||
8089 | } | 6297 | } |
8090 | } | 6298 | } |
8091 | 6299 | ||
8092 | //get line with slope bfm through lp | 6300 | //generate perspective matrix that contains frustum |
8093 | // bfb = y-bfm*x | 6301 | //proj[j] = matrix_perspective(min, max); |
8094 | bfb = lp.mV[1]-bfm*lp.mV[0]; | ||
8095 | |||
8096 | //calculate error | ||
8097 | mShadowError.mV[j] = 0.f; | ||
8098 | |||
8099 | for (U32 i = 0; i < wpf.size(); ++i) | ||
8100 | { | ||
8101 | F32 lx = (wpf[i].mV[1]-bfb)/bfm; | ||
8102 | mShadowError.mV[j] += fabsf(wpf[i].mV[0]-lx); | ||
8103 | } | ||
8104 | |||
8105 | mShadowError.mV[j] /= wpf.size(); | ||
8106 | mShadowError.mV[j] /= size.mV[0]; | ||
8107 | |||
8108 | if (mShadowError.mV[j] > gSavedSettings.getF32("RenderShadowErrorCutoff")) | ||
8109 | { //just use ortho projection | ||
8110 | mShadowFOV.mV[j] = -1.f; | ||
8111 | origin.clearVec(); | ||
8112 | proj[j] = gl_ortho(min.mV[0], max.mV[0], | 6302 | proj[j] = gl_ortho(min.mV[0], max.mV[0], |
8113 | min.mV[1], max.mV[1], | 6303 | min.mV[1], max.mV[1], |
8114 | -max.mV[2], -min.mV[2]); | 6304 | -max.mV[2], -min.mV[2]); |
8115 | } | ||
8116 | else | ||
8117 | { | ||
8118 | //origin is where line x = 0; | ||
8119 | origin.setVec(0,bfb,0); | ||
8120 | |||
8121 | F32 fovz = 1.f; | ||
8122 | F32 fovx = 1.f; | ||
8123 | 6305 | ||
8124 | LLVector3 zp; | ||
8125 | LLVector3 xp; | ||
8126 | |||
8127 | for (U32 i = 0; i < wpf.size(); ++i) | ||
8128 | { | ||
8129 | LLVector3 atz = wpf[i]-origin; | ||
8130 | atz.mV[0] = 0.f; | ||
8131 | atz.normVec(); | ||
8132 | if (fovz > -atz.mV[1]) | ||
8133 | { | ||
8134 | zp = wpf[i]; | ||
8135 | fovz = -atz.mV[1]; | ||
8136 | } | ||
8137 | |||
8138 | LLVector3 atx = wpf[i]-origin; | ||
8139 | atx.mV[2] = 0.f; | ||
8140 | atx.normVec(); | ||
8141 | if (fovx > -atx.mV[1]) | ||
8142 | { | ||
8143 | fovx = -atx.mV[1]; | ||
8144 | xp = wpf[i]; | ||
8145 | } | ||
8146 | } | ||
8147 | |||
8148 | fovx = acos(fovx); | ||
8149 | fovz = acos(fovz); | ||
8150 | |||
8151 | F32 cutoff = llmin(gSavedSettings.getF32("RenderShadowFOVCutoff"), 1.4f); | ||
8152 | |||
8153 | mShadowFOV.mV[j] = fovx; | ||
8154 | |||
8155 | if (fovx < cutoff && fovz > cutoff) | ||
8156 | { | ||
8157 | //x is a good fit, but z is too big, move away from zp enough so that fovz matches cutoff | ||
8158 | F32 d = zp.mV[2]/tan(cutoff); | ||
8159 | F32 ny = zp.mV[1] + fabsf(d); | ||
8160 | |||
8161 | origin.mV[1] = ny; | ||
8162 | |||
8163 | fovz = 1.f; | ||
8164 | fovx = 1.f; | ||
8165 | |||
8166 | for (U32 i = 0; i < wpf.size(); ++i) | ||
8167 | { | ||
8168 | LLVector3 atz = wpf[i]-origin; | ||
8169 | atz.mV[0] = 0.f; | ||
8170 | atz.normVec(); | ||
8171 | fovz = llmin(fovz, -atz.mV[1]); | ||
8172 | |||
8173 | LLVector3 atx = wpf[i]-origin; | ||
8174 | atx.mV[2] = 0.f; | ||
8175 | atx.normVec(); | ||
8176 | fovx = llmin(fovx, -atx.mV[1]); | ||
8177 | } | ||
8178 | |||
8179 | fovx = acos(fovx); | ||
8180 | fovz = acos(fovz); | ||
8181 | |||
8182 | if (fovx > cutoff || llround(fovz, 0.01f) > cutoff) | ||
8183 | { | ||
8184 | // llwarns << "WTF?" << llendl; | ||
8185 | } | ||
8186 | |||
8187 | mShadowFOV.mV[j] = cutoff; | ||
8188 | } | ||
8189 | |||
8190 | |||
8191 | origin += center; | ||
8192 | |||
8193 | F32 ynear = -(max.mV[1]-origin.mV[1]); | ||
8194 | F32 yfar = -(min.mV[1]-origin.mV[1]); | ||
8195 | |||
8196 | if (ynear < 0.1f) //keep a sensible near clip plane | ||
8197 | { | ||
8198 | F32 diff = 0.1f-ynear; | ||
8199 | origin.mV[1] += diff; | ||
8200 | ynear += diff; | ||
8201 | yfar += diff; | ||
8202 | } | ||
8203 | |||
8204 | if (fovx > cutoff) | ||
8205 | { //just use ortho projection | ||
8206 | origin.clearVec(); | ||
8207 | mShadowError.mV[j] = -1.f; | ||
8208 | proj[j] = gl_ortho(min.mV[0], max.mV[0], | ||
8209 | min.mV[1], max.mV[1], | ||
8210 | -max.mV[2], -min.mV[2]); | ||
8211 | } | ||
8212 | else | ||
8213 | { | ||
8214 | //get perspective projection | ||
8215 | view[j] = view[j].inverse(); | ||
8216 | |||
8217 | glh::vec3f origin_agent(origin.mV); | ||
8218 | |||
8219 | //translate view to origin | ||
8220 | view[j].mult_matrix_vec(origin_agent); | ||
8221 | |||
8222 | eye = LLVector3(origin_agent.v); | ||
8223 | |||
8224 | if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) | ||
8225 | { | ||
8226 | mShadowFrustOrigin[j] = eye; | ||
8227 | } | ||
8228 | |||
8229 | view[j] = look(LLVector3(origin_agent.v), lightDir, -up); | ||
8230 | |||
8231 | F32 fx = 1.f/tanf(fovx); | ||
8232 | F32 fz = 1.f/tanf(fovz); | ||
8233 | |||
8234 | proj[j] = glh::matrix4f(-fx, 0, 0, 0, | ||
8235 | 0, (yfar+ynear)/(ynear-yfar), 0, (2.f*yfar*ynear)/(ynear-yfar), | ||
8236 | 0, 0, -fz, 0, | ||
8237 | 0, -1.f, 0, 0); | ||
8238 | } | ||
8239 | } | ||
8240 | } | ||
8241 | |||
8242 | shadow_cam.setFar(128.f); | 6306 | shadow_cam.setFar(128.f); |
8243 | shadow_cam.setOriginAndLookAt(eye, up, center); | 6307 | shadow_cam.setOriginAndLookAt(eye, up, center); |
8244 | 6308 | ||
@@ -8247,7 +6311,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera) | |||
8247 | 6311 | ||
8248 | LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE); | 6312 | LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE); |
8249 | 6313 | ||
8250 | shadow_cam.ignoreAgentFrustumPlane(LLCamera::AGENT_PLANE_NEAR); | 6314 | proj[j] = gl_ortho(fmin.mV[0], fmax.mV[0], |
6315 | fmin.mV[1], fmax.mV[1], | ||
6316 | -fmax.mV[2], -fmin.mV[2]); | ||
8251 | 6317 | ||
8252 | //translate and scale to from [-1, 1] to [0, 1] | 6318 | //translate and scale to from [-1, 1] to [0, 1] |
8253 | glh::matrix4f trans(0.5f, 0.f, 0.f, 0.5f, | 6319 | glh::matrix4f trans(0.5f, 0.f, 0.f, 0.5f, |
@@ -8260,154 +6326,110 @@ void LLPipeline::generateSunShadow(LLCamera& camera) | |||
8260 | 6326 | ||
8261 | mSunShadowMatrix[j] = trans*proj[j]*view[j]*inv_view; | 6327 | mSunShadowMatrix[j] = trans*proj[j]*view[j]*inv_view; |
8262 | 6328 | ||
6329 | U32 type_mask = mRenderTypeMask; | ||
6330 | mRenderTypeMask = type_mask & ((1<<LLPipeline::RENDER_TYPE_SIMPLE) | | ||
6331 | (1<<LLPipeline::RENDER_TYPE_ALPHA) | | ||
6332 | (1<<LLPipeline::RENDER_TYPE_GRASS) | | ||
6333 | (1<<LLPipeline::RENDER_TYPE_FULLBRIGHT) | | ||
6334 | (1<<LLPipeline::RENDER_TYPE_BUMP) | | ||
6335 | (1<<LLPipeline::RENDER_TYPE_VOLUME) | | ||
6336 | (1<<LLPipeline::RENDER_TYPE_AVATAR) | | ||
6337 | (1<<LLPipeline::RENDER_TYPE_TREE) | | ||
6338 | (1<<LLPipeline::RENDER_TYPE_TERRAIN) | | ||
6339 | 0); | ||
6340 | |||
6341 | //clip out geometry on the same side of water as the camera | ||
6342 | static LLCullResult result; | ||
6343 | S32 occlude = LLPipeline::sUseOcclusion; | ||
6344 | LLPipeline::sUseOcclusion = 1; | ||
6345 | LLPipeline::sShadowRender = TRUE; | ||
8263 | //hack to prevent LOD updates from using sun camera origin | 6346 | //hack to prevent LOD updates from using sun camera origin |
8264 | shadow_cam.setOrigin(camera.getOrigin()); | 6347 | shadow_cam.setOrigin(camera.getOrigin()); |
8265 | 6348 | updateCull(shadow_cam, result); | |
8266 | stop_glerror(); | 6349 | stateSort(shadow_cam, result); |
8267 | |||
8268 | mShadow[j].bindTarget(); | ||
8269 | mShadow[j].getViewport(gGLViewport); | ||
8270 | |||
8271 | { | ||
8272 | LLGLDepthTest depth(GL_TRUE); | ||
8273 | mShadow[j].clear(); | ||
8274 | } | ||
8275 | |||
8276 | { | ||
8277 | LLGLEnable enable(GL_DEPTH_CLAMP_NV); | ||
8278 | renderShadow(view[j], proj[j], shadow_cam, FALSE); | ||
8279 | } | ||
8280 | |||
8281 | mShadow[j].flush(); | ||
8282 | 6350 | ||
8283 | if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) | 6351 | if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA)) |
8284 | { | 6352 | { |
8285 | LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE); | 6353 | LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE); |
8286 | mShadowCamera[j+4] = shadow_cam; | 6354 | mShadowCamera[j+4] = shadow_cam; |
8287 | } | 6355 | } |
8288 | } | ||
8289 | |||
8290 | //llinfos << "Shadow error: " << error << " Slope: " << best_fit_slope << llendl; | ||
8291 | |||
8292 | |||
8293 | F32 fade_amt = gFrameIntervalSeconds * llmax(LLViewerCamera::getInstance()->getVelocityStat()->getCurrentPerSec(), 1.f); | ||
8294 | |||
8295 | //update shadow targets | ||
8296 | for (U32 i = 0; i < 2; i++) | ||
8297 | { //for each current shadow | ||
8298 | if (mShadowSpotLight[i].notNull() && | ||
8299 | (mShadowSpotLight[i] == mTargetShadowSpotLight[0] || | ||
8300 | mShadowSpotLight[i] == mTargetShadowSpotLight[1])) | ||
8301 | { //keep this spotlight | ||
8302 | mSpotLightFade[i] = llmin(mSpotLightFade[i]+fade_amt, 1.f); | ||
8303 | } | ||
8304 | else | ||
8305 | { //fade out this light | ||
8306 | mSpotLightFade[i] = llmax(mSpotLightFade[i]-fade_amt, 0.f); | ||
8307 | |||
8308 | if (mSpotLightFade[i] == 0.f || mShadowSpotLight[i].isNull()) | ||
8309 | { //faded out, grab one of the pending spots (whichever one isn't already taken) | ||
8310 | if (mTargetShadowSpotLight[0] != mShadowSpotLight[(i+1)%2]) | ||
8311 | { | ||
8312 | mShadowSpotLight[i] = mTargetShadowSpotLight[0]; | ||
8313 | } | ||
8314 | else | ||
8315 | { | ||
8316 | mShadowSpotLight[i] = mTargetShadowSpotLight[1]; | ||
8317 | } | ||
8318 | } | ||
8319 | } | ||
8320 | } | ||
8321 | 6356 | ||
8322 | for (S32 i = 0; i < 2; i++) | 6357 | LLFastTimer t(LLFastTimer::FTM_SHADOW_RENDER); |
8323 | { | ||
8324 | glh_set_current_modelview(saved_view); | ||
8325 | glh_set_current_projection(saved_proj); | ||
8326 | 6358 | ||
8327 | if (mShadowSpotLight[i].isNull()) | 6359 | stop_glerror(); |
8328 | { | ||
8329 | continue; | ||
8330 | } | ||
8331 | 6360 | ||
8332 | LLVOVolume* volume = mShadowSpotLight[i]->getVOVolume(); | 6361 | mSunShadow[j].bindTarget(); |
6362 | mSunShadow[j].getViewport(gGLViewport); | ||
8333 | 6363 | ||
8334 | if (!volume) | ||
8335 | { | 6364 | { |
8336 | mShadowSpotLight[i] = NULL; | 6365 | LLGLDepthTest depth(GL_TRUE); |
8337 | continue; | 6366 | mSunShadow[j].clear(); |
8338 | } | 6367 | } |
8339 | 6368 | ||
8340 | LLDrawable* drawable = mShadowSpotLight[i]; | 6369 | U32 types[] = { LLRenderPass::PASS_SIMPLE, LLRenderPass::PASS_FULLBRIGHT, LLRenderPass::PASS_SHINY, LLRenderPass::PASS_BUMP }; |
8341 | 6370 | LLGLEnable cull(GL_CULL_FACE); | |
8342 | LLVector3 params = volume->getSpotLightParams(); | ||
8343 | F32 fov = params.mV[0]; | ||
8344 | |||
8345 | //get agent->light space matrix (modelview) | ||
8346 | LLVector3 center = drawable->getPositionAgent(); | ||
8347 | LLQuaternion quat = volume->getRenderRotation(); | ||
8348 | |||
8349 | //get near clip plane | ||
8350 | LLVector3 scale = volume->getScale(); | ||
8351 | LLVector3 at_axis(0,0,-scale.mV[2]*0.5f); | ||
8352 | at_axis *= quat; | ||
8353 | |||
8354 | LLVector3 np = center+at_axis; | ||
8355 | at_axis.normVec(); | ||
8356 | |||
8357 | //get origin that has given fov for plane np, at_axis, and given scale | ||
8358 | F32 dist = (scale.mV[1]*0.5f)/tanf(fov*0.5f); | ||
8359 | |||
8360 | LLVector3 origin = np - at_axis*dist; | ||
8361 | 6371 | ||
8362 | LLMatrix4 mat(quat, LLVector4(origin, 1.f)); | 6372 | //generate sun shadow map |
8363 | 6373 | glMatrixMode(GL_PROJECTION); | |
8364 | view[i+4] = glh::matrix4f((F32*) mat.mMatrix); | 6374 | glPushMatrix(); |
8365 | 6375 | glLoadMatrixf(proj[j].m); | |
8366 | view[i+4] = view[i+4].inverse(); | 6376 | glMatrixMode(GL_MODELVIEW); |
6377 | glPushMatrix(); | ||
6378 | glLoadMatrixf(view[j].m); | ||
8367 | 6379 | ||
8368 | //get perspective matrix | 6380 | stop_glerror(); |
8369 | F32 near_clip = dist+0.01f; | 6381 | gGLLastMatrix = NULL; |
8370 | F32 width = scale.mV[VX]; | ||
8371 | F32 height = scale.mV[VY]; | ||
8372 | F32 far_clip = dist+volume->getLightRadius()*1.5f; | ||
8373 | 6382 | ||
8374 | F32 fovy = fov * RAD_TO_DEG; | 6383 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); |
8375 | F32 aspect = width/height; | ||
8376 | 6384 | ||
8377 | proj[i+4] = gl_perspective(fovy, aspect, near_clip, far_clip); | 6385 | glColor4f(1,1,1,1); |
8378 | |||
8379 | //translate and scale to from [-1, 1] to [0, 1] | ||
8380 | glh::matrix4f trans(0.5f, 0.f, 0.f, 0.5f, | ||
8381 | 0.f, 0.5f, 0.f, 0.5f, | ||
8382 | 0.f, 0.f, 0.5f, 0.5f, | ||
8383 | 0.f, 0.f, 0.f, 1.f); | ||
8384 | |||
8385 | glh_set_current_modelview(view[i+4]); | ||
8386 | glh_set_current_projection(proj[i+4]); | ||
8387 | |||
8388 | mSunShadowMatrix[i+4] = trans*proj[i+4]*view[i+4]*inv_view; | ||
8389 | 6386 | ||
8390 | LLCamera shadow_cam = camera; | 6387 | glCullFace(GL_FRONT); |
8391 | shadow_cam.setFar(far_clip); | ||
8392 | shadow_cam.setOrigin(origin); | ||
8393 | |||
8394 | LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE); | ||
8395 | |||
8396 | shadow_cam.setOrigin(camera.getOrigin()); | ||
8397 | 6388 | ||
8398 | stop_glerror(); | 6389 | stop_glerror(); |
8399 | 6390 | ||
8400 | mShadow[i+4].bindTarget(); | 6391 | gGL.setColorMask(false, false); |
8401 | mShadow[i+4].getViewport(gGLViewport); | ||
8402 | 6392 | ||
6393 | gDeferredShadowProgram.bind(); | ||
8403 | { | 6394 | { |
8404 | LLGLDepthTest depth(GL_TRUE); | 6395 | LLFastTimer ftm(LLFastTimer::FTM_SHADOW_SIMPLE); |
8405 | mShadow[i+4].clear(); | 6396 | LLGLDisable test(GL_ALPHA_TEST); |
6397 | gGL.getTexUnit(0)->disable(); | ||
6398 | for (U32 i = 0; i < sizeof(types)/sizeof(U32); ++i) | ||
6399 | { | ||
6400 | renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE); | ||
8406 | } | 6401 | } |
6402 | gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); | ||
6403 | } | ||
6404 | |||
6405 | { | ||
6406 | LLFastTimer ftm(LLFastTimer::FTM_SHADOW_ALPHA); | ||
6407 | LLGLEnable test(GL_ALPHA_TEST); | ||
6408 | gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.6f); | ||
6409 | renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE); | ||
6410 | glColor4f(1,1,1,1); | ||
6411 | renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE); | ||
6412 | gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); | ||
6413 | } | ||
6414 | |||
6415 | gDeferredShadowProgram.unbind(); | ||
6416 | |||
6417 | renderGeomShadow(shadow_cam); | ||
6418 | |||
6419 | gGL.setColorMask(true, true); | ||
8407 | 6420 | ||
8408 | renderShadow(view[i+4], proj[i+4], shadow_cam, FALSE); | 6421 | glCullFace(GL_BACK); |
6422 | LLPipeline::sUseOcclusion = occlude; | ||
6423 | LLPipeline::sShadowRender = FALSE; | ||
6424 | mRenderTypeMask = type_mask; | ||
6425 | |||
6426 | glMatrixMode(GL_PROJECTION); | ||
6427 | glPopMatrix(); | ||
6428 | glMatrixMode(GL_MODELVIEW); | ||
6429 | glPopMatrix(); | ||
6430 | gGLLastMatrix = NULL; | ||
8409 | 6431 | ||
8410 | mShadow[i+4].flush(); | 6432 | mSunShadow[j].flush(); |
8411 | } | 6433 | } |
8412 | 6434 | ||
8413 | if (!gSavedSettings.getBOOL("CameraOffset")) | 6435 | if (!gSavedSettings.getBOOL("CameraOffset")) |
@@ -8425,8 +6447,6 @@ void LLPipeline::generateSunShadow(LLCamera& camera) | |||
8425 | glMatrixMode(GL_MODELVIEW); | 6447 | glMatrixMode(GL_MODELVIEW); |
8426 | } | 6448 | } |
8427 | gGL.setColorMask(true, false); | 6449 | gGL.setColorMask(true, false); |
8428 | |||
8429 | mRenderTypeMask = type_mask; | ||
8430 | } | 6450 | } |
8431 | 6451 | ||
8432 | void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL texture) | 6452 | void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL texture) |
@@ -8466,7 +6486,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) | |||
8466 | 6486 | ||
8467 | if (muted) | 6487 | if (muted) |
8468 | { | 6488 | { |
8469 | mask = 1 << LLPipeline::RENDER_TYPE_INVISIBLE; // Peachy ;) | 6489 | mask = 1 << LLPipeline::RENDER_TYPE_AVATAR; |
8470 | } | 6490 | } |
8471 | else | 6491 | else |
8472 | { | 6492 | { |
@@ -8477,16 +6497,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) | |||
8477 | (1<<LLPipeline::RENDER_TYPE_SIMPLE) | | 6497 | (1<<LLPipeline::RENDER_TYPE_SIMPLE) | |
8478 | (1<<LLPipeline::RENDER_TYPE_FULLBRIGHT) | | 6498 | (1<<LLPipeline::RENDER_TYPE_FULLBRIGHT) | |
8479 | (1<<LLPipeline::RENDER_TYPE_ALPHA) | | 6499 | (1<<LLPipeline::RENDER_TYPE_ALPHA) | |
8480 | (1<<LLPipeline::RENDER_TYPE_INVISIBLE) | | 6500 | (1<<LLPipeline::RENDER_TYPE_INVISIBLE); |
8481 | (1 << LLPipeline::RENDER_TYPE_PASS_SIMPLE) | | ||
8482 | (1 << LLPipeline::RENDER_TYPE_PASS_ALPHA) | | ||
8483 | (1 << LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK) | | ||
8484 | (1 << LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT) | | ||
8485 | (1 << LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK) | | ||
8486 | (1 << LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_SHINY) | | ||
8487 | (1 << LLPipeline::RENDER_TYPE_PASS_SHINY) | | ||
8488 | (1 << LLPipeline::RENDER_TYPE_PASS_INVISIBLE) | | ||
8489 | (1 << LLPipeline::RENDER_TYPE_PASS_INVISI_SHINY); | ||
8490 | } | 6501 | } |
8491 | 6502 | ||
8492 | mask = mask & gPipeline.getRenderTypeMask(); | 6503 | mask = mask & gPipeline.getRenderTypeMask(); |
@@ -8496,7 +6507,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) | |||
8496 | S32 occlusion = sUseOcclusion; | 6507 | S32 occlusion = sUseOcclusion; |
8497 | sUseOcclusion = 0; | 6508 | sUseOcclusion = 0; |
8498 | sReflectionRender = sRenderDeferred ? FALSE : TRUE; | 6509 | sReflectionRender = sRenderDeferred ? FALSE : TRUE; |
8499 | sShadowRender = TRUE; | ||
8500 | sImpostorRender = TRUE; | 6510 | sImpostorRender = TRUE; |
8501 | 6511 | ||
8502 | markVisible(avatar->mDrawable, *LLViewerCamera::getInstance()); | 6512 | markVisible(avatar->mDrawable, *LLViewerCamera::getInstance()); |
@@ -8576,7 +6586,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) | |||
8576 | if (LLPipeline::sRenderDeferred) | 6586 | if (LLPipeline::sRenderDeferred) |
8577 | { | 6587 | { |
8578 | avatar->mImpostor.allocate(resX,resY,GL_RGBA16F_ARB,TRUE,TRUE); | 6588 | avatar->mImpostor.allocate(resX,resY,GL_RGBA16F_ARB,TRUE,TRUE); |
8579 | //addDeferredAttachments(avatar->mImpostor); | 6589 | addDeferredAttachments(avatar->mImpostor); |
8580 | } | 6590 | } |
8581 | else | 6591 | else |
8582 | { | 6592 | { |
@@ -8655,7 +6665,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) | |||
8655 | sUseOcclusion = occlusion; | 6665 | sUseOcclusion = occlusion; |
8656 | sReflectionRender = FALSE; | 6666 | sReflectionRender = FALSE; |
8657 | sImpostorRender = FALSE; | 6667 | sImpostorRender = FALSE; |
8658 | sShadowRender = FALSE; | ||
8659 | gPipeline.mRenderTypeMask = saved_mask; | 6668 | gPipeline.mRenderTypeMask = saved_mask; |
8660 | 6669 | ||
8661 | glMatrixMode(GL_PROJECTION); | 6670 | glMatrixMode(GL_PROJECTION); |
diff --git a/linden/indra/newview/pipeline.h b/linden/indra/newview/pipeline.h index 7c56375..1ecb56e 100644 --- a/linden/indra/newview/pipeline.h +++ b/linden/indra/newview/pipeline.h | |||
@@ -129,8 +129,6 @@ public: | |||
129 | void markMoved(LLDrawable *drawablep, BOOL damped_motion = FALSE); | 129 | void markMoved(LLDrawable *drawablep, BOOL damped_motion = FALSE); |
130 | void markShift(LLDrawable *drawablep); | 130 | void markShift(LLDrawable *drawablep); |
131 | void markTextured(LLDrawable *drawablep); | 131 | void markTextured(LLDrawable *drawablep); |
132 | void markGLRebuild(LLGLUpdate* glu); | ||
133 | void markRebuild(LLSpatialGroup* group, BOOL priority = FALSE); | ||
134 | void markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag = LLDrawable::REBUILD_ALL, BOOL priority = FALSE); | 132 | void markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag = LLDrawable::REBUILD_ALL, BOOL priority = FALSE); |
135 | 133 | ||
136 | //get the object between start and end that's closest to start. | 134 | //get the object between start and end that's closest to start. |
@@ -181,14 +179,10 @@ public: | |||
181 | void updateMove(); | 179 | void updateMove(); |
182 | BOOL visibleObjectsInFrustum(LLCamera& camera); | 180 | BOOL visibleObjectsInFrustum(LLCamera& camera); |
183 | BOOL getVisibleExtents(LLCamera& camera, LLVector3 &min, LLVector3& max); | 181 | BOOL getVisibleExtents(LLCamera& camera, LLVector3 &min, LLVector3& max); |
184 | BOOL getVisiblePointCloud(LLCamera& camera, LLVector3 &min, LLVector3& max, std::vector<LLVector3>& fp, LLVector3 light_dir = LLVector3(0,0,0)); | ||
185 | 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 | 182 | 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 |
186 | void createObjects(F32 max_dtime); | 183 | void createObjects(F32 max_dtime); |
187 | void createObject(LLViewerObject* vobj); | 184 | void createObject(LLViewerObject* vobj); |
188 | void updateGeom(F32 max_dtime); | 185 | void updateGeom(F32 max_dtime); |
189 | void updateGL(); | ||
190 | void rebuildPriorityGroups(); | ||
191 | void rebuildGroups(); | ||
192 | 186 | ||
193 | //calculate pixel area of given box from vantage point of given camera | 187 | //calculate pixel area of given box from vantage point of given camera |
194 | static F32 calcPixelArea(LLVector3 center, LLVector3 size, LLCamera& camera); | 188 | static F32 calcPixelArea(LLVector3 center, LLVector3 size, LLCamera& camera); |
@@ -209,21 +203,12 @@ public: | |||
209 | void renderGeomDeferred(LLCamera& camera); | 203 | void renderGeomDeferred(LLCamera& camera); |
210 | void renderGeomPostDeferred(LLCamera& camera); | 204 | void renderGeomPostDeferred(LLCamera& camera); |
211 | void renderGeomShadow(LLCamera& camera); | 205 | void renderGeomShadow(LLCamera& camera); |
212 | void bindDeferredShader(LLGLSLShader& shader, U32 light_index = 0, LLRenderTarget* gi_source = NULL, LLRenderTarget* last_gi_post = NULL); | 206 | void bindDeferredShader(LLGLSLShader& shader, U32 light_index = 0); |
213 | void setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep); | ||
214 | |||
215 | void unbindDeferredShader(LLGLSLShader& shader); | 207 | void unbindDeferredShader(LLGLSLShader& shader); |
216 | void renderDeferredLighting(); | 208 | void renderDeferredLighting(); |
217 | 209 | ||
218 | void generateWaterReflection(LLCamera& camera); | 210 | void generateWaterReflection(LLCamera& camera); |
219 | void generateSunShadow(LLCamera& camera); | 211 | void generateSunShadow(LLCamera& camera); |
220 | void generateHighlight(LLCamera& camera); | ||
221 | void renderHighlight(const LLViewerObject* obj, F32 fade); | ||
222 | void setHighlightObject(LLDrawable* obj) { mHighlightObject = obj; } | ||
223 | |||
224 | |||
225 | void renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& camera, BOOL use_shader = TRUE); | ||
226 | void generateGI(LLCamera& camera, LLVector3& lightDir, std::vector<LLVector3>& vpc); // KL sd | ||
227 | void renderHighlights(); | 212 | void renderHighlights(); |
228 | void renderDebug(); | 213 | void renderDebug(); |
229 | 214 | ||
@@ -331,27 +316,15 @@ public: | |||
331 | RENDER_TYPE_INVISIBLE = LLDrawPool::POOL_INVISIBLE, | 316 | RENDER_TYPE_INVISIBLE = LLDrawPool::POOL_INVISIBLE, |
332 | RENDER_TYPE_VOIDWATER = LLDrawPool::POOL_VOIDWATER, | 317 | RENDER_TYPE_VOIDWATER = LLDrawPool::POOL_VOIDWATER, |
333 | RENDER_TYPE_WATER = LLDrawPool::POOL_WATER, | 318 | RENDER_TYPE_WATER = LLDrawPool::POOL_WATER, |
334 | RENDER_TYPE_ALPHA = LLDrawPool::POOL_ALPHA, | 319 | RENDER_TYPE_ALPHA = LLDrawPool::POOL_ALPHA, |
335 | RENDER_TYPE_GLOW = LLDrawPool::POOL_GLOW, | 320 | RENDER_TYPE_GLOW = LLDrawPool::POOL_GLOW, |
336 | RENDER_TYPE_PASS_SIMPLE = LLRenderPass::PASS_SIMPLE, | 321 | |
337 | RENDER_TYPE_PASS_GRASS = LLRenderPass::PASS_GRASS, | ||
338 | RENDER_TYPE_PASS_FULLBRIGHT = LLRenderPass::PASS_FULLBRIGHT, | ||
339 | RENDER_TYPE_PASS_INVISIBLE = LLRenderPass::PASS_INVISIBLE, | ||
340 | RENDER_TYPE_PASS_INVISI_SHINY = LLRenderPass::PASS_INVISI_SHINY, | ||
341 | RENDER_TYPE_PASS_FULLBRIGHT_SHINY = LLRenderPass::PASS_FULLBRIGHT_SHINY, | ||
342 | RENDER_TYPE_PASS_SHINY = LLRenderPass::PASS_SHINY, | ||
343 | RENDER_TYPE_PASS_BUMP = LLRenderPass::PASS_BUMP, | ||
344 | RENDER_TYPE_PASS_GLOW = LLRenderPass::PASS_GLOW, | ||
345 | RENDER_TYPE_PASS_ALPHA = LLRenderPass::PASS_ALPHA, | ||
346 | RENDER_TYPE_PASS_ALPHA_MASK = LLRenderPass::PASS_ALPHA_MASK, | ||
347 | RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK = LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, | ||
348 | RENDER_TYPE_PASS_ALPHA_SHADOW = LLRenderPass::PASS_ALPHA_SHADOW, | ||
349 | // Following are object types (only used in drawable mRenderType) | 322 | // Following are object types (only used in drawable mRenderType) |
350 | RENDER_TYPE_HUD = LLDrawPool::NUM_POOL_TYPES, | 323 | RENDER_TYPE_HUD = LLDrawPool::NUM_POOL_TYPES, |
351 | RENDER_TYPE_VOLUME, | 324 | RENDER_TYPE_VOLUME, |
352 | RENDER_TYPE_PARTICLES, | 325 | RENDER_TYPE_PARTICLES, |
353 | RENDER_TYPE_CLOUDS, | 326 | RENDER_TYPE_CLOUDS, |
354 | RENDER_TYPE_HUD_PARTICLES // KL S19? | 327 | RENDER_TYPE_HUD_PARTICLES |
355 | }; | 328 | }; |
356 | 329 | ||
357 | enum LLRenderDebugFeatureMask | 330 | enum LLRenderDebugFeatureMask |
@@ -389,7 +362,8 @@ public: | |||
389 | RENDER_DEBUG_SHAME = 0x0020000, | 362 | RENDER_DEBUG_SHAME = 0x0020000, |
390 | RENDER_DEBUG_SHADOW_FRUSTA = 0x0040000, | 363 | RENDER_DEBUG_SHADOW_FRUSTA = 0x0040000, |
391 | RENDER_DEBUG_SCULPTED = 0x0080000, | 364 | RENDER_DEBUG_SCULPTED = 0x0080000, |
392 | RENDER_DEBUG_BUILD_QUEUE = 0x0100000, | 365 | RENDER_DEBUG_AVATAR_VOLUME = 0x0100000, |
366 | RENDER_DEBUG_AGENT_TARGET = 0x0200000, | ||
393 | }; | 367 | }; |
394 | 368 | ||
395 | public: | 369 | public: |
@@ -448,36 +422,15 @@ public: | |||
448 | //screen texture | 422 | //screen texture |
449 | LLRenderTarget mScreen; | 423 | LLRenderTarget mScreen; |
450 | LLRenderTarget mDeferredScreen; | 424 | LLRenderTarget mDeferredScreen; |
451 | LLRenderTarget mDeferredDepth; | 425 | LLRenderTarget mDeferredLight[2]; |
452 | LLRenderTarget mDeferredLight[3]; | ||
453 | LLMultisampleBuffer mSampleBuffer; | 426 | LLMultisampleBuffer mSampleBuffer; |
454 | LLRenderTarget mGIMap; | ||
455 | LLRenderTarget mGIMapPost[2]; | ||
456 | LLRenderTarget mLuminanceMap; | ||
457 | LLRenderTarget mHighlight; | ||
458 | 427 | ||
459 | //sun shadow map | 428 | //sun shadow map |
460 | LLRenderTarget mShadow[6]; | 429 | LLRenderTarget mSunShadow[4]; |
461 | std::vector<LLVector3> mShadowFrustPoints[4]; | ||
462 | LLVector4 mShadowError; | ||
463 | LLVector4 mShadowFOV; | ||
464 | LLVector3 mShadowFrustOrigin[4]; | ||
465 | LLCamera mShadowCamera[8]; | 430 | LLCamera mShadowCamera[8]; |
466 | LLVector3 mShadowExtents[4][2]; | 431 | LLVector3 mShadowExtents[4][2]; |
467 | glh::matrix4f mSunShadowMatrix[6]; | 432 | glh::matrix4f mSunShadowMatrix[4]; |
468 | glh::matrix4f mGIMatrix; | ||
469 | glh::matrix4f mGIMatrixProj; | ||
470 | glh::matrix4f mGINormalMatrix; | ||
471 | glh::matrix4f mGIInvProj; | ||
472 | LLVector2 mGIRange; | ||
473 | F32 mGILightRadius; | ||
474 | |||
475 | LLPointer<LLDrawable> mShadowSpotLight[2]; | ||
476 | F32 mSpotLightFade[2]; | ||
477 | LLPointer<LLDrawable> mTargetShadowSpotLight[2]; | ||
478 | |||
479 | LLVector4 mSunClipPlanes; | 433 | LLVector4 mSunClipPlanes; |
480 | LLVector4 mSunOrthoClipPlanes; | ||
481 | 434 | ||
482 | LLVector2 mScreenScale; | 435 | LLVector2 mScreenScale; |
483 | 436 | ||
@@ -492,8 +445,6 @@ public: | |||
492 | 445 | ||
493 | //noise map | 446 | //noise map |
494 | U32 mNoiseMap; | 447 | U32 mNoiseMap; |
495 | U32 mTrueNoiseMap; | ||
496 | U32 mLightFunc; | ||
497 | 448 | ||
498 | LLColor4 mSunDiffuse; | 449 | LLColor4 mSunDiffuse; |
499 | LLVector3 mSunDir; | 450 | LLVector3 mSunDir; |
@@ -554,45 +505,12 @@ protected: | |||
554 | // | 505 | // |
555 | LLDrawable::drawable_list_t mBuildQ1; // priority | 506 | LLDrawable::drawable_list_t mBuildQ1; // priority |
556 | LLDrawable::drawable_list_t mBuildQ2; // non-priority | 507 | LLDrawable::drawable_list_t mBuildQ2; // non-priority |
557 | LLSpatialGroup::sg_list_t mGroupQ1; //priority | ||
558 | LLSpatialGroup::sg_vector_t mGroupQ2; // non-priority | ||
559 | |||
560 | LLViewerObject::vobj_list_t mCreateQ; | 508 | LLViewerObject::vobj_list_t mCreateQ; |
561 | 509 | ||
562 | LLDrawable::drawable_set_t mActiveQ; | 510 | LLDrawable::drawable_set_t mActiveQ; |
563 | 511 | ||
564 | LLDrawable::drawable_set_t mRetexturedList; | 512 | LLDrawable::drawable_set_t mRetexturedList; |
565 | 513 | ||
566 | class HighlightItem | ||
567 | { | ||
568 | public: | ||
569 | const LLPointer<LLDrawable> mItem; | ||
570 | mutable F32 mFade; | ||
571 | |||
572 | HighlightItem(LLDrawable* item) | ||
573 | : mItem(item), mFade(0) | ||
574 | { | ||
575 | } | ||
576 | |||
577 | bool operator<(const HighlightItem& rhs) const | ||
578 | { | ||
579 | return mItem < rhs.mItem; | ||
580 | } | ||
581 | |||
582 | bool operator==(const HighlightItem& rhs) const | ||
583 | { | ||
584 | return mItem == rhs.mItem; | ||
585 | } | ||
586 | |||
587 | void incrFade(F32 val) const | ||
588 | { | ||
589 | mFade = llclamp(mFade+val, 0.f, 1.f); | ||
590 | } | ||
591 | }; | ||
592 | |||
593 | std::set<HighlightItem> mHighlightSet; | ||
594 | LLPointer<LLDrawable> mHighlightObject; | ||
595 | |||
596 | ////////////////////////////////////////////////// | 514 | ////////////////////////////////////////////////// |
597 | // | 515 | // |
598 | // Draw pools are responsible for storing all rendered data, | 516 | // Draw pools are responsible for storing all rendered data, |
diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_hardware_settings.xml b/linden/indra/newview/skins/default/xui/en-us/floater_hardware_settings.xml index e85eaa8..24a895b 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_hardware_settings.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_hardware_settings.xml | |||
@@ -64,35 +64,7 @@ | |||
64 | tool_tip="Enabling this on modern hardware gives a performance gain. However, older hardware often has poor implementations of VBOs and you may get crashes when this is enabled." | 64 | tool_tip="Enabling this on modern hardware gives a performance gain. However, older hardware often has poor implementations of VBOs and you may get crashes when this is enabled." |
65 | width="315" /> | 65 | width="315" /> |
66 | 66 | ||
67 | <text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | 67 | <slider bottom_delta="-21" can_edit_text="false" control_name="TextureMemory" |
68 | bottom_delta="-20" drop_shadow_visible="true" enabled="true" follows="left|top" | ||
69 | font="SansSerifSmall" h_pad="0" halign="left" height="12" | ||
70 | left="10" mouse_opaque="true" name="Enable FBO:" v_pad="0" | ||
71 | width="128"> | ||
72 | Enable FBO: | ||
73 | </text> | ||
74 | <check_box bottom_delta="-5" control_name="RenderUseFBO" enabled="true" follows="left|top" | ||
75 | font="SansSerifSmall" height="16" initial_value="true" | ||
76 | label="Enable OpenGL Framebuffer Objects" left="148" | ||
77 | mouse_opaque="true" name="fbo" radio_style="false" | ||
78 | tool_tip="Enabling this will use OpenGL Framebuffer objects for some dynamic textures. Prerequisite for deferred rendering." | ||
79 | width="315" /> | ||
80 | |||
81 | <text type="string" length="1" bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | ||
82 | bottom_delta="-20" drop_shadow_visible="true" enabled="true" follows="left|top" | ||
83 | font="SansSerifSmall" h_pad="0" halign="left" height="12" | ||
84 | left="10" mouse_opaque="true" name="Deferred Rendering:" v_pad="0" | ||
85 | width="128"> | ||
86 | Deferred Rendering: | ||
87 | </text> | ||
88 | <check_box bottom_delta="-5" control_name="RenderDeferred" enabled="true" follows="left|top" | ||
89 | font="SansSerifSmall" height="16" initial_value="true" | ||
90 | label="Enable per-pixel lighting and shadows" left="148" | ||
91 | mouse_opaque="true" name="deferred" radio_style="false" | ||
92 | tool_tip="Enabling this will perform lighting calculations in screen space, enabling per pixel lighting for all lights and shadows from the sun/moon. Requires a fast graphics card. Might not be compatible with FSAA." | ||
93 | width="315" /> | ||
94 | |||
95 | <slider bottom_delta="-21" can_edit_text="false" control_name="TextureMemory" | ||
96 | decimal_digits="0" enabled="true" | 68 | decimal_digits="0" enabled="true" |
97 | follows="left|top" height="16" increment="16" | 69 | follows="left|top" height="16" increment="16" |
98 | initial_val="32" label="Texture Memory (MB):" label_width="135" left="10" | 70 | initial_val="32" label="Texture Memory (MB):" label_width="135" left="10" |
diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml b/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml index 1be2e58..0cb4a59 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml | |||
@@ -1036,47 +1036,25 @@ | |||
1036 | <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | 1036 | <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" |
1037 | bottom_delta="-21" drop_shadow_visible="true" follows="left|top" | 1037 | bottom_delta="-21" drop_shadow_visible="true" follows="left|top" |
1038 | font="SansSerifSmall" h_pad="0" halign="left" height="10" left_delta="0" | 1038 | font="SansSerifSmall" h_pad="0" halign="left" height="10" left_delta="0" |
1039 | mouse_opaque="true" name="label color" v_pad="0" width="57"> | 1039 | mouse_opaque="true" name="label color" v_pad="0" width="58"> |
1040 | Color: | 1040 | Color: |
1041 | </text> | 1041 | </text> |
1042 | <color_swatch border_color="0.45098, 0.517647, 0.607843, 1" bottom_delta="-28" | 1042 | <color_swatch border_color="0.45098, 0.517647, 0.607843, 1" bottom_delta="-28" |
1043 | can_apply_immediately="true" color="0.5, 0.5, 0.5, 1" follows="left|top" | 1043 | can_apply_immediately="true" color="0.5, 0.5, 0.5, 1" follows="left|top" |
1044 | height="48" label="" left_delta="57" mouse_opaque="true" name="colorswatch" | 1044 | height="48" label="" left_delta="67" mouse_opaque="true" name="colorswatch" |
1045 | tool_tip="Click to open Color Picker" width="32" /> | 1045 | tool_tip="Click to open Color Picker" width="32" /> |
1046 | <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | ||
1047 | bottom_delta="28" drop_shadow_visible="true" follows="left|top" | ||
1048 | font="SansSerifSmall" h_pad="0" height="10" left="144" | ||
1049 | mouse_opaque="true" name="label texture" v_pad="0" width="58"> | ||
1050 | Texture | ||
1051 | </text> | ||
1052 | <texture_picker allow_no_texture="true" bottom_delta="-28" can_apply_immediately="true" | ||
1053 | default_image_name="Default" follows="left|top" height="48" label="" | ||
1054 | left_delta="57" mouse_opaque="true" name="light texture control" | ||
1055 | tool_tip="Click to choose a projection image (only has effect with deferred rendering enabled)" width="32" /> | ||
1056 | <spinner bottom_delta="-4" decimal_digits="3" follows="left|top" height="16" | 1046 | <spinner bottom_delta="-4" decimal_digits="3" follows="left|top" height="16" |
1057 | increment="0.1" initial_val="0.5" label="Intensity:" label_width="55" | 1047 | increment="0.1" initial_val="0.5" label="Intensity:" label_width="65" |
1058 | left="10" max_val="1" min_val="0" mouse_opaque="true" | 1048 | left="10" max_val="1" min_val="0" mouse_opaque="true" |
1059 | name="Light Intensity" width="120" /> | 1049 | name="Light Intensity" width="128" /> |
1060 | <spinner bottom_delta="0" decimal_digits="3" follows="left|top" height="16" | ||
1061 | increment="0.1" initial_val="0.5" label="FOV" label_width="55" | ||
1062 | left="144" max_val="3" min_val="0" mouse_opaque="true" | ||
1063 | name="Light FOV" width="120" /> | ||
1064 | <spinner bottom_delta="-20" decimal_digits="3" follows="left|top" height="16" | 1050 | <spinner bottom_delta="-20" decimal_digits="3" follows="left|top" height="16" |
1065 | increment="0.1" initial_val="5" label="Radius" label_width="55" | 1051 | increment="0.1" initial_val="5" label="Radius:" label_width="65" |
1066 | left="10" max_val="20" min_val="0" mouse_opaque="true" | 1052 | left_delta="0" max_val="20" min_val="0" mouse_opaque="true" |
1067 | name="Light Radius" width="120" /> | 1053 | name="Light Radius" width="128" /> |
1068 | <spinner bottom_delta="0" decimal_digits="3" follows="left|top" height="16" | ||
1069 | increment="0.5" initial_val="0.5" label="Focus" label_width="55" | ||
1070 | left="144" max_val="20" min_val="-20" mouse_opaque="true" | ||
1071 | name="Light Focus" width="120" /> | ||
1072 | <spinner bottom_delta="-20" decimal_digits="3" follows="left|top" height="16" | 1054 | <spinner bottom_delta="-20" decimal_digits="3" follows="left|top" height="16" |
1073 | increment="0.25" initial_val="1" label="Falloff" label_width="55" | 1055 | increment="0.25" initial_val="1" label="Falloff:" label_width="65" |
1074 | left="10" max_val="2" min_val="0" mouse_opaque="true" | 1056 | left_delta="0" max_val="2" min_val="0" mouse_opaque="true" |
1075 | name="Light Falloff" width="120" /> | 1057 | name="Light Falloff" width="128" /> |
1076 | <spinner bottom_delta="0" decimal_digits="3" follows="left|top" height="16" | ||
1077 | increment="0.05" initial_val="1" label="Ambiance" label_width="55" | ||
1078 | left="144" max_val="1" min_val="0" mouse_opaque="true" | ||
1079 | name="Light Ambiance" width="120" /> | ||
1080 | </panel> | 1058 | </panel> |
1081 | 1059 | ||
1082 | <!-- Texture sub-tab --> | 1060 | <!-- Texture sub-tab --> |