VCiewRenderer no longer depends on the global TextContext variable. Instead it's updated when it changes.

This commit is contained in:
dfighter1985 2012-02-11 02:28:14 +01:00
parent a006d657cd
commit 6374bffe37
5 changed files with 25 additions and 6 deletions

View file

@ -83,6 +83,7 @@ void resetTextContext (const char *font, bool resetInterfaceManager)
if (resetInterfaceManager)
{
CInterfaceManager *im = CInterfaceManager::getInstance();
im->setTextContext( TextContext );
im->resetTextIndex();
}
}

View file

@ -254,7 +254,7 @@ int CInterfaceManager::DebugTrackGroupsGetId( CInterfaceGroup *pIG )
// ------------------------------------------------------------------------------------------------
CInterfaceManager::CInterfaceManager() :
_ViewRenderer( Driver )
_ViewRenderer( Driver, TextContext )
{
_Instance = this;
_DbRootNode = new CCDBNodeBranch("ROOT");
@ -6600,3 +6600,8 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr)
ucstr = str;
return true;;
}
void CInterfaceManager::setTextContext( NL3D::UTextContext *textcontext )
{
_ViewRenderer.setTextContext( textcontext );
}

View file

@ -720,6 +720,9 @@ public:
*/
static bool parseTokens(ucstring& ucstr);
/// Sets the current TextContext.
void setTextContext( NL3D::UTextContext *textcontext );
// ------------------------------------------------------------------------------------------------
private:

View file

@ -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;i<VR_NUM_LAYER;i++)
{
_StringRBLayers[i]= TextContext->createRenderBuffer();
_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;

View file

@ -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;
};