mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-26 10:50:54 +00:00
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.
--HG-- branch : gui-refactoring
This commit is contained in:
parent
38f215735c
commit
c27ad72de6
16 changed files with 111 additions and 99 deletions
|
@ -62,6 +62,7 @@
|
||||||
#include "ingame_database_manager.h"
|
#include "ingame_database_manager.h"
|
||||||
#include "client_chat_manager.h"
|
#include "client_chat_manager.h"
|
||||||
#include "interface_v3/input_handler_manager.h"
|
#include "interface_v3/input_handler_manager.h"
|
||||||
|
#include "interface_v3/interface_manager.h"
|
||||||
//#include "crtdbg.h"
|
//#include "crtdbg.h"
|
||||||
#include "sound_manager.h"
|
#include "sound_manager.h"
|
||||||
#include "net_manager.h"
|
#include "net_manager.h"
|
||||||
|
@ -1074,6 +1075,8 @@ void prelogInit()
|
||||||
// resetTextContext ("bremenb.ttf", false);
|
// resetTextContext ("bremenb.ttf", false);
|
||||||
resetTextContext ("ryzom.ttf", false);
|
resetTextContext ("ryzom.ttf", false);
|
||||||
|
|
||||||
|
CInterfaceManager::getInstance();
|
||||||
|
|
||||||
ProgressBar.setFontFactor(0.85f);
|
ProgressBar.setFontFactor(0.85f);
|
||||||
|
|
||||||
nmsg = "Loading background...";
|
nmsg = "Loading background...";
|
||||||
|
|
|
@ -3920,6 +3920,7 @@ public:
|
||||||
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
|
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
|
||||||
{
|
{
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
|
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver();
|
||||||
if (Driver)
|
if (Driver)
|
||||||
{
|
{
|
||||||
HWND wnd = Driver->getDisplay();
|
HWND wnd = Driver->getDisplay();
|
||||||
|
|
|
@ -520,7 +520,8 @@ CCameraBackup setupCameraForScreenshot(UScene &scene, uint left, uint right, uin
|
||||||
|
|
||||||
// Build a viewport
|
// Build a viewport
|
||||||
CViewport 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
|
// Activate all this
|
||||||
scene.getCam().setFrustum (frustumPart);
|
scene.getCam().setFrustum (frustumPart);
|
||||||
|
@ -552,6 +553,7 @@ void renderSceneScreenShot (uint left, uint right, uint top, uint bottom, uint s
|
||||||
|
|
||||||
void getBuffer (CBitmap &btm)
|
void getBuffer (CBitmap &btm)
|
||||||
{
|
{
|
||||||
|
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver();
|
||||||
//
|
//
|
||||||
if (ClientCfg.ScreenShotWidth && ClientCfg.ScreenShotHeight)
|
if (ClientCfg.ScreenShotWidth && ClientCfg.ScreenShotHeight)
|
||||||
{
|
{
|
||||||
|
@ -611,6 +613,8 @@ bool screenshotZBuffer(const std::string &filename)
|
||||||
std::string ext = filename.substr(pos+1);
|
std::string ext = filename.substr(pos+1);
|
||||||
|
|
||||||
std::vector<float> z;
|
std::vector<float> z;
|
||||||
|
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver();
|
||||||
|
|
||||||
Driver->getZBuffer(z);
|
Driver->getZBuffer(z);
|
||||||
|
|
||||||
float min = std::numeric_limits<float>::max();
|
float min = std::numeric_limits<float>::max();
|
||||||
|
|
|
@ -250,6 +250,7 @@ CCtrlSheetInfo::CCtrlSheetInfo()
|
||||||
|
|
||||||
void CDBCtrlSheet::release ()
|
void CDBCtrlSheet::release ()
|
||||||
{
|
{
|
||||||
|
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver();
|
||||||
if (Driver)
|
if (Driver)
|
||||||
Driver->deleteMaterial(_GuildMat);
|
Driver->deleteMaterial(_GuildMat);
|
||||||
|
|
||||||
|
@ -489,6 +490,8 @@ CDBCtrlSheet::CDBCtrlSheet(const TCtorParam ¶m)
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
CDBCtrlSheet::~CDBCtrlSheet()
|
CDBCtrlSheet::~CDBCtrlSheet()
|
||||||
{
|
{
|
||||||
|
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver();
|
||||||
|
|
||||||
if (_GuildBack)
|
if (_GuildBack)
|
||||||
{
|
{
|
||||||
if (Driver)
|
if (Driver)
|
||||||
|
@ -1304,6 +1307,8 @@ void CDBCtrlSheet::setupGuildFlag ()
|
||||||
sint8 nLastGuildBack = (sint8)(_MacroID&15); // 4 bits en pos 0
|
sint8 nLastGuildBack = (sint8)(_MacroID&15); // 4 bits en pos 0
|
||||||
sint8 nLastGuildSymbol = (sint8)((_MacroID>>4)&63); // 6 bits en pos 4
|
sint8 nLastGuildSymbol = (sint8)((_MacroID>>4)&63); // 6 bits en pos 4
|
||||||
|
|
||||||
|
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver();
|
||||||
|
|
||||||
if (_GuildMat.empty())
|
if (_GuildMat.empty())
|
||||||
{
|
{
|
||||||
_GuildMat = Driver->createMaterial();
|
_GuildMat = Driver->createMaterial();
|
||||||
|
|
|
@ -335,7 +335,7 @@ void CGroupEditBox::copy()
|
||||||
stopParentBlink();
|
stopParentBlink();
|
||||||
|
|
||||||
// get the selection and copy it
|
// 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");
|
nlinfo ("Chat input was copied in the clipboard");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ void CGroupEditBox::paste()
|
||||||
|
|
||||||
ucstring sString;
|
ucstring sString;
|
||||||
|
|
||||||
if (Driver->pasteTextFromClipboard(sString))
|
if (CInterfaceManager::getInstance()->getViewRenderer().getDriver()->pasteTextFromClipboard(sString))
|
||||||
{
|
{
|
||||||
// append string now
|
// append string now
|
||||||
appendStringFromClipboard(sString);
|
appendStringFromClipboard(sString);
|
||||||
|
|
|
@ -86,8 +86,8 @@ void CGroupInScene::computeWindowPos(sint32 &newX, sint32 &newY, CVector &newPro
|
||||||
tmp = pVR.getFrustum().projectZ (tmp);
|
tmp = pVR.getFrustum().projectZ (tmp);
|
||||||
|
|
||||||
// Get the width and height
|
// Get the width and height
|
||||||
tmp.x *= (float)Driver->getWindowWidth();
|
tmp.x *= (float)CInterfaceManager::getInstance()->getViewRenderer().getDriver()->getWindowWidth();
|
||||||
tmp.y *= (float)Driver->getWindowHeight();
|
tmp.y *= (float)CInterfaceManager::getInstance()->getViewRenderer().getDriver()->getWindowHeight();
|
||||||
|
|
||||||
// position without offset, in float
|
// position without offset, in float
|
||||||
newProjCenter.x= tmp.x;
|
newProjCenter.x= tmp.x;
|
||||||
|
|
|
@ -667,6 +667,7 @@ CGroupInSceneBubbleManager::CPopupContext *CGroupInSceneBubbleManager::buildCont
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
// Find a position
|
// Find a position
|
||||||
|
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver();
|
||||||
const uint width = Driver->getWindowWidth();
|
const uint width = Driver->getWindowWidth();
|
||||||
const uint height = Driver->getWindowHeight();
|
const uint height = Driver->getWindowHeight();
|
||||||
h = (target->getXReal() < ((sint)width-target->getXReal()-target->getWReal()))?"l":"r";
|
h = (target->getXReal() < ((sint)width-target->getXReal()-target->getWReal()))?"l":"r";
|
||||||
|
|
|
@ -174,13 +174,13 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event)
|
||||||
UserControls.stopFreeLook();
|
UserControls.stopFreeLook();
|
||||||
}
|
}
|
||||||
// be nice with other app : let the mouse reappear (useful in direct 3D mode with no hardware cursor)
|
// 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();
|
// Driver->setSystemArrow();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_RecoverFocusLost = true; // force to update mouse pos on next click or move
|
_RecoverFocusLost = true; // force to update mouse pos on next click or move
|
||||||
Driver->showCursor(IsMouseCursorHardware());
|
CInterfaceManager::getInstance()->getViewRenderer().getDriver()->showCursor(IsMouseCursorHardware());
|
||||||
_Focus = true;
|
_Focus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,7 @@ CInterface3DScene::~CInterface3DScene()
|
||||||
for (i = 0; i < _FXs.size(); ++i)
|
for (i = 0; i < _FXs.size(); ++i)
|
||||||
delete _FXs[i];
|
delete _FXs[i];
|
||||||
|
|
||||||
|
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver();
|
||||||
if (_Scene != NULL)
|
if (_Scene != NULL)
|
||||||
Driver->deleteScene (_Scene);
|
Driver->deleteScene (_Scene);
|
||||||
|
|
||||||
|
@ -171,7 +172,8 @@ bool CInterface3DScene::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
nlassert (Driver != NULL);
|
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver();
|
||||||
|
nlassert ( Driver != NULL);
|
||||||
|
|
||||||
_Scene = Driver->createScene(true);
|
_Scene = Driver->createScene(true);
|
||||||
|
|
||||||
|
@ -297,7 +299,7 @@ bool CInterface3DScene::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
|
||||||
if (!animName.empty())
|
if (!animName.empty())
|
||||||
{
|
{
|
||||||
if (_AutoAnimSet == NULL)
|
if (_AutoAnimSet == NULL)
|
||||||
_AutoAnimSet = Driver->createAnimationSet();
|
_AutoAnimSet = CInterfaceManager::getInstance()->getViewRenderer().getDriver()->createAnimationSet();
|
||||||
uint id = _AutoAnimSet->addAnimation (ptr, animName.c_str ());
|
uint id = _AutoAnimSet->addAnimation (ptr, animName.c_str ());
|
||||||
if (id == UAnimationSet::NotFound)
|
if (id == UAnimationSet::NotFound)
|
||||||
{
|
{
|
||||||
|
@ -376,7 +378,9 @@ void CInterface3DScene::draw ()
|
||||||
{
|
{
|
||||||
H_AUTO( RZ_Interface_CInterface3DScene_draw )
|
H_AUTO( RZ_Interface_CInterface3DScene_draw )
|
||||||
|
|
||||||
if (Driver == NULL)
|
NL3D::UDriver *Driver = CInterfaceManager::getInstance()->getViewRenderer().getDriver();
|
||||||
|
|
||||||
|
if ( Driver == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// No Op if screen minimized
|
// No Op if screen minimized
|
||||||
|
@ -434,7 +438,7 @@ void CInterface3DScene::draw ()
|
||||||
float vpW = (float) clipw / iavoid0(wsw);
|
float vpW = (float) clipw / iavoid0(wsw);
|
||||||
float vpH = (float) cliph / iavoid0(wsh);
|
float vpH = (float) cliph / iavoid0(wsh);
|
||||||
newVP.init(vpX, vpY, vpW, vpH);
|
newVP.init(vpX, vpY, vpW, vpH);
|
||||||
NL3D::CFrustum oldFrustum = Driver->getFrustum();
|
NL3D::CFrustum oldFrustum = CInterfaceManager::getInstance()->getViewRenderer().getDriver()->getFrustum();
|
||||||
NL3D::CFrustum newFrustum;
|
NL3D::CFrustum newFrustum;
|
||||||
newFrustum.initPerspective (pI3DCam->getFOV() * (float) (NLMISC::Pi / 180), (float) _WReal / iavoid0(_HReal), 0.1f, 100.f);
|
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);
|
setRotX (_Rot.x);
|
||||||
setRotY (_Rot.y);
|
setRotY (_Rot.y);
|
||||||
setRotZ (_Rot.z);
|
setRotZ (_Rot.z);
|
||||||
_IG->addToScene (*parentGroup->getScene(), Driver);
|
_IG->addToScene (*parentGroup->getScene(), CInterfaceManager::getInstance()->getViewRenderer().getDriver() );
|
||||||
parentGroup->getScene()->setToGlobalInstanceGroup (_IG);
|
parentGroup->getScene()->setToGlobalInstanceGroup (_IG);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1214,7 +1218,7 @@ void CInterface3DIG::setName (const std::string &ht)
|
||||||
_IG = UInstanceGroup::createInstanceGroup(_Name);
|
_IG = UInstanceGroup::createInstanceGroup(_Name);
|
||||||
if (_IG == NULL) return;
|
if (_IG == NULL) return;
|
||||||
_IG->setPos (_Pos);
|
_IG->setPos (_Pos);
|
||||||
_IG->addToScene (*pI3DS->getScene(), Driver);
|
_IG->addToScene (*pI3DS->getScene(), CInterfaceManager::getInstance()->getViewRenderer().getDriver() );
|
||||||
pI3DS->getScene()->setToGlobalInstanceGroup (_IG);
|
pI3DS->getScene()->setToGlobalInstanceGroup (_IG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,8 @@ int CInterfaceManager::DebugTrackGroupsGetId( CInterfaceGroup *pIG )
|
||||||
#endif // AJM_DEBUG_TRACK_INTERFACE_GROUPS
|
#endif // AJM_DEBUG_TRACK_INTERFACE_GROUPS
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
CInterfaceManager::CInterfaceManager()
|
CInterfaceManager::CInterfaceManager() :
|
||||||
|
_ViewRenderer( Driver )
|
||||||
{
|
{
|
||||||
_Instance = this;
|
_Instance = this;
|
||||||
_DbRootNode = new CCDBNodeBranch("ROOT");
|
_DbRootNode = new CCDBNodeBranch("ROOT");
|
||||||
|
|
|
@ -414,7 +414,7 @@ COptionsAnimationSet::~COptionsAnimationSet()
|
||||||
BUT this is OK, since the actual animationSet is kept by SmartPtr through UPlayList
|
BUT this is OK, since the actual animationSet is kept by SmartPtr through UPlayList
|
||||||
(see deleteAnimationSet() doc)
|
(see deleteAnimationSet() doc)
|
||||||
*/
|
*/
|
||||||
Driver->deleteAnimationSet(AnimationSet);
|
CInterfaceManager::getInstance()->getViewRenderer().getDriver()->deleteAnimationSet(AnimationSet);
|
||||||
AnimationSet= NULL;
|
AnimationSet= NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -424,10 +424,10 @@ bool COptionsAnimationSet::parse (xmlNodePtr cur)
|
||||||
{
|
{
|
||||||
bool result = CInterfaceOptions::parse(cur);
|
bool result = CInterfaceOptions::parse(cur);
|
||||||
if (!result) return false;
|
if (!result) return false;
|
||||||
nlassert(Driver);
|
nlassert( CInterfaceManager::getInstance()->getViewRenderer().getDriver() );
|
||||||
|
|
||||||
// create the animation set
|
// create the animation set
|
||||||
AnimationSet= Driver->createAnimationSet();
|
AnimationSet= CInterfaceManager::getInstance()->getViewRenderer().getDriver()->createAnimationSet();
|
||||||
nlassert(AnimationSet);
|
nlassert(AnimationSet);
|
||||||
|
|
||||||
AnimMale.clear();
|
AnimMale.clear();
|
||||||
|
|
|
@ -118,7 +118,8 @@ using namespace NLMISC;
|
||||||
|
|
||||||
void badLuaParseMessageBox()
|
void badLuaParseMessageBox()
|
||||||
{
|
{
|
||||||
NL3D::UDriver::TMessageBoxId ret = Driver->systemMessageBox( "LUA files reading failed!\n"
|
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"
|
"Some LUA files are corrupted, moved or may have been removed.\n"
|
||||||
"Ryzom may need to be restarted to run properly.\n"
|
"Ryzom may need to be restarted to run properly.\n"
|
||||||
"Would you like to quit now?",
|
"Would you like to quit now?",
|
||||||
|
|
|
@ -701,7 +701,7 @@ void CViewPointer::drawCursor(sint32 texId, NLMISC::CRGBA col, uint8 rot)
|
||||||
{
|
{
|
||||||
// set new cursor for the hardware mouse
|
// set new cursor for the hardware mouse
|
||||||
std::string name = rVR.getTextureNameFromId(texId);
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,45 +30,15 @@ using namespace NLMISC;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NL3D;
|
using namespace NL3D;
|
||||||
|
|
||||||
|
CViewRenderer::CViewRenderer( NL3D::UDriver *driver )
|
||||||
/*
|
|
||||||
* constructor
|
|
||||||
*/
|
|
||||||
CViewRenderer::CViewRenderer()
|
|
||||||
{
|
{
|
||||||
_ClipX = _ClipY = 0;
|
setup();
|
||||||
_ClipW = 800;
|
|
||||||
_ClipH = 600;
|
this->driver = driver;
|
||||||
_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;i<VR_NUM_LAYER;i++)
|
|
||||||
{
|
|
||||||
_StringRBLayers[i]= NULL;
|
|
||||||
_EmptyLayer[i]= true;
|
|
||||||
}
|
|
||||||
_BlankGlobalTexture = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* destructor
|
|
||||||
*/
|
|
||||||
CViewRenderer::~CViewRenderer()
|
CViewRenderer::~CViewRenderer()
|
||||||
{
|
{
|
||||||
if (!_Material.empty() && Driver)
|
|
||||||
Driver->deleteMaterial(_Material);
|
|
||||||
|
|
||||||
for(uint i=0;i<VR_NUM_LAYER;i++)
|
for(uint i=0;i<VR_NUM_LAYER;i++)
|
||||||
{
|
{
|
||||||
delete _StringRBLayers[i];
|
delete _StringRBLayers[i];
|
||||||
|
@ -101,9 +71,9 @@ void CViewRenderer::setClipWindow (sint32 x, sint32 y, sint32 w, sint32 h)
|
||||||
*/
|
*/
|
||||||
void CViewRenderer::checkNewScreenSize ()
|
void CViewRenderer::checkNewScreenSize ()
|
||||||
{
|
{
|
||||||
if (!Driver) return;
|
if (!driver) return;
|
||||||
uint32 w, h;
|
uint32 w, h;
|
||||||
Driver->getWindowSize (w, h);
|
driver->getWindowSize (w, h);
|
||||||
// not minimized? change coords
|
// not minimized? change coords
|
||||||
if(w!=0 && h!=0)
|
if(w!=0 && h!=0)
|
||||||
{
|
{
|
||||||
|
@ -145,14 +115,40 @@ void CViewRenderer::getScreenOOSize (float &oow, float &ooh)
|
||||||
ooh= _OneOverScreenH;
|
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;i<VR_NUM_LAYER;i++)
|
||||||
|
{
|
||||||
|
_StringRBLayers[i]= NULL;
|
||||||
|
_EmptyLayer[i]= true;
|
||||||
|
}
|
||||||
|
_BlankGlobalTexture = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* init: init material and string buffer
|
* init: init material and string buffer
|
||||||
*/
|
*/
|
||||||
void CViewRenderer::init()
|
void CViewRenderer::init()
|
||||||
{
|
{
|
||||||
if (!Driver) return;
|
if (!driver) return;
|
||||||
_Material = Driver->createMaterial();
|
_Material = driver->createMaterial();
|
||||||
|
|
||||||
setRenderStates();
|
setRenderStates();
|
||||||
|
|
||||||
|
@ -188,7 +184,7 @@ void CViewRenderer::reset()
|
||||||
UTextureFile *tf = dynamic_cast<NL3D::UTextureFile *>(ite->Texture);
|
UTextureFile *tf = dynamic_cast<NL3D::UTextureFile *>(ite->Texture);
|
||||||
if (tf)
|
if (tf)
|
||||||
{
|
{
|
||||||
Driver->deleteTextureFile (tf);
|
driver->deleteTextureFile (tf);
|
||||||
}
|
}
|
||||||
ite++;
|
ite++;
|
||||||
}
|
}
|
||||||
|
@ -200,6 +196,10 @@ void CViewRenderer::reset()
|
||||||
_IndexesToTextureIds.clear();
|
_IndexesToTextureIds.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NL3D::UDriver* CViewRenderer::getDriver(){
|
||||||
|
return driver;
|
||||||
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CViewRenderer::SImage::setupQuadUV(bool flipv, uint8 rot, CQuadColorUV &dest)
|
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;
|
CIFile ifTmp;
|
||||||
if (ifTmp.open(filename))
|
if (ifTmp.open(filename))
|
||||||
CBitmap::loadSize (ifTmp, gt.Width, gt.Height);
|
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.
|
// 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)
|
// Its why we don't release it at the end, because it is likely to be uploaded soon)
|
||||||
CBitmap *texDatas = gt.Texture->generateDatas();
|
CBitmap *texDatas = gt.Texture->generateDatas();
|
||||||
|
@ -729,7 +729,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std:
|
||||||
|
|
||||||
_GlobalTextures.push_back (gt);
|
_GlobalTextures.push_back (gt);
|
||||||
|
|
||||||
Driver->setCursorScale(ClientCfg.HardwareCursorScale);
|
driver->setCursorScale(ClientCfg.HardwareCursorScale);
|
||||||
|
|
||||||
char bufTmp[256], tgaName[256];
|
char bufTmp[256], tgaName[256];
|
||||||
string sTGAname;
|
string sTGAname;
|
||||||
|
@ -781,7 +781,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std:
|
||||||
CBitmap curs;
|
CBitmap curs;
|
||||||
curs.resize(x1 - x0, y1 - y0);
|
curs.resize(x1 - x0, y1 - y0);
|
||||||
curs.blit(*texDatas, x0, y0, (x1 - x0), (y1 - y0), 0, 0);
|
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());
|
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.Name = sLwrGTName;
|
||||||
gtTmp.Texture->setFilterMode(UTexture::Nearest, UTexture::NearestMipMapOff);
|
gtTmp.Texture->setFilterMode(UTexture::Nearest, UTexture::NearestMipMapOff);
|
||||||
if(uploadDXTC)
|
if(uploadDXTC)
|
||||||
|
@ -1007,7 +1007,7 @@ void CViewRenderer::deleteTexture (sint32 textureId)
|
||||||
UTextureFile *tf = dynamic_cast<NL3D::UTextureFile *>(iteGT->Texture);
|
UTextureFile *tf = dynamic_cast<NL3D::UTextureFile *>(iteGT->Texture);
|
||||||
if (tf)
|
if (tf)
|
||||||
{
|
{
|
||||||
Driver->deleteTextureFile (tf);
|
driver->deleteTextureFile (tf);
|
||||||
}
|
}
|
||||||
_GlobalTextures.erase (iteGT);
|
_GlobalTextures.erase (iteGT);
|
||||||
return;
|
return;
|
||||||
|
@ -1151,13 +1151,13 @@ void CViewRenderer::flush ()
|
||||||
// draw quads and empty list
|
// draw quads and empty list
|
||||||
if (layer.NbQuads != 0)
|
if (layer.NbQuads != 0)
|
||||||
{
|
{
|
||||||
Driver->drawQuads (&(layer.Quads[0]), layer.NbQuads, _Material);
|
driver->drawQuads (&(layer.Quads[0]), layer.NbQuads, _Material);
|
||||||
layer.NbQuads = 0;
|
layer.NbQuads = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!layer.Tris.empty())
|
if (!layer.Tris.empty())
|
||||||
{
|
{
|
||||||
Driver->drawTriangles(layer.Tris, _Material);
|
driver->drawTriangles(layer.Tris, _Material);
|
||||||
layer.Tris.clear();
|
layer.Tris.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1178,12 +1178,12 @@ void CViewRenderer::flush ()
|
||||||
// alpha blended
|
// alpha blended
|
||||||
if (!layer.FilteredAlphaBlendedQuads.empty())
|
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();
|
layer.FilteredAlphaBlendedQuads.clear();
|
||||||
}
|
}
|
||||||
if (!layer.FilteredAlphaBlendedTris.empty())
|
if (!layer.FilteredAlphaBlendedTris.empty())
|
||||||
{
|
{
|
||||||
Driver->drawTriangles(layer.FilteredAlphaBlendedTris, _Material);
|
driver->drawTriangles(layer.FilteredAlphaBlendedTris, _Material);
|
||||||
layer.FilteredAlphaBlendedTris.clear();
|
layer.FilteredAlphaBlendedTris.clear();
|
||||||
}
|
}
|
||||||
// additif
|
// additif
|
||||||
|
@ -1193,12 +1193,12 @@ void CViewRenderer::flush ()
|
||||||
_Material.setBlendFunc (NL3D::UMaterial::one, NL3D::UMaterial::one);
|
_Material.setBlendFunc (NL3D::UMaterial::one, NL3D::UMaterial::one);
|
||||||
if (!layer.FilteredAdditifQuads.empty())
|
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();
|
layer.FilteredAdditifQuads.clear();
|
||||||
}
|
}
|
||||||
if (!layer.FilteredAdditifTris.empty())
|
if (!layer.FilteredAdditifTris.empty())
|
||||||
{
|
{
|
||||||
Driver->drawTriangles(layer.FilteredAdditifTris, _Material);
|
driver->drawTriangles(layer.FilteredAdditifTris, _Material);
|
||||||
layer.FilteredAdditifTris.clear();
|
layer.FilteredAdditifTris.clear();
|
||||||
}
|
}
|
||||||
// restore alpha blend
|
// 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*/)
|
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*/)
|
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);
|
worldSpaceTransformation (qcoluv2_clipped);
|
||||||
|
|
||||||
// Draw clipped quad
|
// 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
|
// 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);
|
worldSpaceTransformation (qcoluv2_clipped);
|
||||||
|
|
||||||
// Draw clipped quad
|
// Draw clipped quad
|
||||||
Driver->drawQuads (&qcoluv2_clipped, 1, Mat);
|
driver->drawQuads (&qcoluv2_clipped, 1, Mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
|
@ -29,16 +29,6 @@
|
||||||
#include "../ingame_database_manager.h"
|
#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_NUM_LAYER 32
|
||||||
#define VR_BIAS_LAYER (VR_NUM_LAYER/2)
|
#define VR_BIAS_LAYER (VR_NUM_LAYER/2)
|
||||||
|
@ -113,15 +103,13 @@ public:
|
||||||
sint32 _TextureId;
|
sint32 _TextureId;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
CViewRenderer( NL3D::UDriver *driver );
|
||||||
* destructor
|
|
||||||
*/
|
|
||||||
CViewRenderer ();
|
|
||||||
/**
|
|
||||||
* destructor
|
|
||||||
*/
|
|
||||||
~CViewRenderer ();
|
~CViewRenderer ();
|
||||||
|
|
||||||
|
/// setup the default values for everything
|
||||||
|
void setup();
|
||||||
|
|
||||||
/// init when TextContext and Driver are created
|
/// init when TextContext and Driver are created
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
|
@ -131,6 +119,9 @@ public:
|
||||||
/// Delete all textures and the like and reset the view renderer
|
/// Delete all textures and the like and reset the view renderer
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
/// Retrieves the 3d driver we are using
|
||||||
|
NL3D::UDriver* getDriver();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* setClipWindow : set the current clipping window
|
* setClipWindow : set the current clipping window
|
||||||
* (this window do not inherit properties from parent or whatever)
|
* (this window do not inherit properties from parent or whatever)
|
||||||
|
@ -568,6 +559,8 @@ private:
|
||||||
NLMISC::CMatrix _WorldSpaceMatrix; // Matrix to be applied for world space transformation
|
NLMISC::CMatrix _WorldSpaceMatrix; // Matrix to be applied for world space transformation
|
||||||
bool _WorldSpaceScale;
|
bool _WorldSpaceScale;
|
||||||
|
|
||||||
|
|
||||||
|
NL3D::UDriver *driver;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -300,7 +300,6 @@ void CObjectRefIdClient::getNameInParent(std::string &name, sint32 &indexInArray
|
||||||
nlwarning("ObservedObject parent instance ptr = %p", parent);
|
nlwarning("ObservedObject parent instance ptr = %p", parent);
|
||||||
parent->getLuaProjection().dump();
|
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
|
nlassert(0); // not found in parent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue