dialog_about::dialog_about(context::context_gui &elems, IGUIEnvironment* env, std::map<std::wstring, std::wstring> &lang) : env_(env), lang_(lang), elems_(elems) { initElements(); }
HIDGamepad::HIDGamepad(IOHIDDeviceRef hidDevice) : m_hidDevice(hidDevice) { m_connectTime = m_lastUpdateTime = monotonicallyIncreasingTime(); CFNumberRef cfVendorID = (CFNumberRef)IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDVendorIDKey)); CFNumberRef cfProductID = (CFNumberRef)IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDProductIDKey)); int vendorID, productID; CFNumberGetValue(cfVendorID, kCFNumberIntType, &vendorID); CFNumberGetValue(cfProductID, kCFNumberIntType, &productID); CFStringRef cfProductName = (CFStringRef)IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDProductKey)); String productName(cfProductName); // Currently the spec has no formatting for the id string. // This string formatting matches Firefox. m_id = String::format("%x-%x-%s", vendorID, productID, productName.utf8().data()); initElements(); }
Options::Options(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder) : Gtk::Window(cobject){ builder->get_widget("SubEncodingOs", subEncodingCombo); //Gtk::ComboBox builder->get_widget("SubColorEntryOs", subColorEntry); //Gtk::Entry builder->get_widget("SubBackEntryOs", subBackgroundEntry); //Gtk::Entry builder->get_widget("SubSizeOs", subSizeCombo); //Gtk::ComboBox builder->get_widget("SubColorOptions", subColorButton); //Gtk::Button builder->get_widget("SubBackButtonOs1", subBackgroundButton); //Gtk::Button builder->get_widget("StatusMessageOs", statusMessageLabel); //Gtk::Label builder->get_widget("SaveOptions", saveButton); //Gtk::Button builder->get_widget("CancelOptions", cancelButton); //Gtk::Button mySubEncodingCombo = new MyComboBox(subEncodingCombo); mySubSizeCombo = new MyComboBox(subSizeCombo); initEncoding(); initElements(); saveButton->signal_clicked().connect(sigc::mem_fun(this, &Options::saveOptions)); cancelButton->signal_clicked().connect(sigc::mem_fun(this, &Options::CancelOptions)); this->signal_show ().connect(sigc::mem_fun(this, &Options::showWindow)); }
// react to keys void keyboard(unsigned char k, int, int) { switch(k) { case 27: { #ifdef OSG_WITH_NVPERFSDK NVPMShutdown(); #endif mgr = NULL; tact = NULL; debugact = NULL; scene = NULL; mainwin = NULL; debugwin = NULL; statfg = NULL; OSG::osgExit(); exit(0); } #ifdef OSG_OLD_RENDER_ACTION case 'v': { mgr->getAction()->setVolumeDrawing( !mgr->getAction()->getVolumeDrawing()); std::cerr << "Volume Drawing: " << (mgr->getAction()->getVolumeDrawing()?"on":"off") << std::endl; } case 'z': { OSG::RenderAction *ract = dynamic_cast<OSG::RenderAction *>(mgr->getAction()); ract->setZWriteTrans(!ract->getZWriteTrans()); std::cerr << "Switch TransZWrite to " << (ract->getZWriteTrans()?"on":"off") << std::endl; } break; #endif case 'r': { initElements(); bool buseTrav = mgr->getUseTraversalAction(); buseTrav = !buseTrav; mgr->setUseTraversalAction(buseTrav); } break; #ifdef OSG_OLD_RENDER_ACTION case 'n': fprintf(stderr, "1) set s sorting to %d\n", act->getStateSorting()); act->setStateSorting(!act->getStateSorting()); fprintf(stderr, "2) set s sorting to %d\n", act->getStateSorting()); break; #endif case 'k': tact->setKeyGen(0); break; case 's': { OSG::UInt32 uiSId = OSG::SimpleSHLChunk ::getStaticClassId() & 0x000003FF; OSG::UInt32 uiTId = OSG::TextureBaseChunk::getStaticClassId() & 0x000003FF; OSG::UInt32 uiMId = OSG::MaterialChunk ::getStaticClassId() & 0x000003FF; OSG::UInt32 uiKeyGen = (uiSId) | (uiTId << 10) | (uiMId << 20); tact->setKeyGen(uiKeyGen); } break; case 'g': bGLFinish = !bGLFinish; tact->setUseGLFinish(bGLFinish); #ifdef OSG_OLD_RENDER_ACTION act->setUseGLFinish(bGLFinish); #endif break; case 'C': { OSG::Real32 cov = tact->getOcclusionCullingCoveredThreshold(); cov+=0.1f; tact->setOcclusionCullingCoveredThreshold(cov); std::cout << "Covered Threshold now: " << cov << std::endl; } break; case 'c': { OSG::Real32 cov1 = tact->getOcclusionCullingCoveredThreshold(); cov1-=0.1f; tact->setOcclusionCullingCoveredThreshold(cov1); std::cout << "Covered Threshold now: " << cov1 << std::endl; } break; case 'M': { OSG::UInt32 minFSize = tact->getOcclusionCullingMinimumFeatureSize(); minFSize+=1; tact->setOcclusionCullingMinimumFeatureSize(minFSize); std::cout << "Minimum Feature Size now: " << minFSize << std::endl; } break; case 'm': { OSG::UInt32 small1 = tact->getOcclusionCullingMinimumFeatureSize(); small1-=1; tact->setOcclusionCullingMinimumFeatureSize(small1); std::cout << "Minimum Feature Size now: " << small1 << std::endl; } break; case 'I': { OSG::UInt32 visT = tact->getOcclusionCullingVisibilityThreshold(); visT+=1; tact->setOcclusionCullingVisibilityThreshold(visT); std::cout << "Visibility Threshold now: " << visT << std::endl; } break; case 'i': { OSG::UInt32 visTa = tact->getOcclusionCullingVisibilityThreshold(); visTa-=1; tact->setOcclusionCullingVisibilityThreshold(visTa); std::cout << "Visibility Threshold now: " << visTa << std::endl; } break; case 'l': { OSG::UInt32 numLev = tact->getScreenLODNumLevels(); numLev-=1; tact->setScreenLODNumLevels(numLev); std::cout << "LOD's in use now: " << numLev << std::endl; } break; case 'L': { OSG::UInt32 numLeva = tact->getScreenLODNumLevels(); numLeva+=1; tact->setScreenLODNumLevels(numLeva); std::cout << "LOD's in use now: " << numLeva << std::endl; } break; case 'B': { OSG::UInt32 bfsz = tact->getOcclusionCullingQueryBufferSize(); bfsz+=200; tact->setOcclusionCullingQueryBufferSize(bfsz); std::cout << "Query Buffer Size now: " << bfsz << std::endl; } break; case 'b': { OSG::UInt32 bfsza = tact->getOcclusionCullingQueryBufferSize(); bfsza-=200; tact->setOcclusionCullingQueryBufferSize(bfsza); std::cout << "Query Buffer Size now: " << bfsza << std::endl; } break; case 't': { OSG::UInt32 tcount = tact->getOcclusionCullingMinimumTriangleCount(); tcount-=50; tact->setOcclusionCullingMinimumTriangleCount(tcount); std::cout << "Minimum Triangle Count now: " << tcount << std::endl; } break; case 'T': { OSG::UInt32 tcounta = tact->getOcclusionCullingMinimumTriangleCount(); tcounta+=50; tact->setOcclusionCullingMinimumTriangleCount(tcounta); std::cout << "Minimum Triangle Count now: " << tcounta << std::endl; } break; case 'H': { OSG::UInt32 mfsa = 0; OSG::Real32 sfta = 0.0f; tact->setOcclusionCullingMinimumFeatureSize(mfsa); tact->setOcclusionCullingVisibilityThreshold(mfsa); tact->setScreenLODCoverageThreshold(sfta); std::cout << "High Resolution Mode" << std::endl; } break; case 'h': { OSG::UInt32 mfs = 1000; OSG::Real32 sft = 0.15f; tact->setOcclusionCullingMinimumFeatureSize(mfs); tact->setOcclusionCullingVisibilityThreshold(mfs); tact->setScreenLODCoverageThreshold(sft); std::cout << "Low Resolution Mode" << std::endl; } break; case 'P': { OSG::Real32 cover = tact->getScreenLODCoverageThreshold(); cover+=0.001f; tact->setScreenLODCoverageThreshold(cover); std::cout << "ScreenLOD Coverage Threshold now: " << cover << std::endl; } break; case 'p': { OSG::Real32 covera = tact->getScreenLODCoverageThreshold(); covera-=0.001f; tact->setScreenLODCoverageThreshold(covera); std::cout << "ScreenLOD Coverage Threshold now: " << covera << std::endl; } break; case 'D': { OSG::Real32 user_dega = tact->getScreenLODDegradationFactor(); user_dega+=0.01f; tact->setScreenLODDegradationFactor(user_dega); std::cout << "ScreenLOD User Degradation Factor now: " << user_dega << std::endl; } break; case 'd': { OSG::Real32 user_deg = tact->getScreenLODDegradationFactor(); user_deg-=0.01f; tact->setScreenLODDegradationFactor(user_deg); std::cout << "ScreenLOD User Degradation Factor now: " << user_deg << std::endl; } break; case 'N': { OSG::Real32 coverb = tact->getScreenLODCoverageThreshold(); coverb=0.0; tact->setScreenLODCoverageThreshold(coverb); std::cout << "ScreenLOD Coverage Threshold now: " << coverb << std::endl; } break; case 'o': { tact->setOcclusionCulling(false); std::cout << "OCC Off" << std::endl; } break; case 'O': { tact->setOcclusionCulling(true); std::cout << "OCC On" << std::endl; } break; case 'f': { std::cout << "Freeze Occlusion result" << std::endl; //initElements(); mgr->setUseTraversalAction(false); // Render stuff that is visible and tested mgr->getWindow()->getPort(0)->setTravMask(0x5); } break; case 'F': { std::cout << "Unfreeze Occlusion result" << std::endl; //initElements(); mgr->setUseTraversalAction(true); mgr->getWindow()->getPort(0)->setTravMask(0xffffffff); } break; case 'W': { std::string sss = "out.osb"; OSG::SceneFileHandler::the()->write(scene, sss.c_str()); } break; #ifdef OSG_WITH_NVPERFSDK case 'e': runExperiment = true; break; #endif } redisplay(); }