From 7149af988601d6768d769a36f4ec281703a5f2ed Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 11 Feb 2012 02:28:14 +0100 Subject: [PATCH] VCiewRenderer no longer depends on the global TextContext variable. Instead it's updated when it changes. --- code/ryzom/client/src/global.cpp | 1 + .../client/src/interface_v3/interface_manager.cpp | 7 ++++++- .../client/src/interface_v3/interface_manager.h | 3 +++ .../client/src/interface_v3/view_renderer.cpp | 14 ++++++++++---- code/ryzom/client/src/interface_v3/view_renderer.h | 6 +++++- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/code/ryzom/client/src/global.cpp b/code/ryzom/client/src/global.cpp index 01756dd01..ee6e1f483 100644 --- a/code/ryzom/client/src/global.cpp +++ b/code/ryzom/client/src/global.cpp @@ -83,6 +83,7 @@ void resetTextContext (const char *font, bool resetInterfaceManager) if (resetInterfaceManager) { CInterfaceManager *im = CInterfaceManager::getInstance(); + im->setTextContext( TextContext ); im->resetTextIndex(); } } diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 4ca1f9bac..64839446c 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -254,7 +254,7 @@ int CInterfaceManager::DebugTrackGroupsGetId( CInterfaceGroup *pIG ) // ------------------------------------------------------------------------------------------------ CInterfaceManager::CInterfaceManager() : -_ViewRenderer( Driver ) +_ViewRenderer( Driver, TextContext ) { _Instance = this; _DbRootNode = new CCDBNodeBranch("ROOT"); @@ -6599,4 +6599,9 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) ucstr = str; return true;; +} + +void CInterfaceManager::setTextContext( NL3D::UTextContext *textcontext ) +{ + _ViewRenderer.setTextContext( textcontext ); } \ No newline at end of file diff --git a/code/ryzom/client/src/interface_v3/interface_manager.h b/code/ryzom/client/src/interface_v3/interface_manager.h index ced23130f..f6192f95b 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.h +++ b/code/ryzom/client/src/interface_v3/interface_manager.h @@ -720,6 +720,9 @@ public: */ static bool parseTokens(ucstring& ucstr); + /// Sets the current TextContext. + void setTextContext( NL3D::UTextContext *textcontext ); + // ------------------------------------------------------------------------------------------------ private: diff --git a/code/ryzom/client/src/interface_v3/view_renderer.cpp b/code/ryzom/client/src/interface_v3/view_renderer.cpp index 8f53d41f6..833e9b47b 100644 --- a/code/ryzom/client/src/interface_v3/view_renderer.cpp +++ b/code/ryzom/client/src/interface_v3/view_renderer.cpp @@ -30,11 +30,12 @@ using namespace NLMISC; using namespace std; using namespace NL3D; -CViewRenderer::CViewRenderer( NL3D::UDriver *driver ) +CViewRenderer::CViewRenderer( NL3D::UDriver *driver, NL3D::UTextContext *textcontext ) { setup(); this->driver = driver; + this->textcontext = textcontext; } CViewRenderer::~CViewRenderer() @@ -155,7 +156,7 @@ void CViewRenderer::init() // Init all renderBuffer for(uint i=0;icreateRenderBuffer(); + _StringRBLayers[i]= textcontext->createRenderBuffer(); } } @@ -200,6 +201,11 @@ NL3D::UDriver* CViewRenderer::getDriver(){ return driver; } +void CViewRenderer::setTextContext(NL3D::UTextContext *textcontext) +{ + this->textcontext = textcontext; +} + // *************************************************************************** void CViewRenderer::SImage::setupQuadUV(bool flipv, uint8 rot, CQuadColorUV &dest) { @@ -1211,9 +1217,9 @@ void CViewRenderer::flush () // **** Display Computed Strings of this layer if (_WorldSpaceTransformation) - TextContext->flushRenderBufferUnProjected(_StringRBLayers[layerId], false); + textcontext->flushRenderBufferUnProjected(_StringRBLayers[layerId], false); else - TextContext->flushRenderBuffer(_StringRBLayers[layerId]); + textcontext->flushRenderBuffer(_StringRBLayers[layerId]); // flushed _EmptyLayer[layerId]= true; diff --git a/code/ryzom/client/src/interface_v3/view_renderer.h b/code/ryzom/client/src/interface_v3/view_renderer.h index ff53a4c67..eed178795 100644 --- a/code/ryzom/client/src/interface_v3/view_renderer.h +++ b/code/ryzom/client/src/interface_v3/view_renderer.h @@ -103,7 +103,7 @@ public: sint32 _TextureId; }; - CViewRenderer( NL3D::UDriver *driver ); + CViewRenderer( NL3D::UDriver *driver, NL3D::UTextContext *textcontext ); ~CViewRenderer (); @@ -122,6 +122,9 @@ public: /// Retrieves the 3d driver we are using NL3D::UDriver* getDriver(); + /// Sets the current TextContext. + void setTextContext( NL3D::UTextContext *textcontext ); + /* * setClipWindow : set the current clipping window * (this window do not inherit properties from parent or whatever) @@ -561,6 +564,7 @@ private: NL3D::UDriver *driver; + NL3D::UTextContext *textcontext; };