void Osg3dView::paintGL() { vDebug("paintGL"); // Update the camera osg::Camera *cam = this->getCamera(); const osg::Viewport* vp = cam->getViewport(); m_viewingCore->setAspect(vp->width() / vp->height()); cam->setViewMatrix(m_viewingCore->getInverseMatrix()); cam->setProjectionMatrix(m_viewingCore->computeProjection()); // if m_timeToDrawLastFrame > threshold && m_mouseIsPressed // draw simplified // else // draw the full polygon mesh QTime frameTimer = QTime::currentTime(); // Invoke the OSG traversal pipeline frame(); m_timeToDrawLastFrame = frameTimer.elapsed(); emit updated(); }
void Osg3dView::resizeGL(int w, int h) { vDebug("resizeGL"); m_osgGraphicsWindow->getEventQueue()->windowResize(9, 0, w, h); m_osgGraphicsWindow->resized(0,0,w,h); }
void Osg3dView::mousePressEvent(QMouseEvent *event) { vDebug("mousePressEvent"); if (event->button() == Qt::LeftButton) { m_savedEventNDCoords = getNormalized(event->x(), event->y()); // always identify the item under the mouse in case // it is a drag object findObjectsUnderMouseEvent(); // if np.at(1) != loadedModel we are dragging/clicking some control // in that case we want to stash the current mouse mode, do the drag // and restore the mouse mode when we are done. // Do the job asked if (m_mouseMode & (MM_PAN|MM_ROTATE|MM_ORBIT|MM_ZOOM) ) m_viewingCore->setPanStart( m_savedEventNDCoords.x(), m_savedEventNDCoords.y()); else if (m_mouseMode & MM_PICK_CENTER) { m_viewingCore->pickCenter(m_savedEventNDCoords.x(), m_savedEventNDCoords.y() ); update(); } else if (m_mouseMode & MM_SELECT) { // In this case we probably want to skip any intersections with // objects other than those under loadedModel; pickAnObjectFromView(); } m_mouseIsPressed = true; } }
void Osg3dView::mouseReleaseEvent(QMouseEvent *event) { vDebug("mouseReleaseEvent"); m_savedEventNDCoords = getNormalized(event->x(), event->y()); if (event->button() == Qt::LeftButton) m_mouseIsPressed = false; }
void ErrorHandler::debug (const char *format, ...) { if (verbosity() > QUIET) { va_list argptr; va_start (argptr, format); vDebug (format, argptr); va_end (argptr); } }
void PRINT_ADDRESSES(uint32* pu32Stack) { u32EPCR = pu32Stack[PROGRAM_COUNTER]; u32EEAR = pu32Stack[EFFECTIVE_ADDR]; u32Stack = pu32Stack[STACK_REG]; vUTIL_NumToString(u32EPCR, c); vDebug("PC: "); vDebug(c); vDebug("\n"); vUTIL_NumToString(u32EEAR, c); vDebug("Eff. Addr.: "); vDebug(c); vDebug("\n"); vUTIL_NumToString(u32Stack, c); vDebug("SP: "); vDebug(c); vDebug("\n"); }
void _jn516_custom_exception_bus_error(uint32* pu32Stack, int type) { unsigned char TX_BUFFER[100]; LED_INIT(); UART_INIT(TX_BUFFER); while (TRUE) { SOS(); BLINK(1); vDebug("Bus Error\n"); PRINT_ADDRESSES(pu32Stack); LONG_OFF(); } }
void _jn516_custom_exception_stack_overflow(uint32* pu32Stack, int type) { unsigned char TX_BUFFER[100]; LED_INIT(); UART_INIT(TX_BUFFER); while (TRUE) { SOS(); BLINK(7); vDebug("Stack Overflow\n"); PRINT_ADDRESSES(pu32Stack); LONG_OFF(); } }
void _jn516_custom_exception_illegal_instruction(uint32* pu32Stack, int type) { unsigned char TX_BUFFER[100]; LED_INIT(); UART_INIT(TX_BUFFER); while (TRUE) { SOS(); BLINK(3); vDebug("Illegal Instruction\n"); PRINT_ADDRESSES(pu32Stack); LONG_OFF(); } }
void _jn516_custom_exception_unaligned_access(uint32* pu32Stack, int type) { unsigned char TX_BUFFER[100]; LED_INIT(); UART_INIT(TX_BUFFER); while (TRUE) { SOS(); BLINK(2); vDebug("Unaligned Access\n"); PRINT_ADDRESSES(pu32Stack); LONG_OFF(); } }
void vJoy::updateWheelStatus(wheel_report_t* wReport) { iReport.bDevice = (BYTE)vID; iReport.wAxisX = wReport->wWheel; iReport.wAxisXRot = wReport->bThrottle*128; iReport.wAxisYRot = wReport->bBrake*128; iReport.wAxisZRot = wReport->bClutch*128; iReport.lButtons = wReport->wButtons; if (!UpdateVJD(vID, (void*)&iReport)) { vDebug() << "Feeding vJoy device failed\n"; AcquireVJD(vID); } }
void Osg3dView::mouseMoveEvent(QMouseEvent *event) { vDebug("mouseMoveEvent"); osg::Vec2d currentNDC = getNormalized(event->x(), event->y()); osg::Vec2d delta = currentNDC - m_savedEventNDCoords; switch (m_mouseMode) { case MM_ORBIT: m_viewingCore->rotate( m_savedEventNDCoords, delta); break; case MM_PAN: m_viewingCore->pan(delta.x(), delta.y()); break; case MM_ZOOM: { double tempScale = m_viewingCore->getFovyScale(); m_viewingCore->setFovyScale(1.03); if(delta.y() > 0) m_viewingCore->fovyScaleDown(); if(delta.y() < 0) m_viewingCore->fovyScaleUp(); m_viewingCore->setFovyScale(tempScale); break; } case MM_ROTATE: m_viewingCore->rotate( m_savedEventNDCoords, delta ); break; default: break; } m_savedEventNDCoords = currentNDC; update(); }
void Osg3dView::customMenuRequested(const QPoint &pos) { vDebug("customMenu %d %d", pos.x(), pos.y()); m_popupMenu.popup(this->mapToGlobal(pos)); }
vJoy::vJoy() { vID = V_ID; vJoyAcquired = false; iReport = {0}; force = 0; vLogsStr = new QString("================== vJoy Debug ==================\n"); debugStream = new QTextStream(vLogsStr); if (!vJoyEnabled()) { vDebug() << "Failed getting vJoy attributes\n"; } else { vDebug() << "Vendor: " << PVTEXT(GetvJoyManufacturerString())\ << "\nProduct: " << PVTEXT(GetvJoyProductString())\ <<"\nVersion Number: " << PVTEXT(GetvJoySerialNumberString()) << "\n"; } if (!DriverMatch(NULL, NULL)) { vDebug() << "Failed, vJoy Driver does not match vJoyInterface DLL\n"; } else vDebug() << "OK - vJoy Driver and vJoyInterface DLL versions match\n"; //Get the state of the requested device VjdStat status = GetVJDStatus(vID); switch (status) { case VJD_STAT_OWN: vDebug() << "vJoy Device " << vID << " is already owned by this feeder\n"; break; case VJD_STAT_FREE: vDebug() << "vJoy Device " << vID << " is free\n"; break; case VJD_STAT_BUSY: vDebug() << "vJoy Device " << vID << " is already owned by another feeder\nCannot continue\n"; case VJD_STAT_MISS: vDebug() << "vJoy Device " << vID << " is not installed or disabled\nCannot continue\n"; default: vDebug() << "vJoy Device " << vID << " general error\nCannot continue\n"; }; //Check which axes are supported bool AxisX = GetVJDAxisExist(vID, HID_USAGE_X); bool AxisRX = GetVJDAxisExist(vID, HID_USAGE_RX); bool AxisRY = GetVJDAxisExist(vID, HID_USAGE_RY); bool AxisRZ = GetVJDAxisExist(vID, HID_USAGE_RZ); int nButtons = GetVJDButtonNumber(vID); // Print results vDebug() << "-------- vJoy Device " << vID << " capabilities --------\n"; vDebug() << "Numner of buttons: " << nButtons << "\n"; vDebug() << "Axis X\t\t" << (AxisX?"Yes\n":"No\n"); vDebug() << "Axis Rx\t\t" << (AxisRX?"Yes\n":"No\n"); vDebug() << "Axis Ry\t\t" << (AxisRY?"Yes\n":"No\n"); vDebug() << "Axis Rz\t\t" << (AxisRZ?"Yes\n":"No\n"); //Acquire the target vJoy device if ((status == VJD_STAT_OWN) || ((status == VJD_STAT_FREE) && (!AcquireVJD(vID)))) { vDebug() << "Failed to acquire vJoy device number " << vID << "\n"; } else { vDebug() << "Acquired: vJoy device number " << vID << "\n"; ResetVJD(vID); vJoyAcquired = true; } //Start FFB if(!FfbStart(vID)) { vDebug() << "Failed to start FFB on vJoy device number " << vID << "\n"; } else { vDebug() << "Started FFB on vJoy device\n"; } //Register FFB callback function FfbRegisterGenCB(processFFB, NULL); }