From d210d53504630d0da9245ecc08b6b876b2374bc7 Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Thu, 21 Oct 2010 11:12:36 +0100 Subject: Backed out changeset d51528606985 (transplanted from 785883eceedc53d05807647d52608721170ccf8e) (transplanted from 59e80ead6b226b77396983b72315dcf3da59f372) (transplanted from 21ea9fb22a819525949cd86e5b7f6ac32fe44021) --- indra/newview/llfloatersearch.cpp | 12 ++++-------- indra/newview/llfloatersearch.h | 2 -- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp index 2041fac8d8..6fc9a620c1 100644 --- a/indra/newview/llfloatersearch.cpp +++ b/indra/newview/llfloatersearch.cpp @@ -103,14 +103,10 @@ BOOL LLFloaterSearch::postBuild() void LLFloaterSearch::onOpen(const LLSD& key) { - search(key); -} - -void LLFloaterSearch::onClose(bool app_quitting) -{ - // tear down the web view so we don't show the previous search - // result when the floater is opened next time - destroy(); + if ( (key.has("category")) || ((mBrowser) && (mBrowser->getCurrentNavUrl().empty())) ) + { + search(key); + } } void LLFloaterSearch::handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event) diff --git a/indra/newview/llfloatersearch.h b/indra/newview/llfloatersearch.h index ba4dc4c0fa..615c099d0d 100644 --- a/indra/newview/llfloatersearch.h +++ b/indra/newview/llfloatersearch.h @@ -53,8 +53,6 @@ public: /// see search() for details on the key parameter. /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); - /// perform a search with the specific search term. /// The key should be a map that can contain the following keys: /// - "id": specifies the text phrase to search for -- cgit v1.2.3 From 9f25f406f2961def3e189265258a6eaf2a589362 Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Thu, 21 Oct 2010 11:12:57 +0100 Subject: Backed out changeset bb0950d8ec22 (transplanted from f3e64a993f85860cc2d77742f3bcd4e8bfeb5611) (transplanted from 00d2371c816ee517b9e3c5d2e94122d8a1158fa3) (transplanted from 2780caa07ae2d858a70c9c441727bb8237539ff5) --- indra/newview/llfloatersearch.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp index 6fc9a620c1..1e321674a7 100644 --- a/indra/newview/llfloatersearch.cpp +++ b/indra/newview/llfloatersearch.cpp @@ -105,6 +105,10 @@ void LLFloaterSearch::onOpen(const LLSD& key) { if ( (key.has("category")) || ((mBrowser) && (mBrowser->getCurrentNavUrl().empty())) ) { + // new search triggered - blank the page while loading, instead of + // temporarily showing stale results + mBrowser->navigateTo("about:blank"); + search(key); } } -- cgit v1.2.3 From f65a25531b99b756c513c9c1c73c160f72116646 Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Thu, 21 Oct 2010 22:40:06 +0100 Subject: disable prim tesselation 'split' factor - almost useless for deferred rendering, easily wastes ~20,000 triangles per frame. (transplanted from b4fbfa00768c42aed6a5c81b045fdde3920eda88) (transplanted from 056d6bdb02c0851698ae6fc36b086751d692a6ea) (transplanted from 66ccdba75509ab9c4f631d6e9835fdd632ee3b10) --- indra/llmath/llvolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index d6dfb5c7a9..2d3d1adaa5 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -1898,7 +1898,7 @@ BOOL LLVolume::generate() // Split is a parameter to LLProfile::generate that tesselates edges on the profile // to prevent lighting and texture interpolation errors on triangles that are // stretched due to twisting or scaling on the path. - S32 split = (S32) ((mDetail)*0.66f); + S32 split = 0;//(S32) ((mDetail)*0.66f); if (mParams.getPathParams().getCurveType() == LL_PCODE_PATH_LINE && (mParams.getPathParams().getScale().mV[0] != 1.0f || -- cgit v1.2.3 From a6e8026de00248bf6be5cf608bea6c7d94c4e07c Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Wed, 15 Dec 2010 13:40:28 +0000 Subject: CTS-411 edge ghosting in deferred rendering (w/shadows and shadow smoothing enabled) (transplanted from c698ce37c0502597aafc75fcf9c37ff2970b7faf) (transplanted from ae92e806703a0c03ec2ab76d74906c7465285aaf) --- doc/contributions.txt | 1 + .../shaders/class1/deferred/blurLightF.glsl | 27 +++---- .../shaders/class2/deferred/blurLightF.glsl | 83 ---------------------- .../shaders/class2/deferred/blurLightV.glsl | 19 ----- 4 files changed, 15 insertions(+), 115 deletions(-) delete mode 100644 indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl delete mode 100644 indra/newview/app_settings/shaders/class2/deferred/blurLightV.glsl diff --git a/doc/contributions.txt b/doc/contributions.txt index 4c59e703ee..b5158b3792 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -750,6 +750,7 @@ Thraxis Epsilon tiamat bingyi CT-246 Tofu Buzzard + CTS-411 STORM-546 TraductoresAnonimos Alter CT-324 diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index ea2df4b51a..ad4d700b99 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -39,43 +39,44 @@ vec4 getPosition(vec2 pos_screen) void main() { - vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz; + vec2 tc = vary_fragcoord.xy; + vec3 norm = texture2DRect(normalMap, tc).xyz; norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - vec3 pos = getPosition(vary_fragcoord.xy).xyz; - vec4 ccol = texture2DRect(lightMap, vary_fragcoord.xy).rgba; + vec3 pos = getPosition(tc).xyz; + vec4 ccol = texture2DRect(lightMap, tc).rgba; vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); - dlt /= max(-pos.z*dist_factor, 1.0); 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' vec4 col = defined_weight.xyxx * ccol; - + + // perturb sampling origin slightly in screen-space to hide edge-ghosting artifacts where smoothing radius is quite large + tc += ( (int(tc.x+tc.y)%2 - 0.5) * kern[1].z * dlt * 0.5 ); + for (int i = 1; i < 4; i++) { - vec2 tc = vary_fragcoord.xy + kern[i].z*dlt; - vec3 samppos = getPosition(tc).xyz; + vec2 samptc = tc + kern[i].z*dlt; + vec3 samppos = getPosition(samptc).xyz; float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane if (d*d <= 0.003) { - col += texture2DRect(lightMap, tc)*kern[i].xyxx; + col += texture2DRect(lightMap, samptc)*kern[i].xyxx; defined_weight += kern[i].xy; } } for (int i = 1; i < 4; i++) { - vec2 tc = vary_fragcoord.xy - kern[i].z*dlt; - vec3 samppos = getPosition(tc).xyz; + vec2 samptc = tc - kern[i].z*dlt; + vec3 samppos = getPosition(samptc).xyz; float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane if (d*d <= 0.003) { - col += texture2DRect(lightMap, tc)*kern[i].xyxx; + col += texture2DRect(lightMap, samptc)*kern[i].xyxx; defined_weight += kern[i].xy; } } - - col /= defined_weight.xyxx; gl_FragColor = col; diff --git a/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl deleted file mode 100644 index ea2df4b51a..0000000000 --- a/indra/newview/app_settings/shaders/class2/deferred/blurLightF.glsl +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @file blurLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * $/LicenseInfo$ - */ - -#version 120 - -#extension GL_ARB_texture_rectangle : enable - -uniform sampler2DRect depthMap; -uniform sampler2DRect normalMap; -uniform sampler2DRect lightMap; - -uniform float dist_factor; -uniform float blur_size; -uniform vec2 delta; -uniform vec3 kern[4]; -uniform float kern_scale; - -varying vec2 vary_fragcoord; - -uniform mat4 inv_proj; -uniform vec2 screen_res; - -vec4 getPosition(vec2 pos_screen) -{ - float depth = texture2DRect(depthMap, pos_screen.xy).a; - vec2 sc = pos_screen.xy*2.0; - sc /= screen_res; - sc -= vec2(1.0,1.0); - vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); - vec4 pos = inv_proj * ndc; - pos /= pos.w; - pos.w = 1.0; - return pos; -} - -void main() -{ - vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz; - norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - vec3 pos = getPosition(vary_fragcoord.xy).xyz; - vec4 ccol = texture2DRect(lightMap, vary_fragcoord.xy).rgba; - - vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy); - - dlt /= max(-pos.z*dist_factor, 1.0); - - 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' - vec4 col = defined_weight.xyxx * ccol; - - for (int i = 1; i < 4; i++) - { - vec2 tc = vary_fragcoord.xy + kern[i].z*dlt; - vec3 samppos = getPosition(tc).xyz; - float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane - if (d*d <= 0.003) - { - col += texture2DRect(lightMap, tc)*kern[i].xyxx; - defined_weight += kern[i].xy; - } - } - for (int i = 1; i < 4; i++) - { - vec2 tc = vary_fragcoord.xy - kern[i].z*dlt; - vec3 samppos = getPosition(tc).xyz; - float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane - if (d*d <= 0.003) - { - col += texture2DRect(lightMap, tc)*kern[i].xyxx; - defined_weight += kern[i].xy; - } - } - - - - col /= defined_weight.xyxx; - - gl_FragColor = col; -} - diff --git a/indra/newview/app_settings/shaders/class2/deferred/blurLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/blurLightV.glsl deleted file mode 100644 index c2d05c601a..0000000000 --- a/indra/newview/app_settings/shaders/class2/deferred/blurLightV.glsl +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @file blurLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * $/LicenseInfo$ - */ - -#version 120 - -varying vec2 vary_fragcoord; -uniform vec2 screen_res; - -void main() -{ - //transform vertex - gl_Position = ftransform(); - vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; - vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; -} -- cgit v1.2.3 From 139dddda8f416782d69f39b22c2665c4a196877a Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Sat, 8 Jan 2011 15:08:57 +0000 Subject: local build kludges. (transplanted from b22a24247bdb5df1f9325f250d23adbdd915469e) --- indra/llprimitive/llmodel.cpp | 2 +- indra/newview/llmeshrepository.cpp | 8 ++++---- install.xml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 3d03209eaf..5f9ed850c9 100755 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -65,7 +65,7 @@ LLModel::~LLModel() { if (mDecompID >= 0) { - LLConvexDecomposition::getInstance()->deleteDecomposition(mDecompID); +// LLConvexDecomposition::getInstance()->deleteDecomposition(mDecompID); } } diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index b772999ee2..4e25a13af2 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -3468,7 +3468,7 @@ void LLPhysicsDecomp::run() if (!stages) { - num_stages = decomp->getStages(&stages); + //num_stages = decomp->getStages(&stages); } for (S32 i = 0; i < num_stages; i++) @@ -3490,9 +3490,9 @@ void LLPhysicsDecomp::run() S32& id = *(mCurRequest->mDecompID); if (id == -1) { - decomp->genDecomposition(id); + //decomp->genDecomposition(id); } - decomp->bindDecomposition(id); + //decomp->bindDecomposition(id); if (mCurRequest->mStage == "single_hull") { @@ -3505,7 +3505,7 @@ void LLPhysicsDecomp::run() } } - decomp->quitThread(); + //decomp->quitThread(); //delete mSignal; delete mMutex; diff --git a/install.xml b/install.xml index 88a6a7ce90..bcedf234c9 100755 --- a/install.xml +++ b/install.xml @@ -306,9 +306,9 @@ linux md5sum - 9c9b629b62bf874d550c430ad678dc04 + a20e73f2e7d6a032ff25a5161b1b7394 url - https://s3.amazonaws.com/automated-builds-secondlife-com/hg/repo/brad_curl-autobuild/rev/216961/arch/Linux/installer/curl-7.21.1-linux-20101215.tar.bz2 + http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/curl-7.20.1-linux-20100527.tar.bz2 linux64 -- cgit v1.2.3 From 4f06f3dae6d35b142f57e07c41e0a8abcd296fcb Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Sun, 16 Jan 2011 13:36:44 +0000 Subject: FIX VWR-24509 Fix SSAO speckling artifacts at distance, re-enable distant SSAO (transplanted from ef938dea0504b12fcf802f38fcf5457ba566c468) --- doc/contributions.txt | 1 + indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index b5158b3792..313cc11341 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -752,6 +752,7 @@ tiamat bingyi Tofu Buzzard CTS-411 STORM-546 + VWR-24509 TraductoresAnonimos Alter CT-324 Tue Torok diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index ad4d700b99..6859f72a9c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -51,6 +51,9 @@ void main() 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' vec4 col = defined_weight.xyxx * ccol; + // relax tolerance according to distance to avoid speckling artifacts, as angles and distances are a lot more abrupt within a small screen area at larger distances + float pointplanedist_tolerance_pow2 = pos.z*pos.z*0.00005; + // perturb sampling origin slightly in screen-space to hide edge-ghosting artifacts where smoothing radius is quite large tc += ( (int(tc.x+tc.y)%2 - 0.5) * kern[1].z * dlt * 0.5 ); @@ -59,7 +62,7 @@ void main() vec2 samptc = tc + kern[i].z*dlt; vec3 samppos = getPosition(samptc).xyz; float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane - if (d*d <= 0.003) + if (d*d <= pointplanedist_tolerance_pow2) { col += texture2DRect(lightMap, samptc)*kern[i].xyxx; defined_weight += kern[i].xy; @@ -70,7 +73,7 @@ void main() vec2 samptc = tc - kern[i].z*dlt; vec3 samppos = getPosition(samptc).xyz; float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane - if (d*d <= 0.003) + if (d*d <= pointplanedist_tolerance_pow2) { col += texture2DRect(lightMap, samptc)*kern[i].xyxx; defined_weight += kern[i].xy; -- cgit v1.2.3 From 951f4af77dc21f7761cf9b9787f391e752e738ca Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Sun, 16 Jan 2011 13:37:26 +0000 Subject: local - nerf failing test (transplanted from 2ca6263676abac96c6982880fc6ee2fe182a206a) --- indra/llui/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 684e393cba..3e94a4738b 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -245,11 +245,11 @@ target_link_libraries(llui ) # Add tests -if (LL_TESTS) +if (0 AND LL_TESTS) include(LLAddBuildTest) SET(llui_TEST_SOURCE_FILES llurlmatch.cpp llurlentry.cpp ) LL_ADD_PROJECT_UNIT_TESTS(llui "${llui_TEST_SOURCE_FILES}") -endif (LL_TESTS) \ No newline at end of file +endif (0 AND LL_TESTS) -- cgit v1.2.3 From 1426bcbae4ff6fad8383b857a6697abcbe243116 Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Sun, 16 Jan 2011 13:47:15 +0000 Subject: FIX VWR-24509 Fix SSAO speckling artifacts at distance, re-enable distant SSAO followup - remove the distance limiting, re-enabling distant SSAO. (transplanted from d11eafacb2609537905718fa559e81b53e6740f8) --- .../shaders/class1/deferred/sunLightSSAOF.glsl | 74 ++++++++++----------- .../shaders/class2/deferred/sunLightSSAOF.glsl | 76 ++++++++++------------ 2 files changed, 67 insertions(+), 83 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl index 1e0693d19f..25ff958107 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl @@ -53,57 +53,49 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm) { float ret = 1.0; - float dist = dot(pos.xyz,pos.xyz); - - if (dist < 64.0*64.0) - { - vec2 kern[8]; - // exponentially (^2) distant occlusion samples spread around origin - kern[0] = vec2(-1.0, 0.0) * 0.125*0.125; - kern[1] = vec2(1.0, 0.0) * 0.250*0.250; - kern[2] = vec2(0.0, 1.0) * 0.375*0.375; - kern[3] = vec2(0.0, -1.0) * 0.500*0.500; - kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625; - kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; - kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; - kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; + vec2 kern[8]; + // exponentially (^2) distant occlusion samples spread around origin + kern[0] = vec2(-1.0, 0.0) * 0.125*0.125; + kern[1] = vec2(1.0, 0.0) * 0.250*0.250; + kern[2] = vec2(0.0, 1.0) * 0.375*0.375; + kern[3] = vec2(0.0, -1.0) * 0.500*0.500; + kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625; + kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; + kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; + kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; - vec2 pos_screen = vary_fragcoord.xy; - vec3 pos_world = pos.xyz; - vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy; + vec2 pos_screen = vary_fragcoord.xy; + vec3 pos_world = pos.xyz; + vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy; - float angle_hidden = 0.0; - int points = 0; + float angle_hidden = 0.0; + int points = 0; - float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); + float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); - // it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?) - for (int i = 0; i < 8; i++) - { - vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect); - vec3 samppos_world = getPosition(samppos_screen).xyz; + // it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations unrolling?) + for (int i = 0; i < 8; i++) + { + vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect); + vec3 samppos_world = getPosition(samppos_screen).xyz; - vec3 diff = pos_world - samppos_world; - float dist2 = dot(diff, diff); + vec3 diff = pos_world - samppos_world; + float dist2 = dot(diff, diff); - // assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area - // --> solid angle shrinking by the square of distance - //radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 - //(k should vary inversely with # of samples, but this is taken care of later) + // assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area + // --> solid angle shrinking by the square of distance + //radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 + //(k should vary inversely with # of samples, but this is taken care of later) - //if (dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) // -0.05*norm to shift sample point back slightly for flat surfaces - // angle_hidden += min(1.0/dist2, ssao_factor_inv); // dist != 0 follows from conditional. max of 1.0 (= ssao_factor_inv * ssao_factor) - angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv); + angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv); - // 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion" - points = points + int(diff.z > -1.0); - } + // 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion" + points = points + int(diff.z > -1.0); + } - angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); + angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); - ret = (1.0 - (float(points != 0) * angle_hidden)); - ret += max((dist-32.0*32.0)/(32.0*32.0), 0.0); - } + ret = (1.0 - (float(points != 0) * angle_hidden)); return min(ret, 1.0); } diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl index cc921f23d7..08b16d787f 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl @@ -62,58 +62,50 @@ vec4 getPosition(vec2 pos_screen) float calcAmbientOcclusion(vec4 pos, vec3 norm) { float ret = 1.0; - - float dist = dot(pos.xyz,pos.xyz); - - if (dist < 64.0*64.0) - { - vec2 kern[8]; - // exponentially (^2) distant occlusion samples spread around origin - kern[0] = vec2(-1.0, 0.0) * 0.125*0.125; - kern[1] = vec2(1.0, 0.0) * 0.250*0.250; - kern[2] = vec2(0.0, 1.0) * 0.375*0.375; - kern[3] = vec2(0.0, -1.0) * 0.500*0.500; - kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625; - kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; - kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; - kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; - vec2 pos_screen = vary_fragcoord.xy; - vec3 pos_world = pos.xyz; - vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy; + vec2 kern[8]; + // exponentially (^2) distant occlusion samples spread around origin + kern[0] = vec2(-1.0, 0.0) * 0.125*0.125; + kern[1] = vec2(1.0, 0.0) * 0.250*0.250; + kern[2] = vec2(0.0, 1.0) * 0.375*0.375; + kern[3] = vec2(0.0, -1.0) * 0.500*0.500; + kern[4] = vec2(0.7071, 0.7071) * 0.625*0.625; + kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; + kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; + kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; + + vec2 pos_screen = vary_fragcoord.xy; + vec3 pos_world = pos.xyz; + vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy; - float angle_hidden = 0.0; - int points = 0; + float angle_hidden = 0.0; + int points = 0; - float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); + float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); - // it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?) - for (int i = 0; i < 8; i++) - { - vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect); - vec3 samppos_world = getPosition(samppos_screen).xyz; + // it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?) + for (int i = 0; i < 8; i++) + { + vec2 samppos_screen = pos_screen + scale * reflect(kern[i], noise_reflect); + vec3 samppos_world = getPosition(samppos_screen).xyz; - vec3 diff = pos_world - samppos_world; - float dist2 = dot(diff, diff); + vec3 diff = pos_world - samppos_world; + float dist2 = dot(diff, diff); - // assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area - // --> solid angle shrinking by the square of distance - //radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 - //(k should vary inversely with # of samples, but this is taken care of later) + // assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area + // --> solid angle shrinking by the square of distance + //radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 + //(k should vary inversely with # of samples, but this is taken care of later) - //if (dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) // -0.05*norm to shift sample point back slightly for flat surfaces - // angle_hidden += min(1.0/dist2, ssao_factor_inv); // dist != 0 follows from conditional. max of 1.0 (= ssao_factor_inv * ssao_factor) - angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv); + angle_hidden = angle_hidden + float(dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) * min(1.0/dist2, ssao_factor_inv); - // 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion" - points = points + int(diff.z > -1.0); - } + // 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion" + points = points + int(diff.z > -1.0); + } - angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); + angle_hidden = min(ssao_factor*angle_hidden/float(points), 1.0); - ret = (1.0 - (float(points != 0) * angle_hidden)); - ret += max((dist-32.0*32.0)/(32.0*32.0), 0.0); - } + ret = (1.0 - (float(points != 0) * angle_hidden)); return min(ret, 1.0); } -- cgit v1.2.3 From f810c851ed2242a48ba7372093f8d79a737d15cd Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Fri, 21 Jan 2011 18:29:25 +0000 Subject: adjust SSAO towards a stronger, darker effect curve (transplanted from 4b7066a9a309fa82727c0b403cc6f20720077dc0) --- indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index 6859f72a9c..8dc9e98e05 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -81,6 +81,7 @@ void main() } col /= defined_weight.xyxx; + col.y *= col.y; gl_FragColor = col; } -- cgit v1.2.3 From dedec6404ae3333e0b645b6e4c74c552b7e52937 Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Fri, 21 Jan 2011 18:33:27 +0000 Subject: possibly controversial - turn autoglow on, tweaked to only be red-responsive. (transplanted from 93837b880d479534b651ff5bd25e4779fa6ec9ea) --- indra/newview/app_settings/settings.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 304ba15d07..8af84ba7b4 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8283,9 +8283,9 @@ Vector3 Value - 0.299 - 0.587 - 0.114 + 1 + 0 + 0 RenderGlowMaxExtractAlpha @@ -8297,7 +8297,7 @@ Type F32 Value - 0.065 + 0.25 RenderGlowMinLuminance @@ -8308,7 +8308,7 @@ Type F32 Value - 2.5 + 0.74 RenderGlowResolutionPow -- cgit v1.2.3 From 3940b79b1a191f423002936dfcd7479be5383ea5 Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Sun, 30 Jan 2011 10:56:54 -0800 Subject: tweak autoglow to be less invasive --- indra/newview/app_settings/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 8af84ba7b4..f976a2170c 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8308,7 +8308,7 @@ Type F32 Value - 0.74 + 0.81 RenderGlowResolutionPow -- cgit v1.2.3 From cae8a075c40b734a37e7d4cce4faf5dcdb6ece0c Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Fri, 21 Jan 2011 18:37:43 +0000 Subject: tweak SSAO to be weaker now that it's been de-linearized, and totally nerf the shadow blur dist factor since it helps more than hinders now that the shadow-smoother is more relaxed about edges at great distances. (transplanted from e6227fac98097154c46454228825a5a1c0e8a63e) --- indra/newview/app_settings/settings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f976a2170c..e679a04320 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7306,7 +7306,7 @@ Vector3 Value - 0.40 + 0.70 1.00 0.00 @@ -8063,7 +8063,7 @@ Type F32 Value - 0.1 + 0 RenderGIAmbiance -- cgit v1.2.3 From 9ca57fdf9832ce6c114e1254d45f828b1312df25 Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Sat, 22 Jan 2011 00:55:14 +0000 Subject: HACK to make deferred imposters more-or-less work. (transplanted from e41d116728dd1e453273047ba7fde9455a1811d4) --- indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl index 7125d845d9..7829e9b72f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -14,7 +14,7 @@ uniform sampler2D specularMap; void main() { vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); - gl_FragData[0] = vec4(col.rgb, col.a <= 0.5 ? 0.0 : 0.005); + gl_FragData[0] = vec4(col.rgb, col != vec4(0,0,0,0)); gl_FragData[1] = texture2D(specularMap, gl_TexCoord[0].xy); - gl_FragData[2] = vec4(texture2D(normalMap, gl_TexCoord[0].xy).xyz, 0.0); + gl_FragData[2] = texture2D(normalMap, gl_TexCoord[0].xy); } -- cgit v1.2.3 From ef0b1b1564c469b526d0a62d8e4412a26571fb4f Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Sat, 22 Jan 2011 00:56:18 +0000 Subject: remove some unused depth samplings. (transplanted from a38a7ea07c52aafbd4305f96d715201a35d86726) --- indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl | 3 --- indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl | 3 --- 2 files changed, 6 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index b08c5dd295..28a38d4390 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -10,7 +10,6 @@ #extension GL_ARB_texture_rectangle : enable uniform sampler2D diffuseMap; -uniform sampler2D noiseMap; uniform sampler2DRect depthMap; uniform mat4 shadow_matrix[6]; @@ -45,8 +44,6 @@ void main() vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; frag *= screen_res; - vec3 samp_pos = getPosition(frag).xyz; - vec4 pos = vec4(vary_position, 1.0); vec4 col = vec4(vary_ambient + vary_directional.rgb, gl_Color.a); diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index 32aab152a3..1dd29bfc70 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -14,7 +14,6 @@ uniform sampler2DRectShadow shadowMap0; uniform sampler2DRectShadow shadowMap1; uniform sampler2DRectShadow shadowMap2; uniform sampler2DRectShadow shadowMap3; -uniform sampler2D noiseMap; uniform sampler2DRect depthMap; uniform mat4 shadow_matrix[6]; @@ -70,8 +69,6 @@ void main() vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; frag *= screen_res; - vec3 samp_pos = getPosition(frag).xyz; - float shadow = 1.0; vec4 pos = vec4(vary_position, 1.0); -- cgit v1.2.3 From 893518c7a0aeb4f05f7289532e1790a0120d2345 Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Sun, 30 Jan 2011 12:09:28 -0800 Subject: dither compat tweak --- indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index 8dc9e98e05..d9f021b114 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -55,7 +55,7 @@ void main() float pointplanedist_tolerance_pow2 = pos.z*pos.z*0.00005; // perturb sampling origin slightly in screen-space to hide edge-ghosting artifacts where smoothing radius is quite large - tc += ( (int(tc.x+tc.y)%2 - 0.5) * kern[1].z * dlt * 0.5 ); + tc += ( (mod(tc.x+tc.y,2) - 0.5) * kern[1].z * dlt * 0.5 ); for (int i = 1; i < 4; i++) { -- cgit v1.2.3 From 85d91c7ad936db73b13d9780ed107672eb67dd39 Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Thu, 10 Feb 2011 10:42:41 -0800 Subject: crap fix --- indra/llvfs/lldir_win32.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llvfs/lldir_win32.h b/indra/llvfs/lldir_win32.h index 4c932c932c..9a07150f0f 100644 --- a/indra/llvfs/lldir_win32.h +++ b/indra/llvfs/lldir_win32.h @@ -47,7 +47,7 @@ public: /*virtual*/ std::string getLLPluginFilename(std::string base_name); private: - BOOL LLDir_Win32::getNextFileInDir(const llutf16string &dirname, const std::string &mask, std::string &fname); + BOOL getNextFileInDir(const llutf16string &dirname, const std::string &mask, std::string &fname); void* mDirSearch_h; llutf16string mCurrentDir; -- cgit v1.2.3 From 2e7771d9866a5006c8423064ca30bb654b143fef Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Sun, 20 Mar 2011 15:20:02 +0000 Subject: subtler SSAO / better worst-case. --- indra/newview/app_settings/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f56882b91e..c6317e1a1d 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7274,7 +7274,7 @@ Vector3 Value - 0.70 + 0.80 1.00 0.00 -- cgit v1.2.3 From fb862afc8b9b48ebcd3902f3324cb60c9af623d4 Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Sun, 20 Mar 2011 15:48:01 +0000 Subject: revert a bunch of stuff from my local repo so this can go in minimally. --- indra/llmath/llvolume.cpp | 2 +- indra/llprimitive/llmodel.cpp | 2 +- indra/llui/CMakeLists.txt | 4 ++-- indra/newview/llfloatersearch.cpp | 14 +++++++------- indra/newview/llfloatersearch.h | 2 ++ indra/newview/llmeshrepository.cpp | 8 ++++---- install.xml | 4 ++-- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index dabec6390d..c4be176353 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -1898,7 +1898,7 @@ BOOL LLVolume::generate() // Split is a parameter to LLProfile::generate that tesselates edges on the profile // to prevent lighting and texture interpolation errors on triangles that are // stretched due to twisting or scaling on the path. - S32 split = 0;//(S32) ((mDetail)*0.66f); + S32 split = (S32) ((mDetail)*0.66f); if (mParams.getPathParams().getCurveType() == LL_PCODE_PATH_LINE && (mParams.getPathParams().getScale().mV[0] != 1.0f || diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 2284ca0bee..eed82f924b 100755 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -66,7 +66,7 @@ LLModel::~LLModel() { if (mDecompID >= 0) { -// LLConvexDecomposition::getInstance()->deleteDecomposition(mDecompID); + LLConvexDecomposition::getInstance()->deleteDecomposition(mDecompID); } } diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 3e94a4738b..684e393cba 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -245,11 +245,11 @@ target_link_libraries(llui ) # Add tests -if (0 AND LL_TESTS) +if (LL_TESTS) include(LLAddBuildTest) SET(llui_TEST_SOURCE_FILES llurlmatch.cpp llurlentry.cpp ) LL_ADD_PROJECT_UNIT_TESTS(llui "${llui_TEST_SOURCE_FILES}") -endif (0 AND LL_TESTS) +endif (LL_TESTS) \ No newline at end of file diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp index 1e321674a7..2041fac8d8 100644 --- a/indra/newview/llfloatersearch.cpp +++ b/indra/newview/llfloatersearch.cpp @@ -103,14 +103,14 @@ BOOL LLFloaterSearch::postBuild() void LLFloaterSearch::onOpen(const LLSD& key) { - if ( (key.has("category")) || ((mBrowser) && (mBrowser->getCurrentNavUrl().empty())) ) - { - // new search triggered - blank the page while loading, instead of - // temporarily showing stale results - mBrowser->navigateTo("about:blank"); + search(key); +} - search(key); - } +void LLFloaterSearch::onClose(bool app_quitting) +{ + // tear down the web view so we don't show the previous search + // result when the floater is opened next time + destroy(); } void LLFloaterSearch::handleMediaEvent(LLPluginClassMedia *self, EMediaEvent event) diff --git a/indra/newview/llfloatersearch.h b/indra/newview/llfloatersearch.h index 615c099d0d..ba4dc4c0fa 100644 --- a/indra/newview/llfloatersearch.h +++ b/indra/newview/llfloatersearch.h @@ -53,6 +53,8 @@ public: /// see search() for details on the key parameter. /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void onClose(bool app_quitting); + /// perform a search with the specific search term. /// The key should be a map that can contain the following keys: /// - "id": specifies the text phrase to search for diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 986b8cd509..93e773d33b 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -3532,7 +3532,7 @@ void LLPhysicsDecomp::run() if (!stages) { - //num_stages = decomp->getStages(&stages); + num_stages = decomp->getStages(&stages); } for (S32 i = 0; i < num_stages; i++) @@ -3554,9 +3554,9 @@ void LLPhysicsDecomp::run() S32& id = *(mCurRequest->mDecompID); if (id == -1) { - //decomp->genDecomposition(id); + decomp->genDecomposition(id); } - //decomp->bindDecomposition(id); + decomp->bindDecomposition(id); if (mCurRequest->mStage == "single_hull") { @@ -3569,7 +3569,7 @@ void LLPhysicsDecomp::run() } } - //decomp->quitThread(); + decomp->quitThread(); if (mSignal->isLocked()) { //let go of mSignal's associated mutex diff --git a/install.xml b/install.xml index 096921a823..1bc6746223 100755 --- a/install.xml +++ b/install.xml @@ -306,9 +306,9 @@ linux md5sum - a20e73f2e7d6a032ff25a5161b1b7394 + 9c9b629b62bf874d550c430ad678dc04 url - http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/curl-7.20.1-linux-20100527.tar.bz2 + https://s3.amazonaws.com/automated-builds-secondlife-com/hg/repo/brad_curl-autobuild/rev/216961/arch/Linux/installer/curl-7.21.1-linux-20101215.tar.bz2 linux64 -- cgit v1.2.3 From d693c4f6e2f581cd9c82d5526115a5bbd072a8c2 Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Sun, 20 Mar 2011 15:52:01 +0000 Subject: undo another local change. --- indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl index f4f6ee95d0..e3c15a2ab2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -16,5 +16,5 @@ void main() vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); gl_FragData[0] = vec4(col.rgb, col.a * 0.005); gl_FragData[1] = texture2D(specularMap, gl_TexCoord[0].xy); - gl_FragData[2] = texture2D(normalMap, gl_TexCoord[0].xy); + gl_FragData[2] = vec4(texture2D(normalMap, gl_TexCoord[0].xy).xyz, 0.0); } -- cgit v1.2.3 From 7e7ff13b49f6f806a385bd92d675123ff7db7232 Mon Sep 17 00:00:00 2001 From: Tofu Buzzard Date: Sun, 20 Mar 2011 15:58:34 +0000 Subject: Disable auto-glow again, though leave my other tweaks in place for those who might turn it on. --- indra/newview/app_settings/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index c6317e1a1d..f715272681 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8276,7 +8276,7 @@ Type F32 Value - 0.81 + 9999 RenderGlowResolutionPow -- cgit v1.2.3 From 844c3ec724c0183c6158ca742404018ad8deb9b5 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 4 Apr 2011 12:19:14 -0500 Subject: SH-477 Scene stats console work in progress. --- indra/newview/CMakeLists.txt | 2 + indra/newview/lldebugview.cpp | 13 + indra/newview/llsceneview.cpp | 273 +++++++++++++++++++++ indra/newview/llsceneview.h | 48 ++++ indra/newview/llviewermenu.cpp | 10 + indra/newview/llviewerobject.cpp | 5 + indra/newview/llviewerobject.h | 1 + indra/newview/llvovolume.cpp | 30 +++ indra/newview/llvovolume.h | 1 + indra/newview/pipeline.cpp | 4 +- indra/newview/skins/default/xui/en/menu_viewer.xml | 10 + 11 files changed, 395 insertions(+), 2 deletions(-) create mode 100644 indra/newview/llsceneview.cpp create mode 100644 indra/newview/llsceneview.h diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index cb0f1c2907..a3e4760c83 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -410,6 +410,7 @@ set(viewer_SOURCE_FILES llremoteparcelrequest.cpp llsavedsettingsglue.cpp llsaveoutfitcombobtn.cpp + llsceneview.cpp llscreenchannel.cpp llscriptfloater.cpp llscrollingpanelparam.cpp @@ -953,6 +954,7 @@ set(viewer_HEADER_FILES llrootview.h llsavedsettingsglue.h llsaveoutfitcombobtn.h + llsceneview.h llscreenchannel.h llscriptfloater.h llscrollingpanelparam.h diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index 0876c3fd99..b6d67899f8 100644 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -39,7 +39,9 @@ #include "llviewerwindow.h" #include "llappviewer.h" #include "llmemoryview.h" +#include "llsceneview.h" #include "llviewertexture.h" + // // Globals // @@ -83,6 +85,13 @@ void LLDebugView::init() addChild(mFastTimerView); mFastTimerView->setRect(rect); + gSceneView = new LLSceneView(r); + gSceneView->setFollowsTop(); + gSceneView->setFollowsLeft(); + gSceneView->setVisible(FALSE); + addChild(gSceneView); + gSceneView->setRect(rect); + r.setLeftTopAndSize(25, rect.getHeight() - 50, (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f), (S32) (gViewerWindow->getWindowRectScaled().getHeight() * 0.75f)); LLMemoryView::Params mp; @@ -103,6 +112,9 @@ void LLDebugView::init() addChild(gTextureView); //gTextureView->reshape(r.getWidth(), r.getHeight(), TRUE); + + + if(gAuditTexture) { r.set(150, rect.getHeight() - 50, 900 + LLImageGL::sTextureLoadedCounter.size() * 30, 100); @@ -133,6 +145,7 @@ LLDebugView::~LLDebugView() // These have already been deleted. Fix the globals appropriately. gDebugView = NULL; gTextureView = NULL; + gSceneView = NULL; gTextureSizeView = NULL; gTextureCategoryView = NULL; } diff --git a/indra/newview/llsceneview.cpp b/indra/newview/llsceneview.cpp new file mode 100644 index 0000000000..dfc13bc9b8 --- /dev/null +++ b/indra/newview/llsceneview.cpp @@ -0,0 +1,273 @@ +/** + * @file llsceneview.cpp + * @brief LLSceneView class implementation + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llsceneview.h" +#include "llviewerwindow.h" +#include "pipeline.h" +#include "llviewerobjectlist.h" +#include "llviewerregion.h" +#include "llagent.h" +#include "llvolumemgr.h" + +LLSceneView* gSceneView = NULL; + +LLSceneView::LLSceneView(const LLRect& rect) + : LLFloater(LLSD()) +{ + setRect(rect); + setVisible(FALSE); + + setCanMinimize(false); + setCanClose(true); +} + +void LLSceneView::onClickCloseBtn() +{ + setVisible(false); +} + + +void LLSceneView::draw() +{ + S32 margin = 10; + S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.75f); + S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f); + + LLRect new_rect; + new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height); + setRect(new_rect); + + // Draw the window background + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); + + + //aggregate some statistics + + //object sizes + std::vector size[2]; + + std::vector triangles[2]; + std::vector visible_triangles[2]; + + + U32 object_count = 0; + + LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + for (U32 i = 0; i < gObjectList.getNumObjects(); ++i) + { + LLViewerObject* object = gObjectList.getObject(i); + + if (object && + object->getVolume()&& + object->getRegion() == region) + { + U32 idx = object->isAttachment() ? 1 : 0; + + LLVolume* volume = object->getVolume(); + object_count++; + + F32 radius = object->getScale().magVec(); + size[idx].push_back(radius); + + visible_triangles[idx].push_back(volume->getNumTriangles()); + + triangles[idx].push_back(object->getHighLODTriangleCount()); + } + } + } + + const char* category[] = + { + "Region", + "Attachment" + }; + + for (U32 idx = 0; idx < 2; idx++) + { + if (!size[idx].empty()) + { //display graph of object sizes + std::sort(size[idx].begin(), size[idx].end()); + + LLRect size_rect; + + if (idx == 0) + { + size_rect = LLRect(margin, new_rect.getHeight()/2-margin*2, new_rect.getWidth()/2-margin, margin*2); + } + else + { + size_rect = LLRect(margin+new_rect.getWidth()/2, new_rect.getHeight()/2-margin*2, new_rect.getWidth()-margin, margin*2); + } + + gl_rect_2d(size_rect, LLColor4::white, false); + + F32 size_domain[] = { 128.f, 0.f }; + + //get domain of sizes + for (U32 i = 0; i < size[idx].size(); ++i) + { + size_domain[0] = llmin(size_domain[0], size[idx][i]); + size_domain[1] = llmax(size_domain[1], size[idx][i]); + } + + F32 size_range = size_domain[1]-size_domain[0]; + + U32 count = size[idx].size(); + + F32 total = 0.f; + + gGL.begin(LLRender::LINE_STRIP); + + for (U32 i = 0; i < count; ++i) + { + F32 rad = size[idx][i]; + total += rad; + F32 y = (rad-size_domain[0])/size_range*size_rect.getHeight()+size_rect.mBottom; + F32 x = (F32) i / count * size_rect.getWidth() + size_rect.mLeft; + + gGL.vertex2f(x,y); + + if (i%4096 == 0) + { + gGL.end(); + gGL.flush(); + gGL.begin(LLRender::LINE_STRIP); + } + } + + gGL.end(); + gGL.flush(); + + std::string label = llformat("%s Object Sizes (m) -- Min: %.1f Max: %.1f Mean: %.1f Median: %.1f -- %d samples", + category[idx], size_domain[0], size_domain[1], total/count, size[idx][count/2], count); + + LLFontGL::getFontMonospace()->renderUTF8(label, + 0 , size_rect.mLeft, size_rect.mTop+margin, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); + + } + } + + for (U32 idx = 0; idx < 2; ++idx) + { + if (!triangles[idx].empty()) + { //plot graph of visible/total triangles + std::sort(triangles[idx].begin(), triangles[idx].end()); + std::sort(visible_triangles[idx].begin(), visible_triangles[idx].end()); + + LLRect tri_rect; + if (idx == 0) + { + tri_rect = LLRect(margin, new_rect.getHeight()-margin*2, new_rect.getWidth()/2-margin, new_rect.getHeight()/2 + margin); + } + else + { + tri_rect = LLRect(new_rect.getWidth()/2+margin, new_rect.getHeight()-margin*2, new_rect.getWidth()-margin, new_rect.getHeight()/2 + margin); + } + + gl_rect_2d(tri_rect, LLColor4::white, false); + + U32 tri_domain[] = { 65536, 0 }; + + llassert(triangles[idx].size() == visible_triangles[idx].size()); + + //get domain of sizes + for (U32 i = 0; i < triangles[idx].size(); ++i) + { + tri_domain[0] = llmin(visible_triangles[idx][i], llmin(tri_domain[0], triangles[idx][i])); + tri_domain[1] = llmax(visible_triangles[idx][i], llmax(tri_domain[1], triangles[idx][i])); + } + + U32 triangle_range = tri_domain[1]-tri_domain[0]; + + U32 count = triangles[idx].size(); + + U32 total = 0; + + gGL.begin(LLRender::LINE_STRIP); + //plot triangles + for (U32 i = 0; i < count; ++i) + { + U32 tri_count = triangles[idx][i]; + total += tri_count; + F32 y = (F32) (tri_count-tri_domain[0])/triangle_range*tri_rect.getHeight()+tri_rect.mBottom; + F32 x = (F32) i / count * tri_rect.getWidth() + tri_rect.mLeft; + + gGL.vertex2f(x,y); + + if (i%4096 == 0) + { + gGL.end(); + gGL.flush(); + gGL.begin(LLRender::LINE_STRIP); + } + } + + gGL.end(); + gGL.flush(); + + U32 total_visible = 0; + gGL.begin(LLRender::LINE_STRIP); + //plot visible triangles + for (U32 i = 0; i < count; ++i) + { + U32 tri_count = visible_triangles[idx][i]; + total_visible += tri_count; + F32 y = (F32) (tri_count-tri_domain[0])/triangle_range*tri_rect.getHeight()+tri_rect.mBottom; + F32 x = (F32) i / count * tri_rect.getWidth() + tri_rect.mLeft; + + gGL.vertex2f(x,y); + + if (i%4096 == 0) + { + gGL.end(); + gGL.flush(); + gGL.begin(LLRender::LINE_STRIP); + } + } + + gGL.end(); + gGL.flush(); + + + std::string label = llformat("%s Object Triangle Counts (Ktris) -- Min: %.2f Max: %.2f Mean: %.2f Median: %.2f (%.2f/%.2f visible) -- %d samples", + category[idx], tri_domain[0]/1024.f, tri_domain[1]/1024.f, (total/count)/1024.f, triangles[idx][count/2]/1024.f, total_visible/1024.f, total/1024.f, count); + + LLFontGL::getFontMonospace()->renderUTF8(label, + 0 , tri_rect.mLeft, tri_rect.mTop+margin, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); + + } + } + + + LLView::draw(); +} + + diff --git a/indra/newview/llsceneview.h b/indra/newview/llsceneview.h new file mode 100644 index 0000000000..2a3a14bbee --- /dev/null +++ b/indra/newview/llsceneview.h @@ -0,0 +1,48 @@ +/** + * @file llsceneview.h + * @brief LLSceneView class header file + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLSCENEVIEW_H +#define LL_LLSCENEVIEW_H + +#include "llfloater.h" + + +class LLSceneView : public LLFloater +{ +public: + LLSceneView(const LLRect& rect); + + virtual void draw(); + +protected: + virtual void onClickCloseBtn(); + + +}; + +extern LLSceneView* gSceneView; + +#endif // LL_LLSCENEVIEW_H diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index f5b0857425..5a8c3befa6 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -76,6 +76,7 @@ #include "llmoveview.h" #include "llparcel.h" #include "llrootview.h" +#include "llsceneview.h" #include "llselectmgr.h" #include "llsidetray.h" #include "llstatusbar.h" @@ -515,6 +516,11 @@ class LLAdvancedToggleConsole : public view_listener_t { toggle_visibility( (void*)gDebugView->mFastTimerView ); } + else if ("scene view" == console_type) + { + toggle_visibility( (void*)gSceneView); + } + #if MEM_TRACK_MEM else if ("memory view" == console_type) { @@ -550,6 +556,10 @@ class LLAdvancedCheckConsole : public view_listener_t { new_value = get_visibility( (void*)gDebugView->mFastTimerView ); } + else if ("scene view" == console_type) + { + new_value = get_visibility( (void*) gSceneView); + } #if MEM_TRACK_MEM else if ("memory view" == console_type) { diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 70b1809033..207e15ff1a 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -3144,6 +3144,11 @@ U32 LLViewerObject::getTriangleCount() return 0; } +U32 LLViewerObject::getHighLODTriangleCount() +{ + return 0; +} + void LLViewerObject::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax) { LLVector4a center; diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 44f46b8c0f..e417343bec 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -328,6 +328,7 @@ public: virtual F32 getStreamingCost(S32* bytes = NULL, S32* visible_bytes = NULL); virtual U32 getTriangleCount(); + virtual U32 getHighLODTriangleCount(); void setObjectCost(F32 cost); F32 getObjectCost(); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 7c4a4c13ba..45277265df 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3108,6 +3108,36 @@ U32 LLVOVolume::getTriangleCount() return count; } +U32 LLVOVolume::getHighLODTriangleCount() +{ + U32 ret = 0; + + LLVolume* volume = getVolume(); + + if (!isSculpted()) + { + LLVolume* ref = LLPrimitive::getVolumeManager()->refVolume(volume->getParams(), 3); + ret = ref->getNumTriangles(); + LLPrimitive::getVolumeManager()->unrefVolume(ref); + } + else if (isMesh()) + { + LLVolume* ref = LLPrimitive::getVolumeManager()->refVolume(volume->getParams(), 3); + if (ref->isTetrahedron() || ref->getNumVolumeFaces() == 0) + { + gMeshRepo.loadMesh(this, volume->getParams(), LLModel::LOD_HIGH); + } + ret = ref->getNumTriangles(); + LLPrimitive::getVolumeManager()->unrefVolume(ref); + } + else + { //default sculpts have a constant number of triangles + ret = 31*2*31; //31 rows of 31 columns of quads for a 32x32 vertex patch + } + + return ret; +} + //static void LLVOVolume::preUpdateGeom() { diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 029811886d..fc00f0c0d0 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -132,6 +132,7 @@ public: U32 getRenderCost(std::set &textures) const; /*virtual*/ F32 getStreamingCost(S32* bytes = NULL, S32* visible_bytes = NULL); /*virtual*/ U32 getTriangleCount(); + /*virtual*/ U32 getHighLODTriangleCount(); /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face = -1, // which face to check, -1 = ALL_SIDES BOOL pick_transparent = FALSE, diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 6a376554b9..4b56ba74b2 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8725,7 +8725,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) near_clip = -max.mV[2]; F32 far_clip = -min.mV[2]*2.f; - far_clip = llmin(far_clip, 128.f); + //far_clip = llmin(far_clip, 128.f); far_clip = llmin(far_clip, camera.getFar()); F32 range = far_clip-near_clip; @@ -9075,7 +9075,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) } } - shadow_cam.setFar(128.f); + //shadow_cam.setFar(128.f); shadow_cam.setOriginAndLookAt(eye, up, center); shadow_cam.setOrigin(0,0,0); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 8c783ae218..3e7c09f636 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1901,6 +1901,16 @@ function="Advanced.ToggleConsole" parameter="memory view" /> + + + + -- cgit v1.2.3 From e52613aad6bc2a9ec2b20171e59fee5a124d5765 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 7 Apr 2011 00:27:48 -0500 Subject: SH-1318 Add check box for disabling depth of field. --- indra/newview/app_settings/settings.xml | 12 ++++++++++++ indra/newview/llfloaterpreference.cpp | 15 +++++++++++++++ indra/newview/pipeline.cpp | 4 ++-- .../skins/default/xui/en/panel_preferences_graphics1.xml | 13 +++++++++++++ 4 files changed, 42 insertions(+), 2 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4b530d5b55..386fae8fa5 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7717,6 +7717,18 @@ Value 0 + + RenderDepthOfField + + Comment + Whether to use depth of field effect when lighting and shadows are enabled + Persist + 1 + Type + Boolean + Value + 0 + RenderSpotLightsInNondeferred diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index a90bacf41d..5172370890 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1046,11 +1046,13 @@ void LLFloaterPreference::refreshEnabledState() ctrl_deferred->setEnabled(enabled); LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); + LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); LLComboBox* ctrl_shadow = getChild("ShadowDetail"); enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO") && (ctrl_deferred->get() ? TRUE : FALSE); ctrl_ssao->setEnabled(enabled); + ctrl_dof->setEnabled(enabled); enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail"); @@ -1074,6 +1076,7 @@ void LLFloaterPreference::disableUnavailableSettings() LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); LLComboBox* ctrl_shadows = getChild("ShadowDetail"); LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); + LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); // if vertex shaders off, disable all shader related products if(!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")) @@ -1099,6 +1102,9 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_ssao->setEnabled(FALSE); ctrl_ssao->setValue(FALSE); + ctrl_dof->setEnabled(FALSE); + ctrl_dof->setValue(FALSE); + ctrl_deferred->setEnabled(FALSE); ctrl_deferred->setValue(FALSE); } @@ -1116,6 +1122,9 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_ssao->setEnabled(FALSE); ctrl_ssao->setValue(FALSE); + ctrl_dof->setEnabled(FALSE); + ctrl_dof->setValue(FALSE); + ctrl_deferred->setEnabled(FALSE); ctrl_deferred->setValue(FALSE); } @@ -1130,6 +1139,9 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_ssao->setEnabled(FALSE); ctrl_ssao->setValue(FALSE); + ctrl_dof->setEnabled(FALSE); + ctrl_dof->setValue(FALSE); + ctrl_deferred->setEnabled(FALSE); ctrl_deferred->setValue(FALSE); } @@ -1171,6 +1183,9 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_ssao->setEnabled(FALSE); ctrl_ssao->setValue(FALSE); + ctrl_dof->setEnabled(FALSE); + ctrl_dof->setValue(FALSE); + ctrl_deferred->setEnabled(FALSE); ctrl_deferred->setValue(FALSE); } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 5f74423c7b..bf65fd123e 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6314,8 +6314,8 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) F32 fnumber = gSavedSettings.getF32("CameraFNumber"); F32 default_focal_length = gSavedSettings.getF32("CameraFocalLength"); - if (LLToolMgr::getInstance()->inBuildMode()) - { //squish focal length when in build mode so DoF doesn't make editing objects difficult + if (LLToolMgr::getInstance()->inBuildMode() || !gSavedSettings.getBOOL("RenderDepthOfField")) + { //squish focal length when in build mode (or if DoF is disabled) so DoF doesn't make editing objects difficult default_focal_length = 5.f; } diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index 70db3c6592..2e1f41fd74 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -258,6 +258,19 @@ + + + Date: Thu, 7 Apr 2011 00:29:02 -0500 Subject: SH-1292 Remove outliers from graphs in scene console to make a more useful view. --- indra/llmath/llmath.h | 39 +++++++++++++++++++++++ indra/newview/llfasttimerview.cpp | 45 +++------------------------ indra/newview/llsceneview.cpp | 65 +++++++++++++++++++-------------------- 3 files changed, 75 insertions(+), 74 deletions(-) diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 25b29ac1a8..97001b4062 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -29,6 +29,7 @@ #include #include +#include #include "lldefs.h" //#include "llstl.h" // *TODO: Remove when LLString is gone //#include "llstring.h" // *TODO: Remove when LLString is gone @@ -497,6 +498,44 @@ inline F32 llgaussian(F32 x, F32 o) return 1.f/(F_SQRT_TWO_PI*o)*powf(F_E, -(x*x)/(2*o*o)); } +//helper function for removing outliers +template +inline void ll_remove_outliers(std::vector& data, F32 k) +{ + if (data.size() < 100) + { //not enough samples + return; + } + + VEC_TYPE Q1 = data[data.size()/4]; + VEC_TYPE Q3 = data[data.size()-data.size()/4-1]; + + VEC_TYPE min = Q1-k*(Q3-Q1); + VEC_TYPE max = Q3+k*(Q3-Q1); + + U32 i = 0; + while (i < data.size() && data[i] < min) + { + i++; + } + + S32 j = data.size()-1; + while (j > 0 && data[j] > max) + { + j--; + } + + if (j < data.size()-1) + { + data.erase(data.begin()+j, data.end()); + } + + if (i > 0) + { + data.erase(data.begin(), data.begin()+i); + } +} + // Include simd math header #include "llsimdmath.h" diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 6e78ea6bbe..35712163eb 100755 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -1040,43 +1040,6 @@ void saveChart(const std::string& label, const char* suffix, LLImageRaw* scratch result->save(out_file); } -template -void removeOutliers(std::vector& data, F32 k) -{ - if (data.size() < 100) - { //not enough samples - return; - } - - VEC_TYPE Q1 = data[data.size()/4]; - VEC_TYPE Q3 = data[data.size()-data.size()/4-1]; - - VEC_TYPE min = Q1-k*(Q3-Q1); - VEC_TYPE max = Q3+k*(Q3-Q1); - - U32 i = 0; - while (i < data.size() && data[i] < min) - { - i++; - } - - S32 j = data.size()-1; - while (j > 0 && data[j] > max) - { - j--; - } - - if (j < data.size()-1) - { - data.erase(data.begin()+j, data.end()); - } - - if (i > 0) - { - data.erase(data.begin(), data.begin()+i); - } -} - //static void LLFastTimerView::exportCharts(const std::string& base, const std::string& target) { @@ -1206,22 +1169,22 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t const U32 OUTLIER_CUTOFF = 512; if (base_times.size() > OUTLIER_CUTOFF) { - removeOutliers(base_times, 1.f); + ll_remove_outliers(base_times, 1.f); } if (base_execution.size() > OUTLIER_CUTOFF) { - removeOutliers(base_execution, 1.f); + ll_remove_outliers(base_execution, 1.f); } if (cur_times.size() > OUTLIER_CUTOFF) { - removeOutliers(cur_times, 1.f); + ll_remove_outliers(cur_times, 1.f); } if (cur_execution.size() > OUTLIER_CUTOFF) { - removeOutliers(cur_execution, 1.f); + ll_remove_outliers(cur_execution, 1.f); } diff --git a/indra/newview/llsceneview.cpp b/indra/newview/llsceneview.cpp index dfc13bc9b8..25a7373018 100644 --- a/indra/newview/llsceneview.cpp +++ b/indra/newview/llsceneview.cpp @@ -36,6 +36,11 @@ LLSceneView* gSceneView = NULL; +//borrow this helper function from llfasttimerview.cpp +template +void removeOutliers(std::vector& data, F32 k); + + LLSceneView::LLSceneView(const LLRect& rect) : LLFloater(LLSD()) { @@ -72,8 +77,11 @@ void LLSceneView::draw() //object sizes std::vector size[2]; - std::vector triangles[2]; - std::vector visible_triangles[2]; + std::vector triangles[2]; + std::vector visible_triangles[2]; + + S32 total_visible_triangles[] = {0, 0}; + S32 total_triangles[] = {0, 0}; U32 object_count = 0; @@ -97,9 +105,14 @@ void LLSceneView::draw() F32 radius = object->getScale().magVec(); size[idx].push_back(radius); - visible_triangles[idx].push_back(volume->getNumTriangles()); - - triangles[idx].push_back(object->getHighLODTriangleCount()); + S32 visible = volume->getNumTriangles(); + S32 high_triangles = object->getHighLODTriangleCount(); + + total_visible_triangles[idx] += visible; + total_triangles[idx] += high_triangles; + + visible_triangles[idx].push_back(visible); + triangles[idx].push_back(high_triangles); } } } @@ -116,6 +129,8 @@ void LLSceneView::draw() { //display graph of object sizes std::sort(size[idx].begin(), size[idx].end()); + ll_remove_outliers(size[idx], 1.f); + LLRect size_rect; if (idx == 0) @@ -180,8 +195,9 @@ void LLSceneView::draw() if (!triangles[idx].empty()) { //plot graph of visible/total triangles std::sort(triangles[idx].begin(), triangles[idx].end()); - std::sort(visible_triangles[idx].begin(), visible_triangles[idx].end()); - + + ll_remove_outliers(triangles[idx], 1.f); + LLRect tri_rect; if (idx == 0) { @@ -194,19 +210,17 @@ void LLSceneView::draw() gl_rect_2d(tri_rect, LLColor4::white, false); - U32 tri_domain[] = { 65536, 0 }; - - llassert(triangles[idx].size() == visible_triangles[idx].size()); - - //get domain of sizes + S32 tri_domain[] = { 65536, 0 }; + + //get domain of triangle counts for (U32 i = 0; i < triangles[idx].size(); ++i) { - tri_domain[0] = llmin(visible_triangles[idx][i], llmin(tri_domain[0], triangles[idx][i])); - tri_domain[1] = llmax(visible_triangles[idx][i], llmax(tri_domain[1], triangles[idx][i])); + tri_domain[0] = llmin(tri_domain[0], triangles[idx][i]); + tri_domain[1] = llmax(tri_domain[1], triangles[idx][i]); } U32 triangle_range = tri_domain[1]-tri_domain[0]; - + U32 count = triangles[idx].size(); U32 total = 0; @@ -234,31 +248,16 @@ void LLSceneView::draw() gGL.flush(); U32 total_visible = 0; - gGL.begin(LLRender::LINE_STRIP); - //plot visible triangles + count = visible_triangles[idx].size(); + for (U32 i = 0; i < count; ++i) { U32 tri_count = visible_triangles[idx][i]; total_visible += tri_count; - F32 y = (F32) (tri_count-tri_domain[0])/triangle_range*tri_rect.getHeight()+tri_rect.mBottom; - F32 x = (F32) i / count * tri_rect.getWidth() + tri_rect.mLeft; - - gGL.vertex2f(x,y); - - if (i%4096 == 0) - { - gGL.end(); - gGL.flush(); - gGL.begin(LLRender::LINE_STRIP); - } } - gGL.end(); - gGL.flush(); - - std::string label = llformat("%s Object Triangle Counts (Ktris) -- Min: %.2f Max: %.2f Mean: %.2f Median: %.2f (%.2f/%.2f visible) -- %d samples", - category[idx], tri_domain[0]/1024.f, tri_domain[1]/1024.f, (total/count)/1024.f, triangles[idx][count/2]/1024.f, total_visible/1024.f, total/1024.f, count); + category[idx], tri_domain[0]/1024.f, tri_domain[1]/1024.f, (total/count)/1024.f, triangles[idx][count/2]/1024.f, total_visible_triangles[idx]/1024.f, total_triangles[idx]/1024.f, count); LLFontGL::getFontMonospace()->renderUTF8(label, 0 , tri_rect.mLeft, tri_rect.mTop+margin, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); -- cgit v1.2.3 From feccb5b84c7ffcfe98a9afd042c7ca44b8717aaf Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 7 Apr 2011 19:18:02 -0500 Subject: SH-1292 Add streaming and physics cost to stats console. --- indra/newview/llsceneview.cpp | 173 +++++++++++++++++++++++++++++++++++++-- indra/newview/llviewerobject.cpp | 3 + 2 files changed, 168 insertions(+), 8 deletions(-) diff --git a/indra/newview/llsceneview.cpp b/indra/newview/llsceneview.cpp index 25a7373018..8e8fc9dd25 100644 --- a/indra/newview/llsceneview.cpp +++ b/indra/newview/llsceneview.cpp @@ -77,13 +77,21 @@ void LLSceneView::draw() //object sizes std::vector size[2]; + //triangle counts std::vector triangles[2]; std::vector visible_triangles[2]; - S32 total_visible_triangles[] = {0, 0}; S32 total_triangles[] = {0, 0}; + + //streaming cost + std::vector streaming_cost[2]; + F32 total_streaming[] = { 0.f, 0.f }; + //physics cost + std::vector physics_cost[2]; + F32 total_physics[] = { 0.f, 0.f }; + U32 object_count = 0; LLViewerRegion* region = gAgent.getRegion(); @@ -113,6 +121,14 @@ void LLSceneView::draw() visible_triangles[idx].push_back(visible); triangles[idx].push_back(high_triangles); + + F32 streaming = object->getStreamingCost(); + total_streaming[idx] += streaming; + streaming_cost[idx].push_back(streaming); + + F32 physics = object->getPhysicsCost(); + total_physics[idx] += physics; + physics_cost[idx].push_back(physics); } } } @@ -123,6 +139,13 @@ void LLSceneView::draw() "Attachment" }; + S32 graph_pos[4]; + + for (U32 i = 0; i < 4; ++i) + { + graph_pos[i] = new_rect.getHeight()/4*(i+1); + } + for (U32 idx = 0; idx < 2; idx++) { if (!size[idx].empty()) @@ -135,11 +158,11 @@ void LLSceneView::draw() if (idx == 0) { - size_rect = LLRect(margin, new_rect.getHeight()/2-margin*2, new_rect.getWidth()/2-margin, margin*2); + size_rect = LLRect(margin, graph_pos[0]-margin, new_rect.getWidth()/2-margin, margin*2); } else { - size_rect = LLRect(margin+new_rect.getWidth()/2, new_rect.getHeight()/2-margin*2, new_rect.getWidth()-margin, margin*2); + size_rect = LLRect(margin+new_rect.getWidth()/2, graph_pos[0]-margin, new_rect.getWidth()-margin, margin*2); } gl_rect_2d(size_rect, LLColor4::white, false); @@ -181,7 +204,7 @@ void LLSceneView::draw() gGL.end(); gGL.flush(); - std::string label = llformat("%s Object Sizes (m) -- Min: %.1f Max: %.1f Mean: %.1f Median: %.1f -- %d samples", + std::string label = llformat("%s Object Sizes (m) -- [%.1f, %.1f] Mean: %.1f Median: %.1f -- %d samples", category[idx], size_domain[0], size_domain[1], total/count, size[idx][count/2], count); LLFontGL::getFontMonospace()->renderUTF8(label, @@ -201,11 +224,11 @@ void LLSceneView::draw() LLRect tri_rect; if (idx == 0) { - tri_rect = LLRect(margin, new_rect.getHeight()-margin*2, new_rect.getWidth()/2-margin, new_rect.getHeight()/2 + margin); + tri_rect = LLRect(margin, graph_pos[1]-margin, new_rect.getWidth()/2-margin, graph_pos[0]+margin); } else { - tri_rect = LLRect(new_rect.getWidth()/2+margin, new_rect.getHeight()-margin*2, new_rect.getWidth()-margin, new_rect.getHeight()/2 + margin); + tri_rect = LLRect(new_rect.getWidth()/2+margin, graph_pos[1]-margin, new_rect.getWidth()-margin, graph_pos[0]+margin); } gl_rect_2d(tri_rect, LLColor4::white, false); @@ -256,8 +279,8 @@ void LLSceneView::draw() total_visible += tri_count; } - std::string label = llformat("%s Object Triangle Counts (Ktris) -- Min: %.2f Max: %.2f Mean: %.2f Median: %.2f (%.2f/%.2f visible) -- %d samples", - category[idx], tri_domain[0]/1024.f, tri_domain[1]/1024.f, (total/count)/1024.f, triangles[idx][count/2]/1024.f, total_visible_triangles[idx]/1024.f, total_triangles[idx]/1024.f, count); + std::string label = llformat("%s Object Triangle Counts (Ktris) -- [%.2f, %.2f] Mean: %.2f Median: %.2f Visible: %.2f/%.2f", + category[idx], tri_domain[0]/1024.f, tri_domain[1]/1024.f, (total/count)/1024.f, triangles[idx][count/2]/1024.f, total_visible_triangles[idx]/1024.f, total_triangles[idx]/1024.f); LLFontGL::getFontMonospace()->renderUTF8(label, 0 , tri_rect.mLeft, tri_rect.mTop+margin, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); @@ -265,6 +288,140 @@ void LLSceneView::draw() } } + for (U32 idx = 0; idx < 2; ++idx) + { + if (!streaming_cost[idx].empty()) + { //plot graph of streaming cost + std::sort(streaming_cost[idx].begin(), streaming_cost[idx].end()); + + ll_remove_outliers(streaming_cost[idx], 1.f); + + LLRect tri_rect; + if (idx == 0) + { + tri_rect = LLRect(margin, graph_pos[2]-margin, new_rect.getWidth()/2-margin, graph_pos[1]+margin); + } + else + { + tri_rect = LLRect(new_rect.getWidth()/2+margin, graph_pos[2]-margin, new_rect.getWidth()-margin, graph_pos[1]+margin); + } + + gl_rect_2d(tri_rect, LLColor4::white, false); + + F32 streaming_domain[] = { 65536, 0 }; + + //get domain of triangle counts + for (U32 i = 0; i < streaming_cost[idx].size(); ++i) + { + streaming_domain[0] = llmin(streaming_domain[0], streaming_cost[idx][i]); + streaming_domain[1] = llmax(streaming_domain[1], streaming_cost[idx][i]); + } + + F32 cost_range = streaming_domain[1]-streaming_domain[0]; + + U32 count = streaming_cost[idx].size(); + + F32 total = 0; + + gGL.begin(LLRender::LINE_STRIP); + //plot triangles + for (U32 i = 0; i < count; ++i) + { + F32 sc = streaming_cost[idx][i]; + total += sc; + F32 y = (F32) (sc-streaming_domain[0])/cost_range*tri_rect.getHeight()+tri_rect.mBottom; + F32 x = (F32) i / count * tri_rect.getWidth() + tri_rect.mLeft; + + gGL.vertex2f(x,y); + + if (i%4096 == 0) + { + gGL.end(); + gGL.flush(); + gGL.begin(LLRender::LINE_STRIP); + } + } + + gGL.end(); + gGL.flush(); + + std::string label = llformat("%s Object Streaming Cost -- [%.2f, %.2f] Mean: %.2f Total: %.2f", + category[idx], streaming_domain[0], streaming_domain[1], total/count, total_streaming[idx]); + + LLFontGL::getFontMonospace()->renderUTF8(label, + 0 , tri_rect.mLeft, tri_rect.mTop+margin, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); + + } + } + + for (U32 idx = 0; idx < 2; ++idx) + { + if (!physics_cost[idx].empty()) + { //plot graph of physics cost + std::sort(physics_cost[idx].begin(), physics_cost[idx].end()); + + ll_remove_outliers(physics_cost[idx], 1.f); + + LLRect tri_rect; + if (idx == 0) + { + tri_rect = LLRect(margin, graph_pos[3]-margin, new_rect.getWidth()/2-margin, graph_pos[2]+margin); + } + else + { + tri_rect = LLRect(new_rect.getWidth()/2+margin, graph_pos[3]-margin, new_rect.getWidth()-margin, graph_pos[2]+margin); + } + + gl_rect_2d(tri_rect, LLColor4::white, false); + + F32 physics_domain[] = { 65536, 0 }; + + //get domain of triangle counts + for (U32 i = 0; i < physics_cost[idx].size(); ++i) + { + physics_domain[0] = llmin(physics_domain[0], physics_cost[idx][i]); + physics_domain[1] = llmax(physics_domain[1], physics_cost[idx][i]); + } + + F32 cost_range = physics_domain[1]-physics_domain[0]; + + U32 count = physics_cost[idx].size(); + + F32 total = 0; + + gGL.begin(LLRender::LINE_STRIP); + //plot triangles + for (U32 i = 0; i < count; ++i) + { + F32 pc = physics_cost[idx][i]; + total += pc; + F32 y = (F32) (pc-physics_domain[0])/cost_range*tri_rect.getHeight()+tri_rect.mBottom; + F32 x = (F32) i / count * tri_rect.getWidth() + tri_rect.mLeft; + + gGL.vertex2f(x,y); + + if (i%4096 == 0) + { + gGL.end(); + gGL.flush(); + gGL.begin(LLRender::LINE_STRIP); + } + } + + gGL.end(); + gGL.flush(); + + std::string label = llformat("%s Object Physics Cost -- [%.2f, %.2f] Mean: %.2f Total: %.2f", + category[idx], physics_domain[0], physics_domain[1], total/count, total_physics[idx]); + + LLFontGL::getFontMonospace()->renderUTF8(label, + 0 , tri_rect.mLeft, tri_rect.mTop+margin, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); + + } + } + + + LLView::draw(); } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 207e15ff1a..a5b59e8281 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -240,6 +240,9 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mState(0), mMedia(NULL), mClickAction(0), + mObjectCost(0), + mLinksetCost(0), + mPhysicsCost(0), mLinksetPhysicsCost(0.f), mCostStale(true), mPhysicsShapeUnknown(true), -- cgit v1.2.3 From 897a4668bd385fe73237c163284a6bc63353bf26 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 8 Apr 2011 01:24:17 -0500 Subject: SH-1320 Fix for flickering objects in water distortion/reflection maps. --- indra/llrender/llgl.cpp | 22 ++++++++++------ indra/llrender/llgl.h | 4 ++- indra/newview/pipeline.cpp | 63 +++++++++++++++++++++++++++++++++++++--------- indra/newview/pipeline.h | 2 +- 4 files changed, 70 insertions(+), 21 deletions(-) diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index d5f0b81830..b508705759 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1858,12 +1858,17 @@ void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor } } -LLGLUserClipPlane::LLGLUserClipPlane(const LLPlane& p, const glh::matrix4f& modelview, const glh::matrix4f& projection) +LLGLUserClipPlane::LLGLUserClipPlane(const LLPlane& p, const glh::matrix4f& modelview, const glh::matrix4f& projection, bool apply) { - mModelview = modelview; - mProjection = projection; + mApply = apply; - setPlane(p[0], p[1], p[2], p[3]); + if (mApply) + { + mModelview = modelview; + mProjection = projection; + + setPlane(p[0], p[1], p[2], p[3]); + } } void LLGLUserClipPlane::setPlane(F32 a, F32 b, F32 c, F32 d) @@ -1894,9 +1899,12 @@ void LLGLUserClipPlane::setPlane(F32 a, F32 b, F32 c, F32 d) LLGLUserClipPlane::~LLGLUserClipPlane() { - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); + if (mApply) + { + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + } } LLGLNamePool::LLGLNamePool() diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index 0d7ba15b12..43992d51cb 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -301,12 +301,14 @@ class LLGLUserClipPlane { public: - LLGLUserClipPlane(const LLPlane& plane, const glh::matrix4f& modelview, const glh::matrix4f& projection); + LLGLUserClipPlane(const LLPlane& plane, const glh::matrix4f& modelview, const glh::matrix4f& projection, bool apply = true); ~LLGLUserClipPlane(); void setPlane(F32 a, F32 b, F32 c, F32 d); private: + bool mApply; + glh::matrix4f mProjection; glh::matrix4f mModelview; }; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index bf65fd123e..d18e1de60c 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -240,6 +240,16 @@ glh::matrix4f glh_get_current_projection() return glh_copy_matrix(gGLProjection); } +glh::matrix4f glh_get_last_modelview() +{ + return glh_copy_matrix(gGLLastModelView); +} + +glh::matrix4f glh_get_last_projection() +{ + return glh_copy_matrix(gGLLastProjection); +} + void glh_copy_matrix(const glh::matrix4f& src, GLdouble* dst) { for (U32 i = 0; i < 16; i++) @@ -1910,7 +1920,7 @@ BOOL LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3& static LLFastTimer::DeclareTimer FTM_CULL("Object Culling"); -void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_clip) +void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_clip, LLPlane* planep) { LLFastTimer t(FTM_CULL); LLMemType mt_uc(LLMemType::MTYPE_PIPELINE_UPDATE_CULL); @@ -1930,6 +1940,11 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl mScreen.bindTarget(); } + if (sUseOcclusion > 1) + { + gGL.setColorMask(false, false); + } + glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadMatrixd(gGLLastProjection); @@ -1944,10 +1959,37 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl LLGLDisable test(GL_ALPHA_TEST); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - if (sUseOcclusion > 1) + + //setup a clip plane in projection matrix for reflection renders (prevents flickering from occlusion culling) + LLViewerRegion* region = gAgent.getRegion(); + LLPlane plane; + + if (planep) { - gGL.setColorMask(false, false); + plane = *planep; } + else + { + if (region) + { + LLVector3 pnorm; + F32 height = region->getWaterHeight(); + if (water_clip < 0) + { //camera is above water, clip plane points up + pnorm.setVec(0,0,1); + plane.setVec(pnorm, -height); + } + else if (water_clip > 0) + { //camera is below water, clip plane points down + pnorm = LLVector3(0,0,-1); + plane.setVec(pnorm, height); + } + } + } + + glh::matrix4f modelview = glh_get_last_modelview(); + glh::matrix4f proj = glh_get_last_projection(); + LLGLUserClipPlane clip(plane, modelview, proj, water_clip != 0 && LLPipeline::sReflectionRender); LLGLDepthTest depth(GL_TRUE, GL_FALSE); @@ -7887,18 +7929,13 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) gPipeline.pushRenderTypeMask(); gPipeline.andRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES); static LLCullResult result; updateCull(camera, result); stateSort(camera, result); - andRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, - LLPipeline::RENDER_TYPE_CLOUDS, - LLPipeline::RENDER_TYPE_WL_SKY, - LLPipeline::END_RENDER_TYPES); - - //bad pop here renderGeom(camera, TRUE); gPipeline.popRenderTypeMask(); @@ -7931,7 +7968,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) LLGLUserClipPlane clip_plane(plane, mat, projection); LLGLDisable cull(GL_CULL_FACE); - updateCull(camera, ref_result, 1); + updateCull(camera, ref_result, -water_clip, &plane); stateSort(camera, ref_result); } @@ -7988,9 +8025,11 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) { //clip out geometry on the same side of water as the camera mat = glh_get_current_modelview(); - LLGLUserClipPlane clip_plane(LLPlane(-pnorm, -(pd+pad)), mat, projection); + LLPlane plane(-pnorm, -(pd+pad)); + + LLGLUserClipPlane clip_plane(plane, mat, projection); static LLCullResult result; - updateCull(camera, result, water_clip); + updateCull(camera, result, water_clip, &plane); stateSort(camera, result); gGL.setColorMask(true, true); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 074c1742e2..0cf3fde562 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -208,7 +208,7 @@ public: BOOL visibleObjectsInFrustum(LLCamera& camera); BOOL getVisibleExtents(LLCamera& camera, LLVector3 &min, LLVector3& max); BOOL getVisiblePointCloud(LLCamera& camera, LLVector3 &min, LLVector3& max, std::vector& fp, LLVector3 light_dir = LLVector3(0,0,0)); - void updateCull(LLCamera& camera, LLCullResult& result, S32 water_clip = 0); //if water_clip is 0, ignore water plane, 1, cull to above plane, -1, cull to below plane + void updateCull(LLCamera& camera, LLCullResult& result, S32 water_clip = 0, LLPlane* plane = NULL); //if water_clip is 0, ignore water plane, 1, cull to above plane, -1, cull to below plane void createObjects(F32 max_dtime); void createObject(LLViewerObject* vobj); void updateGeom(F32 max_dtime); -- cgit v1.2.3 From 0ce8e962399e6cd8e231b529d9741b033fa4aa8f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 8 Apr 2011 01:49:09 -0500 Subject: Minor DoF tweak to keep focus point from behaving eratically when flying around. --- indra/newview/llviewerwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 8e4e6b5b07..bde35ee33d 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -3746,7 +3746,7 @@ LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 de LLVector3 mouse_world_start = mouse_point_global; LLVector3 mouse_world_end = mouse_point_global + mouse_direction_global * depth; - //gDebugRaycastIntersection = mouse_world_end; + gDebugRaycastIntersection = mouse_world_end; if (start) { -- cgit v1.2.3 From 8807496ed78b36658f488d901842852d63f73cb9 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 8 Apr 2011 02:11:46 -0500 Subject: attempted fix for linux build --- indra/llmath/llmath.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 97001b4062..eea7c977fb 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -510,8 +510,8 @@ inline void ll_remove_outliers(std::vector& data, F32 k) VEC_TYPE Q1 = data[data.size()/4]; VEC_TYPE Q3 = data[data.size()-data.size()/4-1]; - VEC_TYPE min = Q1-k*(Q3-Q1); - VEC_TYPE max = Q3+k*(Q3-Q1); + VEC_TYPE min = (VEC_TYPE) ((F32) Q1-k * (F32) (Q3-Q1)); + VEC_TYPE max = (VEC_TYPE) ((F32) Q3+k * (F32) (Q3-Q1)); U32 i = 0; while (i < data.size() && data[i] < min) -- cgit v1.2.3 From 92c3107419a9c810d802318816dd8015f4762e3f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 11 Apr 2011 14:08:01 -0600 Subject: fix for SH-1235: [PUBLIC] Select a HUD attachment and moving a child prim or entire linkset crashes viewer --- indra/newview/llviewerdisplay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index b45d1aa3a6..ba48ad4517 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1024,7 +1024,7 @@ void render_hud_attachments() gPipeline.renderGeom(hud_cam); LLSpatialGroup::sNoDelete = FALSE; - gPipeline.clearReferences(); + //gPipeline.clearReferences(); render_hud_elements(); -- cgit v1.2.3 From 241350f8455a262eca8f1195b6abfc167674dca6 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Tue, 12 Apr 2011 15:06:21 -0700 Subject: SH-1205 Lock out ability to change sculpt stitching type or sculpt map when sculpt stitching type --- indra/newview/llpanelobject.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index f135fcbed6..64af6c2157 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -1117,23 +1117,23 @@ void LLPanelObject::getState( ) mSculptTypeRevert = sculpt_params->getSculptType(); } + U8 sculpt_type = sculpt_params->getSculptType(); + U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK; + BOOL sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; + BOOL sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; + isMesh = (sculpt_stitching == LL_SCULPT_TYPE_MESH); + LLTextureCtrl* mTextureCtrl = getChild("sculpt texture control"); if(mTextureCtrl) { mTextureCtrl->setTentative(FALSE); - mTextureCtrl->setEnabled(editable); + mTextureCtrl->setEnabled(editable && !isMesh); if (editable) mTextureCtrl->setImageAssetID(sculpt_params->getSculptTexture()); else mTextureCtrl->setImageAssetID(LLUUID::null); } - U8 sculpt_type = sculpt_params->getSculptType(); - U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK; - BOOL sculpt_invert = sculpt_type & LL_SCULPT_FLAG_INVERT; - BOOL sculpt_mirror = sculpt_type & LL_SCULPT_FLAG_MIRROR; - isMesh = (sculpt_stitching == LL_SCULPT_TYPE_MESH); - mComboBaseType->setEnabled(!isMesh); if (mCtrlSculptType) -- cgit v1.2.3 From 1a6908a2d97380d8a625bb8d8797599c6f3dce7a Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Wed, 13 Apr 2011 16:31:16 -0700 Subject: SH-1299 and SH-1300 Adding mesh enabled checkbox to region floater --- indra/newview/llfloaterregiondebugconsole.cpp | 7 +- indra/newview/llfloaterregiondebugconsole.h | 5 ++ indra/newview/llfloaterregioninfo.cpp | 81 ++++++++++++++++++++++ indra/newview/llfloaterregioninfo.h | 5 ++ .../skins/default/xui/en/panel_region_general.xml | 15 +++- 5 files changed, 108 insertions(+), 5 deletions(-) diff --git a/indra/newview/llfloaterregiondebugconsole.cpp b/indra/newview/llfloaterregiondebugconsole.cpp index ada0dcf569..c7fab2573f 100644 --- a/indra/newview/llfloaterregiondebugconsole.cpp +++ b/indra/newview/llfloaterregiondebugconsole.cpp @@ -58,8 +58,6 @@ namespace { // Signal used to notify the floater of responses from the asynchronous // API. - typedef boost::signals2::signal< - void (const std::string& output)> console_reply_signal_t; console_reply_signal_t sConsoleReplySignal; const std::string PROMPT("\n\n> "); @@ -132,6 +130,11 @@ namespace }; } +boost::signals2::connection LLFloaterRegionDebugConsole::setConsoleReplyCallback(const console_reply_signal_t::slot_type& cb) +{ + return sConsoleReplySignal.connect(cb); +} + LLFloaterRegionDebugConsole::LLFloaterRegionDebugConsole(LLSD const & key) : LLFloater(key), mOutput(NULL) { diff --git a/indra/newview/llfloaterregiondebugconsole.h b/indra/newview/llfloaterregiondebugconsole.h index 3aa525724e..fd3af4152e 100644 --- a/indra/newview/llfloaterregiondebugconsole.h +++ b/indra/newview/llfloaterregiondebugconsole.h @@ -35,6 +35,9 @@ class LLTextEditor; +typedef boost::signals2::signal< + void (const std::string& output)> console_reply_signal_t; + class LLFloaterRegionDebugConsole : public LLFloater, public LLHTTPClient::Responder { public: @@ -48,6 +51,8 @@ public: LLTextEditor * mOutput; + static boost::signals2::connection setConsoleReplyCallback(const console_reply_signal_t::slot_type& cb); + private: void onReplyReceived(const std::string& output); diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 7792b3fb40..34fda49375 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -53,6 +53,7 @@ #include "llfloatertopobjects.h" // added to fix SL-32336 #include "llfloatergroups.h" #include "llfloaterreg.h" +#include "llfloaterregiondebugconsole.h" #include "llfloatertelehub.h" #include "llfloaterwindlight.h" #include "llinventorymodel.h" @@ -159,9 +160,30 @@ bool estate_dispatch_initialized = false; //S32 LLFloaterRegionInfo::sRequestSerial = 0; LLUUID LLFloaterRegionInfo::sRequestInvoice; + +void LLFloaterRegionInfo::onConsoleReplyReceived(const std::string& output) +{ + llwarns << "here is what they're giving us: " << output << llendl; + + if (output.find("FALSE") != std::string::npos) + { + getChild("mesh_rez_enabled_check")->setValue(FALSE); + } + else + { + getChild("mesh_rez_enabled_check")->setValue(TRUE); + } +} + + LLFloaterRegionInfo::LLFloaterRegionInfo(const LLSD& seed) : LLFloater(seed) { + mConsoleReplySignalConnection = LLFloaterRegionDebugConsole::setConsoleReplyCallback( + boost::bind( + &LLFloaterRegionInfo::onConsoleReplyReceived, + this, + _1)); } BOOL LLFloaterRegionInfo::postBuild() @@ -211,12 +233,14 @@ BOOL LLFloaterRegionInfo::postBuild() LLFloaterRegionInfo::~LLFloaterRegionInfo() { + mConsoleReplySignalConnection.disconnect(); } void LLFloaterRegionInfo::onOpen(const LLSD& key) { refreshFromRegion(gAgent.getRegion()); requestRegionInfo(); + requestMeshRezInfo(); } // static @@ -584,6 +608,7 @@ BOOL LLPanelRegionGeneralInfo::postBuild() initCtrl("access_combo"); initCtrl("restrict_pushobject"); initCtrl("block_parcel_search_check"); + initCtrl("mesh_rez_enabled_check"); childSetAction("kick_btn", boost::bind(&LLPanelRegionGeneralInfo::onClickKick, this)); childSetAction("kick_all_btn", onClickKickAll, this); @@ -691,7 +716,42 @@ bool LLPanelRegionGeneralInfo::onMessageCommit(const LLSD& notification, const L return false; } +class ConsoleRequestResponder : public LLHTTPClient::Responder +{ +public: + /*virtual*/ + void error(U32 status, const std::string& reason) + { + llwarns << "requesting mesh_rez_enabled failed" << llendl; + } +}; + + +// called if this request times out. +class ConsoleUpdateResponder : public LLHTTPClient::Responder +{ +public: + /* virtual */ + void error(U32 status, const std::string& reason) + { + llwarns << "Updating mesh enabled region setting failed" << llendl; + } +}; + +void LLFloaterRegionInfo::requestMeshRezInfo() +{ + std::string sim_console_url = gAgent.getRegion()->getCapability("SimConsoleAsync"); + if (!sim_console_url.empty()) + { + std::string request_str = "get mesh_rez_enabled"; + + LLHTTPClient::post( + sim_console_url, + LLSD(request_str), + new ConsoleRequestResponder); + } +} // setregioninfo // strings[0] = 'Y' - block terraform, 'N' - not @@ -764,6 +824,27 @@ BOOL LLPanelRegionGeneralInfo::sendUpdate() sendEstateOwnerMessage(gMessageSystem, "setregioninfo", invoice, strings); } + std::string sim_console_url = gAgent.getRegion()->getCapability("SimConsoleAsync"); + + if (!sim_console_url.empty()) + { + std::string update_str = "set mesh_rez_enabled "; + if (getChild("mesh_rez_enabled_check")->getValue().asBoolean()) + { + update_str += "true"; + } + else + { + update_str += "false"; + } + + LLHTTPClient::post( + sim_console_url, + LLSD(update_str), + new ConsoleUpdateResponder); + } + + // if we changed access levels, tell user about it LLViewerRegion* region = gAgent.getRegion(); if (region && (getChild("access_combo")->getValue().asInteger() != region->getSimAccess()) ) diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index c0758fa92d..2b87c27fcf 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -84,11 +84,16 @@ public: virtual void refresh(); void requestRegionInfo(); + void requestMeshRezInfo(); private: LLFloaterRegionInfo(const LLSD& seed); ~LLFloaterRegionInfo(); + + void onConsoleReplyReceived(const std::string& output); + + boost::signals2::connection mConsoleReplySignalConnection;; protected: void refreshFromRegion(LLViewerRegion* region); diff --git a/indra/newview/skins/default/xui/en/panel_region_general.xml b/indra/newview/skins/default/xui/en/panel_region_general.xml index ca9579284b..e0d9f3f714 100644 --- a/indra/newview/skins/default/xui/en/panel_region_general.xml +++ b/indra/newview/skins/default/xui/en/panel_region_general.xml @@ -114,7 +114,7 @@ layout="topleft" left="10" name="allow_land_resell_check" - top="160" + top="150" width="80" /> + Date: Thu, 14 Apr 2011 11:56:14 -0700 Subject: SH-1343 Change wizard slider labels SH-1344 Remove Physics and Upload from any panel where it's not used --- .../skins/default/xui/en/floater_model_wizard.xml | 36 +++++++++------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_model_wizard.xml b/indra/newview/skins/default/xui/en/floater_model_wizard.xml index 4b312c6ce7..03af348a8d 100644 --- a/indra/newview/skins/default/xui/en/floater_model_wizard.xml +++ b/indra/newview/skins/default/xui/en/floater_model_wizard.xml @@ -291,7 +291,7 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se height="388" top_delta="0" name="optimize_panel" - visible="true" + visible="false" width="535" left="0"> - Performance - Faster rendering but less detailed; lowers Resource (prim) cost. - Accuracy - More detailed model but slower; increases Resource (prim) cost. + Higher Performance + Faster rendering but less detailed; lowers Resource (prim) cost. + Higher Accuracy + More detailed model but slower; increases Resource (prim) cost. Resource Cost: [COST] - Upload Fee: - Performance - Faster rendering but less detailed; lowers Resource (prim) cost. - Accuracy - More detailed model but slower; increases Resource (prim) cost. + Performance + Faster rendering but less detailed; lowers Resource (prim) cost. + Accuracy + More detailed model but slower; increases Resource (prim) cost. - Resource Cost: [COST] - Physics Cost: [COST] - Upload Fee: + Resource Cost: [COST] @@ -619,7 +616,7 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se height="388" top_delta="0" name="physics2_panel" - visible="false" + visible="true" width="535" left="0"> - Resource Cost: [COST] - Physics Cost: [COST] - Upload Fee: - + Resource Cost: [COST] -- cgit v1.2.3 From 8275820df01e9918f254f1a2cd373eb723b88715 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 15 Apr 2011 14:11:48 -0500 Subject: SH-1301 Add some extra asserts around VBO usage to try and narrow down a crash. --- indra/llrender/llvertexbuffer.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 6c0895512e..a9f22193f8 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -56,13 +56,17 @@ protected: virtual GLuint allocateName() { GLuint name; + stop_glerror(); glGenBuffersARB(1, &name); + stop_glerror(); return name; } virtual void releaseName(GLuint name) { + stop_glerror(); glDeleteBuffersARB(1, &name); + stop_glerror(); } }; -- cgit v1.2.3 From 6a491424677086a84d180ace0b91f1eefaeb67ba Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 15 Apr 2011 14:12:12 -0500 Subject: Remove some asserts that cause the physics shape display to error out on occasion. --- indra/llprimitive/llmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 03b893de29..5af1122451 100755 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -2067,7 +2067,7 @@ void LLModel::Decomposition::fromLLSD(LLSD& decomp) std::set valid; //must have at least 4 points - llassert(count > 3); + //llassert(count > 3); for (U32 j = 0; j < count; ++j) { @@ -2085,7 +2085,7 @@ void LLModel::Decomposition::fromLLSD(LLSD& decomp) } //each hull must contain at least 4 unique points - llassert(valid.size() > 3); + //llassert(valid.size() > 3); } } -- cgit v1.2.3 From 719e3f1483b3d74174e0d9d62cdd569a03555e66 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 15 Apr 2011 17:40:26 -0500 Subject: SH-1374 Integrate bokeh depth of field effect from Tofu, but preserve edge detection. --- .../shaders/class1/deferred/postDeferredF.glsl | 118 +++++++++++---------- 1 file changed, 64 insertions(+), 54 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl index 7a6b40006b..f377685045 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl @@ -36,86 +36,97 @@ float getDepth(vec2 pos_screen) return p.z/p.w; } -void dofSample(inout vec4 diff, inout float w, float fd, float x, float y) +float calc_cof(float depth) +{ + float sc = abs(depth-focal_distance)/-depth*blur_constant; + + sc /= magnification; + + // tan_pixel_angle = pixel_length/-depth; + float pixel_length = tan_pixel_angle*-focal_distance; + + sc = sc/pixel_length; + sc *= 1.414; + + return sc; +} + +void dofSampleNear(inout vec4 diff, inout float w, float cur_sc, vec2 tc) { - vec2 tc = vary_fragcoord.xy+vec2(x,y); float d = getDepth(tc); + float sc = calc_cof(d); + float wg = 1.0; - //if (d < fd) - //{ - // diff += texture2DRect(diffuseRect, tc); - // w = 1.0; - //} - if (d > fd) - { - wg = max(d/fd, 0.1); - } + + vec4 s = texture2DRect(diffuseRect, tc); + // de-weight dull areas to make highlights 'pop' + wg *= s.r+s.g+s.b; + + diff += wg*s; - diff += texture2DRect(diffuseRect, tc+vec2(0.5,0.5))*wg*0.25; - diff += texture2DRect(diffuseRect, tc+vec2(-0.5,0.5))*wg*0.25; - diff += texture2DRect(diffuseRect, tc+vec2(0.5,-0.5))*wg*0.25; - diff += texture2DRect(diffuseRect, tc+vec2(-0.5,-0.5))*wg*0.25; w += wg; } -void dofSampleNear(inout vec4 diff, inout float w, float x, float y) +void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, vec2 tc) { - vec2 tc = vary_fragcoord.xy+vec2(x,y); + float d = getDepth(tc); + + float sc = calc_cof(d); + + if (sc > min_sc //sampled pixel is more "out of focus" than current sample radius + || d < cur_depth) //sampled pixel is further away than current pixel + { + float wg = 1.0; - diff += texture2DRect(diffuseRect, tc); - w += 1.0; + vec4 s = texture2DRect(diffuseRect, tc); + // de-weight dull areas to make highlights 'pop' + wg *= s.r+s.g+s.b; + + diff += wg*s; + + w += wg; + } } + void main() { vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz; norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - - + vec2 tc = vary_fragcoord.xy; - float sc = 0.75; + float depth = getDepth(tc); - float depth; - depth = getDepth(tc); - vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); - { //pixel is behind far focal plane + { float w = 1.0; - sc = (abs(depth-focal_distance)/-depth)*blur_constant; - - sc /= magnification; - - // tan_pixel_angle = pixel_length/-depth; - float pixel_length = tan_pixel_angle*-focal_distance; - - sc = sc/pixel_length; - - //diff.r = sc; - - sc = min(abs(sc), 8.0); - - //sc = 4.0; + float sc = calc_cof(depth); + sc = min(abs(sc), 10.0); float fd = depth*0.5f; - while (sc > 0.5) + float PI = 3.14159265358979323846264; + + // sample quite uniformly spaced points within a circle, for a circular 'bokeh' + //if (depth < focal_distance) { - dofSample(diff,w, fd, sc,sc); - dofSample(diff,w, fd, -sc,sc); - dofSample(diff,w, fd, sc,-sc); - dofSample(diff,w, fd, -sc,-sc); - - sc -= 0.5; - float sc2 = sc*1.414; - dofSample(diff,w, fd, 0,sc2); - dofSample(diff,w, fd, 0,-sc2); - dofSample(diff,w, fd, -sc2,0); - dofSample(diff,w, fd, sc2,0); - sc -= 0.5; + while (sc > 0.5) + { + int its = int(max(1.0,(sc*3.7))); + for (int i=0; i Date: Fri, 15 Apr 2011 17:46:34 -0500 Subject: Fix for flycam not overriding focal point properly for DoF effect. --- indra/newview/llviewerwindow.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index bde35ee33d..b946dbbd0f 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -3746,7 +3746,11 @@ LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 de LLVector3 mouse_world_start = mouse_point_global; LLVector3 mouse_world_end = mouse_point_global + mouse_direction_global * depth; - gDebugRaycastIntersection = mouse_world_end; + if (!LLViewerJoystick::getInstance()->getOverrideCamera()) + { //always set raycast intersection to mouse_world_end unless + //flycam is on (for DoF effect) + gDebugRaycastIntersection = mouse_world_end; + } if (start) { -- cgit v1.2.3 From c494e5c0d55b2da2f5aa5ea18fbccb670b2f3107 Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 18 Apr 2011 10:41:32 -0400 Subject: WIP for SH-1281. Rigged assets are critiqued differently based upon whether they're avrigs w/wo joint offets and whether the asset contains a subset of the joints in the visual scene --- indra/newview/llfloatermodelpreview.cpp | 447 ++++++++++++++++++++++++++------ indra/newview/llfloatermodelpreview.h | 52 +++- 2 files changed, 410 insertions(+), 89 deletions(-) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index a808cc47a2..cdd2bcf8e3 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -340,7 +340,7 @@ BOOL LLFloaterModelPreview::postBuild() mPreviewRect = preview_panel->getRect(); - mModelPreview = new LLModelPreview(512, 512, this); + mModelPreview = new LLModelPreview(512, 512, this ); mModelPreview->setPreviewTarget(16.f); mModelPreview->setDetailsCallback(boost::bind(&LLFloaterModelPreview::setDetails, this, _1, _2, _3, _4, _5)); @@ -383,7 +383,7 @@ LLFloaterModelPreview::~LLFloaterModelPreview() sInstance = NULL; if ( mModelPreview && mModelPreview->getResetJointFlag() ) - { + { gAgentAvatarp->resetJointPositions(); } @@ -994,8 +994,11 @@ void LLFloaterModelPreview::onMouseCaptureLostModelPreview(LLMouseHandler* handl //----------------------------------------------------------------------------- // LLModelLoader //----------------------------------------------------------------------------- -LLModelLoader::LLModelLoader(std::string filename, S32 lod, LLModelPreview* preview) -: LLThread("Model Loader"), mFilename(filename), mLod(lod), mPreview(preview), mFirstTransform(TRUE) +LLModelLoader::LLModelLoader( std::string filename, S32 lod, LLModelPreview* preview, JointTransformMap& jointMap, + std::deque& jointsFromNodes ) +: mJointList( jointMap ) +, mJointsFromNode( jointsFromNodes ) +, LLThread("Model Loader"), mFilename(filename), mLod(lod), mPreview(preview), mFirstTransform(TRUE) { mJointMap["mPelvis"] = "mPelvis"; mJointMap["mTorso"] = "mTorso"; @@ -1073,27 +1076,6 @@ LLModelLoader::LLModelLoader(std::string filename, S32 lod, LLModelPreview* prev mJointMap["lShin"] = "mKneeLeft"; mJointMap["lFoot"] = "mFootLeft"; - //move into joint mapper class - mMasterJointList.push_front("mPelvis"); - mMasterJointList.push_front("mTorso"); - mMasterJointList.push_front("mChest"); - mMasterJointList.push_front("mNeck"); - mMasterJointList.push_front("mHead"); - mMasterJointList.push_front("mCollarLeft"); - mMasterJointList.push_front("mShoulderLeft"); - mMasterJointList.push_front("mElbowLeft"); - mMasterJointList.push_front("mWristLeft"); - mMasterJointList.push_front("mCollarRight"); - mMasterJointList.push_front("mShoulderRight"); - mMasterJointList.push_front("mElbowRight"); - mMasterJointList.push_front("mWristRight"); - mMasterJointList.push_front("mHipRight"); - mMasterJointList.push_front("mKneeRight"); - mMasterJointList.push_front("mFootRight"); - mMasterJointList.push_front("mHipLeft"); - mMasterJointList.push_front("mKneeLeft"); - mMasterJointList.push_front("mFootLeft"); - if (mPreview) { //only try to load from slm if viewer is configured to do so and this is the @@ -1356,12 +1338,8 @@ bool LLModelLoader::doLoadModel() skin_info.mBindShapeMatrix = trans; } - - - //The joint transfom map that we'll populate below - std::map jointTransforms; - jointTransforms.clear(); - + + //Some collada setup for accessing the skeleton daeElement* pElement = 0; dae.getDatabase()->getElement( &pElement, 0, 0, "skeleton" ); @@ -1410,7 +1388,7 @@ bool LLModelLoader::doLoadModel() domNode* pNode = daeSafeCast(children[i]); if ( isNodeAJoint( pNode ) ) { - processJointNode( pNode, jointTransforms ); + processJointNode( pNode, mJointList ); } } } @@ -1468,7 +1446,7 @@ bool LLModelLoader::doLoadModel() } //Store the joint transform w/respect to it's name. - jointTransforms[(*jointIt).second.c_str()] = workingTransform; + mJointList[(*jointIt).second.c_str()] = workingTransform; } } @@ -1571,13 +1549,10 @@ bool LLModelLoader::doLoadModel() //Now that we've parsed the joint array, let's determine if we have a full rig //(which means we have all the joints that are required for an avatar versus //a skinned asset attached to a node in a file that contains an entire skeleton, - //but does not use the skeleton). - mPreview->setRigValid( doesJointArrayContainACompleteRig( model->mSkinInfo.mJointNames ) ); - if ( !skeletonWithNoRootNode && !model->mSkinInfo.mJointNames.empty() && mPreview->isRigValid() ) - { - mPreview->setResetJointFlag( true ); - } + //but does not use the skeleton). + mPreview->critiqueRigForUploadApplicability( model->mSkinInfo.mJointNames ); + if ( !missingSkeletonOrScene ) { //Set the joint translations on the avatar - if it's a full mapping @@ -1590,10 +1565,10 @@ bool LLModelLoader::doLoadModel() { std::string lookingForJoint = (*masterJointIt).first.c_str(); - if ( jointTransforms.find( lookingForJoint ) != jointTransforms.end() ) + if ( mJointList.find( lookingForJoint ) != mJointList.end() ) { //llinfos<<"joint "<getJoint( lookingForJoint ); if ( pJoint ) { @@ -1609,6 +1584,7 @@ bool LLModelLoader::doLoadModel() } } //missingSkeletonOrScene + //We need to construct the alternate bind matrix (which contains the new joint positions) //in the same order as they were stored in the joint buffer. The joints associated //with the skeleton are not stored in the same order as they are in the exported joint buffer. @@ -1620,11 +1596,11 @@ bool LLModelLoader::doLoadModel() std::string lookingForJoint = (*jointIt).c_str(); //Look for the joint xform that we extracted from the skeleton, using the jointIt as the key //and store it in the alternate bind matrix - if ( jointTransforms.find( lookingForJoint ) != jointTransforms.end() ) + if ( mJointList.find( lookingForJoint ) != mJointList.end() ) { - LLMatrix4 jointTransform = jointTransforms[lookingForJoint]; + LLMatrix4 jointTransform = mJointList[lookingForJoint]; LLMatrix4 newInverse = model->mSkinInfo.mInvBindMatrix[i]; - newInverse.setTranslation( jointTransforms[lookingForJoint].getTranslation() ); + newInverse.setTranslation( mJointList[lookingForJoint].getTranslation() ); model->mSkinInfo.mAlternateBindMatrix.push_back( newInverse ); } else @@ -1787,7 +1763,11 @@ bool LLModelLoader::doLoadModel() processElement(scene); handlePivotPoint( root ); + + buildJointToNodeMappingFromScene( root ); + mPreview->critiqueJointToNodeMappingFromScene(); + return true; } @@ -1836,8 +1816,9 @@ bool LLModelLoader::loadFromSLM(const std::string& filename) model[lod].push_back(loaded_model); if (lod == LLModel::LOD_HIGH && !loaded_model->mSkinInfo.mJointNames.empty()) - { //check to see if rig is valid - mPreview->setRigValid( doesJointArrayContainACompleteRig( loaded_model->mSkinInfo.mJointNames ) ); + { + //check to see if rig is valid + mPreview->critiqueRigForUploadApplicability( loaded_model->mSkinInfo.mJointNames ); } } else @@ -1911,7 +1892,52 @@ void LLModelLoader::loadModelCallback() delete this; } - +//----------------------------------------------------------------------------- +// buildJointToNodeMappingFromScene() +//----------------------------------------------------------------------------- +void LLModelLoader::buildJointToNodeMappingFromScene( daeElement* pRoot ) +{ + daeElement* pScene = pRoot->getDescendant("visual_scene"); + if ( pScene ) + { + daeTArray< daeSmartRef > children = pScene->getChildren(); + S32 childCount = children.getCount(); + for (S32 i = 0; i < childCount; ++i) + { + domNode* pNode = daeSafeCast(children[i]); + processJointToNodeMapping( pNode ); + } + } +} +//----------------------------------------------------------------------------- +// processJointToNodeMapping() +//----------------------------------------------------------------------------- +void LLModelLoader::processJointToNodeMapping( domNode* pNode ) +{ + if ( isNodeAJoint( pNode ) ) + { + //1.Store the parent + std::string nodeName = pNode->getName(); + if ( !nodeName.empty() ) + { + mJointsFromNode.push_front( pNode->getName() ); + } + //2. Handle the kiddo's + daeTArray< daeSmartRef > childOfChild = pNode->getChildren(); + S32 childOfChildCount = childOfChild.getCount(); + for (S32 i = 0; i < childOfChildCount; ++i) + { + domNode* pChildNode = daeSafeCast( childOfChild[i] ); + if ( pChildNode ) + { + processJointToNodeMapping( pChildNode ); + } + } + } +} +//----------------------------------------------------------------------------- +// handlePivotPoint() +//----------------------------------------------------------------------------- void LLModelLoader::handlePivotPoint( daeElement* pRoot ) { //Import an optional pivot point - a pivot point is just a node in the visual scene named "AssetPivot" @@ -1953,37 +1979,157 @@ void LLModelLoader::handlePivotPoint( daeElement* pRoot ) } } -bool LLModelLoader::doesJointArrayContainACompleteRig( const std::vector &jointListFromModel ) +//----------------------------------------------------------------------------- +// critiqueRigForUploadApplicability() +//----------------------------------------------------------------------------- +void LLModelPreview::critiqueRigForUploadApplicability( const std::vector &jointListFromAsset ) +{ + //Determines the following use cases for a rig: + //1. It is suitable for upload with skin weights & joint positions, or + //2. It is suitable for upload as standard av with just skin weights + + bool isJointPositionUploadOK = isRigSuitableForJointPositionUpload( jointListFromAsset ); + bool isRigLegacyOK = isRigLegacy( jointListFromAsset ); + + //It's OK that both could end up being true, both default to false + if ( isJointPositionUploadOK ) + { + setRigValidForJointPositionUpload( true ); + } + + if ( isRigLegacyOK ) + { + setLegacyRigValid( true ); + } + + if ( isJointPositionUploadOK ) + { + setResetJointFlag( true ); + } +} +//----------------------------------------------------------------------------- +// critiqueJointToNodeMappingFromScene() +//----------------------------------------------------------------------------- +void LLModelPreview::critiqueJointToNodeMappingFromScene( void ) +{ + //Do the actual nodes back the joint listing from the dae? + //if yes then this is a fully rigged asset, otherwise it's just a partial rig + + std::deque::iterator jointsFromNodeIt = mJointsFromNode.begin(); + std::deque::iterator jointsFromNodeEndIt = mJointsFromNode.end(); + bool result = true; + + if ( !mJointsFromNode.empty() ) + { + for ( ;jointsFromNodeIt!=jointsFromNodeEndIt;++jointsFromNodeIt ) + { + std::string name = *jointsFromNodeIt; + if ( mJointTransformMap.find( name ) != mJointTransformMap.end() ) + { + continue; + } + else + { + llinfos<<"critiqueJointToNodeMappingFromScene is missing a: "< &jointListFromAsset ) +{ + //No joints in asset + if ( jointListFromAsset.size() == 0 ) + { + return false; + } + + bool result = false; + + std::deque :: const_iterator masterJointIt = mMasterLegacyJointList.begin(); + std::deque :: const_iterator masterJointEndIt = mMasterLegacyJointList.end(); + + std::vector :: const_iterator modelJointIt = jointListFromAsset.begin(); + std::vector :: const_iterator modelJointItEnd = jointListFromAsset.end(); + + for ( ;masterJointIt!=masterJointEndIt;++masterJointIt ) + { + result = false; + modelJointIt = jointListFromAsset.begin(); + + for ( ;modelJointIt!=modelJointItEnd; ++modelJointIt ) + { + if ( *masterJointIt == *modelJointIt ) + { + result = true; + break; + } + } + if ( !result ) + { + llinfos<<" Asset did not contain the joint (if you're u/l a fully rigged asset w/joint positions - it is required)." << *masterJointIt<< llendl; + break; + } + } + return result; +} +//----------------------------------------------------------------------------- +// isRigSuitableForJointPositionUpload() +//----------------------------------------------------------------------------- +bool LLModelPreview::isRigSuitableForJointPositionUpload( const std::vector &jointListFromAsset ) { + bool result = false; + std::deque :: const_iterator masterJointIt = mMasterJointList.begin(); std::deque :: const_iterator masterJointEndIt = mMasterJointList.end(); - std::vector :: const_iterator modelJointIt = jointListFromModel.begin(); - std::vector :: const_iterator modelJointItEnd = jointListFromModel.end(); + std::vector :: const_iterator modelJointIt = jointListFromAsset.begin(); + std::vector :: const_iterator modelJointItEnd = jointListFromAsset.end(); - bool found = false; for ( ;masterJointIt!=masterJointEndIt;++masterJointIt ) { - found = false; - modelJointIt = jointListFromModel.begin(); + result = false; + modelJointIt = jointListFromAsset.begin(); + for ( ;modelJointIt!=modelJointItEnd; ++modelJointIt ) { if ( *masterJointIt == *modelJointIt ) { - found = true; + result = true; break; } } - if ( !found ) + if ( !result ) { - llinfos<<" Asset did not contain the joint (if you're u/l a fully rigged asset - it is required)." << *masterJointIt<< llendl; + llinfos<<" Asset did not contain the joint (if you're u/l a fully rigged asset w/joint positions - it is required)." << *masterJointIt<< llendl; break; } - } - - return found; + } + return result; } + //called in the main thread void LLModelLoader::loadTextures() { @@ -2013,6 +2159,9 @@ void LLModelLoader::loadTextures() } } +//----------------------------------------------------------------------------- +// isNodeAJoint() +//----------------------------------------------------------------------------- bool LLModelLoader::isNodeAJoint( domNode* pNode ) { if ( pNode->getName() == NULL) @@ -2027,7 +2176,9 @@ bool LLModelLoader::isNodeAJoint( domNode* pNode ) return false; } - +//----------------------------------------------------------------------------- +// isNodeAPivotPoint() +//----------------------------------------------------------------------------- bool LLModelLoader::isNodeAPivotPoint( domNode* pNode ) { bool result = false; @@ -2046,14 +2197,18 @@ bool LLModelLoader::isNodeAPivotPoint( domNode* pNode ) } return result; } - +//----------------------------------------------------------------------------- +// extractTranslation() +//----------------------------------------------------------------------------- void LLModelLoader::extractTranslation( domTranslate* pTranslate, LLMatrix4& transform ) { domFloat3 jointTrans = pTranslate->getValue(); LLVector3 singleJointTranslation( jointTrans[0], jointTrans[1], jointTrans[2] ); transform.setTranslation( singleJointTranslation ); } - +//----------------------------------------------------------------------------- +// extractTranslationViaElement() +//----------------------------------------------------------------------------- void LLModelLoader::extractTranslationViaElement( daeElement* pTranslateElement, LLMatrix4& transform ) { domTranslate* pTranslateChild = dynamic_cast( pTranslateElement ); @@ -2061,8 +2216,10 @@ void LLModelLoader::extractTranslationViaElement( daeElement* pTranslateElement, LLVector3 singleJointTranslation( translateChild[0], translateChild[1], translateChild[2] ); transform.setTranslation( singleJointTranslation ); } - -void LLModelLoader::processJointNode( domNode* pNode, std::map& jointTransforms ) +//----------------------------------------------------------------------------- +// processJointNode() +//----------------------------------------------------------------------------- +void LLModelLoader::processJointNode( domNode* pNode, JointTransformMap& jointTransforms ) { if (pNode->getName() == NULL) { @@ -2135,7 +2292,9 @@ void LLModelLoader::processJointNode( domNode* pNode, std::mapgetChild( name.c_str() ); @@ -2456,8 +2615,10 @@ LLColor4 LLModelLoader::getDaeColor(daeElement* element) LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp) : LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE), LLMutex(NULL) , mPelvisZOffset( 0.0f ) -, mRigValid( false ) +, mLegacyRigValid( false ) +, mRigValidJointUpload( false ) , mResetJoints( false ) +, mLastJointUpdate( false ) { mNeedsUpdate = TRUE; mCameraDistance = 0.f; @@ -2491,6 +2652,40 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp) mModelPivot = LLVector3( 0.0f, 0.0f, 0.0f ); glodInit(); + + //move into joint mapper class + //1. joints for joint offset verification + mMasterJointList.push_front("mPelvis"); + mMasterJointList.push_front("mTorso"); + mMasterJointList.push_front("mChest"); + mMasterJointList.push_front("mNeck"); + mMasterJointList.push_front("mHead"); + mMasterJointList.push_front("mCollarLeft"); + mMasterJointList.push_front("mShoulderLeft"); + mMasterJointList.push_front("mElbowLeft"); + mMasterJointList.push_front("mWristLeft"); + mMasterJointList.push_front("mCollarRight"); + mMasterJointList.push_front("mShoulderRight"); + mMasterJointList.push_front("mElbowRight"); + mMasterJointList.push_front("mWristRight"); + mMasterJointList.push_front("mHipRight"); + mMasterJointList.push_front("mKneeRight"); + mMasterJointList.push_front("mFootRight"); + mMasterJointList.push_front("mHipLeft"); + mMasterJointList.push_front("mKneeLeft"); + mMasterJointList.push_front("mFootLeft"); + //2. legacy joint list - used to verify rigs that will not be using joint offsets + mMasterLegacyJointList.push_front("mPelvis"); + mMasterLegacyJointList.push_front("mTorso"); + mMasterLegacyJointList.push_front("mChest"); + mMasterLegacyJointList.push_front("mNeck"); + mMasterLegacyJointList.push_front("mHead"); + mMasterLegacyJointList.push_front("mHipRight"); + mMasterLegacyJointList.push_front("mKneeRight"); + mMasterLegacyJointList.push_front("mFootRight"); + mMasterLegacyJointList.push_front("mHipLeft"); + mMasterLegacyJointList.push_front("mKneeLeft"); + mMasterLegacyJointList.push_front("mFootLeft"); } LLModelPreview::~LLModelPreview() @@ -2518,14 +2713,20 @@ U32 LLModelPreview::calcResourceCost() } } - //Upload skin is selected BUT the joints coming in from the asset - //were malformed. + //Upload skin is selected BUT check to see if the joints coming in from the asset were malformed. if ( mFMP && mFMP->childGetValue("upload_skin").asBoolean() ) { - if ( !isRigValid() ) + bool uploadingJointPositions = mFMP->childGetValue("upload_joints").asBoolean(); + if ( uploadingJointPositions && !isRigValidForJointPositionUpload() ) + { + mFMP->childDisable("ok_btn"); + } + else + if ( !isLegacyRigValid() ) { mFMP->childDisable("ok_btn"); } + //ok_btn should not have been changed unless something was wrong with joint list } U32 cost = 0; @@ -2858,7 +3059,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod) clearGLODGroup(); } - mModelLoader = new LLModelLoader(filename, lod, this); + mModelLoader = new LLModelLoader(filename, lod, this, mJointTransformMap, mJointsFromNode ); mModelLoader->start(); @@ -3694,12 +3895,22 @@ void LLModelPreview::updateStatusMessages() bool errorStateFromLoader = getLoadState() >= LLModelLoader::ERROR_PARSING ? true : false; bool skinAndRigOk = true; - bool uploadingSkin = mFMP->childGetValue("upload_skin").asBoolean(); - if ( uploadingSkin && !isRigValid() ) + bool uploadingSkin = mFMP->childGetValue("upload_skin").asBoolean(); + bool uploadingJointPositions = mFMP->childGetValue("upload_joints").asBoolean(); + + if ( uploadingSkin ) { - skinAndRigOk = false; + if ( uploadingJointPositions && !isRigValidForJointPositionUpload() ) + { + skinAndRigOk = false; + } + else + if ( !isLegacyRigValid() ) + { + skinAndRigOk = false; + } } - + if ( upload_ok && !errorStateFromLoader && skinAndRigOk ) { mFMP->childEnable("ok_btn"); @@ -4089,7 +4300,55 @@ void LLModelPreview::update() } } +//----------------------------------------------------------------------------- +// changeAvatarsJointPositions() +//----------------------------------------------------------------------------- +void LLModelPreview::changeAvatarsJointPositions( LLModel* pModel ) +{ + if ( mMasterJointList.empty() ) + { + return; + } + + std::vector :: const_iterator jointListItBegin = pModel->mSkinInfo.mJointNames.begin(); + std::vector :: const_iterator jointListItEnd = pModel->mSkinInfo.mJointNames.end(); + + S32 index = 0; + for ( ; jointListItBegin!=jointListItEnd; ++jointListItBegin, ++index ) + { + std::string elem = *jointListItBegin; + //llinfos<<"joint "<mSkinInfo.mAlternateBindMatrix.size(); + if ( matrixCnt < 1 ) + { + llinfos<<"Total WTF moment :"<mSkinInfo.mAlternateBindMatrix[index]; + LLJoint* pJoint = gAgentAvatarp->getJoint( elem ); + if ( pJoint ) + { + pJoint->storeCurrentXform( jointTransform.getTranslation() ); + } + } + } +} +//----------------------------------------------------------------------------- +// getTranslationForJointOffset() +//----------------------------------------------------------------------------- +LLVector3 LLModelPreview::getTranslationForJointOffset( std::string joint ) +{ + LLMatrix4 jointTransform; + if ( mJointTransformMap.find( joint ) != mJointTransformMap.end() ) + { + jointTransform = mJointTransformMap[joint]; + return jointTransform.getTranslation(); + } + return LLVector3(0.0f,0.0f,0.0f); +} //----------------------------------------------------------------------------- // render() //----------------------------------------------------------------------------- @@ -4140,9 +4399,21 @@ BOOL LLModelPreview::render() LLFloaterModelPreview* fmp = LLFloaterModelPreview::sInstance; bool has_skin_weights = false; - bool upload_skin = mFMP->childGetValue("upload_skin").asBoolean(); + bool upload_skin = mFMP->childGetValue("upload_skin").asBoolean(); bool upload_joints = mFMP->childGetValue("upload_joints").asBoolean(); + bool resetJoints = false; + if ( upload_joints != mLastJointUpdate ) + { + if ( mLastJointUpdate ) + { + resetJoints = true; + } + + mLastJointUpdate = upload_joints; + + } + for (LLModelLoader::scene::iterator iter = mScene[mPreviewLOD].begin(); iter != mScene[mPreviewLOD].end(); ++iter) { for (LLModelLoader::model_instance_list::iterator model_iter = iter->second.begin(); model_iter != iter->second.end(); ++model_iter) @@ -4187,11 +4458,30 @@ BOOL LLModelPreview::render() if (!upload_skin && upload_joints) { //can't upload joints if not uploading skin weights mFMP->childSetValue("upload_joints", false); - upload_joints = false; - } - + upload_joints = false; + } + mFMP->childSetEnabled("upload_joints", upload_skin); + //poke at avatar when we upload custom joints + /* + if ( upload_joints ) + { + for (LLModelLoader::scene::iterator iter = mScene[mPreviewLOD].begin(); iter != mScene[mPreviewLOD].end(); ++iter) + { + for (LLModelLoader::model_instance_list::iterator model_iter = iter->second.begin(); model_iter != iter->second.end(); ++model_iter) + { + LLModelInstance& instance = *model_iter; + LLModel* model = instance.mModel; + if ( !model->mSkinWeights.empty() ) + { + changeAvatarsJointPositions( model ); + } + } + } + } + */ + F32 explode = mFMP->childGetValue("physics_explode").asReal(); glClear(GL_DEPTH_BUFFER_BIT); @@ -4468,6 +4758,7 @@ BOOL LLModelPreview::render() //quick 'n dirty software vertex skinning //build matrix palette + LLMatrix4 mat[64]; for (U32 j = 0; j < model->mSkinInfo.mJointNames.size(); ++j) { diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index dc6a33d0ab..186bf114d1 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -53,6 +53,9 @@ class domTranslate; class LLMenuButton; class LLToggleableMenu; +typedef std::map JointTransformMap; +typedef std::map:: iterator JointTransformMapIt; + const S32 NUM_LOD = 4; class LLModelLoader : public LLThread @@ -94,8 +97,8 @@ public: //queue of models that need a physics rep model_queue mPhysicsQ; - LLModelLoader(std::string filename, S32 lod, LLModelPreview* preview); - + LLModelLoader( std::string filename, S32 lod, LLModelPreview* preview, JointTransformMap& jointMap, + std::deque& jointsFromNodes ); virtual void run(); bool doLoadModel(); bool loadFromSLM(const std::string& filename); @@ -115,17 +118,19 @@ public: void extractTranslation( domTranslate* pTranslate, LLMatrix4& transform ); void extractTranslationViaElement( daeElement* pTranslateElement, LLMatrix4& transform ); - bool doesJointArrayContainACompleteRig( const std::vector &modelJointList ); - bool checkForCompleteRig( const std::vector &jointListFromModel ); - void handlePivotPoint( daeElement* pRoot ); bool isNodeAPivotPoint( domNode* pNode ); void setLoadState(U32 state); + void buildJointToNodeMappingFromScene( daeElement* pRoot ); + void processJointToNodeMapping( domNode* pNode ); + + //map of avatar joints as named in COLLADA assets to internal joint names std::map mJointMap; - std::deque mMasterJointList; + JointTransformMap& mJointList; + std::deque& mJointsFromNode; }; class LLFloaterModelPreview : public LLFloater @@ -297,12 +302,28 @@ public: void updateStatusMessages(); void clearGLODGroup(); void onLODParamCommit(bool enforce_tri_limit); + const bool getModelPivot( void ) const { return mHasPivot; } void setHasPivot( bool val ) { mHasPivot = val; } void setModelPivot( const LLVector3& pivot ) { mModelPivot = pivot; } - const bool isRigValid( void ) const { return mRigValid; } - void setRigValid( bool rigValid ) { mRigValid = rigValid; } - + + //Sets the current avatars joints to new positions + //Makes in world go to shit, however + void changeAvatarsJointPositions( LLModel* pModel ); + //Determines the viability of an asset to be used as an avatar rig (w or w/o joint upload caps) + void critiqueRigForUploadApplicability( const std::vector &jointListFromAsset ); + void critiqueJointToNodeMappingFromScene( void ); + //Is a rig valid so that it can be used as a criteria for allowing for uploading of joint positions + //Accessors for joint position upload friendly rigs + const bool isRigValidForJointPositionUpload( void ) const { return mRigValidJointUpload; } + void setRigValidForJointPositionUpload( bool rigValid ) { mRigValidJointUpload = rigValid; } + bool isRigSuitableForJointPositionUpload( const std::vector &jointListFromAsset ); + //Determines if a rig is a legacy from the joint list + bool isRigLegacy( const std::vector &jointListFromAsset ); + //Accessors for the legacy rigs + const bool isLegacyRigValid( void ) const { return mLegacyRigValid; } + void setLegacyRigValid( bool rigValid ) { mLegacyRigValid = rigValid; } + static void textureLoadedCallback( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); boost::signals2::connection setDetailsCallback( const details_signal_t::slot_type& cb ){ return mDetailsSignal.connect(cb); } @@ -314,6 +335,8 @@ public: void setResetJointFlag( bool state ) { mResetJoints = state; } bool getResetJointFlag( void ) { return mResetJoints; } + LLVector3 getTranslationForJointOffset( std::string joint ); + protected: friend class LLModelLoader; friend class LLFloaterModelPreview; @@ -377,8 +400,15 @@ public: float mPelvisZOffset; - bool mRigValid; -}; + bool mRigValidJointUpload; + bool mLegacyRigValid; + bool mLastJointUpdate; + + std::deque mMasterJointList; + std::deque mMasterLegacyJointList; + std::deque mJointsFromNode; + JointTransformMap mJointTransformMap; +}; #endif // LL_LLFLOATERMODELPREVIEW_H -- cgit v1.2.3