diff options
author | James Cook <james@lindenlab.com> | 2009-11-30 14:42:34 -0800 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2009-11-30 14:42:34 -0800 |
commit | d83f934ec87e594b7e88267bdd1be938a73f090d (patch) | |
tree | 2fc1bc60f960e3139f3da799b7d93c9a08f8e7c6 /indra | |
parent | 1ec8ca378814b7f493f5f6e55fb505b5c884a995 (diff) | |
parent | 7d3b3cc474822db144b623980d08b7addc2f77ff (diff) |
merge
Diffstat (limited to 'indra')
37 files changed, 171 insertions, 103 deletions
diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index da03230b47..5eefa6a16b 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -123,13 +123,15 @@ #pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual" #pragma warning( 3 : 4266 ) // 'function' : no override available for virtual member function from base 'type'; function is hidden #pragma warning (disable : 4180) // qualifier applied to function type has no meaning; ignored -// Linker optimization with "extern template" generates this innocuous warning -#pragma warning( disable : 4231 ) // nonstandard extension used : 'extern' before template explicit instantiation #pragma warning( disable : 4284 ) // silly MS warning deep inside their <map> include file #pragma warning( disable : 4503 ) // 'decorated name length exceeded, name was truncated'. Does not seem to affect compilation. #pragma warning( disable : 4800 ) // 'BOOL' : forcing value to bool 'true' or 'false' (performance warning) #pragma warning( disable : 4996 ) // warning: deprecated +// Linker optimization with "extern template" generates these warnings +#pragma warning( disable : 4231 ) // nonstandard extension used : 'extern' before template explicit instantiation +#pragma warning( disable : 4506 ) // no definition for inline function + // level 4 warnings that we need to disable: #pragma warning (disable : 4100) // unreferenced formal parameter #pragma warning (disable : 4127) // conditional expression is constant (e.g. while(1) ) diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index f55fafadd8..ddeb4d1489 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -35,7 +35,6 @@ #include <typeinfo> #include <boost/noncopyable.hpp> -#include <boost/any.hpp> /// @brief A global registry of all singletons to prevent duplicate allocations /// across shared library boundaries diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 617a97b6cf..7721137e29 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -32,6 +32,7 @@ #include "linden_common.h" +#define LLBUTTON_CPP #include "llbutton.h" // Linden library includes @@ -57,8 +58,8 @@ static LLDefaultChildRegistry::Register<LLButton> r("button"); // Compiler optimization, generate extern template -//template class LLButton* LLView::getChild<class LLButton>( -// const std::string& name, BOOL recurse) const; +template class LLButton* LLView::getChild<class LLButton>( + const std::string& name, BOOL recurse) const; // globals loaded from settings.xml S32 LLBUTTON_H_PAD = 0; diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 8c3b4bd859..4c7400220d 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -322,5 +322,10 @@ private: LLFrameTimer mFlashingTimer; }; +// Build time optimization, generate once in .cpp file +#ifndef LLBUTTON_CPP +extern template class LLButton* LLView::getChild<class LLButton>( + const std::string& name, BOOL recurse) const; +#endif #endif // LL_LLBUTTON_H diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index 3c5925f965..cd10dfdb1c 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -33,6 +33,7 @@ // The mutants are coming! #include "linden_common.h" +#define LLCHECKBOXCTRL_CPP #include "llcheckboxctrl.h" #include "llgl.h" @@ -51,8 +52,8 @@ const U32 MAX_STRING_LENGTH = 10; static LLDefaultChildRegistry::Register<LLCheckBoxCtrl> r("check_box"); // Compiler optimization, generate extern template -//template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>( -// const std::string& name, BOOL recurse) const; +template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>( + const std::string& name, BOOL recurse) const; LLCheckBoxCtrl::Params::Params() : text_enabled_color("text_enabled_color"), diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h index b14e66b915..28d50f957d 100644 --- a/indra/llui/llcheckboxctrl.h +++ b/indra/llui/llcheckboxctrl.h @@ -126,5 +126,10 @@ protected: LLUIColor mTextDisabledColor; }; +// Build time optimization, generate once in .cpp file +#ifndef LLCHECKBOXCTRL_CPP +extern template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>( + const std::string& name, BOOL recurse) const; +#endif #endif // LL_LLCHECKBOXCTRL_H diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 1551aab192..8a21155cc3 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -34,6 +34,7 @@ #include "linden_common.h" +#define LLLINEEDITOR_CPP #include "lllineeditor.h" #include "lltexteditor.h" @@ -72,8 +73,8 @@ const F32 TRIPLE_CLICK_INTERVAL = 0.3f; // delay between double and triple click static LLDefaultChildRegistry::Register<LLLineEditor> r1("line_editor"); // Compiler optimization, generate extern template -//template class LLLineEditor* LLView::getChild<class LLLineEditor>( -// const std::string& name, BOOL recurse) const; +template class LLLineEditor* LLView::getChild<class LLLineEditor>( + const std::string& name, BOOL recurse) const; // // Member functions diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index b96220e020..49e9539b16 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -395,5 +395,10 @@ private: }; // end class LLLineEditor +// Build time optimization, generate once in .cpp file +#ifndef LLLINEEDITOR_CPP +extern template class LLLineEditor* LLView::getChild<class LLLineEditor>( + const std::string& name, BOOL recurse) const; +#endif #endif // LL_LINEEDITOR_ diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index dc5db03a44..750b190953 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -34,6 +34,7 @@ #include "linden_common.h" +#define LLPANEL_CPP #include "llpanel.h" #include "llalertdialog.h" @@ -59,8 +60,8 @@ static LLDefaultChildRegistry::Register<LLPanel> r1("panel", &LLPanel::fromXML); // Compiler optimization, generate extern template -//template class LLPanel* LLView::getChild<class LLPanel>( -// const std::string& name, BOOL recurse) const; +template class LLPanel* LLView::getChild<class LLPanel>( + const std::string& name, BOOL recurse) const; LLPanel::LocalizedString::LocalizedString() : name("name"), diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 0a0fed82fb..a8bd5fd5e5 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -275,4 +275,10 @@ private: }; // end class LLPanel +// Build time optimization, generate once in .cpp file +#ifndef LLPANEL_CPP +extern template class LLPanel* LLView::getChild<class LLPanel>( + const std::string& name, BOOL recurse) const; +#endif + #endif diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 4bd9a32b1d..0bd0ab59fb 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -31,7 +31,10 @@ */ #include "linden_common.h" + +#define LLTEXTBOX_CPP #include "lltextbox.h" + #include "lluictrlfactory.h" #include "llfocusmgr.h" #include "llwindow.h" @@ -41,8 +44,8 @@ static LLDefaultChildRegistry::Register<LLTextBox> r("text"); // Compiler optimization, generate extern template -//template class LLTextBox* LLView::getChild<class LLTextBox>( -// const std::string& name, BOOL recurse) const; +template class LLTextBox* LLView::getChild<class LLTextBox>( + const std::string& name, BOOL recurse) const; LLTextBox::LLTextBox(const LLTextBox::Params& p) : LLTextBase(p), diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index 01b4bfa5ed..3a045534d3 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -79,4 +79,10 @@ protected: callback_t mClickedCallback; }; +// Build time optimization, generate once in .cpp file +#ifndef LLTEXTBOX_CPP +extern template class LLTextBox* LLView::getChild<class LLTextBox>( + const std::string& name, BOOL recurse) const; +#endif + #endif diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 6e07a890ad..e68affc36c 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1,6 +1,5 @@ /** * @file lltexteditor.cpp - * @brief LLTextEditor base class * * $LicenseInfo:firstyear=2001&license=viewergpl$ * @@ -34,6 +33,7 @@ #include "linden_common.h" +#define LLTEXTEDITOR_CPP #include "lltexteditor.h" #include "llfontfreetype.h" // for LLFontFreetype::FIRST_CHAR @@ -74,8 +74,8 @@ static LLDefaultChildRegistry::Register<LLTextEditor> r("simple_text_editor"); // Compiler optimization, generate extern template -//template class LLTextEditor* LLView::getChild<class LLTextEditor>( -// const std::string& name, BOOL recurse) const; +template class LLTextEditor* LLView::getChild<class LLTextEditor>( + const std::string& name, BOOL recurse) const; // // Constants diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index fb014b86bf..043dda8fa6 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -334,5 +334,10 @@ private: LLContextMenu* mContextMenu; }; // end class LLTextEditor +// Build time optimization, generate once in .cpp file +#ifndef LLTEXTEDITOR_CPP +extern template class LLTextEditor* LLView::getChild<class LLTextEditor>( + const std::string& name, BOOL recurse) const; +#endif #endif // LL_TEXTEDITOR_ diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 3cf592f351..1e0af1201f 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -31,9 +31,11 @@ * $/LicenseInfo$ */ -//#include "llviewerprecompiledheaders.h" #include "linden_common.h" + +#define LLUICTRL_CPP #include "lluictrl.h" + #include "llfocusmgr.h" #include "llpanel.h" #include "lluictrlfactory.h" @@ -41,8 +43,8 @@ static LLDefaultChildRegistry::Register<LLUICtrl> r("ui_ctrl"); // Compiler optimization, generate extern template -//template class LLUICtrl* LLView::getChild<class LLUICtrl>( -// const std::string& name, BOOL recurse) const; +template class LLUICtrl* LLView::getChild<class LLUICtrl>( + const std::string& name, BOOL recurse) const; LLUICtrl::Params::Params() : tab_stop("tab_stop", true), diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index aef1bcd519..ac916c9a43 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -328,4 +328,10 @@ private: class DefaultTabGroupFirstSorter; }; +// Build time optimization, generate once in .cpp file +#ifndef LLUICTRL_CPP +extern template class LLUICtrl* LLView::getChild<class LLUICtrl>( + const std::string& name, BOOL recurse) const; +#endif + #endif // LL_LLUICTRL_H diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 49182be328..3643bf44f7 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -32,6 +32,7 @@ #include "linden_common.h" +#define LLUICTRLFACTORY_CPP #include "lluictrlfactory.h" #include "llxmlnode.h" diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index e021c04ad6..55d7d745eb 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -109,7 +109,9 @@ extern LLFastTimer::DeclareTimer FTM_WIDGET_CONSTRUCTION; extern LLFastTimer::DeclareTimer FTM_INIT_FROM_PARAMS; // Build time optimization, generate this once in .cpp file -//extern template class LLUICtrlFactory* LLSingleton<class LLUICtrlFactory>::getInstance(); +#ifndef LLUICTRLFACTORY_CPP +extern template class LLUICtrlFactory* LLSingleton<class LLUICtrlFactory>::getInstance(); +#endif class LLUICtrlFactory : public LLSingleton<LLUICtrlFactory> { diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index ef23268a14..e7e8b1b858 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -33,6 +33,7 @@ #include "linden_common.h" +#define LLVIEW_CPP #include "llview.h" #include <cassert> @@ -77,7 +78,8 @@ BOOL LLView::sIsDrawing = FALSE; #endif // Compiler optimization, generate extern template -//template class LLView* LLView::getChild<class LLView>(const std::string& name, BOOL recurse) const; +template class LLView* LLView::getChild<class LLView>( + const std::string& name, BOOL recurse) const; static LLDefaultChildRegistry::Register<LLView> r("view"); diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 1b12e78509..8ee05675c1 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -661,21 +661,9 @@ template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) co // Compiler optimization - don't generate these specializations inline, // require explicit specialization. See llbutton.cpp for an example. -//extern template class LLButton* LLView::getChild<class LLButton>( -// const std::string& name, BOOL recurse) const; -//extern template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>( -// const std::string& name, BOOL recurse) const; -//extern template class LLLineEditor* LLView::getChild<class LLLineEditor>( -// const std::string& name, BOOL recurse) const; -//extern template class LLPanel* LLView::getChild<class LLPanel>( -// const std::string& name, BOOL recurse) const; -//extern template class LLTextBox* LLView::getChild<class LLTextBox>( -// const std::string& name, BOOL recurse) const; -//extern template class LLTextEditor* LLView::getChild<class LLTextEditor>( -// const std::string& name, BOOL recurse) const; -//extern template class LLUICtrl* LLView::getChild<class LLUICtrl>( -// const std::string& name, BOOL recurse) const; -//extern template class LLView* LLView::getChild<class LLView>( -// const std::string& name, BOOL recurse) const; +#ifndef LLVIEW_CPP +extern template class LLView* LLView::getChild<class LLView>( + const std::string& name, BOOL recurse) const; +#endif #endif //LL_LLVIEW_H diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 4823932951..c44b0b5331 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -31,6 +31,8 @@ */ #include "llviewerprecompiledheaders.h" // must be first include + +#define LLBOTTOMTRAY_CPP #include "llbottomtray.h" #include "llagent.h" @@ -46,7 +48,7 @@ #include "llsyswellwindow.h" #include "llfloatercamera.h" -// Build time optimization, generate this once in .cpp file +// Build time optimization, generate extern template once in .cpp file template class LLBottomTray* LLSingleton<class LLBottomTray>::getInstance(); LLBottomTray::LLBottomTray(const LLSD&) diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h index 30f5f88cce..728a420324 100644 --- a/indra/newview/llbottomtray.h +++ b/indra/newview/llbottomtray.h @@ -47,8 +47,10 @@ class LLSpeakButton; class LLNearbyChatBar; class LLIMChiclet; -// Build time optimization, generate this once in .cpp file -//extern template class LLBottomTray* LLSingleton<class LLBottomTray>::getInstance(); +// Build time optimization, generate once in .cpp file +#ifndef LLBOTTOMTRAY_CPP +extern template class LLBottomTray* LLSingleton<class LLBottomTray>::getInstance(); +#endif class LLBottomTray : public LLSingleton<LLBottomTray> diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 9bc7221dc8..c7c79401a0 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -141,11 +141,12 @@ void LLViewerDynamicTexture::preRender(BOOL clear_depth) gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } // Set up camera - mCamera.setOrigin(*LLViewerCamera::getInstance()); - mCamera.setAxes(*LLViewerCamera::getInstance()); - mCamera.setAspect(LLViewerCamera::getInstance()->getAspect()); - mCamera.setView(LLViewerCamera::getInstance()->getView()); - mCamera.setNear(LLViewerCamera::getInstance()->getNear()); + LLViewerCamera* camera = LLViewerCamera::getInstance(); + mCamera.setOrigin(*camera); + mCamera.setAxes(*camera); + mCamera.setAspect(camera->getAspect()); + mCamera.setView(camera->getView()); + mCamera.setNear(camera->getNear()); glViewport(mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight); if (clear_depth) @@ -174,11 +175,12 @@ void LLViewerDynamicTexture::postRender(BOOL success) gViewerWindow->setup2DViewport(); // restore camera - LLViewerCamera::getInstance()->setOrigin(mCamera); - LLViewerCamera::getInstance()->setAxes(mCamera); - LLViewerCamera::getInstance()->setAspect(mCamera.getAspect()); - LLViewerCamera::getInstance()->setView(mCamera.getView()); - LLViewerCamera::getInstance()->setNear(mCamera.getNear()); + LLViewerCamera* camera = LLViewerCamera::getInstance(); + camera->setOrigin(mCamera); + camera->setAxes(mCamera); + camera->setAspect(mCamera.getAspect()); + camera->setView(mCamera.getView()); + camera->setNear(mCamera.getNear()); } //----------------------------------------------------------------------------- diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 31f1462a12..eef774426a 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1378,7 +1378,8 @@ F32 LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) LLVector3 center = getPositionAgent(); LLVector3 size = (mExtents[1] - mExtents[0]) * 0.5f; - LLVector3 lookAt = center - LLViewerCamera::getInstance()->getOrigin(); + LLViewerCamera* camera = LLViewerCamera::getInstance(); + LLVector3 lookAt = center - camera->getOrigin(); F32 dist = lookAt.normVec() ; //get area of circle around node @@ -1393,7 +1394,7 @@ F32 LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) } else { - cos_angle_to_view_dir = lookAt * LLViewerCamera::getInstance()->getXAxis() ; + cos_angle_to_view_dir = lookAt * camera->getXAxis() ; mImportanceToCamera = LLFace::calcImportanceToCamera(cos_angle_to_view_dir, dist) ; } @@ -1443,8 +1444,9 @@ F32 LLFace::calcImportanceToCamera(F32 cos_angle_to_view_dir, F32 dist) if(cos_angle_to_view_dir > LLViewerCamera::getInstance()->getCosHalfFov() && dist < FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[FACE_IMPORTANCE_LEVEL - 1][0]) { - F32 camera_moving_speed = LLViewerCamera::getInstance()->getAverageSpeed() ; - F32 camera_angular_speed = LLViewerCamera::getInstance()->getAverageAngularSpeed(); + LLViewerCamera* camera = LLViewerCamera::getInstance(); + F32 camera_moving_speed = camera->getAverageSpeed() ; + F32 camera_angular_speed = camera->getAverageAngularSpeed(); if(camera_moving_speed > 10.0f || camera_angular_speed > 1.0f) { diff --git a/indra/newview/llhudicon.cpp b/indra/newview/llhudicon.cpp index 040027c70d..28b0e7356a 100644 --- a/indra/newview/llhudicon.cpp +++ b/indra/newview/llhudicon.cpp @@ -103,28 +103,29 @@ void LLHUDIcon::renderIcon(BOOL for_select) // put icon above object, and in front // RN: don't use drawable radius, it's fricking HUGE - LLVector3 icon_relative_pos = (LLViewerCamera::getInstance()->getUpAxis() * ~mSourceObject->getRenderRotation()); + LLViewerCamera* camera = LLViewerCamera::getInstance(); + LLVector3 icon_relative_pos = (camera->getUpAxis() * ~mSourceObject->getRenderRotation()); icon_relative_pos.abs(); F32 distance_scale = llmin(mSourceObject->getScale().mV[VX] / icon_relative_pos.mV[VX], mSourceObject->getScale().mV[VY] / icon_relative_pos.mV[VY], mSourceObject->getScale().mV[VZ] / icon_relative_pos.mV[VZ]); F32 up_distance = 0.5f * distance_scale; - LLVector3 icon_position = obj_position + (up_distance * LLViewerCamera::getInstance()->getUpAxis()) * 1.2f; + LLVector3 icon_position = obj_position + (up_distance * camera->getUpAxis()) * 1.2f; LLVector3 icon_to_cam = LLViewerCamera::getInstance()->getOrigin() - icon_position; icon_to_cam.normVec(); icon_position += icon_to_cam * mSourceObject->mDrawable->getRadius() * 1.1f; - mDistance = dist_vec(icon_position, LLViewerCamera::getInstance()->getOrigin()); + mDistance = dist_vec(icon_position, camera->getOrigin()); F32 alpha_factor = for_select ? 1.f : clamp_rescale(mDistance, DIST_START_FADE, DIST_END_FADE, 1.f, 0.f); LLVector3 x_pixel_vec; LLVector3 y_pixel_vec; - LLViewerCamera::getInstance()->getPixelVectors(icon_position, y_pixel_vec, x_pixel_vec); + camera->getPixelVectors(icon_position, y_pixel_vec, x_pixel_vec); F32 scale_factor = 1.f; if (mAnimTimer.getElapsedTimeF32() < ANIM_TIME) @@ -226,26 +227,27 @@ BOOL LLHUDIcon::lineSegmentIntersect(const LLVector3& start, const LLVector3& en // put icon above object, and in front // RN: don't use drawable radius, it's fricking HUGE - LLVector3 icon_relative_pos = (LLViewerCamera::getInstance()->getUpAxis() * ~mSourceObject->getRenderRotation()); + LLViewerCamera* camera = LLViewerCamera::getInstance(); + LLVector3 icon_relative_pos = (camera->getUpAxis() * ~mSourceObject->getRenderRotation()); icon_relative_pos.abs(); F32 distance_scale = llmin(mSourceObject->getScale().mV[VX] / icon_relative_pos.mV[VX], mSourceObject->getScale().mV[VY] / icon_relative_pos.mV[VY], mSourceObject->getScale().mV[VZ] / icon_relative_pos.mV[VZ]); F32 up_distance = 0.5f * distance_scale; - LLVector3 icon_position = obj_position + (up_distance * LLViewerCamera::getInstance()->getUpAxis()) * 1.2f; + LLVector3 icon_position = obj_position + (up_distance * camera->getUpAxis()) * 1.2f; LLVector3 icon_to_cam = LLViewerCamera::getInstance()->getOrigin() - icon_position; icon_to_cam.normVec(); icon_position += icon_to_cam * mSourceObject->mDrawable->getRadius() * 1.1f; - mDistance = dist_vec(icon_position, LLViewerCamera::getInstance()->getOrigin()); + mDistance = dist_vec(icon_position, camera->getOrigin()); LLVector3 x_pixel_vec; LLVector3 y_pixel_vec; - LLViewerCamera::getInstance()->getPixelVectors(icon_position, y_pixel_vec, x_pixel_vec); + camera->getPixelVectors(icon_position, y_pixel_vec, x_pixel_vec); F32 scale_factor = 1.f; if (mAnimTimer.getElapsedTimeF32() < ANIM_TIME) diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index ab0be90def..a02dc3355b 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -64,11 +64,12 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, const LLColor4& color, const BOOL orthographic) { + LLViewerCamera* camera = LLViewerCamera::getInstance(); // Do cheap plane culling - LLVector3 dir_vec = pos_agent - LLViewerCamera::getInstance()->getOrigin(); + LLVector3 dir_vec = pos_agent - camera->getOrigin(); dir_vec /= dir_vec.magVec(); - if (wstr.empty() || (!orthographic && dir_vec * LLViewerCamera::getInstance()->getAtAxis() <= 0.f)) + if (wstr.empty() || (!orthographic && dir_vec * camera->getAtAxis() <= 0.f)) { return; } @@ -82,15 +83,15 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, } else { - LLViewerCamera::getInstance()->getPixelVectors(pos_agent, up_axis, right_axis); + camera->getPixelVectors(pos_agent, up_axis, right_axis); } - LLCoordFrame render_frame = *LLViewerCamera::getInstance(); + LLCoordFrame render_frame = *camera; LLQuaternion rot; if (!orthographic) { rot = render_frame.getQuaternion(); - rot = rot * LLQuaternion(-F_PI_BY_TWO, LLViewerCamera::getInstance()->getYAxis()); - rot = rot * LLQuaternion(F_PI_BY_TWO, LLViewerCamera::getInstance()->getXAxis()); + rot = rot * LLQuaternion(-F_PI_BY_TWO, camera->getYAxis()); + rot = rot * LLQuaternion(F_PI_BY_TWO, camera->getXAxis()); } else { diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 4394271ec4..1605838b94 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -33,6 +33,7 @@ #include "llviewerprecompiledheaders.h" // file include +#define LLSELECTMGR_CPP #include "llselectmgr.h" // library includes diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 57e0ee4e0e..6641be335a 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -324,7 +324,9 @@ private: typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle; // Build time optimization, generate this once in .cpp file -//extern template class LLSelectMgr* LLSingleton<class LLSelectMgr>::getInstance(); +#ifndef LLSELECTMGR_CPP +extern template class LLSelectMgr* LLSingleton<class LLSelectMgr>::getInstance(); +#endif class LLSelectMgr : public LLEditMenuHandler, public LLSingleton<LLSelectMgr> { diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index 221db2defa..bd4f172907 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -32,6 +32,7 @@ #include "llviewerprecompiledheaders.h" +#define LLVIEWERCAMERA_CPP #include "llviewercamera.h" // Viewer includes diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index bf561c3e4d..cd67af5fef 100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -53,7 +53,9 @@ const BOOL FOR_SELECTION = TRUE; const BOOL NOT_FOR_SELECTION = FALSE; // Build time optimization, generate this once in .cpp file -//extern template class LLViewerCamera* LLSingleton<class LLViewerCamera>::getInstance(); +#ifndef LLVIEWERCAMERA_CPP +extern template class LLViewerCamera* LLSingleton<class LLViewerCamera>::getInstance(); +#endif class LLViewerCamera : public LLCamera, public LLSingleton<LLViewerCamera> { diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index e491e11960..3c79045cc5 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2767,22 +2767,23 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent) // I don't think there's a better way to do this without calculating distance per-poly F32 range = sqrt(dx*dx + dy*dy + dz*dz) - min_scale/2; + LLViewerCamera* camera = LLViewerCamera::getInstance(); if (range < 0.001f || isHUDAttachment()) // range == zero { mAppAngle = 180.f; - mPixelArea = (F32)LLViewerCamera::getInstance()->getScreenPixelArea(); + mPixelArea = (F32)camera->getScreenPixelArea(); } else { mAppAngle = (F32) atan2( max_scale, range) * RAD_TO_DEG; - F32 pixels_per_meter = LLViewerCamera::getInstance()->getPixelMeterRatio() / range; + F32 pixels_per_meter = camera->getPixelMeterRatio() / range; mPixelArea = (pixels_per_meter * max_scale) * (pixels_per_meter * mid_scale); - if (mPixelArea > LLViewerCamera::getInstance()->getScreenPixelArea()) + if (mPixelArea > camera->getScreenPixelArea()) { mAppAngle = 180.f; - mPixelArea = (F32)LLViewerCamera::getInstance()->getScreenPixelArea(); + mPixelArea = (F32)camera->getScreenPixelArea(); } } } diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 9896adad97..9de1ef7190 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -808,6 +808,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines () S32 drawn = 0; F32* vertexp; U8* colorp; + bool render_hidden = LLSelectMgr::sRenderHiddenSelections && LLFloaterReg::instanceVisible("build"); const F32 PROPERTY_LINE_CLIP_DIST = 256.f; @@ -849,7 +850,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines () gGL.end(); - if (LLSelectMgr::sRenderHiddenSelections && LLFloaterReg::instanceVisible("build")) + if (render_hidden) { LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER); diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp index cfb8340462..841a7ccc5e 100644 --- a/indra/newview/llviewerpartsim.cpp +++ b/indra/newview/llviewerpartsim.cpp @@ -71,9 +71,9 @@ const F32 LLViewerPartSim::PART_ADAPT_RATE_MULT_RECIP = 1.0f/PART_ADAPT_RATE_MUL U32 LLViewerPart::sNextPartID = 1; -F32 calc_desired_size(LLVector3 pos, LLVector2 scale) +F32 calc_desired_size(LLViewerCamera* camera, LLVector3 pos, LLVector2 scale) { - F32 desired_size = (pos-LLViewerCamera::getInstance()->getOrigin()).magVec(); + F32 desired_size = (pos - camera->getOrigin()).magVec(); desired_size /= 4; return llclamp(desired_size, scale.magVec()*0.5f, PART_SIM_BOX_SIDE*2); } @@ -273,6 +273,7 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt) LLViewerPartSim::checkParticleCount(mParticles.size()); + LLViewerCamera* camera = LLViewerCamera::getInstance(); LLViewerRegion *regionp = getRegion(); S32 end = (S32) mParticles.size(); for (S32 i = 0 ; i < (S32)mParticles.size();) @@ -394,7 +395,7 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt) } else { - F32 desired_size = calc_desired_size(part->mPosAgent, part->mScale); + F32 desired_size = calc_desired_size(camera, part->mPosAgent, part->mScale); if (!posInGroup(part->mPosAgent, desired_size)) { // Transfer particles between groups @@ -557,7 +558,8 @@ LLViewerPartGroup *LLViewerPartSim::put(LLViewerPart* part) } else { - F32 desired_size = calc_desired_size(part->mPosAgent, part->mScale); + LLViewerCamera* camera = LLViewerCamera::getInstance(); + F32 desired_size = calc_desired_size(camera, part->mPosAgent, part->mScale); S32 count = (S32) mViewerPartGroups.size(); for (S32 i = 0; i < count; i++) diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp index e777d7362f..4794cab32e 100644 --- a/indra/newview/llvoicevisualizer.cpp +++ b/indra/newview/llvoicevisualizer.cpp @@ -369,8 +369,9 @@ void LLVoiceVisualizer::render() //------------------------------------------------------------- // create coordinates of the geometry for the dot //------------------------------------------------------------- - LLVector3 l = LLViewerCamera::getInstance()->getLeftAxis() * DOT_SIZE; - LLVector3 u = LLViewerCamera::getInstance()->getUpAxis() * DOT_SIZE; + LLViewerCamera* camera = LLViewerCamera::getInstance(); + LLVector3 l = camera->getLeftAxis() * DOT_SIZE; + LLVector3 u = camera->getUpAxis() * DOT_SIZE; LLVector3 bottomLeft = mSoundSymbol.mPosition + l - u; LLVector3 bottomRight = mSoundSymbol.mPosition - l - u; @@ -496,8 +497,8 @@ void LLVoiceVisualizer::render() F32 width = i * WAVE_WIDTH_SCALE * mSoundSymbol.mWaveExpansion[i]; F32 height = i * WAVE_HEIGHT_SCALE * mSoundSymbol.mWaveExpansion[i]; - LLVector3 l = LLViewerCamera::getInstance()->getLeftAxis() * width; - LLVector3 u = LLViewerCamera::getInstance()->getUpAxis() * height; + LLVector3 l = camera->getLeftAxis() * width; + LLVector3 u = camera->getUpAxis() * height; LLVector3 bottomLeft = mSoundSymbol.mPosition + l - u; LLVector3 bottomRight = mSoundSymbol.mPosition - l - u; diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 9dd0b598dc..139d2fbd88 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -386,6 +386,7 @@ void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_co mFaceList.clear(); + LLViewerCamera* camera = LLViewerCamera::getInstance(); for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) { LLDrawable* drawablep = *i; @@ -415,7 +416,7 @@ void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_co } count++; - facep->mDistance = (facep->mCenterLocal - LLViewerCamera::getInstance()->getOrigin()) * LLViewerCamera::getInstance()->getAtAxis(); + facep->mDistance = (facep->mCenterLocal - camera->getOrigin()) * camera->getAtAxis(); obj->mDepth += facep->mDistance; mFaceList.push_back(facep); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 48bd387022..1ee0811ba6 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -622,6 +622,7 @@ void LLVOVolume::updateTextureVirtualSize() const S32 num_faces = mDrawable->getNumFaces(); F32 min_vsize=999999999.f, max_vsize=0.f; + LLViewerCamera* camera = LLViewerCamera::getInstance(); for (S32 i = 0; i < num_faces; i++) { LLFace* face = mDrawable->getFace(i); @@ -638,7 +639,7 @@ void LLVOVolume::updateTextureVirtualSize() if (isHUDAttachment()) { - F32 area = (F32) LLViewerCamera::getInstance()->getScreenPixelArea(); + F32 area = (F32) camera->getScreenPixelArea(); vsize = area; imagep->setBoostLevel(LLViewerTexture::BOOST_HUD); face->setPixelArea(area); // treat as full screen @@ -704,9 +705,9 @@ void LLVOVolume::updateTextureVirtualSize() //if the sculpty very close to the view point, load first { - LLVector3 lookAt = getPositionAgent() - LLViewerCamera::getInstance()->getOrigin(); + LLVector3 lookAt = getPositionAgent() - camera->getOrigin(); F32 dist = lookAt.normVec() ; - F32 cos_angle_to_view_dir = lookAt * LLViewerCamera::getInstance()->getXAxis() ; + F32 cos_angle_to_view_dir = lookAt * camera->getXAxis() ; mSculptTexture->setAdditionalDecodePriority(0.8f * LLFace::calcImportanceToCamera(cos_angle_to_view_dir, dist)) ; } } @@ -741,7 +742,7 @@ void LLVOVolume::updateTextureVirtualSize() F32 rad = getLightRadius(); mLightTexture->addTextureStats(gPipeline.calcPixelArea(getPositionAgent(), LLVector3(rad,rad,rad), - *LLViewerCamera::getInstance())); + *camera)); } } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f908a015df..21b297c4ee 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -3768,9 +3768,10 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects, BOOL render gGL.setColorMask(true, false); gPipeline.resetDrawOrders(); + LLViewerCamera* camera = LLViewerCamera::getInstance(); for (std::set<LLViewerObject*>::iterator iter = objects.begin(); iter != objects.end(); ++iter) { - stateSort((*iter)->mDrawable, *LLViewerCamera::getInstance()); + stateSort((*iter)->mDrawable, *camera); } LLMemType mt(LLMemType::MTYPE_PIPELINE_RENDER_SELECT); @@ -6248,6 +6249,7 @@ void LLPipeline::renderDeferredLighting() { LLFastTimer ftm(FTM_RENDER_DEFERRED); + LLViewerCamera* camera = LLViewerCamera::getInstance(); { LLGLDepthTest depth(GL_TRUE); mDeferredDepth.copyContents(mDeferredScreen, 0, 0, mDeferredScreen.getWidth(), mDeferredScreen.getHeight(), @@ -6641,7 +6643,7 @@ void LLPipeline::renderDeferredLighting() continue; } - if (LLViewerCamera::getInstance()->AABBInFrustumNoFarClip(center, LLVector3(s,s,s)) == 0) + if (camera->AABBInFrustumNoFarClip(center, LLVector3(s,s,s)) == 0) { continue; } @@ -6665,12 +6667,12 @@ void LLPipeline::renderDeferredLighting() v[18] = c[0]+s; v[19] = c[1]+s; v[20] = c[2]-s; // 6 - 0110 v[21] = c[0]+s; v[22] = c[1]+s; v[23] = c[2]+s; // 7 - 0111 - if (LLViewerCamera::getInstance()->getOrigin().mV[0] > c[0] + s + 0.2f || - LLViewerCamera::getInstance()->getOrigin().mV[0] < c[0] - s - 0.2f || - LLViewerCamera::getInstance()->getOrigin().mV[1] > c[1] + s + 0.2f || - LLViewerCamera::getInstance()->getOrigin().mV[1] < c[1] - s - 0.2f || - LLViewerCamera::getInstance()->getOrigin().mV[2] > c[2] + s + 0.2f || - LLViewerCamera::getInstance()->getOrigin().mV[2] < c[2] - s - 0.2f) + if (camera->getOrigin().mV[0] > c[0] + s + 0.2f || + camera->getOrigin().mV[0] < c[0] - s - 0.2f || + camera->getOrigin().mV[1] > c[1] + s + 0.2f || + camera->getOrigin().mV[1] < c[1] - s - 0.2f || + camera->getOrigin().mV[2] > c[2] + s + 0.2f || + camera->getOrigin().mV[2] < c[2] - s - 0.2f) { //draw box if camera is outside box if (render_local) { @@ -6685,7 +6687,7 @@ void LLPipeline::renderDeferredLighting() glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, - GL_UNSIGNED_BYTE, get_box_fan_indices(LLViewerCamera::getInstance(), center)); + GL_UNSIGNED_BYTE, get_box_fan_indices(camera, center)); stop_glerror(); } } @@ -6750,7 +6752,7 @@ void LLPipeline::renderDeferredLighting() glTexCoord4f(tc.v[0], tc.v[1], tc.v[2], s*s); glColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, - GL_UNSIGNED_BYTE, get_box_fan_indices(LLViewerCamera::getInstance(), center)); + GL_UNSIGNED_BYTE, get_box_fan_indices(camera, center)); } gDeferredSpotLightProgram.disableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); unbindDeferredShader(gDeferredSpotLightProgram); @@ -8684,7 +8686,8 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) sShadowRender = TRUE; sImpostorRender = TRUE; - markVisible(avatar->mDrawable, *LLViewerCamera::getInstance()); + LLViewerCamera* viewer_camera = LLViewerCamera::getInstance(); + markVisible(avatar->mDrawable, *viewer_camera); LLVOAvatar::sUseImpostors = FALSE; LLVOAvatar::attachment_map_t::iterator iter; @@ -8699,7 +8702,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) { if (LLViewerObject* attached_object = (*attachment_iter)) { - markVisible(attached_object->mDrawable->getSpatialBridge(), *LLViewerCamera::getInstance()); + markVisible(attached_object->mDrawable->getSpatialBridge(), *viewer_camera); } } } @@ -8709,9 +8712,9 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) const LLVector3* ext = avatar->mDrawable->getSpatialExtents(); LLVector3 pos(avatar->getRenderPosition()+avatar->getImpostorOffset()); - LLCamera camera = *LLViewerCamera::getInstance(); + LLCamera camera = *viewer_camera; - camera.lookAt(LLViewerCamera::getInstance()->getOrigin(), pos, LLViewerCamera::getInstance()->getUpAxis()); + camera.lookAt(viewer_camera->getOrigin(), pos, viewer_camera->getUpAxis()); LLVector2 tdim; @@ -8754,7 +8757,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) glClearStencil(0); // get the number of pixels per angle - F32 pa = gViewerWindow->getWindowHeightRaw() / (RAD_TO_DEG * LLViewerCamera::getInstance()->getView()); + F32 pa = gViewerWindow->getWindowHeightRaw() / (RAD_TO_DEG * viewer_camera->getView()); //get resolution based on angle width and height of impostor (double desired resolution to prevent aliasing) U32 resY = llmin(nhpo2((U32) (fov*pa)), (U32) 512); |