diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/lldebugview.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llsceneview.cpp | 273 | ||||
-rw-r--r-- | indra/newview/llsceneview.h | 48 | ||||
-rwxr-xr-x | indra/newview/llviewermenu.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llviewerobject.h | 1 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llvovolume.h | 1 | ||||
-rwxr-xr-x | indra/newview/pipeline.cpp | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 10 |
11 files changed, 395 insertions, 2 deletions
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<F32> size[2]; + + std::vector<U32> triangles[2]; + std::vector<U32> 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 512e716c80..674fa91d4d 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<LLUUID> &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 82a29bbbe9..5f74423c7b 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8785,7 +8785,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;
@@ -9135,7 +9135,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" /> </menu_item_check> + <menu_item_check + label="Scene Statistics" + name="Scene Statistics"> + <menu_item_check.on_check + function="Advanced.CheckConsole" + parameter="scene view" /> + <menu_item_check.on_click + function="Advanced.ToggleConsole" + parameter="scene view" /> + </menu_item_check> <menu_item_separator/> |