diff --git a/code/ryzom/client/src/cursor_functions.cpp b/code/ryzom/client/src/cursor_functions.cpp index ef9c5fcb3..64df4e5d2 100644 --- a/code/ryzom/client/src/cursor_functions.cpp +++ b/code/ryzom/client/src/cursor_functions.cpp @@ -244,7 +244,7 @@ void checkUnderCursor() return; // No Op if screen minimized - if(IM->getViewRenderer().isMinimized()) + if(CViewRenderer::getInstance()->isMinimized()) return; // Get the pointer position (in pixel) @@ -258,7 +258,7 @@ void checkUnderCursor() if(x < 0 || y <0) return; uint32 w, h; - CViewRenderer &viewRender = IM->getViewRenderer(); + CViewRenderer &viewRender = *CViewRenderer::getInstance(); viewRender.getScreenSize(w, h); if(x>=(sint32)w || y>=(sint32)h) return; diff --git a/code/ryzom/client/src/decal.cpp b/code/ryzom/client/src/decal.cpp index 6d7020bcb..753850c55 100644 --- a/code/ryzom/client/src/decal.cpp +++ b/code/ryzom/client/src/decal.cpp @@ -190,7 +190,7 @@ void CDecal::setTexture(const std::string &fileName, bool clampU, bool clamp if (getTextureFileName() != fileName) { CInterfaceManager *im = CInterfaceManager::getInstance(); - CViewRenderer &vr = im->getViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); UTexture *tex = vr.getGlobalTexture(fileName); if (tex != NULL) { diff --git a/code/ryzom/client/src/interface_v3/action_handler_help.cpp b/code/ryzom/client/src/interface_v3/action_handler_help.cpp index 6a93a9da3..7812df510 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -464,7 +464,7 @@ void CInterfaceHelp::resetWindowPos(sint y) sint maxHelpWindow= (sint)_InfoWindows.size(); uint32 w, h; - pIM->getViewRenderer().getScreenSize(w,h); + CViewRenderer::getInstance()->getScreenSize(w,h); // For all windows, reset pos for(uint i=0;i<(uint)maxHelpWindow;i++) @@ -3978,7 +3978,7 @@ public: virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) { #ifdef NL_OS_WINDOWS - NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver(); if (Driver) { HWND wnd = (HWND) Driver->getDisplay(); diff --git a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp index 050ac1cd1..082669574 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -520,7 +520,7 @@ CCameraBackup setupCameraForScreenshot(UScene &scene, uint left, uint right, uin // Build a viewport CViewport viewport; - NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver(); viewport.init (0, 0, (float)(right-left)/Driver->getWindowWidth(),(float)(bottom-top)/Driver->getWindowHeight()); // Activate all this @@ -553,7 +553,7 @@ void renderSceneScreenShot (uint left, uint right, uint top, uint bottom, uint s void getBuffer (CBitmap &btm) { - NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver(); // if (ClientCfg.ScreenShotWidth && ClientCfg.ScreenShotHeight) { @@ -613,7 +613,7 @@ bool screenshotZBuffer(const std::string &filename) std::string ext = filename.substr(pos+1); std::vector z; - NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver(); Driver->getZBuffer(z); diff --git a/code/ryzom/client/src/interface_v3/ctrl_button.cpp b/code/ryzom/client/src/interface_v3/ctrl_button.cpp index cbccfc131..001f83c2b 100644 --- a/code/ryzom/client/src/interface_v3/ctrl_button.cpp +++ b/code/ryzom/client/src/interface_v3/ctrl_button.cpp @@ -107,7 +107,7 @@ void CCtrlButton::draw () CRGBA color; CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); CRGBA globalColor= pIM->getGlobalColorForContent(); // *** Detect Over @@ -204,7 +204,7 @@ void CCtrlButton::draw () if (!_Scale) { - pIM->getViewRenderer().getTextureSizeFromId (nTxId, txw, txh); + CViewRenderer::getInstance()->getTextureSizeFromId (nTxId, txw, txh); if (_Align&1) x = x + _WReal - txw; if (_Align&2) @@ -249,7 +249,7 @@ void CCtrlButton::updateCoords() if (!_Scale) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 txw, txh; rVR.getTextureSizeFromId (_TextureIdNormal, txw, txh); _W = txw; @@ -262,7 +262,7 @@ void CCtrlButton::updateCoords() void CCtrlButton::setTexture(const std::string&name) { // CInterfaceManager *pIM = CInterfaceManager::getInstance(); -// CViewRenderer &rVR = pIM->getViewRenderer(); +// CViewRenderer &rVR = *CViewRenderer::getInstance(); _TextureIdNormal.setTexture(name.c_str()); } @@ -270,7 +270,7 @@ void CCtrlButton::setTexture(const std::string&name) void CCtrlButton::setTexturePushed(const std::string&name) { // CInterfaceManager *pIM = CInterfaceManager::getInstance(); -// CViewRenderer &rVR = pIM->getViewRenderer(); +// CViewRenderer &rVR = *CViewRenderer::getInstance(); _TextureIdPushed.setTexture(name.c_str()); } @@ -278,7 +278,7 @@ void CCtrlButton::setTexturePushed(const std::string&name) void CCtrlButton::setTextureOver(const std::string&name) { // CInterfaceManager *pIM = CInterfaceManager::getInstance(); -// CViewRenderer &rVR = pIM->getViewRenderer(); +// CViewRenderer &rVR = *CViewRenderer::getInstance(); _TextureIdOver.setTexture(name.c_str()); } @@ -286,7 +286,7 @@ void CCtrlButton::setTextureOver(const std::string&name) std::string CCtrlButton::getTexture() const { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); return rVR.getTextureNameFromId(_TextureIdNormal); } @@ -294,7 +294,7 @@ std::string CCtrlButton::getTexture() const std::string CCtrlButton::getTexturePushed() const { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); return rVR.getTextureNameFromId(_TextureIdPushed); } @@ -302,7 +302,7 @@ std::string CCtrlButton::getTexturePushed() const std::string CCtrlButton::getTextureOver() const { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); return rVR.getTextureNameFromId(_TextureIdOver); } @@ -311,7 +311,7 @@ sint32 CCtrlButton::getMaxUsedW() const { sint32 txw, txh; CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); rVR.getTextureSizeFromId (_TextureIdNormal, txw, txh); return txw; } @@ -326,7 +326,7 @@ sint32 CCtrlButton::getMinUsedW() const void CCtrlButton::fitTexture() { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 w, h; rVR.getTextureSizeFromId(_TextureIdNormal, w, h); setW(w); diff --git a/code/ryzom/client/src/interface_v3/ctrl_col_pick.cpp b/code/ryzom/client/src/interface_v3/ctrl_col_pick.cpp index 6e38caf46..d158b0280 100644 --- a/code/ryzom/client/src/interface_v3/ctrl_col_pick.cpp +++ b/code/ryzom/client/src/interface_v3/ctrl_col_pick.cpp @@ -41,7 +41,7 @@ CCtrlColPick::~CCtrlColPick() if (_Texture>=0) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); rVR.deleteTexture (_Texture); } } @@ -56,7 +56,7 @@ bool CCtrlColPick::parse(xmlNodePtr node, CInterfaceGroup * parentGroup) // Read textures prop = (char*) xmlGetProp( node, (xmlChar*)"texture" ); CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); if(prop) { string sTmp = NLMISC::strlwr((const char*)prop); @@ -84,7 +84,7 @@ bool CCtrlColPick::parse(xmlNodePtr node, CInterfaceGroup * parentGroup) void CCtrlColPick::updateCoords() { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 txw, txh; rVR.getTextureSizeFromId (_Texture, txw, txh); _W = txw; @@ -96,7 +96,7 @@ void CCtrlColPick::updateCoords() void CCtrlColPick::draw() { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); CRGBA col = CRGBA(255,255,255,(uint8)pIM->getGlobalColor().A); @@ -194,7 +194,7 @@ void CCtrlColPick::selectColor (sint32 x, sint32 y) CRGBA CCtrlColPick::getColor (sint32 x, sint32 y) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); if (x < 0) x = 0; if (y < 0) y = 0; diff --git a/code/ryzom/client/src/interface_v3/ctrl_polygon.cpp b/code/ryzom/client/src/interface_v3/ctrl_polygon.cpp index 9bcc2411f..08d1fb691 100644 --- a/code/ryzom/client/src/interface_v3/ctrl_polygon.cpp +++ b/code/ryzom/client/src/interface_v3/ctrl_polygon.cpp @@ -149,7 +149,7 @@ void CCtrlPolygon::draw() if (_Tris.empty()) return; if (!_Parent) return; CInterfaceManager *im = CInterfaceManager::getInstance(); - CViewRenderer &vr = im->getViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); if (_Touched) { _RealTris.clear(); diff --git a/code/ryzom/client/src/interface_v3/ctrl_quad.cpp b/code/ryzom/client/src/interface_v3/ctrl_quad.cpp index e517342bf..75886ef82 100644 --- a/code/ryzom/client/src/interface_v3/ctrl_quad.cpp +++ b/code/ryzom/client/src/interface_v3/ctrl_quad.cpp @@ -61,7 +61,7 @@ void CCtrlQuad::draw() H_AUTO(Rz_CCtrlQuad_draw) nlassert(_Parent); CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); CRGBA col; if(getModulateGlobalColor()) @@ -297,7 +297,7 @@ void CCtrlQuad::setTexture(const std::string &texName) { H_AUTO(Rz_CCtrlQuad_setTexture) // CInterfaceManager *pIM = CInterfaceManager::getInstance(); -// CViewRenderer &rVR = pIM->getViewRenderer(); +// CViewRenderer &rVR = *CViewRenderer::getInstance(); _TextureId.setTexture(texName.c_str()); } @@ -306,7 +306,7 @@ std::string CCtrlQuad::getTexture() const { H_AUTO(Rz_CCtrlQuad_getTexture) CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); return rVR.getTextureNameFromId (_TextureId); } @@ -357,7 +357,7 @@ void CCtrlQuad::setQuad(const std::string &texName, const NLMISC::CVector &srcPo H_AUTO(Rz_CCtrlQuad_setQuad) NLMISC::CVector pos = srcPos; CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 w, h; rVR.getTextureSizeFromId(rVR.getTextureIdFromName(texName), w, h); if (angle == 0.f) diff --git a/code/ryzom/client/src/interface_v3/ctrl_scroll.cpp b/code/ryzom/client/src/interface_v3/ctrl_scroll.cpp index 59c5ca636..d433b2a07 100644 --- a/code/ryzom/client/src/interface_v3/ctrl_scroll.cpp +++ b/code/ryzom/client/src/interface_v3/ctrl_scroll.cpp @@ -227,7 +227,7 @@ void CCtrlScroll::updateCoords() if (_Target->getActive()) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 w, h; rVR.getTextureSizeFromId (_TxIdB, w, h); @@ -410,7 +410,7 @@ void CCtrlScroll::updateCoords() void CCtrlScroll::draw() { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); CRGBA col = pIM->getGlobalColorForContent(); if (_Target) @@ -694,7 +694,7 @@ sint32 CCtrlScroll::moveTrackY (sint32 dy) void CCtrlScroll::setTextureBottomOrLeft (const std::string &txName) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); _TxIdB = rVR.getTextureIdFromName(txName); } @@ -702,7 +702,7 @@ void CCtrlScroll::setTextureBottomOrLeft (const std::string &txName) void CCtrlScroll::setTextureMiddle (const std::string &txName) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); _TxIdM = rVR.getTextureIdFromName(txName); } @@ -710,7 +710,7 @@ void CCtrlScroll::setTextureMiddle (const std::string &txName) void CCtrlScroll::setTextureTopOrRight (const std::string &txName) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); _TxIdT = rVR.getTextureIdFromName(txName); } diff --git a/code/ryzom/client/src/interface_v3/ctrl_sheet_selection.cpp b/code/ryzom/client/src/interface_v3/ctrl_sheet_selection.cpp index 7f7dee1d7..f4c9b5f9f 100644 --- a/code/ryzom/client/src/interface_v3/ctrl_sheet_selection.cpp +++ b/code/ryzom/client/src/interface_v3/ctrl_sheet_selection.cpp @@ -24,7 +24,7 @@ void CSheetSelectionGroup::setTexture(const std::string &texName) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); _TextureIndex = rVR.getTextureIdFromName(texName); rVR.getTextureSizeFromId(_TextureIndex, _TextureWidth, _TextureHeight); } diff --git a/code/ryzom/client/src/interface_v3/ctrl_text_button.cpp b/code/ryzom/client/src/interface_v3/ctrl_text_button.cpp index ad791b5c1..faa74d213 100644 --- a/code/ryzom/client/src/interface_v3/ctrl_text_button.cpp +++ b/code/ryzom/client/src/interface_v3/ctrl_text_button.cpp @@ -70,7 +70,7 @@ bool CCtrlTextButton::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) { CXMLAutoPtr prop; CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); //try to get props that can be inherited from groups //if a property is not defined, try to find it in the parent group. @@ -273,7 +273,7 @@ void CCtrlTextButton::draw () CRGBA color; CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); CRGBA globalColor= pIM->getGlobalColorForContent(); // *** Detect Over diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index d00d0ba77..b4af18ea7 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -318,7 +318,7 @@ CCtrlSheetInfo::CCtrlSheetInfo() void CDBCtrlSheet::release () { - NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver(); if (Driver) Driver->deleteMaterial(_GuildMat); @@ -367,7 +367,7 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr { string TxName = (const char *) prop; TxName = strlwr (TxName); - CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); _DispNoSheetBmpId = rVR.getTextureIdFromName (TxName); } @@ -558,7 +558,7 @@ CDBCtrlSheet::CDBCtrlSheet(const TCtorParam ¶m) // ---------------------------------------------------------------------------- CDBCtrlSheet::~CDBCtrlSheet() { - NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver(); if (_GuildBack) { @@ -656,7 +656,7 @@ void CDBCtrlSheet::initSheet(const std::string &dbBranchId, const CCtrlSheetInfo // get over for spell CInterfaceManager *pIM = CInterfaceManager::getInstance(); - _TextureIdOver = pIM->getViewRenderer().getTextureIdFromName ("w_slot_spell_over.tga"); + _TextureIdOver = CViewRenderer::getInstance()->getTextureIdFromName ("w_slot_spell_over.tga"); } // Init size. @@ -682,7 +682,7 @@ void CDBCtrlSheet::initSheetFast( const std::string &dbParentBranchId, int sheet // get over for spell CInterfaceManager *pIM = CInterfaceManager::getInstance(); - _TextureIdOver = pIM->getViewRenderer().getTextureIdFromName ("w_slot_spell_over.tga"); + _TextureIdOver = CViewRenderer::getInstance()->getTextureIdFromName ("w_slot_spell_over.tga"); } // Init size. @@ -944,7 +944,7 @@ uint CDBCtrlSheet::getInventorySlot( const string &dbBranchId ) void CDBCtrlSheet::initSheetSize() { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); // If the user type is auto, then select always item slot. if(_Type==SheetType_Auto) { @@ -1030,7 +1030,7 @@ void CDBCtrlSheet::updateCoords () void CDBCtrlSheet::updateIconSize() { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); if (_DispSheetBmpId != -1) { rVR.getTextureSizeFromId(_DispSheetBmpId, _IconW, _IconH); @@ -1062,7 +1062,7 @@ void CDBCtrlSheet::setupPact() if (_LastSheetId != sheet || _NeedSetup) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); _LastSheetId = sheet; CSheetId sheetId(sheet); @@ -1105,7 +1105,7 @@ void CDBCtrlSheet::setupItem () // If this is the same sheet, need to resetup if (_LastSheetId != sheet || _NeedSetup) { - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); _NeedSetup= false; _LastSheetId = sheet; @@ -1324,7 +1324,7 @@ void CDBCtrlSheet::setupMission() CMissionIconSheet *pMIS = (CMissionIconSheet*)pES; CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); _DispBackBmpId = rVR.getTextureIdFromName(pMIS->MainIconBg); _DispSheetBmpId = rVR.getTextureIdFromName(pMIS->MainIconFg); @@ -1375,7 +1375,7 @@ void CDBCtrlSheet::setupGuildFlag () sint8 nLastGuildBack = (sint8)(_MacroID&15); // 4 bits en pos 0 sint8 nLastGuildSymbol = (sint8)((_MacroID>>4)&63); // 6 bits en pos 4 - NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver(); if (_GuildMat.empty()) { @@ -1454,7 +1454,7 @@ void CDBCtrlSheet::setupDisplayAsSBrick(sint32 sheet, sint32 optSheet) { // Setup with the param sheet CSBrickManager *pBM = CSBrickManager::getInstance(); - CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); CSBrickSheet *pBR = pBM->getBrick (CSheetId(sheet)); CSBrickSheet *pBROpt = pBM->getBrick (CSheetId(optSheet)); @@ -1662,7 +1662,7 @@ void CDBCtrlSheet::setupOutpostBuilding() // If this is the same sheet, need to resetup if (_LastSheetId != sheet || _NeedSetup) { - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); _NeedSetup= false; _LastSheetId = sheet; @@ -1747,7 +1747,7 @@ void CDBCtrlSheet::setupCharBitmaps(sint32 maxW, sint32 maxLine, sint32 maxWChar // Use the optString for the Macro name _OptString = strlwr(_OptString); CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); _CharBitmaps.clear(); @@ -1804,7 +1804,7 @@ void CDBCtrlSheet::setupCharBitmaps(sint32 maxW, sint32 maxLine, sint32 maxWChar void CDBCtrlSheet::displayCharBitmaps(sint32 rdrLayer, sint32 x, sint32 y, CRGBA color) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); for (uint i = 0; i < _CharBitmaps.size(); ++i) { @@ -1820,7 +1820,7 @@ void CDBCtrlSheet::draw() H_AUTO( RZ_Interface_CDBCtrlSheet_draw ) CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); CRGBA color = CRGBA(255,255,255,255); if (_Type != SheetType_Macro) @@ -2091,7 +2091,7 @@ static inline CRGBA fastMulRGB(CRGBA sheetColor, CRGBA iconColor) void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelectionBorder /*= true*/) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); // The sheet is the slot-2 sint32 wSheet= _WReal-2; sint32 hSheet= _HReal-2; @@ -2548,7 +2548,7 @@ void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelecti sint32 CDBCtrlSheet::drawNumber(sint32 x, sint32 y, sint32 wSheet, sint32 /* hSheet */, CRGBA color, sint32 value, bool rightAlign) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 wDigit= rVR.getFigurTextureW(); sint32 hDigit= rVR.getFigurTextureH(); @@ -3927,7 +3927,7 @@ void CDBCtrlSheet::setInvertGuildSymbol(bool b) void CDBCtrlSheet::setSlot(const std::string &textureName) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); _DispSlotBmpId = rVR.getTextureIdFromName (textureName); rVR.getTextureSizeFromId (_DispSlotBmpId, _W, _H); _DrawSlot = true; @@ -4262,7 +4262,7 @@ void CDBCtrlSheet::updateArmourColor(sint8 col) if(_ArmourColorIndex>=0 && _ArmourColorIndex<=7) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); - CViewRenderer &rVR= pIM->getViewRenderer(); + CViewRenderer &rVR= *CViewRenderer::getInstance(); // if the BMP have not been correctly setuped if(!_ArmourColorBmpOk) diff --git a/code/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp b/code/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp index e3b2fb407..d6ee00ef1 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp @@ -94,7 +94,7 @@ bool CDBGroupBuildPhrase::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) CInterfaceManager *pIM= CInterfaceManager::getInstance(); // Init the disabled texture id - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); _TextureIdSlotDisabled= rVR.getTextureIdFromName ("w_slot_brick_disabled.tga"); // Create now (before sons ctrl sheet parsing) the variables diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp index dc6a9dd91..eb539384c 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp @@ -141,7 +141,7 @@ bool CDBGroupListSheet::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) } // get item size. - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 dispSlotBmpId = 0; switch(_CtrlInfo._Type) { diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_bonus_malus.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_bonus_malus.cpp index 0b5d1f985..0130aa703 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_bonus_malus.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_bonus_malus.cpp @@ -56,7 +56,7 @@ bool CDBGroupListSheetBonusMalus::parse (xmlNodePtr cur, CInterfaceGroup *parent if (prop) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); _TextId= rVR.getTextureIdFromName ((const char *)prop); } @@ -86,7 +86,7 @@ void CDBGroupListSheetBonusMalus::draw () CDBGroupListSheet::draw(); // CInterfaceManager *pIM= CInterfaceManager::getInstance(); -// CViewRenderer &rVR= pIM->getViewRenderer(); +// CViewRenderer &rVR= *CViewRenderer::getInstance(); // sint32 drl= getRenderLayer()+1; diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp index 2dcea9d7a..d3f2e75b7 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp @@ -125,7 +125,7 @@ bool CDBGroupListSheetText::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) } // get item size. - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 dispSlotBmpId = 0; switch(_CtrlInfo._Type) { diff --git a/code/ryzom/client/src/interface_v3/dbview_bar.cpp b/code/ryzom/client/src/interface_v3/dbview_bar.cpp index 6f4bf906d..a9235b435 100644 --- a/code/ryzom/client/src/interface_v3/dbview_bar.cpp +++ b/code/ryzom/client/src/interface_v3/dbview_bar.cpp @@ -120,7 +120,7 @@ void CDBViewBar::setType (TViewBar vb) // Get the Height Size. CInterfaceManager *pIM= CInterfaceManager::getInstance(); sint32 wBar; - pIM->getViewRenderer().getTextureSizeFromId(_TextureId, wBar, _HBar); + CViewRenderer::getInstance()->getTextureSizeFromId(_TextureId, wBar, _HBar); } // ---------------------------------------------------------------------------- @@ -180,7 +180,7 @@ void CDBViewBar::draw () _Slot.draw(); CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); color.A = (uint8)(((sint32)color.A*((sint32)pIM->getGlobalColorForContent().A+1))>>8); diff --git a/code/ryzom/client/src/interface_v3/dbview_bar3.cpp b/code/ryzom/client/src/interface_v3/dbview_bar3.cpp index 490952fb9..73f261dde 100644 --- a/code/ryzom/client/src/interface_v3/dbview_bar3.cpp +++ b/code/ryzom/client/src/interface_v3/dbview_bar3.cpp @@ -141,7 +141,7 @@ void CDBViewBar3::updateCoords () // get the height of the texture sint32 dummy; - CInterfaceManager::getInstance()->getViewRenderer().getTextureSizeFromId(_TextureId, dummy, _BarH); + CViewRenderer::getInstance()->getTextureSizeFromId(_TextureId, dummy, _BarH); CViewBitmap::updateCoords(); } @@ -162,7 +162,7 @@ void CDBViewBar3::draw () _Slot.draw(); CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); CRGBA gColor = pIM->getGlobalColorForContent(); if (_Mini) diff --git a/code/ryzom/client/src/interface_v3/dbview_digit.cpp b/code/ryzom/client/src/interface_v3/dbview_digit.cpp index 86e79783d..683662fef 100644 --- a/code/ryzom/client/src/interface_v3/dbview_digit.cpp +++ b/code/ryzom/client/src/interface_v3/dbview_digit.cpp @@ -45,7 +45,7 @@ bool CDBViewDigit::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) return false; CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); // link to the db CXMLAutoPtr ptr; @@ -103,7 +103,7 @@ void CDBViewDigit::updateCoords() void CDBViewDigit::draw () { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 wDigit= rVR.getFigurTextureW(); sint32 hDigit= rVR.getFigurTextureH(); diff --git a/code/ryzom/client/src/interface_v3/group_container.cpp b/code/ryzom/client/src/interface_v3/group_container.cpp index bc442c0f4..f5519bcd5 100644 --- a/code/ryzom/client/src/interface_v3/group_container.cpp +++ b/code/ryzom/client/src/interface_v3/group_container.cpp @@ -61,7 +61,7 @@ bool CGroupContainer::_ValidateCanDeactivate = true; #ifdef DRAW_GC_TEST_QUADS static void drawGCTestQuad(sint renderLayer, sint32 xreal, sint32 yreal, sint32 wreal, sint32 hreal, CRGBA color) { - CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); if(rVR.isMinimized()) return; sint32 x, y, w, h; @@ -348,7 +348,7 @@ sint32 CCtrlResizer::resizeW (sint32 dx) NLMISC::clamp(clippedNewW, WMin, WMax); // clip by screen uint32 sw, sh; - CViewRenderer &vr = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); vr.getScreenSize(sw, sh); if (_Parent->getPosRef() & Hotspot_xR) { @@ -405,7 +405,7 @@ sint32 CCtrlResizer::resizeH (sint32 dy) // clip by screen uint32 sw, sh; - CViewRenderer &vr = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); vr.getScreenSize(sw, sh); if (_Parent->getPosRef() & Hotspot_Tx) { @@ -483,7 +483,7 @@ void CCtrlMover::draw () // No Op if window is minimized CInterfaceManager *pIM= CInterfaceManager::getInstance(); - if(pIM->getViewRenderer().isMinimized()) + if(CViewRenderer::getInstance()->isMinimized()) return; // draw insertion position if moving in parent list @@ -491,14 +491,14 @@ void CCtrlMover::draw () { COptionsContainerInsertion *options = getInsertionOptions(); if (!options) return; - CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 oldSciX, oldSciY, oldSciW, oldSciH; rVR.getClipWindow (oldSciX, oldSciY, oldSciW, oldSciH); uint32 sw, sh; rVR.getScreenSize(sw, sh); rVR.setClipWindow (0, 0, (sint32) sw, (sint32) sh); CInterfaceManager *im = CInterfaceManager::getInstance(); - CViewRenderer &vr = im->getViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); // CGroupContainer *gc = dynamic_cast(_Parent); if (!gc) return; @@ -807,7 +807,7 @@ bool CCtrlMover::handleEvent (const NLGUI::CEventDescriptor &event) { // clip, in real coords space uint32 wScreen, hScreen; - pIM->getViewRenderer().getScreenSize(wScreen, hScreen); + CViewRenderer::getInstance()->getScreenSize(wScreen, hScreen); x+= _MoveDeltaXReal; y+= _MoveDeltaYReal; @@ -1067,7 +1067,7 @@ void CCtrlMover::setPoped(CGroupContainer *gc, sint32 x, sint32 y, CInterfaceMan sint32 newX = gc->getXReal() + deltaX; sint32 newY = gc->getYReal() + deltaY; uint32 wScreen, hScreen; - pIM->getViewRenderer().getScreenSize(wScreen, hScreen); + CViewRenderer::getInstance()->getScreenSize(wScreen, hScreen); clamp(newX, 0, (sint32)wScreen - gc->getWReal()); clamp(newY, 0, (sint32)hScreen - gc->getHReal()); // move window @@ -1516,7 +1516,7 @@ void CGroupContainer::updateCoords() { // Clip by screen uint32 sw, sh; - CViewRenderer &vr = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); vr.getScreenSize(sw, sh); // ensure the maxH is > minH and < sh (prioritary > minH, in case of shgetViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); vr.getScreenSize(sw, sh); if((sint32)sw>_PopupMinW && _W>(sint32)sw) _W= sw; if((sint32)sh>_PopupMinH && _H>(sint32)sh) _H= sh; @@ -1725,7 +1725,7 @@ void CGroupContainer::updateCoords() { // test if must clip uint32 wScreen, hScreen; - CInterfaceManager::getInstance()->getViewRenderer().getScreenSize(wScreen, hScreen); + CViewRenderer::getInstance()->getScreenSize(wScreen, hScreen); if (_WReal <= (sint32) wScreen && _HReal <= (sint32) hScreen) { sint32 newX = _XReal; @@ -1849,7 +1849,7 @@ void CGroupContainer::draw () makeNewClip (oldSciX, oldSciY, oldSciW, oldSciH); // Draw the container - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); CRGBA col = pIM->getGlobalColor(); bool bGrayed = isGrayed(); diff --git a/code/ryzom/client/src/interface_v3/group_editbox.cpp b/code/ryzom/client/src/interface_v3/group_editbox.cpp index ea5811b9b..0615a6428 100644 --- a/code/ryzom/client/src/interface_v3/group_editbox.cpp +++ b/code/ryzom/client/src/interface_v3/group_editbox.cpp @@ -109,7 +109,7 @@ bool CGroupEditBox::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) return false; CXMLAutoPtr prop; // CInterfaceManager *pIM = CInterfaceManager::getInstance(); -// CViewRenderer &rVR = pIM->getViewRenderer(); +// CViewRenderer &rVR = *CViewRenderer::getInstance(); if (! CInterfaceGroup::parse(cur,parentGroup) ) { @@ -219,7 +219,7 @@ void CGroupEditBox::draw () { // CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); // /*CRGBA col; col.modulateFromColor(CRGBA(64,64,64,255), pIM->getGlobalColorForContent()); @@ -335,7 +335,7 @@ void CGroupEditBox::copy() stopParentBlink(); // get the selection and copy it - if (CInterfaceManager::getInstance()->getViewRenderer().getDriver()->copyTextToClipboard(getSelection())) + if (CViewRenderer::getInstance()->getDriver()->copyTextToClipboard(getSelection())) nlinfo ("Chat input was copied in the clipboard"); } @@ -353,7 +353,7 @@ void CGroupEditBox::paste() ucstring sString; - if (CInterfaceManager::getInstance()->getViewRenderer().getDriver()->pasteTextFromClipboard(sString)) + if (CViewRenderer::getInstance()->getDriver()->pasteTextFromClipboard(sString)) { // append string now appendStringFromClipboard(sString); diff --git a/code/ryzom/client/src/interface_v3/group_frame.cpp b/code/ryzom/client/src/interface_v3/group_frame.cpp index 54b95476e..6b4782dab 100644 --- a/code/ryzom/client/src/interface_v3/group_frame.cpp +++ b/code/ryzom/client/src/interface_v3/group_frame.cpp @@ -72,7 +72,7 @@ bool CGroupFrame::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) // Get the borders texture _DispTypeDefined= false; CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); ptr = (char*) xmlGetProp( cur, (xmlChar*)"options" ); CInterfaceOptions *pIO = NULL; @@ -160,7 +160,7 @@ void CGroupFrame::draw () if (_DisplayFrame) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); // get global color CRGBA col; diff --git a/code/ryzom/client/src/interface_v3/group_html.cpp b/code/ryzom/client/src/interface_v3/group_html.cpp index c566fd477..640ce8def 100644 --- a/code/ryzom/client/src/interface_v3/group_html.cpp +++ b/code/ryzom/client/src/interface_v3/group_html.cpp @@ -2737,7 +2737,7 @@ CCtrlButton *CGroupHTML::addButton(CCtrlButton::EType type, const std::string &/ { // search in the compressed texture CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 id = rVR.getTextureIdFromName(normal); if(id == -1) { @@ -2757,7 +2757,7 @@ CCtrlButton *CGroupHTML::addButton(CCtrlButton::EType type, const std::string &/ { // search in the compressed texture CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 id = rVR.getTextureIdFromName(pushed); if(id == -1) { @@ -3031,7 +3031,7 @@ bool CGroupHTML::lookupLocalFile (string &result, const char *url, bool isUrl) { // Is it a texture in the big texture ? CInterfaceManager *pIM = CInterfaceManager::getInstance(); - if (pIM->getViewRenderer().getTextureIdFromName (result) >= 0) + if (CViewRenderer::getInstance()->getTextureIdFromName (result) >= 0) { return true; } diff --git a/code/ryzom/client/src/interface_v3/group_in_scene.cpp b/code/ryzom/client/src/interface_v3/group_in_scene.cpp index bad4e4236..ba1023f48 100644 --- a/code/ryzom/client/src/interface_v3/group_in_scene.cpp +++ b/code/ryzom/client/src/interface_v3/group_in_scene.cpp @@ -78,7 +78,7 @@ void CGroupInScene::computeWindowPos(sint32 &newX, sint32 &newY, CVector &newPro if(getActive()) { - CViewRenderer &pVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &pVR = *CViewRenderer::getInstance(); nlassert(isValidDouble(Position.x) && isValidDouble(Position.y) && isValidDouble(Position.z)); CVector tmp = MainSceneViewMatrix * Position; if (tmp.y>=0.001) @@ -86,8 +86,8 @@ void CGroupInScene::computeWindowPos(sint32 &newX, sint32 &newY, CVector &newPro tmp = pVR.getFrustum().projectZ (tmp); // Get the width and height - tmp.x *= (float)CInterfaceManager::getInstance()->getViewRenderer().getDriver()->getWindowWidth(); - tmp.y *= (float)CInterfaceManager::getInstance()->getViewRenderer().getDriver()->getWindowHeight(); + tmp.x *= (float)CViewRenderer::getInstance()->getDriver()->getWindowWidth(); + tmp.y *= (float)CViewRenderer::getInstance()->getDriver()->getWindowHeight(); // position without offset, in float newProjCenter.x= tmp.x; @@ -156,7 +156,7 @@ void CGroupInScene::draw() if (_ProjCenter.z > NearDrawClip) { - CViewRenderer &pVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &pVR = *CViewRenderer::getInstance(); // Set the current Z, and projCenter / scale if(_UserScale) diff --git a/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp b/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp index cd7ee194b..b5734ce35 100644 --- a/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp +++ b/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp @@ -667,7 +667,7 @@ CGroupInSceneBubbleManager::CPopupContext *CGroupInSceneBubbleManager::buildCont if (target) { // Find a position - NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver(); const uint width = Driver->getWindowWidth(); const uint height = Driver->getWindowHeight(); h = (target->getXReal() < ((sint)width-target->getXReal()-target->getWReal()))?"l":"r"; diff --git a/code/ryzom/client/src/interface_v3/group_list.cpp b/code/ryzom/client/src/interface_v3/group_list.cpp index c8d45b576..fad80e694 100644 --- a/code/ryzom/client/src/interface_v3/group_list.cpp +++ b/code/ryzom/client/src/interface_v3/group_list.cpp @@ -566,12 +566,12 @@ void CGroupList::updateCoords() void CGroupList::draw () { // TEMP TEMP - //CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + //CViewRenderer &rVR = *CViewRenderer::getInstance(); //rVR.drawRotFlipBitmap _RenderLayer, (_XReal, _YReal, _WReal, _HReal, 0, false, rVR.getBlankTextureId(), CRGBA(0, 255, 0, 255) ); if (_Over) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); if (CWidgetManager::getInstance()->getModalWindow() == NULL) { diff --git a/code/ryzom/client/src/interface_v3/group_map.cpp b/code/ryzom/client/src/interface_v3/group_map.cpp index 20429edb0..125183f5a 100644 --- a/code/ryzom/client/src/interface_v3/group_map.cpp +++ b/code/ryzom/client/src/interface_v3/group_map.cpp @@ -257,7 +257,7 @@ float CGroupMap::getActualMaxScale() const void CGroupMap::CPolyButton::drawPolyButton() { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); float oow, ooh; rVR.getScreenOOSize(oow, ooh); @@ -1470,7 +1470,7 @@ void CGroupMap::draw() sint32 oldSciX, oldSciY, oldSciW, oldSciH; makeNewClip (oldSciX, oldSciY, oldSciW, oldSciH); CInterfaceManager *im = CInterfaceManager::getInstance(); - CViewRenderer &vr = im->getViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); uint8 alpha = im->getGlobalColorForContent().A; updateScale(); diff --git a/code/ryzom/client/src/interface_v3/group_menu.cpp b/code/ryzom/client/src/interface_v3/group_menu.cpp index 7635a5344..2ffd1d95d 100644 --- a/code/ryzom/client/src/interface_v3/group_menu.cpp +++ b/code/ryzom/client/src/interface_v3/group_menu.cpp @@ -208,7 +208,7 @@ void CGroupSubMenu::initOptions(CInterfaceGroup *parent) { _SelectionView = new CViewBitmap(CViewBase::TCtorParam()); // CInterfaceManager *pIM = CInterfaceManager::getInstance(); -// CViewRenderer &rVR = pIM->getViewRenderer(); +// CViewRenderer &rVR = *CViewRenderer::getInstance(); _SelectionView->setParent (this); _SelectionView->setActive (false); _SelectionView->setTexture ("blank.tga"); @@ -437,7 +437,7 @@ void CGroupSubMenu::updateCoords () setY(_GroupMenu->SpawnMouseY); CGroupFrame::updateCoords(); - CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); uint32 screenW, screenH; rVR.getScreenSize(screenW, screenH); if ((_XReal+_WReal) > (sint32)screenW) @@ -458,7 +458,7 @@ void CGroupSubMenu::updateCoords () CGroupFrame::updateCoords(); // get screen size - CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); uint32 screenW, screenH; rVR.getScreenSize(screenW, screenH); @@ -673,7 +673,7 @@ void CGroupSubMenu::updateCoords () _SubMenus[RALineNb]->setParentPos (this); // According to mouse position, set the sub menu on the left or right, begin at top or bottom - CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); uint32 screenW, screenH; rVR.getScreenSize(screenW, screenH); if ((_GroupMenu->SpawnMouseX <= ((sint32)screenW/2)) && (_GroupMenu->SpawnMouseY <= ((sint32)screenH/2))) @@ -875,7 +875,7 @@ void CGroupSubMenu::checkCoords() (yMouse <= (_YReal+ _HReal)))) _Selected= -1; -// CViewRenderer &rVR = pIM->getViewRenderer(); +// CViewRenderer &rVR = *CViewRenderer::getInstance(); // Highlight (background under the selection) if (_Selected != -1) @@ -2060,7 +2060,7 @@ void CGroupMenu::recurseDraw(CGroupSubMenu *pSubMenu) if (pGSM != NULL) { recurseDraw(pGSM); - CInterfaceManager::getInstance()->getViewRenderer().flush(); + CViewRenderer::getInstance()->flush(); } } } @@ -2071,7 +2071,7 @@ void CGroupMenu::draw () if (!_Active) return; // TEMP TEMP - //CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + //CViewRenderer &rVR = *CViewRenderer::getInstance(); //rVR.drawRotFlipBitmap _RenderLayer, (_XReal, _YReal, _WReal, _HReal, 0, false, rVR.getBlankTextureId(), CRGBA(255, 0, 0, 255) ); _RootMenu->_Active = true; @@ -2105,7 +2105,7 @@ void CGroupMenu::setActive (bool state) { if (SpawnOnMousePos) { - CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); uint32 w,h; rVR.getScreenSize(w,h); setW(w); diff --git a/code/ryzom/client/src/interface_v3/group_modal.cpp b/code/ryzom/client/src/interface_v3/group_modal.cpp index bbd6a8015..78aad5ed4 100644 --- a/code/ryzom/client/src/interface_v3/group_modal.cpp +++ b/code/ryzom/client/src/interface_v3/group_modal.cpp @@ -100,7 +100,7 @@ void CGroupModal::updateCoords () if(SpawnOnMousePos) { // Special for menu for instance: If the size is bigger or equal to the screen, keep 0, because will be clipped just after - CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); uint32 w,h; rVR.getScreenSize(w,h); if(_W>=(sint32)w && _H>=(sint32)h) diff --git a/code/ryzom/client/src/interface_v3/group_paragraph.cpp b/code/ryzom/client/src/interface_v3/group_paragraph.cpp index e600638a4..d1daf9ce8 100644 --- a/code/ryzom/client/src/interface_v3/group_paragraph.cpp +++ b/code/ryzom/client/src/interface_v3/group_paragraph.cpp @@ -766,12 +766,12 @@ void CGroupParagraph::checkCoords () void CGroupParagraph::draw () { // TEMP TEMP - //CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + //CViewRenderer &rVR = *CViewRenderer::getInstance(); //rVR.drawRotFlipBitmap _RenderLayer, (_XReal, _YReal, _WReal, _HReal, 0, false, rVR.getBlankTextureId(), CRGBA(0,255,0,255) ); if (_Over) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); if (CWidgetManager::getInstance()->getModalWindow() == NULL) { diff --git a/code/ryzom/client/src/interface_v3/group_table.cpp b/code/ryzom/client/src/interface_v3/group_table.cpp index 378c33be5..b4ae09527 100644 --- a/code/ryzom/client/src/interface_v3/group_table.cpp +++ b/code/ryzom/client/src/interface_v3/group_table.cpp @@ -195,7 +195,7 @@ void CGroupCell::draw () if (DebugUICell) { // Draw cell - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal, _WReal, 1, 0, false, rVR.getBlankTextureId(), CRGBA(0,255,255,255) ); rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal, 1, _HReal, 0, false, rVR.getBlankTextureId(), CRGBA(0,255,255,255) ); rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal+_HReal-1, _WReal, 1, 0, false, rVR.getBlankTextureId(), CRGBA(0,255,255,255) ); @@ -205,7 +205,7 @@ void CGroupCell::draw () // Draw the background if (_UserTexture || BgColor.A != 0) { - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); if (_UserTexture) { CRGBA col; @@ -950,7 +950,7 @@ void CGroupTable::draw () finalColor.A = CurrentAlpha; // Draw the top and bottom lines - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal, _WReal, border, 0, false, rVR.getBlankTextureId(), finalColor); rVR.drawRotFlipBitmap (_RenderLayer, _XReal, _YReal-border+_HReal, _WReal, border, 0, false, rVR.getBlankTextureId(), finalColor); diff --git a/code/ryzom/client/src/interface_v3/group_tree.cpp b/code/ryzom/client/src/interface_v3/group_tree.cpp index 01f7b5e63..e5c7afba7 100644 --- a/code/ryzom/client/src/interface_v3/group_tree.cpp +++ b/code/ryzom/client/src/interface_v3/group_tree.cpp @@ -476,7 +476,7 @@ bool CGroupTree::parse (xmlNodePtr cur, CInterfaceGroup * parentGroup) _RootNode->Opened = true; _ResizeFromChildW = _ResizeFromChildH = true; - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 id = rVR.getTextureIdFromName(_ArboOpenFirst); if (id != -1) rVR.getTextureSizeFromId(id, _BmpW, _BmpH); @@ -522,7 +522,7 @@ void CGroupTree::updateCoords() void CGroupTree::drawSelection(sint x, sint y, sint w, CRGBA col) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); if(!_RectangleOutlineMode) { @@ -557,7 +557,7 @@ CGroupTree::SNode *CGroupTree::getNodeUnderMouse() const void CGroupTree::draw() { CInterfaceManager *pIM = CInterfaceManager::getInstance(); -// CViewRenderer &rVR = pIM->getViewRenderer(); +// CViewRenderer &rVR = *CViewRenderer::getInstance(); // get the clip area sint32 clipx, clipy, clipw, cliph; diff --git a/code/ryzom/client/src/interface_v3/input_handler_manager.cpp b/code/ryzom/client/src/interface_v3/input_handler_manager.cpp index 3332e33ac..e83d2b5af 100644 --- a/code/ryzom/client/src/interface_v3/input_handler_manager.cpp +++ b/code/ryzom/client/src/interface_v3/input_handler_manager.cpp @@ -163,13 +163,13 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) UserControls.stopFreeLook(); } // be nice with other app : let the mouse reappear (useful in direct 3D mode with no hardware cursor) - CInterfaceManager::getInstance()->getViewRenderer().getDriver()->showCursor(true); + CViewRenderer::getInstance()->getDriver()->showCursor(true); // Driver->setSystemArrow(); } else { _RecoverFocusLost = true; // force to update mouse pos on next click or move - CInterfaceManager::getInstance()->getViewRenderer().getDriver()->showCursor(IsMouseCursorHardware()); + CViewRenderer::getInstance()->getDriver()->showCursor(IsMouseCursorHardware()); _Focus = true; } diff --git a/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp b/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp index fc0582d19..609ebc351 100644 --- a/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp +++ b/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp @@ -78,7 +78,7 @@ CInterface3DScene::~CInterface3DScene() for (i = 0; i < _FXs.size(); ++i) delete _FXs[i]; - NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver(); if (_Scene != NULL) Driver->deleteScene (_Scene); @@ -172,7 +172,7 @@ bool CInterface3DScene::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) return true; } - NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver(); nlassert ( Driver != NULL); _Scene = Driver->createScene(true); @@ -299,7 +299,7 @@ bool CInterface3DScene::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) if (!animName.empty()) { if (_AutoAnimSet == NULL) - _AutoAnimSet = CInterfaceManager::getInstance()->getViewRenderer().getDriver()->createAnimationSet(); + _AutoAnimSet = CViewRenderer::getInstance()->getDriver()->createAnimationSet(); uint id = _AutoAnimSet->addAnimation (ptr, animName.c_str ()); if (id == UAnimationSet::NotFound) { @@ -378,14 +378,14 @@ void CInterface3DScene::draw () { H_AUTO( RZ_Interface_CInterface3DScene_draw ) - NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver(); if ( Driver == NULL) return; // No Op if screen minimized CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); if(rVR.isMinimized()) return; @@ -438,7 +438,7 @@ void CInterface3DScene::draw () float vpW = (float) clipw / iavoid0(wsw); float vpH = (float) cliph / iavoid0(wsh); newVP.init(vpX, vpY, vpW, vpH); - NL3D::CFrustum oldFrustum = CInterfaceManager::getInstance()->getViewRenderer().getDriver()->getFrustum(); + NL3D::CFrustum oldFrustum = CViewRenderer::getInstance()->getDriver()->getFrustum(); NL3D::CFrustum newFrustum; newFrustum.initPerspective (pI3DCam->getFOV() * (float) (NLMISC::Pi / 180), (float) _WReal / iavoid0(_HReal), 0.1f, 100.f); @@ -540,7 +540,7 @@ void CInterface3DScene::draw () Driver->setFrustum(oldFrustum); // Restaure render states - pIM->getViewRenderer().setRenderStates(); + CViewRenderer::getInstance()->setRenderStates(); restoreClip (oldSciX, oldSciY, oldSciW, oldSciH); } @@ -1097,7 +1097,7 @@ bool CInterface3DIG::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) setRotX (_Rot.x); setRotY (_Rot.y); setRotZ (_Rot.z); - _IG->addToScene (*parentGroup->getScene(), CInterfaceManager::getInstance()->getViewRenderer().getDriver() ); + _IG->addToScene (*parentGroup->getScene(), CViewRenderer::getInstance()->getDriver() ); parentGroup->getScene()->setToGlobalInstanceGroup (_IG); return true; @@ -1218,7 +1218,7 @@ void CInterface3DIG::setName (const std::string &ht) _IG = UInstanceGroup::createInstanceGroup(_Name); if (_IG == NULL) return; _IG->setPos (_Pos); - _IG->addToScene (*pI3DS->getScene(), CInterfaceManager::getInstance()->getViewRenderer().getDriver() ); + _IG->addToScene (*pI3DS->getScene(), CViewRenderer::getInstance()->getDriver() ); pI3DS->getScene()->setToGlobalInstanceGroup (_IG); } } diff --git a/code/ryzom/client/src/interface_v3/interface_element.cpp b/code/ryzom/client/src/interface_v3/interface_element.cpp index ff9977ce6..90176baae 100644 --- a/code/ryzom/client/src/interface_v3/interface_element.cpp +++ b/code/ryzom/client/src/interface_v3/interface_element.cpp @@ -1001,7 +1001,7 @@ void CInterfaceElement::center() { // center the pc CInterfaceManager *im = CInterfaceManager::getInstance(); - CViewRenderer &vr = im->getViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); uint32 sw, sh; vr.getScreenSize(sw, sh); setX(sw / 2 - getWReal() / 2); @@ -1025,7 +1025,7 @@ void CInterfaceElement::renderWiredQuads(TRenderWired type, const std::string &u ) return; CInterfaceManager *im = CInterfaceManager::getInstance(); - CViewRenderer &vr = im->getViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); vr.drawWiredQuad(_XReal, _YReal, _WReal, _HReal); drawHotSpot(_PosRef, CRGBA::Red); if (_Parent) _Parent->drawHotSpot(_ParentPosRef, CRGBA::Blue); @@ -1064,7 +1064,7 @@ void CInterfaceElement::drawHotSpot(THotSpot hs, CRGBA col) px = _XReal + _WReal - radius; } CInterfaceManager *im = CInterfaceManager::getInstance(); - CViewRenderer &vr = im->getViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); vr.drawFilledQuad(px - radius, py - radius, radius * 2, radius * 2, col); } diff --git a/code/ryzom/client/src/interface_v3/interface_group.cpp b/code/ryzom/client/src/interface_v3/interface_group.cpp index 4d917a80d..8104c5676 100644 --- a/code/ryzom/client/src/interface_v3/interface_group.cpp +++ b/code/ryzom/client/src/interface_v3/interface_group.cpp @@ -787,7 +787,7 @@ void CInterfaceGroup::draw () makeNewClip (oldSciX, oldSciY, oldSciW, oldSciH); // Display sons only if not total clipped - CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); if( !rVR.isClipWindowEmpty() ) { // Draw all decorative elements @@ -807,7 +807,7 @@ void CInterfaceGroup::draw () void CInterfaceGroup::drawNoClip() { // Display sons only if not total clipped - CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); if( !rVR.isClipWindowEmpty() ) { // Draw all decorative elements @@ -1417,7 +1417,7 @@ void CInterfaceGroup::computeCurrentClipContribution(sint32 oldSciX, sint32 oldS // ------------------------------------------------------------------------------------------------ void CInterfaceGroup::makeNewClip (sint32 &oldSciX, sint32 &oldSciY, sint32 &oldSciW, sint32 &oldSciH) { - CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); rVR.getClipWindow (oldSciX, oldSciY, oldSciW, oldSciH); sint32 newSciX, newSciY, newSciW, newSciH; @@ -1428,7 +1428,7 @@ void CInterfaceGroup::makeNewClip (sint32 &oldSciX, sint32 &oldSciY, sint32 &old // ------------------------------------------------------------------------------------------------ void CInterfaceGroup::getClip(sint32 &x, sint32 &y, sint32 &w, sint32 &h) const { - CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); uint32 sw, sh; rVR.getScreenSize(sw, sh); sint32 sciX = 0, sciY = 0, sciW = sw, sciH =sh; @@ -1447,7 +1447,7 @@ void CInterfaceGroup::getClip(sint32 &x, sint32 &y, sint32 &w, sint32 &h) const // ------------------------------------------------------------------------------------------------ void CInterfaceGroup::restoreClip (sint32 oldSciX, sint32 oldSciY, sint32 oldSciW, sint32 oldSciH) { - CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); rVR.setClipWindow (oldSciX, oldSciY, oldSciW, oldSciH); } diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index e07e4b64f..42e465fc0 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -254,11 +254,14 @@ int CInterfaceManager::DebugTrackGroupsGetId( CInterfaceGroup *pIG ) #endif // AJM_DEBUG_TRACK_INTERFACE_GROUPS // ------------------------------------------------------------------------------------------------ -CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext *textcontext ) : -_ViewRenderer( driver, textcontext ) +CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext *textcontext ) { this->driver = driver; this->textcontext = textcontext; + CViewRenderer::setDriver( driver ); + CViewRenderer::setTextContext( textcontext ); + CViewRenderer::getInstance(); + _Instance = this; NLGUI::CDBManager::getInstance()->resizeBanks( NB_CDB_BANKS ); interfaceLinkUpdater = new CInterfaceLink::CInterfaceLinkUpdater(); @@ -298,8 +301,8 @@ _ViewRenderer( driver, textcontext ) // ********************* // Interface Manager init - _ViewRenderer.checkNewScreenSize(); - _ViewRenderer.init(); + CViewRenderer::getInstance()->checkNewScreenSize(); + CViewRenderer::getInstance()->init(); _CurrentMode = 0; @@ -370,7 +373,7 @@ CInterfaceManager::~CInterfaceManager() // ------------------------------------------------------------------------------------------------ void CInterfaceManager::reset() { - _ViewRenderer.reset(); + CViewRenderer::getInstance()->reset(); _CtrlsUnderPointer.clear(); CWidgetManager::getInstance()->setCurContextHelp( NULL ); _ViewsUnderPointer.clear(); @@ -645,7 +648,7 @@ void CInterfaceManager::uninitOutGame() void badXMLParseMessageBox() { - NL3D::UDriver *driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + NL3D::UDriver *driver = CViewRenderer::getInstance()->getDriver(); NL3D::UDriver::TMessageBoxId ret = driver->systemMessageBox( "Interface XML reading failed!\n" "Some XML files are corrupted and may have been removed.\n" "Ryzom may need to be restarted to run properly.\n" @@ -1366,7 +1369,7 @@ void CInterfaceManager::updateFrameViews(NL3D::UCamera camera) H_AUTO ( RZ_Interface_updateFrameViews ) if (!camera.empty()) - _ViewRenderer.setWorldSpaceFrustum (camera.getFrustum()); + CViewRenderer::getInstance()->setWorldSpaceFrustum (camera.getFrustum()); checkCoords(); drawViews(camera); @@ -1452,7 +1455,7 @@ bool CInterfaceManager::parseInterface (const std::vector &xmlFileN // ------------------------------------------------------------------------------------------------ void CInterfaceManager::loadTextures (const string &textFileName, const string &uvFileName, bool uploadDXTC) { - _ViewRenderer.loadTextures (textFileName, uvFileName, uploadDXTC); + CViewRenderer::getInstance()->loadTextures (textFileName, uvFileName, uploadDXTC); } // ------------------------------------------------------------------------------------------------ @@ -1473,7 +1476,7 @@ bool CInterfaceManager::loadConfig (const string &filename) { uint32 w,h; // NB: even if minimzed, getScreenSize() no more return 0 values (return the last setuped screen size) - _ViewRenderer.getScreenSize(w, h); + CViewRenderer::getInstance()->getScreenSize(w, h); // Windows are positioned according to resolution, and we must backup W/H for the system that move windows when the resolution change _LastInGameScreenW= w; _LastInGameScreenH= h; @@ -1912,7 +1915,7 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera) { H_AUTO ( RZ_Interface_DrawViews_Setup ) - _ViewRenderer.activateWorldSpaceMatrix (false); + CViewRenderer::getInstance()->activateWorldSpaceMatrix (false); IngameDbMngr.flushObserverCalls(); NLGUI::CDBManager::getInstance()->flushObserverCalls(); @@ -1934,12 +1937,12 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera) } // Check if screen size changed uint32 w, h; - _ViewRenderer.checkNewScreenSize (); - _ViewRenderer.getScreenSize (w, h); + CViewRenderer::getInstance()->checkNewScreenSize (); + CViewRenderer::getInstance()->getScreenSize (w, h); if ((w != _ScreenW) || (h != _ScreenH)) { // No Op if screen minimized - if(w!=0 && h!=0 && !_ViewRenderer.isMinimized()) + if(w!=0 && h!=0 && !CViewRenderer::getInstance()->isMinimized()) { updateAllLocalisedElements (); _ScreenW = w; @@ -2006,7 +2009,7 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera) driver->setViewMatrix(CMatrix::Identity); driver->setModelMatrix(CMatrix::Identity); driver->setFrustum(camera.getFrustum()); - _ViewRenderer.activateWorldSpaceMatrix (true); + CViewRenderer::getInstance()->activateWorldSpaceMatrix (true); } list &rList = rMG.PrioritizedWindows[nPriority]; @@ -2022,7 +2025,7 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera) // Draw all the elements of this window in the layers in ViewRendered pIG->draw (); // flush the layers - _ViewRenderer.flush (); + CViewRenderer::getInstance()->flush (); } } } @@ -2030,7 +2033,7 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera) if ( (nPriority == WIN_PRIORITY_WORLD_SPACE) && !camera.empty()) { driver->setMatrixMode2D11(); - _ViewRenderer.activateWorldSpaceMatrix (false); + CViewRenderer::getInstance()->activateWorldSpaceMatrix (false); } } } @@ -2066,7 +2069,7 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera) // if the control support CopyDrag, and if copy key pressed, display a tiny "+" if(pCS->canDragCopy() && testDragCopyKey()) { - CViewRenderer &rVR = getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint w= rVR.getSystemTextureW(CViewRenderer::DragCopyTexture); sint h= rVR.getSystemTextureW(CViewRenderer::DragCopyTexture); rVR.draw11RotFlipBitmap (pCS->getRenderLayer()+1, x-w/2, y-h/2, 0, false, @@ -2083,7 +2086,7 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera) } // flush layers - _ViewRenderer.flush(); + CViewRenderer::getInstance()->flush(); // todo hulud remove Return in 2d world driver->setMatrixMode2D11(); @@ -2374,7 +2377,7 @@ void CInterfaceManager::drawContextHelp () groupContextHelp->executeLuaScriptOnDraw(); groupContextHelp->draw (); // flush layers - _ViewRenderer.flush(); + CViewRenderer::getInstance()->flush(); } } else @@ -2382,7 +2385,7 @@ void CInterfaceManager::drawContextHelp () groupContextHelp->executeLuaScriptOnDraw(); groupContextHelp->draw (); // flush layers - _ViewRenderer.flush(); + CViewRenderer::getInstance()->flush(); } } else @@ -2390,7 +2393,7 @@ void CInterfaceManager::drawContextHelp () groupContextHelp->executeLuaScriptOnDraw(); groupContextHelp->draw (); // flush layers - _ViewRenderer.flush(); + CViewRenderer::getInstance()->flush(); } } } @@ -3023,7 +3026,7 @@ bool CInterfaceManager::handleMouseMoveEvent( const NLGUI::CEventDescriptor &eve nlassert( e.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mousemove ); uint32 screenW, screenH; - _ViewRenderer.getScreenSize( screenW, screenH ); + CViewRenderer::getInstance()->getScreenSize( screenW, screenH ); sint32 oldX = CWidgetManager::getInstance()->getPointer()->getX(); sint32 oldY = CWidgetManager::getInstance()->getPointer()->getY(); @@ -3054,7 +3057,7 @@ void CInterfaceManager::movePointer (sint32 dx, sint32 dy) uint32 nScrW, nScrH; sint32 oldpx, oldpy, newpx, newpy, disppx, disppy, olddisppx, olddisppy; - _ViewRenderer.getScreenSize (nScrW, nScrH); + CViewRenderer::getInstance()->getScreenSize (nScrW, nScrH); _Pointer->getPointerPos (oldpx, oldpy); olddisppx = oldpx; @@ -3089,7 +3092,7 @@ void CInterfaceManager::movePointerAbs(sint32 px, sint32 py) { if (!CWidgetManager::getInstance()->getPointer()) return; uint32 nScrW, nScrH; - _ViewRenderer.getScreenSize (nScrW, nScrH); + CViewRenderer::getInstance()->getScreenSize (nScrW, nScrH); clamp(px, 0, (sint32) nScrW); clamp(py, 0, (sint32) nScrH); // @@ -3256,8 +3259,8 @@ void CInterfaceManager::updateAllLocalisedElements() uint32 nMasterGroup; uint32 w, h; - _ViewRenderer.checkNewScreenSize (); - _ViewRenderer.getScreenSize (w, h); + CViewRenderer::getInstance()->checkNewScreenSize (); + CViewRenderer::getInstance()->getScreenSize (w, h); std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup(); @@ -3268,7 +3271,7 @@ void CInterfaceManager::updateAllLocalisedElements() rMG.Group->setW (w); rMG.Group->setH (h); } - _ViewRenderer.setClipWindow(0, 0, w, h); + CViewRenderer::getInstance()->setClipWindow(0, 0, w, h); // If all conditions are OK, move windows so they fit correctly with new screen size // Do this work only InGame when Config is loaded @@ -3464,13 +3467,13 @@ void CInterfaceManager::getViewsUnder (sint32 x, sint32 y, std::vectorisMinimized()) return; std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup(); uint32 sw, sh; - _ViewRenderer.getScreenSize(sw, sh); + CViewRenderer::getInstance()->getScreenSize(sw, sh); for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++) { CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup]; @@ -3502,13 +3505,13 @@ void CInterfaceManager::getCtrlsUnder (sint32 x, sint32 y, std::vectorisMinimized()) return; std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup(); uint32 sw, sh; - _ViewRenderer.getScreenSize(sw, sh); + CViewRenderer::getInstance()->getScreenSize(sw, sh); for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++) { CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup]; @@ -3542,13 +3545,13 @@ void CInterfaceManager::getGroupsUnder (sint32 x, sint32 y, std::vectorisMinimized()) return; std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup(); uint32 sw, sh; - _ViewRenderer.getScreenSize(sw, sh); + CViewRenderer::getInstance()->getScreenSize(sw, sh); for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++) { CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup]; @@ -4744,7 +4747,7 @@ void CInterfaceManager::drawOverExtendViewText() // draw groupOver->draw (); // flush layers - _ViewRenderer.flush(); + CViewRenderer::getInstance()->flush(); } } @@ -6126,7 +6129,7 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) void CInterfaceManager::setTextContext( NL3D::UTextContext *textcontext ) { this->textcontext = textcontext; - _ViewRenderer.setTextContext( textcontext ); + CViewRenderer::getInstance()->setTextContext( textcontext ); } diff --git a/code/ryzom/client/src/interface_v3/interface_manager.h b/code/ryzom/client/src/interface_v3/interface_manager.h index 9bf7849e4..717176359 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.h +++ b/code/ryzom/client/src/interface_v3/interface_manager.h @@ -49,6 +49,8 @@ #include "../string_manager_client.h" #include "yubo_chat.h" +#include "../ingame_database_manager.h" + static const float ROLLOVER_MIN_DELTA_PER_MS = 0.28f; static const float ROLLOVER_MAX_DELTA_PER_MS = 0.12f; @@ -302,7 +304,6 @@ public: void drawContextHelp (); //void drawContextMenu (); - CViewRenderer &getViewRenderer () { return _ViewRenderer; } void setGlobalColor (NLMISC::CRGBA col); NLMISC::CRGBA getGlobalColor() { return _GlobalColor; } void setContentAlpha(uint8 alpha); @@ -821,8 +822,6 @@ private: }; std::vector _IDStringWaiters; - /// Renderer - CViewRenderer _ViewRenderer; uint32 _ScreenW, _ScreenH; // Change res detection NLMISC::CRGBA _GlobalColor; sint32 _LastInGameScreenW, _LastInGameScreenH; // Resolution used for last InGame interface diff --git a/code/ryzom/client/src/interface_v3/interface_options.cpp b/code/ryzom/client/src/interface_v3/interface_options.cpp index f46111c79..eb85bdb42 100644 --- a/code/ryzom/client/src/interface_v3/interface_options.cpp +++ b/code/ryzom/client/src/interface_v3/interface_options.cpp @@ -169,7 +169,7 @@ bool COptionsLayer::parse (xmlNodePtr cur) return false; CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); Tile_Blank = getValSInt32("tile_blank"); Tile_M_Header = getValSInt32("tile_m_header"); @@ -267,7 +267,7 @@ bool COptionsContainerInsertion::parse(xmlNodePtr cur) return false; CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); TxId_T_Arrow = rVR.getTextureIdFromName (getValStr("arrow_top")); TxId_B_Arrow = rVR.getTextureIdFromName (getValStr("arrow_down")); TxId_L_Arrow = rVR.getTextureIdFromName (getValStr("arrow_left")); @@ -355,7 +355,7 @@ bool CMissionIconList::parse(xmlNodePtr cur) bool result = CInterfaceOptions::parse(cur); if (!result) return false; CInterfaceManager *im = CInterfaceManager::getInstance(); - CViewRenderer &vr = im->getViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); for(std::map::iterator it = _ParamValue.begin(); it != _ParamValue.end(); ++it) { int index; @@ -414,7 +414,7 @@ COptionsAnimationSet::~COptionsAnimationSet() BUT this is OK, since the actual animationSet is kept by SmartPtr through UPlayList (see deleteAnimationSet() doc) */ - CInterfaceManager::getInstance()->getViewRenderer().getDriver()->deleteAnimationSet(AnimationSet); + CViewRenderer::getInstance()->getDriver()->deleteAnimationSet(AnimationSet); AnimationSet= NULL; } } @@ -424,10 +424,10 @@ bool COptionsAnimationSet::parse (xmlNodePtr cur) { bool result = CInterfaceOptions::parse(cur); if (!result) return false; - nlassert( CInterfaceManager::getInstance()->getViewRenderer().getDriver() ); + nlassert( CViewRenderer::getInstance()->getDriver() ); // create the animation set - AnimationSet= CInterfaceManager::getInstance()->getViewRenderer().getDriver()->createAnimationSet(); + AnimationSet= CViewRenderer::getInstance()->getDriver()->createAnimationSet(); nlassert(AnimationSet); AnimMale.clear(); diff --git a/code/ryzom/client/src/interface_v3/interface_parser.cpp b/code/ryzom/client/src/interface_v3/interface_parser.cpp index 7e1b15f34..7ca6c77a6 100644 --- a/code/ryzom/client/src/interface_v3/interface_parser.cpp +++ b/code/ryzom/client/src/interface_v3/interface_parser.cpp @@ -122,7 +122,7 @@ using namespace NLMISC; void badLuaParseMessageBox() { NL3D::UDriver::TMessageBoxId ret = - CInterfaceManager::getInstance()->getViewRenderer().getDriver()->systemMessageBox( "LUA files reading failed!\n" + CViewRenderer::getInstance()->getDriver()->systemMessageBox( "LUA files reading failed!\n" "Some LUA files are corrupted, moved or may have been removed.\n" "Ryzom may need to be restarted to run properly.\n" "Would you like to quit now?", diff --git a/code/ryzom/client/src/interface_v3/inventory_manager.cpp b/code/ryzom/client/src/interface_v3/inventory_manager.cpp index cdb2a2e36..2756e6391 100644 --- a/code/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/code/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -1112,7 +1112,7 @@ void CInventoryManager::CDBEquipObs::update(ICDBNode* node) } // reset display of left hand - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); pCSLeftHand->setTextureNoItem(rVR.getTextureIdFromName("hand_left.tga")); pCSLeftHand->setGrayed(false); pCSLeftHand->setItemSlot(SLOTTYPE::stringToSlotType("LEFT_HAND")); @@ -1187,7 +1187,7 @@ void CInventoryManager::CDBEquipObs::update(ICDBNode* node) CDBCtrlSheet *pCSLeftHand = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(CTRL_HAND_LEFT)); if ( pCSLeftHand ) { - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); pCSLeftHand->setActionOnLeftClick("proc"); pCSLeftHand->setGrayed(false); diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 3211c20e9..b111b4440 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -1608,7 +1608,7 @@ int CLuaIHMRyzom::getWindowSize(CLuaState &ls) CLuaIHM::checkArgCount(ls, "getWindowSize", 0); CInterfaceManager *pIM= CInterfaceManager::getInstance(); uint32 w, h; - pIM->getViewRenderer().getScreenSize(w, h); + CViewRenderer::getInstance()->getScreenSize(w, h); ls.push((double) w); ls.push((double) h); return 2; diff --git a/code/ryzom/client/src/interface_v3/macrocmd_manager.cpp b/code/ryzom/client/src/interface_v3/macrocmd_manager.cpp index 5548f9354..b87ecafda 100644 --- a/code/ryzom/client/src/interface_v3/macrocmd_manager.cpp +++ b/code/ryzom/client/src/interface_v3/macrocmd_manager.cpp @@ -204,7 +204,7 @@ void CMacroCmdManager::initInGame() { // Get all custom icon bitmaps CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); CInterfaceOptions *pIO = pIM->getOptions("macro_custom_icon"); if (pIO != NULL) { diff --git a/code/ryzom/client/src/interface_v3/view_bitmap.cpp b/code/ryzom/client/src/interface_v3/view_bitmap.cpp index 3ec51b270..7372f9401 100644 --- a/code/ryzom/client/src/interface_v3/view_bitmap.cpp +++ b/code/ryzom/client/src/interface_v3/view_bitmap.cpp @@ -80,7 +80,7 @@ bool CViewBitmap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) TxName = strlwr (TxName); setTexture (TxName); //CInterfaceManager *pIM = CInterfaceManager::getInstance(); - //CViewRenderer &rVR = pIM->getViewRenderer(); + //CViewRenderer &rVR = *CViewRenderer::getInstance(); //_TextureId = rVR.getTextureIdFromName (TxName); } @@ -145,7 +145,7 @@ bool CViewBitmap::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) void CViewBitmap::draw () { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); CRGBA col; if(getModulateGlobalColor()) @@ -209,7 +209,7 @@ void CViewBitmap::updateCoords() if (!_Scale) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 txw, txh; rVR.getTextureSizeFromId (_TextureId, txw, txh); _W = txw; @@ -222,7 +222,7 @@ void CViewBitmap::updateCoords() void CViewBitmap::setTexture(const std::string & TxName) { // CInterfaceManager *pIM = CInterfaceManager::getInstance(); -// CViewRenderer &rVR = pIM->getViewRenderer(); +// CViewRenderer &rVR = *CViewRenderer::getInstance(); _TextureId.setTexture (TxName.c_str (), _TxtOffsetX, _TxtOffsetY, _TxtWidth, _TxtHeight, false); } @@ -231,7 +231,7 @@ void CViewBitmap::setTexture(const std::string & TxName) std::string CViewBitmap::getTexture () const { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); return rVR.getTextureNameFromId (_TextureId); } @@ -239,7 +239,7 @@ std::string CViewBitmap::getTexture () const void CViewBitmap::fitTexture() { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 w, h; rVR.getTextureSizeFromId(_TextureId, w, h); setW(w); @@ -287,7 +287,7 @@ sint32 CViewBitmap::getMaxUsedW() const { sint32 txw, txh; CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); rVR.getTextureSizeFromId (_TextureId, txw, txh); return txw; } diff --git a/code/ryzom/client/src/interface_v3/view_bitmap_combo.cpp b/code/ryzom/client/src/interface_v3/view_bitmap_combo.cpp index a44dcf509..43c9be22c 100644 --- a/code/ryzom/client/src/interface_v3/view_bitmap_combo.cpp +++ b/code/ryzom/client/src/interface_v3/view_bitmap_combo.cpp @@ -276,7 +276,7 @@ void CViewBitmapCombo::draw() sint32 mx = 0, my = 0; CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); const std::vector &rVB = pIM->getViewsUnderPointer(); if (!CWidgetManager::getInstance()->getPointer()) return; CWidgetManager::getInstance()->getPointer()->getPointerDispPos(mx, my); @@ -377,7 +377,7 @@ void CViewBitmapCombo::draw() textId = getTexId(_TexsId, texIndex); color = getCol(_Col, texIndex); } - pIM->getViewRenderer().drawRotFlipBitmap (_RenderLayer, px, py, itemw, itemh, 0, false, + CViewRenderer::getInstance()->drawRotFlipBitmap (_RenderLayer, px, py, itemw, itemh, 0, false, textId, color); } @@ -454,7 +454,7 @@ void CViewBitmapCombo::draw() } } - pIM->getViewRenderer().drawRotFlipBitmap (_RenderLayer, px, py, itemw, itemh, 0, false, + CViewRenderer::getInstance()->drawRotFlipBitmap (_RenderLayer, px, py, itemw, itemh, 0, false, textId, color); } diff --git a/code/ryzom/client/src/interface_v3/view_bitmap_faber_mp.cpp b/code/ryzom/client/src/interface_v3/view_bitmap_faber_mp.cpp index ff7b0fa70..b2f05769e 100644 --- a/code/ryzom/client/src/interface_v3/view_bitmap_faber_mp.cpp +++ b/code/ryzom/client/src/interface_v3/view_bitmap_faber_mp.cpp @@ -119,7 +119,7 @@ void CViewBitmapFaberMp::draw () */ //get the item - CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); uint32 sheet = (uint32)_SheetId.getSInt64(); CSheetId sheetId(sheet); diff --git a/code/ryzom/client/src/interface_v3/view_pointer.cpp b/code/ryzom/client/src/interface_v3/view_pointer.cpp index 941f5ffb1..7a6740176 100644 --- a/code/ryzom/client/src/interface_v3/view_pointer.cpp +++ b/code/ryzom/client/src/interface_v3/view_pointer.cpp @@ -170,7 +170,7 @@ void CViewPointer::draw () return; CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); if (pIM->isInGame()) if (!_StringCursor) @@ -573,7 +573,7 @@ bool CViewPointer::drawCustom(CCtrlBase* pCB) nlinfo(tooltip.c_str()); setString(ucstring(tooltip)); CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 texId = rVR.getTextureIdFromName (texName); CInterfaceGroup *stringCursor = IsMouseCursorHardware() ? _StringCursorHardware : _StringCursor; @@ -596,7 +596,7 @@ bool CViewPointer::drawCustom(CCtrlBase* pCB) else { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 texId = rVR.getTextureIdFromName (texName); drawCursor(texId, col, 0); return true; @@ -760,7 +760,7 @@ void CViewPointer::setString (const ucstring &str) void CViewPointer::drawCursor(sint32 texId, NLMISC::CRGBA col, uint8 rot) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 xPos = _XReal + _OffsetX; sint32 yPos = _YReal + _OffsetY; if (!IsMouseCursorHardware()) diff --git a/code/ryzom/client/src/interface_v3/view_polygon.cpp b/code/ryzom/client/src/interface_v3/view_polygon.cpp index 4ed849c7c..b033b2885 100644 --- a/code/ryzom/client/src/interface_v3/view_polygon.cpp +++ b/code/ryzom/client/src/interface_v3/view_polygon.cpp @@ -77,7 +77,7 @@ void CViewPolygon::draw() if (_Tris.empty()) return; if (!_Parent) return; CInterfaceManager *im = CInterfaceManager::getInstance(); - CViewRenderer &vr = im->getViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); if (_Touched) { _RealTris.clear(); diff --git a/code/ryzom/client/src/interface_v3/view_quad.cpp b/code/ryzom/client/src/interface_v3/view_quad.cpp index a788fc226..296643a2d 100644 --- a/code/ryzom/client/src/interface_v3/view_quad.cpp +++ b/code/ryzom/client/src/interface_v3/view_quad.cpp @@ -58,7 +58,7 @@ void CViewQuad::draw() { nlassert(_Parent); CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); CRGBA col; if(getModulateGlobalColor()) @@ -280,7 +280,7 @@ void CViewQuad::setAlpha(sint32 a) void CViewQuad::setTexture(const std::string &texName) { // CInterfaceManager *pIM = CInterfaceManager::getInstance(); -// CViewRenderer &rVR = pIM->getViewRenderer(); +// CViewRenderer &rVR = *CViewRenderer::getInstance(); _TextureId.setTexture(texName.c_str()); } @@ -288,7 +288,7 @@ void CViewQuad::setTexture(const std::string &texName) std::string CViewQuad::getTexture() const { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); return rVR.getTextureNameFromId (_TextureId); } @@ -335,7 +335,7 @@ void CViewQuad::setQuad(const std::string &texName, const NLMISC::CVector &srcPo { NLMISC::CVector pos = srcPos; CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); sint32 w, h; rVR.getTextureSizeFromId(rVR.getTextureIdFromName(texName), w, h); if (angle == 0.f) diff --git a/code/ryzom/client/src/interface_v3/view_radar.cpp b/code/ryzom/client/src/interface_v3/view_radar.cpp index 933d57b80..06382059d 100644 --- a/code/ryzom/client/src/interface_v3/view_radar.cpp +++ b/code/ryzom/client/src/interface_v3/view_radar.cpp @@ -60,7 +60,7 @@ bool CViewRadar::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) // Spot textures CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); // Large missions Icons const char *spotTextureNames[NbRadarSpotIds] = { "texture_std", "texture_missionlist", "texture_missionauto", "texture_missionstep" }; @@ -105,7 +105,7 @@ bool CViewRadar::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) void CViewRadar::draw () { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); CEntityCL *user = EntitiesMngr.entity(0); if (user == NULL) return; diff --git a/code/ryzom/client/src/interface_v3/view_renderer.cpp b/code/ryzom/client/src/interface_v3/view_renderer.cpp index 395b719af..6dfb1e977 100644 --- a/code/ryzom/client/src/interface_v3/view_renderer.cpp +++ b/code/ryzom/client/src/interface_v3/view_renderer.cpp @@ -14,28 +14,26 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - - -#include "stdpch.h" - #include "view_renderer.h" #include "nel/misc/path.h" #include "nel/misc/file.h" #include "nel/misc/uv.h" #include "nel/misc/hierarchical_timer.h" -#include "interface_manager.h" #include "../client_cfg.h" using namespace NLMISC; using namespace std; using namespace NL3D; -CViewRenderer::CViewRenderer( NL3D::UDriver *driver, NL3D::UTextContext *textcontext ) -{ - setup(); +CViewRenderer* CViewRenderer::instance = NULL; +NL3D::UDriver* CViewRenderer::driver = NULL; +NL3D::UTextContext* CViewRenderer::textcontext = NULL; - this->driver = driver; - this->textcontext = textcontext; +CViewRenderer::CViewRenderer() +{ + nlassert( driver != NULL ); + nlassert( textcontext != NULL ); + setup(); } CViewRenderer::~CViewRenderer() @@ -49,6 +47,13 @@ CViewRenderer::~CViewRenderer() } +CViewRenderer* CViewRenderer::getInstance() +{ + if( instance == NULL ) + instance = new CViewRenderer; + return instance; +} + /* * setClipWindow : set the current clipping window * (this window do not inherit properties from parent or whatever) @@ -203,7 +208,12 @@ NL3D::UDriver* CViewRenderer::getDriver(){ void CViewRenderer::setTextContext(NL3D::UTextContext *textcontext) { - this->textcontext = textcontext; + CViewRenderer::textcontext = textcontext; +} + +void CViewRenderer::setDriver( NL3D::UDriver *driver ) +{ + CViewRenderer::driver = driver; } // *************************************************************************** @@ -1732,10 +1742,8 @@ void CViewRenderer::drawCustom (sint32 x, sint32 y, sint32 width, sint32 height, CViewRenderer::CTextureId::~CTextureId () { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); if (_TextureId>=0) - rVR.deleteTexture(_TextureId); + CViewRenderer::getInstance()->deleteTexture(_TextureId); _TextureId = -1; } @@ -1744,8 +1752,7 @@ CViewRenderer::CTextureId::~CTextureId () bool CViewRenderer::CTextureId::setTexture (const char *textureName, sint32 offsetX, sint32 offsetY, sint32 width, sint32 height, bool uploadDXTC, bool bReleasable) { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); if (_TextureId>=0) rVR.deleteTexture(_TextureId); _TextureId = rVR.getTextureIdFromName(textureName); @@ -1766,8 +1773,7 @@ void CViewRenderer::CTextureId::serial(NLMISC::IStream &f) } else { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); texName = rVR.getTextureNameFromId(_TextureId); f.serial(texName); } diff --git a/code/ryzom/client/src/interface_v3/view_renderer.h b/code/ryzom/client/src/interface_v3/view_renderer.h index f5e46c5ae..cc96cee34 100644 --- a/code/ryzom/client/src/interface_v3/view_renderer.h +++ b/code/ryzom/client/src/interface_v3/view_renderer.h @@ -26,8 +26,6 @@ #include "nel/misc/rgba.h" #include "nel/misc/uv.h" #include "nel/3d/frustum.h" -#include "../ingame_database_manager.h" - // *************************************************************************** #define VR_NUM_LAYER 32 @@ -104,9 +102,12 @@ public: sint32 _TextureId; }; - CViewRenderer( NL3D::UDriver *driver, NL3D::UTextContext *textcontext ); +private: + CViewRenderer(); + ~CViewRenderer(); - ~CViewRenderer (); +public: + static CViewRenderer* getInstance(); /// setup the default values for everything void setup(); @@ -121,10 +122,13 @@ public: void reset(); /// Retrieves the 3d driver we are using - NL3D::UDriver* getDriver(); + static NL3D::UDriver* getDriver(); /// Sets the current TextContext. - void setTextContext( NL3D::UTextContext *textcontext ); + static void setTextContext( NL3D::UTextContext *textcontext ); + + /// Sets the current driver + static void setDriver( NL3D::UDriver *driver ); /* * setClipWindow : set the current clipping window @@ -564,8 +568,9 @@ private: bool _WorldSpaceScale; - NL3D::UDriver *driver; - NL3D::UTextContext *textcontext; + static CViewRenderer *instance; + static NL3D::UDriver *driver; + static NL3D::UTextContext *textcontext; }; diff --git a/code/ryzom/client/src/interface_v3/view_text.cpp b/code/ryzom/client/src/interface_v3/view_text.cpp index 6167fd5f9..98904d390 100644 --- a/code/ryzom/client/src/interface_v3/view_text.cpp +++ b/code/ryzom/client/src/interface_v3/view_text.cpp @@ -418,7 +418,7 @@ void CViewText::draw () H_AUTO( RZ_Interface_CViewText_draw ) CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CViewRenderer &rVR = pIM->getViewRenderer(); + CViewRenderer &rVR = *CViewRenderer::getInstance(); // *** Out Of Clip? sint32 ClipX, ClipY, ClipW, ClipH; @@ -1559,7 +1559,7 @@ void CViewText::getCharacterPositionFromIndex(sint index, bool cursorAtPreviousL TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setShaded (_Shadow); TextContext->setFontSize (_FontSize); -// CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); +// CViewRenderer &rVR = *CViewRenderer::getInstance(); height = getFontHeight(); // if (_MultiLine) @@ -1691,7 +1691,7 @@ void CViewText::getCharacterIndexFromPosition(sint x, sint y, uint &index, bool TextContext->setShaded (_Shadow); TextContext->setFontSize (_FontSize); // find the line where the character is -// CViewRenderer &rVR = CInterfaceManager::getInstance()->getViewRenderer(); +// CViewRenderer &rVR = *CViewRenderer::getInstance(); uint charPos = 0; if (_MultiLine) { diff --git a/code/ryzom/client/src/main_loop.cpp b/code/ryzom/client/src/main_loop.cpp index 1abf1dc28..c35b680d8 100644 --- a/code/ryzom/client/src/main_loop.cpp +++ b/code/ryzom/client/src/main_loop.cpp @@ -1735,7 +1735,7 @@ bool mainLoop() H_AUTO_USE ( RZ_Client_Main_Loop_Cursor ) // Change only if screen is not minimized - if(!pIMinstance->getViewRenderer().isMinimized()) + if(!CViewRenderer::getInstance()->isMinimized()) { // Get the cursor instance CViewPointer *cursor = CWidgetManager::getInstance()->getPointer(); @@ -1746,7 +1746,7 @@ bool mainLoop() cursor->getPointerPos(x, y); uint32 w, h; - CViewRenderer &viewRender = pIMinstance->getViewRenderer(); + CViewRenderer &viewRender = *CViewRenderer::getInstance(); viewRender.getScreenSize(w, h); if(w) diff --git a/code/ryzom/client/src/r2/displayer_visual_activity_sequence.cpp b/code/ryzom/client/src/r2/displayer_visual_activity_sequence.cpp index c997c64a5..95b8f089b 100644 --- a/code/ryzom/client/src/r2/displayer_visual_activity_sequence.cpp +++ b/code/ryzom/client/src/r2/displayer_visual_activity_sequence.cpp @@ -598,7 +598,7 @@ void CDisplayerVisualActivitySequence::onUpdate(CGroupMap &owner) //H_AUTO(R2_CDisplayerVisualActivitySequence_onUpdate) nlassert(_AddedToWorldMap); nlassert(_FootSteps.size() == _WorldMapEdges.size()); - CViewRenderer &vr = getEditor().getUI().getViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); sint32 id = vr.getTextureIdFromName(CV_FootStepMapTexture.get()); sint32 width, height; vr.getTextureSizeFromId(id, width, height); diff --git a/code/ryzom/client/src/r2/island_collision.cpp b/code/ryzom/client/src/r2/island_collision.cpp index b096a4255..2c32fefb6 100644 --- a/code/ryzom/client/src/r2/island_collision.cpp +++ b/code/ryzom/client/src/r2/island_collision.cpp @@ -141,7 +141,7 @@ void CIslandCollision::releaseAccessibilityTexture() //H_AUTO(R2_CIslandCollision_releaseAccessibilityTexture) delete _AccessibilityTexture; _AccessibilityTexture = NULL; - CViewRenderer &vr = getEditor().getUI().getViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); vr.setExternalTexture(_AccessibilityTextureId, NULL, 0, 0, 0, 0); } @@ -460,7 +460,7 @@ CPackedWorld *CIslandCollision::reloadPackedIsland(const CScenarioEntryPoints::C uint height = std::max(_HeightMap.getHeight() / MapSizeDivisor, 1u); uint realWidth = NLMISC::raiseToNextPowerOf2(width); uint realHeight = NLMISC::raiseToNextPowerOf2(height); - CViewRenderer &vr = getEditor().getUI().getViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); // create / update texture vr.setExternalTexture(_AccessibilityTextureId, _AccessibilityTexture, realWidth, realHeight, width, height); if (vr.getTextureIdFromName(_AccessibilityTextureId) == -1) diff --git a/code/ryzom/client/src/r2/prim_render.cpp b/code/ryzom/client/src/r2/prim_render.cpp index ac05a1633..c932643d8 100644 --- a/code/ryzom/client/src/r2/prim_render.cpp +++ b/code/ryzom/client/src/r2/prim_render.cpp @@ -157,7 +157,7 @@ void CPrimRender::setLook(const CPrimLook &look) if (!look.EdgeLook.WorldMapTexture.empty()) { CInterfaceManager *im = CInterfaceManager::getInstance(); - CViewRenderer &vr = im->getViewRenderer(); + CViewRenderer &vr = *CViewRenderer::getInstance(); sint32 width, height; sint32 id = vr.getTextureIdFromName(look.EdgeLook.WorldMapTexture); vr.getTextureSizeFromId(id, width, height); diff --git a/code/ryzom/client/src/r2/tool.cpp b/code/ryzom/client/src/r2/tool.cpp index 4d3e890e2..b7e4ee069 100644 --- a/code/ryzom/client/src/r2/tool.cpp +++ b/code/ryzom/client/src/r2/tool.cpp @@ -130,7 +130,7 @@ CInterfaceManager &CTool::getUI() void CTool::getScreenSize(uint32 &scrW, uint32 &scrH) { //H_AUTO(R2_CTool_getScreenSize) - getUI().getViewRenderer().getScreenSize(scrW, scrH); + CViewRenderer::getInstance()->getScreenSize(scrW, scrH); } // *************************************************************** @@ -138,7 +138,7 @@ uint32 CTool::getScreenWidth() { //H_AUTO(R2_CTool_getScreenWidth) uint32 scrW, scrH; - getUI().getViewRenderer().getScreenSize(scrW, scrH); + CViewRenderer::getInstance()->getScreenSize(scrW, scrH); return scrW; } @@ -147,7 +147,7 @@ uint32 CTool::getScreenHeight() { //H_AUTO(R2_CTool_getScreenHeight) uint32 scrW, scrH; - getUI().getViewRenderer().getScreenSize(scrW, scrH); + CViewRenderer::getInstance()->getScreenSize(scrW, scrH); return scrH; }