From f0cc382971f8e36552311cdbcbc88ea05384cdea Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 11 Feb 2012 01:41:46 +0100 Subject: [PATCH] CViewRenderer no longer depends on the Driver global variable. Also got rid of the same dependencies in files which included that global from the CViewRenderer header. --- code/ryzom/client/src/init.cpp | 3 + .../src/interface_v3/action_handler_help.cpp | 1 + .../src/interface_v3/action_handler_misc.cpp | 6 +- .../client/src/interface_v3/dbctrl_sheet.cpp | 5 + .../client/src/interface_v3/group_editbox.cpp | 4 +- .../src/interface_v3/group_in_scene.cpp | 4 +- .../interface_v3/group_in_scene_bubble.cpp | 1 + .../interface_v3/input_handler_manager.cpp | 4 +- .../src/interface_v3/interface_3d_scene.cpp | 16 ++- .../src/interface_v3/interface_manager.cpp | 3 +- .../src/interface_v3/interface_options.cpp | 6 +- .../src/interface_v3/interface_parser.cpp | 15 +-- .../client/src/interface_v3/view_pointer.cpp | 2 +- .../client/src/interface_v3/view_renderer.cpp | 110 +++++++++--------- .../client/src/interface_v3/view_renderer.h | 29 ++--- .../client/src/r2/object_factory_client.cpp | 1 - 16 files changed, 111 insertions(+), 99 deletions(-) diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index a43dd97c0..4f019084c 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -62,6 +62,7 @@ #include "ingame_database_manager.h" #include "client_chat_manager.h" #include "interface_v3/input_handler_manager.h" +#include "interface_v3/interface_manager.h" //#include "crtdbg.h" #include "sound_manager.h" #include "net_manager.h" @@ -1074,6 +1075,8 @@ void prelogInit() // resetTextContext ("bremenb.ttf", false); resetTextContext ("ryzom.ttf", false); + CInterfaceManager::getInstance(); + ProgressBar.setFontFactor(0.85f); nmsg = "Loading background..."; 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 4c92fe6e0..b36e063d7 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -3920,6 +3920,7 @@ public: virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) { #ifdef NL_OS_WINDOWS + NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); if (Driver) { HWND wnd = 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 b8af699dd..fad47b05f 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,8 @@ CCameraBackup setupCameraForScreenshot(UScene &scene, uint left, uint right, uin // Build a viewport CViewport viewport; - viewport.init (0, 0, (float)(right-left)/Driver->getWindowWidth(), (float)(bottom-top)/Driver->getWindowHeight()); + NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + viewport.init (0, 0, (float)(right-left)/Driver->getWindowWidth(),(float)(bottom-top)/Driver->getWindowHeight()); // Activate all this scene.getCam().setFrustum (frustumPart); @@ -552,6 +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(); // if (ClientCfg.ScreenShotWidth && ClientCfg.ScreenShotHeight) { @@ -611,6 +613,8 @@ bool screenshotZBuffer(const std::string &filename) std::string ext = filename.substr(pos+1); std::vector z; + NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + Driver->getZBuffer(z); float min = std::numeric_limits::max(); diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 6f4eb1391..f0aa58dd2 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -250,6 +250,7 @@ CCtrlSheetInfo::CCtrlSheetInfo() void CDBCtrlSheet::release () { + NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); if (Driver) Driver->deleteMaterial(_GuildMat); @@ -489,6 +490,8 @@ CDBCtrlSheet::CDBCtrlSheet(const TCtorParam ¶m) // ---------------------------------------------------------------------------- CDBCtrlSheet::~CDBCtrlSheet() { + NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + if (_GuildBack) { if (Driver) @@ -1304,6 +1307,8 @@ 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(); + if (_GuildMat.empty()) { _GuildMat = Driver->createMaterial(); diff --git a/code/ryzom/client/src/interface_v3/group_editbox.cpp b/code/ryzom/client/src/interface_v3/group_editbox.cpp index fe423a9de..3f3e58a72 100644 --- a/code/ryzom/client/src/interface_v3/group_editbox.cpp +++ b/code/ryzom/client/src/interface_v3/group_editbox.cpp @@ -335,7 +335,7 @@ void CGroupEditBox::copy() stopParentBlink(); // get the selection and copy it - if (Driver->copyTextToClipboard(getSelection())) + if (CInterfaceManager::getInstance()->getViewRenderer().getDriver()->copyTextToClipboard(getSelection())) nlinfo ("Chat input was copied in the clipboard"); } @@ -353,7 +353,7 @@ void CGroupEditBox::paste() ucstring sString; - if (Driver->pasteTextFromClipboard(sString)) + if (CInterfaceManager::getInstance()->getViewRenderer().getDriver()->pasteTextFromClipboard(sString)) { // append string now appendStringFromClipboard(sString); 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 9cc2a0871..bad4e4236 100644 --- a/code/ryzom/client/src/interface_v3/group_in_scene.cpp +++ b/code/ryzom/client/src/interface_v3/group_in_scene.cpp @@ -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)Driver->getWindowWidth(); - tmp.y *= (float)Driver->getWindowHeight(); + tmp.x *= (float)CInterfaceManager::getInstance()->getViewRenderer().getDriver()->getWindowWidth(); + tmp.y *= (float)CInterfaceManager::getInstance()->getViewRenderer().getDriver()->getWindowHeight(); // position without offset, in float newProjCenter.x= tmp.x; 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 85238ad7d..957fa5b0f 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,6 +667,7 @@ CGroupInSceneBubbleManager::CPopupContext *CGroupInSceneBubbleManager::buildCont if (target) { // Find a position + NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().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/input_handler_manager.cpp b/code/ryzom/client/src/interface_v3/input_handler_manager.cpp index c57346655..5723952ee 100644 --- a/code/ryzom/client/src/interface_v3/input_handler_manager.cpp +++ b/code/ryzom/client/src/interface_v3/input_handler_manager.cpp @@ -174,13 +174,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) - Driver->showCursor(true); + CInterfaceManager::getInstance()->getViewRenderer().getDriver()->showCursor(true); // Driver->setSystemArrow(); } else { _RecoverFocusLost = true; // force to update mouse pos on next click or move - Driver->showCursor(IsMouseCursorHardware()); + CInterfaceManager::getInstance()->getViewRenderer().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 90e4aebc9..23e7dda44 100644 --- a/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp +++ b/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp @@ -78,6 +78,7 @@ CInterface3DScene::~CInterface3DScene() for (i = 0; i < _FXs.size(); ++i) delete _FXs[i]; + NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); if (_Scene != NULL) Driver->deleteScene (_Scene); @@ -171,7 +172,8 @@ bool CInterface3DScene::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) return true; } - nlassert (Driver != NULL); + NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + nlassert ( Driver != NULL); _Scene = Driver->createScene(true); @@ -297,7 +299,7 @@ bool CInterface3DScene::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) if (!animName.empty()) { if (_AutoAnimSet == NULL) - _AutoAnimSet = Driver->createAnimationSet(); + _AutoAnimSet = CInterfaceManager::getInstance()->getViewRenderer().getDriver()->createAnimationSet(); uint id = _AutoAnimSet->addAnimation (ptr, animName.c_str ()); if (id == UAnimationSet::NotFound) { @@ -376,7 +378,9 @@ void CInterface3DScene::draw () { H_AUTO( RZ_Interface_CInterface3DScene_draw ) - if (Driver == NULL) + NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver(); + + if ( Driver == NULL) return; // No Op if screen minimized @@ -434,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 = Driver->getFrustum(); + NL3D::CFrustum oldFrustum = CInterfaceManager::getInstance()->getViewRenderer().getDriver()->getFrustum(); NL3D::CFrustum newFrustum; newFrustum.initPerspective (pI3DCam->getFOV() * (float) (NLMISC::Pi / 180), (float) _WReal / iavoid0(_HReal), 0.1f, 100.f); @@ -1093,7 +1097,7 @@ bool CInterface3DIG::parse (xmlNodePtr cur, CInterface3DScene *parentGroup) setRotX (_Rot.x); setRotY (_Rot.y); setRotZ (_Rot.z); - _IG->addToScene (*parentGroup->getScene(), Driver); + _IG->addToScene (*parentGroup->getScene(), CInterfaceManager::getInstance()->getViewRenderer().getDriver() ); parentGroup->getScene()->setToGlobalInstanceGroup (_IG); return true; @@ -1214,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(), Driver); + _IG->addToScene (*pI3DS->getScene(), CInterfaceManager::getInstance()->getViewRenderer().getDriver() ); pI3DS->getScene()->setToGlobalInstanceGroup (_IG); } } diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 180a25763..4ca1f9bac 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -253,7 +253,8 @@ int CInterfaceManager::DebugTrackGroupsGetId( CInterfaceGroup *pIG ) #endif // AJM_DEBUG_TRACK_INTERFACE_GROUPS // ------------------------------------------------------------------------------------------------ -CInterfaceManager::CInterfaceManager() +CInterfaceManager::CInterfaceManager() : +_ViewRenderer( Driver ) { _Instance = this; _DbRootNode = new CCDBNodeBranch("ROOT"); diff --git a/code/ryzom/client/src/interface_v3/interface_options.cpp b/code/ryzom/client/src/interface_v3/interface_options.cpp index 3a06da8f5..f46111c79 100644 --- a/code/ryzom/client/src/interface_v3/interface_options.cpp +++ b/code/ryzom/client/src/interface_v3/interface_options.cpp @@ -414,7 +414,7 @@ COptionsAnimationSet::~COptionsAnimationSet() BUT this is OK, since the actual animationSet is kept by SmartPtr through UPlayList (see deleteAnimationSet() doc) */ - Driver->deleteAnimationSet(AnimationSet); + CInterfaceManager::getInstance()->getViewRenderer().getDriver()->deleteAnimationSet(AnimationSet); AnimationSet= NULL; } } @@ -424,10 +424,10 @@ bool COptionsAnimationSet::parse (xmlNodePtr cur) { bool result = CInterfaceOptions::parse(cur); if (!result) return false; - nlassert(Driver); + nlassert( CInterfaceManager::getInstance()->getViewRenderer().getDriver() ); // create the animation set - AnimationSet= Driver->createAnimationSet(); + AnimationSet= CInterfaceManager::getInstance()->getViewRenderer().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 b01c0e8d1..c7c873196 100644 --- a/code/ryzom/client/src/interface_v3/interface_parser.cpp +++ b/code/ryzom/client/src/interface_v3/interface_parser.cpp @@ -118,13 +118,14 @@ using namespace NLMISC; void badLuaParseMessageBox() { - NL3D::UDriver::TMessageBoxId ret = Driver->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?", - "LUA reading failed!", - NL3D::UDriver::yesNoType, - NL3D::UDriver::exclamationIcon); + NL3D::UDriver::TMessageBoxId ret = + CInterfaceManager::getInstance()->getViewRenderer().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?", + "LUA reading failed!", + NL3D::UDriver::yesNoType, + NL3D::UDriver::exclamationIcon); if (ret == NL3D::UDriver::yesId) { extern void quitCrashReport (); diff --git a/code/ryzom/client/src/interface_v3/view_pointer.cpp b/code/ryzom/client/src/interface_v3/view_pointer.cpp index 092054ee2..459ba3786 100644 --- a/code/ryzom/client/src/interface_v3/view_pointer.cpp +++ b/code/ryzom/client/src/interface_v3/view_pointer.cpp @@ -701,7 +701,7 @@ void CViewPointer::drawCursor(sint32 texId, NLMISC::CRGBA col, uint8 rot) { // set new cursor for the hardware mouse std::string name = rVR.getTextureNameFromId(texId); - Driver->setCursor(name, col, rot, (uint32) std::max(getX() - xPos, (sint32) 0), (uint32) std::max(getY() - yPos, (sint32) 0)); + rVR.getDriver()->setCursor(name, col, rot, (uint32) std::max(getX() - xPos, (sint32) 0), (uint32) std::max(getY() - yPos, (sint32) 0)); } } diff --git a/code/ryzom/client/src/interface_v3/view_renderer.cpp b/code/ryzom/client/src/interface_v3/view_renderer.cpp index 6a300275e..8f53d41f6 100644 --- a/code/ryzom/client/src/interface_v3/view_renderer.cpp +++ b/code/ryzom/client/src/interface_v3/view_renderer.cpp @@ -30,45 +30,15 @@ using namespace NLMISC; using namespace std; using namespace NL3D; - -/* - * constructor - */ -CViewRenderer::CViewRenderer() +CViewRenderer::CViewRenderer( NL3D::UDriver *driver ) { - _ClipX = _ClipY = 0; - _ClipW = 800; - _ClipH = 600; - _ScreenW = 800; - _ScreenH = 600; - _OneOverScreenW= 1.0f / (float)_ScreenW; - _OneOverScreenH= 1.0f / (float)_ScreenH; - _IsMinimized= false; - _WFigurTexture= 0; - _HFigurTexture= 0; - _WFigurSeparatorTexture = 0; - _FigurSeparatorTextureId = -1; - _FigurBlankId = -1; - _BlankId = -1; - _WorldSpaceTransformation = true; - _CurrentZ = 10; - for(uint i=0;idriver = driver; } - -/* - * destructor - */ CViewRenderer::~CViewRenderer() { - if (!_Material.empty() && Driver) - Driver->deleteMaterial(_Material); - for(uint i=0;igetWindowSize (w, h); + driver->getWindowSize (w, h); // not minimized? change coords if(w!=0 && h!=0) { @@ -145,14 +115,40 @@ void CViewRenderer::getScreenOOSize (float &oow, float &ooh) ooh= _OneOverScreenH; } +void CViewRenderer::setup() +{ + _ClipX = _ClipY = 0; + _ClipW = 800; + _ClipH = 600; + _ScreenW = 800; + _ScreenH = 600; + _OneOverScreenW= 1.0f / (float)_ScreenW; + _OneOverScreenH= 1.0f / (float)_ScreenH; + _IsMinimized= false; + _WFigurTexture= 0; + _HFigurTexture= 0; + _WFigurSeparatorTexture = 0; + _FigurSeparatorTextureId = -1; + _FigurBlankId = -1; + _BlankId = -1; + _WorldSpaceTransformation = true; + _CurrentZ = 10; + for(uint i=0;icreateMaterial(); + if (!driver) return; + _Material = driver->createMaterial(); setRenderStates(); @@ -188,7 +184,7 @@ void CViewRenderer::reset() UTextureFile *tf = dynamic_cast(ite->Texture); if (tf) { - Driver->deleteTextureFile (tf); + driver->deleteTextureFile (tf); } ite++; } @@ -200,6 +196,10 @@ void CViewRenderer::reset() _IndexesToTextureIds.clear(); } +NL3D::UDriver* CViewRenderer::getDriver(){ + return driver; +} + // *************************************************************************** void CViewRenderer::SImage::setupQuadUV(bool flipv, uint8 rot, CQuadColorUV &dest) { @@ -711,7 +711,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std: CIFile ifTmp; if (ifTmp.open(filename)) CBitmap::loadSize (ifTmp, gt.Width, gt.Height); - gt.Texture = Driver->createTextureFile (filename); + gt.Texture = driver->createTextureFile (filename); // Force to generate the texture now. This way we can extract the mouse bitmaps from it now without having to load it again. // Its why we don't release it at the end, because it is likely to be uploaded soon) CBitmap *texDatas = gt.Texture->generateDatas(); @@ -729,7 +729,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std: _GlobalTextures.push_back (gt); - Driver->setCursorScale(ClientCfg.HardwareCursorScale); + driver->setCursorScale(ClientCfg.HardwareCursorScale); char bufTmp[256], tgaName[256]; string sTGAname; @@ -781,7 +781,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std: CBitmap curs; curs.resize(x1 - x0, y1 - y0); curs.blit(*texDatas, x0, y0, (x1 - x0), (y1 - y0), 0, 0); - Driver->addCursor(image.Name, curs); + driver->addCursor(image.Name, curs); } } } @@ -877,7 +877,7 @@ sint32 CViewRenderer::createTexture (const std::string &sGlobalTextureName, nlwarning("Failed to load the texture '%s', please check image format", filename.c_str()); } } - gtTmp.Texture = Driver->createTextureFile (sLwrGTName); + gtTmp.Texture = driver->createTextureFile (sLwrGTName); gtTmp.Name = sLwrGTName; gtTmp.Texture->setFilterMode(UTexture::Nearest, UTexture::NearestMipMapOff); if(uploadDXTC) @@ -1007,7 +1007,7 @@ void CViewRenderer::deleteTexture (sint32 textureId) UTextureFile *tf = dynamic_cast(iteGT->Texture); if (tf) { - Driver->deleteTextureFile (tf); + driver->deleteTextureFile (tf); } _GlobalTextures.erase (iteGT); return; @@ -1151,13 +1151,13 @@ void CViewRenderer::flush () // draw quads and empty list if (layer.NbQuads != 0) { - Driver->drawQuads (&(layer.Quads[0]), layer.NbQuads, _Material); + driver->drawQuads (&(layer.Quads[0]), layer.NbQuads, _Material); layer.NbQuads = 0; } if (!layer.Tris.empty()) { - Driver->drawTriangles(layer.Tris, _Material); + driver->drawTriangles(layer.Tris, _Material); layer.Tris.clear(); } @@ -1178,12 +1178,12 @@ void CViewRenderer::flush () // alpha blended if (!layer.FilteredAlphaBlendedQuads.empty()) { - Driver->drawQuads (&(layer.FilteredAlphaBlendedQuads[0]), (uint32)layer.FilteredAlphaBlendedQuads.size(), _Material); + driver->drawQuads (&(layer.FilteredAlphaBlendedQuads[0]), (uint32)layer.FilteredAlphaBlendedQuads.size(), _Material); layer.FilteredAlphaBlendedQuads.clear(); } if (!layer.FilteredAlphaBlendedTris.empty()) { - Driver->drawTriangles(layer.FilteredAlphaBlendedTris, _Material); + driver->drawTriangles(layer.FilteredAlphaBlendedTris, _Material); layer.FilteredAlphaBlendedTris.clear(); } // additif @@ -1193,12 +1193,12 @@ void CViewRenderer::flush () _Material.setBlendFunc (NL3D::UMaterial::one, NL3D::UMaterial::one); if (!layer.FilteredAdditifQuads.empty()) { - Driver->drawQuads (&(layer.FilteredAdditifQuads[0]), (uint32)layer.FilteredAdditifQuads.size(), _Material); + driver->drawQuads (&(layer.FilteredAdditifQuads[0]), (uint32)layer.FilteredAdditifQuads.size(), _Material); layer.FilteredAdditifQuads.clear(); } if (!layer.FilteredAdditifTris.empty()) { - Driver->drawTriangles(layer.FilteredAdditifTris, _Material); + driver->drawTriangles(layer.FilteredAdditifTris, _Material); layer.FilteredAdditifTris.clear(); } // restore alpha blend @@ -1546,13 +1546,13 @@ URenderStringBuffer *CViewRenderer::getStringRenderBuffer(sint layerId) // *************************************************************************** void CViewRenderer::drawWiredQuad(sint32 x, sint32 y, sint32 width, sint32 height, NLMISC::CRGBA col /*=NLMISC::CRGBA::White*/) { - Driver->drawWiredQuad(x * _OneOverScreenW, y * _OneOverScreenH, (x + width) * _OneOverScreenW, (y + height) * _OneOverScreenH, col); + driver->drawWiredQuad(x * _OneOverScreenW, y * _OneOverScreenH, (x + width) * _OneOverScreenW, (y + height) * _OneOverScreenH, col); } // *************************************************************************** void CViewRenderer::drawFilledQuad(sint32 x, sint32 y, sint32 width, sint32 height, NLMISC::CRGBA col /*=NLMISC::CRGBA::White*/) { - Driver->drawQuad(x * _OneOverScreenW, y * _OneOverScreenH, (x + width) * _OneOverScreenW, (y + height) * _OneOverScreenH, col); + driver->drawQuad(x * _OneOverScreenW, y * _OneOverScreenH, (x + width) * _OneOverScreenW, (y + height) * _OneOverScreenH, col); } @@ -1610,7 +1610,7 @@ void CViewRenderer::drawCustom (sint32 x, sint32 y, sint32 width, sint32 height, worldSpaceTransformation (qcoluv2_clipped); // Draw clipped quad - Driver->drawQuads (&qcoluv2_clipped, 1, Mat); + driver->drawQuads (&qcoluv2_clipped, 1, Mat); } // *************************************************************************** @@ -1658,7 +1658,7 @@ void CViewRenderer::drawCustom(sint32 x, sint32 y, sint32 width, sint32 height, } // Draw clipped quad - Driver->drawQuads (&qcoluv_clipped, 1, Mat); + driver->drawQuads (&qcoluv_clipped, 1, Mat); } // *************************************************************************** @@ -1716,7 +1716,7 @@ void CViewRenderer::drawCustom (sint32 x, sint32 y, sint32 width, sint32 height, worldSpaceTransformation (qcoluv2_clipped); // Draw clipped quad - Driver->drawQuads (&qcoluv2_clipped, 1, Mat); + driver->drawQuads (&qcoluv2_clipped, 1, Mat); } // *************************************************************************** diff --git a/code/ryzom/client/src/interface_v3/view_renderer.h b/code/ryzom/client/src/interface_v3/view_renderer.h index ea7583dfa..ff53a4c67 100644 --- a/code/ryzom/client/src/interface_v3/view_renderer.h +++ b/code/ryzom/client/src/interface_v3/view_renderer.h @@ -29,16 +29,6 @@ #include "../ingame_database_manager.h" -//the NEL 3d driver -extern NL3D::UDriver* Driver; - -//the NEL 3d textcontext -extern NL3D::UTextContext *TextContext; - -//the network database node -extern CCDBSynchronised IngameDbMngr; - - // *************************************************************************** #define VR_NUM_LAYER 32 #define VR_BIAS_LAYER (VR_NUM_LAYER/2) @@ -113,15 +103,13 @@ public: sint32 _TextureId; }; - /** - * destructor - */ - CViewRenderer (); - /** - * destructor - */ + CViewRenderer( NL3D::UDriver *driver ); + ~CViewRenderer (); + /// setup the default values for everything + void setup(); + /// init when TextContext and Driver are created void init(); @@ -131,6 +119,9 @@ public: /// Delete all textures and the like and reset the view renderer void reset(); + /// Retrieves the 3d driver we are using + NL3D::UDriver* getDriver(); + /* * setClipWindow : set the current clipping window * (this window do not inherit properties from parent or whatever) @@ -567,7 +558,9 @@ private: NL3D::CFrustum _CameraFrustum; // Transform from screen space to world space NLMISC::CMatrix _WorldSpaceMatrix; // Matrix to be applied for world space transformation bool _WorldSpaceScale; - + + + NL3D::UDriver *driver; }; diff --git a/code/ryzom/client/src/r2/object_factory_client.cpp b/code/ryzom/client/src/r2/object_factory_client.cpp index 975d2d6a1..a8ad45e3d 100644 --- a/code/ryzom/client/src/r2/object_factory_client.cpp +++ b/code/ryzom/client/src/r2/object_factory_client.cpp @@ -300,7 +300,6 @@ void CObjectRefIdClient::getNameInParent(std::string &name, sint32 &indexInArray nlwarning("ObservedObject parent instance ptr = %p", parent); parent->getLuaProjection().dump(); } - Driver->systemMessageBox("Bug catched, please send log.log to vizerie@nevrax.com", "nevrax internal", NL3D::UDriver::okType, NL3D::UDriver::exclamationIcon); nlassert(0); // not found in parent }