Fixed: Build object viewer widget on Mac OS X (and line terminator consistency)
This commit is contained in:
parent
587d1820c4
commit
dab1bec1aa
1 changed files with 91 additions and 91 deletions
|
@ -54,10 +54,10 @@ namespace NLQT
|
|||
CObjectViewerWidget *CObjectViewerWidget::_objectViewerWidget = NULL;
|
||||
|
||||
CObjectViewerWidget::CObjectViewerWidget(QWidget *parent)
|
||||
: _isGraphicsInitialized(false), _isGraphicsEnabled(false),
|
||||
_Driver(NULL), _Light(0), _phi(0), _psi(0),_dist(2),
|
||||
_CameraFocal(75), _CurrentInstance(""), _BloomEffect(false),
|
||||
_Scene(0), QWidget(parent)
|
||||
: _isGraphicsInitialized(false), _isGraphicsEnabled(false),
|
||||
_Driver(NULL), _Light(0), _phi(0), _psi(0),_dist(2),
|
||||
_CameraFocal(75), _CurrentInstance(""), _BloomEffect(false),
|
||||
_Scene(0), QWidget(parent)
|
||||
{
|
||||
|
||||
_objectViewerWidget = this;
|
||||
|
@ -89,7 +89,7 @@ namespace NLQT
|
|||
//dynamic_cast<QNLWidget*>(widget())->makeCurrent();
|
||||
#endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
|
||||
|
||||
nlWindow wnd = winId();
|
||||
nlWindow wnd = (nlWindow)winId();
|
||||
uint16 w = width();
|
||||
uint16 h = height();
|
||||
|
||||
|
@ -112,7 +112,7 @@ namespace NLQT
|
|||
//else nlwarning("Invalid driver specified, defaulting to OpenGL");
|
||||
#endif
|
||||
|
||||
//Modules::config().setAndCallback("CameraFocal",CConfigCallback(this,&CObjectViewer::cfcbCameraFocal));
|
||||
//Modules::config().setAndCallback("CameraFocal",CConfigCallback(this,&CObjectViewer::cfcbCameraFocal));
|
||||
//Modules::config().setAndCallback("BloomEffect",CConfigCallback(this,&CObjectViewer::cfcbBloomEffect));
|
||||
|
||||
// create the driver
|
||||
|
@ -164,10 +164,10 @@ namespace NLQT
|
|||
_MouseListener->setHotSpot(hotSpot);
|
||||
_MouseListener->setMouseMode(U3dMouseListener::edit3d);
|
||||
|
||||
NL3D::CBloomEffect::instance().setDriver(_Driver);
|
||||
NL3D::CBloomEffect::instance().setScene(_Scene);
|
||||
NL3D::CBloomEffect::instance().init(!_Direct3D);
|
||||
//NL3D::CBloomEffect::instance().setDensityBloom(Modules::config().getConfigFile().getVar("BloomDensity").asInt());
|
||||
NL3D::CBloomEffect::instance().setDriver(_Driver);
|
||||
NL3D::CBloomEffect::instance().setScene(_Scene);
|
||||
NL3D::CBloomEffect::instance().init(!_Direct3D);
|
||||
//NL3D::CBloomEffect::instance().setDensityBloom(Modules::config().getConfigFile().getVar("BloomDensity").asInt());
|
||||
//NL3D::CBloomEffect::instance().setSquareBloom(Modules::config().getConfigFile().getVar("BloomSquare").asBool());
|
||||
}
|
||||
|
||||
|
@ -344,11 +344,11 @@ namespace NLQT
|
|||
|
||||
void CObjectViewerWidget::renderDriver()
|
||||
{
|
||||
// Render the scene.
|
||||
if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect))
|
||||
{
|
||||
NL3D::CBloomEffect::instance().initBloom();
|
||||
}
|
||||
// Render the scene.
|
||||
if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect))
|
||||
{
|
||||
NL3D::CBloomEffect::instance().initBloom();
|
||||
}
|
||||
_Driver->clearBuffers(_BackgroundColor);
|
||||
}
|
||||
|
||||
|
@ -357,10 +357,10 @@ namespace NLQT
|
|||
// render the scene
|
||||
_Scene->render();
|
||||
|
||||
if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect))
|
||||
{
|
||||
NL3D::CBloomEffect::instance().endBloom();
|
||||
NL3D::CBloomEffect::instance().endInterfacesDisplayBloom();
|
||||
if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect))
|
||||
{
|
||||
NL3D::CBloomEffect::instance().endBloom();
|
||||
NL3D::CBloomEffect::instance().endInterfacesDisplayBloom();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,8 +406,8 @@ namespace NLQT
|
|||
|
||||
bool CObjectViewerWidget::loadMesh(const std::string &meshFileName, const std::string &skelFileName)
|
||||
{
|
||||
std::string fileName = CFile::getFilenameWithoutExtension(meshFileName);
|
||||
if ( _Entities.count(fileName) != 0)
|
||||
std::string fileName = CFile::getFilenameWithoutExtension(meshFileName);
|
||||
if ( _Entities.count(fileName) != 0)
|
||||
return false;
|
||||
|
||||
CPath::display();
|
||||
|
@ -432,17 +432,17 @@ namespace NLQT
|
|||
CEntity &entity = (*eit).second;
|
||||
|
||||
// set the entity up
|
||||
entity._Name = fileName;
|
||||
entity._FileNameShape = meshFileName;
|
||||
entity._FileNameSkeleton = skelFileName;
|
||||
entity._Instance = Entity;
|
||||
if (!Skeleton.empty())
|
||||
{
|
||||
entity._Skeleton = Skeleton;
|
||||
entity._Skeleton.bindSkin (entity._Instance);
|
||||
}
|
||||
entity._AnimationSet = _Driver->createAnimationSet(false);
|
||||
entity._PlayList = _PlayListManager->createPlayList(entity._AnimationSet);
|
||||
entity._Name = fileName;
|
||||
entity._FileNameShape = meshFileName;
|
||||
entity._FileNameSkeleton = skelFileName;
|
||||
entity._Instance = Entity;
|
||||
if (!Skeleton.empty())
|
||||
{
|
||||
entity._Skeleton = Skeleton;
|
||||
entity._Skeleton.bindSkin (entity._Instance);
|
||||
}
|
||||
entity._AnimationSet = _Driver->createAnimationSet(false);
|
||||
entity._PlayList = _PlayListManager->createPlayList(entity._AnimationSet);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -699,65 +699,65 @@ namespace NLQT
|
|||
return true;
|
||||
}
|
||||
|
||||
#if defined(NL_OS_WINDOWS)
|
||||
|
||||
typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
bool CObjectViewerWidget::winEvent(MSG * message, long * result)
|
||||
{
|
||||
if (getDriver() && getDriver()->isActive())
|
||||
{
|
||||
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser*>(getDriver())->getDriver();
|
||||
if (driver)
|
||||
{
|
||||
winProc proc = (winProc)driver->getWindowProc();
|
||||
return proc(driver, message->hwnd, message->message, message->wParam, message->lParam);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#elif defined(NL_OS_MAC)
|
||||
|
||||
typedef bool (*cocoaProc)(NL3D::IDriver*, const void* e);
|
||||
|
||||
bool CObjectViewerWidget::macEvent(EventHandlerCallRef caller, EventRef event)
|
||||
{
|
||||
if(caller)
|
||||
nlerror("You are using QtCarbon! Only QtCocoa supported, please upgrade Qt");
|
||||
|
||||
if (getDriver() && getDriver()->isActive())
|
||||
{
|
||||
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser*>(getDriver())->getDriver();
|
||||
if (driver)
|
||||
{
|
||||
cocoaProc proc = (cocoaProc)driver->getWindowProc();
|
||||
return proc(driver, event);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#elif defined(NL_OS_UNIX)
|
||||
|
||||
typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e);
|
||||
|
||||
bool CObjectViewerWidget::x11Event(XEvent *event)
|
||||
{
|
||||
if (getDriver() && getDriver()->isActive())
|
||||
{
|
||||
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser*>(getDriver())->getDriver();
|
||||
if (driver)
|
||||
{
|
||||
x11Proc proc = (x11Proc)driver->getWindowProc();
|
||||
return proc(driver, event);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#if defined(NL_OS_WINDOWS)
|
||||
|
||||
typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
bool CObjectViewerWidget::winEvent(MSG * message, long * result)
|
||||
{
|
||||
if (getDriver() && getDriver()->isActive())
|
||||
{
|
||||
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser*>(getDriver())->getDriver();
|
||||
if (driver)
|
||||
{
|
||||
winProc proc = (winProc)driver->getWindowProc();
|
||||
return proc(driver, message->hwnd, message->message, message->wParam, message->lParam);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#elif defined(NL_OS_MAC)
|
||||
|
||||
typedef bool (*cocoaProc)(NL3D::IDriver*, const void* e);
|
||||
|
||||
bool CObjectViewerWidget::macEvent(EventHandlerCallRef caller, EventRef event)
|
||||
{
|
||||
if(caller)
|
||||
nlerror("You are using QtCarbon! Only QtCocoa supported, please upgrade Qt");
|
||||
|
||||
if (getDriver() && getDriver()->isActive())
|
||||
{
|
||||
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser*>(getDriver())->getDriver();
|
||||
if (driver)
|
||||
{
|
||||
cocoaProc proc = (cocoaProc)driver->getWindowProc();
|
||||
return proc(driver, event);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#elif defined(NL_OS_UNIX)
|
||||
|
||||
typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e);
|
||||
|
||||
bool CObjectViewerWidget::x11Event(XEvent *event)
|
||||
{
|
||||
if (getDriver() && getDriver()->isActive())
|
||||
{
|
||||
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser*>(getDriver())->getDriver();
|
||||
if (driver)
|
||||
{
|
||||
x11Proc proc = (x11Proc)driver->getWindowProc();
|
||||
return proc(driver, event);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
} /* namespace NLQT */
|
||||
|
|
Loading…
Reference in a new issue