|
|
@ -32,6 +32,7 @@ namespace MaterialEditor
|
|
|
|
QWidget( parent )
|
|
|
|
QWidget( parent )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nl3dIface = NULL;
|
|
|
|
nl3dIface = NULL;
|
|
|
|
|
|
|
|
timerId = 0;
|
|
|
|
setAttribute( Qt::WA_PaintOnScreen, true );
|
|
|
|
setAttribute( Qt::WA_PaintOnScreen, true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -55,73 +56,98 @@ namespace MaterialEditor
|
|
|
|
QWidget::resizeEvent( evnt );
|
|
|
|
QWidget::resizeEvent( evnt );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ViewPortWidget::startTimedUpdates( int interval )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if( interval == 0 )
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
#if defined( NL_OS_WINDOWS )
|
|
|
|
timerId = startTimer( interval );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
typedef bool ( *winProc )( NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
|
|
|
|
void ViewPortWidget::stopTimedUpdates()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
killTimer( timerId );
|
|
|
|
|
|
|
|
timerId = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ViewPortWidget::winEvent( MSG *message, long *result )
|
|
|
|
void ViewPortWidget::timerEvent( QTimerEvent *evnt )
|
|
|
|
{
|
|
|
|
|
|
|
|
NL3D::UDriver *udriver = nl3dIface->getDriver();
|
|
|
|
|
|
|
|
if( ( udriver != NULL ) && udriver->isActive() )
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NL3D::IDriver *driver = dynamic_cast< NL3D::CDriverUser* >( udriver )->getDriver();
|
|
|
|
int id = evnt->timerId();
|
|
|
|
if( driver != NULL )
|
|
|
|
if( id == timerId )
|
|
|
|
{
|
|
|
|
update();
|
|
|
|
winProc proc = (winProc)driver->getWindowProc();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return proc( driver, message->hwnd, message->message, message->wParam, message->lParam );
|
|
|
|
#if defined( NL_OS_WINDOWS )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef bool ( *winProc )( NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool ViewPortWidget::winEvent( MSG *message, long *result )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
NL3D::UDriver *udriver = nl3dIface->getDriver();
|
|
|
|
|
|
|
|
if( ( udriver != NULL ) && udriver->isActive() )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
NL3D::IDriver *driver = dynamic_cast< NL3D::CDriverUser* >( udriver )->getDriver();
|
|
|
|
|
|
|
|
if( driver != NULL )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
winProc proc = (winProc)driver->getWindowProc();
|
|
|
|
|
|
|
|
return proc( driver, message->hwnd, message->message, message->wParam, message->lParam );
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#elif defined( NL_OS_MAC )
|
|
|
|
#elif defined( NL_OS_MAC )
|
|
|
|
|
|
|
|
|
|
|
|
typedef bool ( *cocoaProc )( NL3D::IDriver *, const void *e );
|
|
|
|
typedef bool ( *cocoaProc )( NL3D::IDriver *, const void *e );
|
|
|
|
|
|
|
|
|
|
|
|
bool ViewPortWidget::macEvent( EventHandlerCallRef caller, EventRef event )
|
|
|
|
bool ViewPortWidget::macEvent( EventHandlerCallRef caller, EventRef event )
|
|
|
|
{
|
|
|
|
|
|
|
|
if(caller)
|
|
|
|
|
|
|
|
nlerror("You are using QtCarbon! Only QtCocoa supported, please upgrade Qt");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NL3D::UDriver *udriver = nl3dIface->getDriver();
|
|
|
|
|
|
|
|
if( ( udriver != NULL ) && udriver->isActive() )
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NL3D::IDriver *driver = dynamic_cast< NL3D::CDriverUser* >( udriver )->getDriver();
|
|
|
|
if( caller )
|
|
|
|
if( driver != NULL )
|
|
|
|
nlerror("You are using QtCarbon! Only QtCocoa supported, please upgrade Qt");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NL3D::UDriver *udriver = nl3dIface->getDriver();
|
|
|
|
|
|
|
|
if( ( udriver != NULL ) && udriver->isActive() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cocoaProc proc = ( cocoaProc )driver->getWindowProc();
|
|
|
|
NL3D::IDriver *driver = dynamic_cast< NL3D::CDriverUser* >( udriver )->getDriver();
|
|
|
|
proc( driver, event );
|
|
|
|
if( driver != NULL )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cocoaProc proc = ( cocoaProc )driver->getWindowProc();
|
|
|
|
|
|
|
|
proc( driver, event );
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#elif defined( NL_OS_UNIX )
|
|
|
|
#elif defined( NL_OS_UNIX )
|
|
|
|
|
|
|
|
|
|
|
|
typedef bool ( *x11Proc )( NL3D::IDriver *drv, XEvent *e );
|
|
|
|
typedef bool ( *x11Proc )( NL3D::IDriver *drv, XEvent *e );
|
|
|
|
|
|
|
|
|
|
|
|
bool ViewPortWidget::x11Event( XEvent *event )
|
|
|
|
bool ViewPortWidget::x11Event( XEvent *event )
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NL3D::UDriver *udriver = nl3dIface->getDriver();
|
|
|
|
|
|
|
|
if( ( udriver != NULL ) && udriver->isActive() )
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NL3D::IDriver *driver = dynamic_cast< NL3D::CDriverUser* >( udriver )->getDriver();
|
|
|
|
NL3D::UDriver *udriver = nl3dIface->getDriver();
|
|
|
|
if( driver != NULL )
|
|
|
|
|
|
|
|
|
|
|
|
if( ( udriver != NULL ) && udriver->isActive() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
x11Proc proc = ( x11Proc )driver->getWindowProc();
|
|
|
|
NL3D::IDriver *driver = dynamic_cast< NL3D::CDriverUser* >( udriver )->getDriver();
|
|
|
|
proc( driver, event );
|
|
|
|
if( driver != NULL )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
x11Proc proc = ( x11Proc )driver->getWindowProc();
|
|
|
|
|
|
|
|
proc( driver, event );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ViewPortWidget::update()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
nl3dIface->renderScene();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|