//-------------------------------------------------------------- void ofApp::setup(){ this->payload.init(1920, 1080); this->decoder.init(this->payload); this->scene.init(); gui.init(); auto screenScene = gui.add(scene, "World"); gui.add(scene.viewCamera, "Camera View"); gui.add(scene.viewProjector0, "Projector0 View"); gui.add(scene.viewProjector1, "Projector1 View"); gui.add(scene.imageCamera0, "Camera0 Median"); gui.add(scene.imageCamera1, "Camera1 Median"); screenScene->setGridLabelsEnabled(false); screenScene->setGridEnabled(false); auto & camera = screenScene->getCamera(); camera.setPosition(2.0f, 2.0f, -1.0f); camera.lookAt(ofVec3f(0,0,-6.0f)); camera.setFov(90.0f); camera.setCursorDraw(true); camera.setNearClip(0.01f); camera.setFarClip(100.0f); ofBackground(50); ofSetVerticalSync(true); }
//---------- void Board::init() { RULR_NODE_INSPECTOR_LISTENER; RULR_NODE_SERIALIZATION_LISTENERS; this->boardType.set("Board Type", 0, 0, 1); this->sizeX.set("Size X", 10.0f, 2.0f, 20.0f); this->sizeY.set("Size Y", 7.0f, 2.0f, 20.0f); this->spacing.set("Spacing [m]", 0.05f, 0.001f, 1.0f); this->updatePreviewMesh(); auto view = MAKE(ofxCvGui::Panels::World); view->onDrawWorld += [this](ofCamera &) { this->previewMesh.draw(); }; view->setGridEnabled(false); #ifdef OFXCVGUI_USE_OFXGRABCAM view->getCamera().setCursorDrawEnabled(true); view->getCamera().setCursorDrawSize(this->spacing / 5.0f); #endif auto & camera = view->getCamera(); auto distance = this->spacing * MAX(this->sizeX, this->sizeY); camera.setPosition(0, 0, -distance); camera.lookAt(ofVec3f(), ofVec3f(0, -1, 0)); camera.setNearClip(distance / 100.0f); camera.setFarClip(distance * 100.0f); this->view = view; }
TileMapEditor::TileMapEditor(EditableTileMaps& tileMaps__, EditableLevelGraphicsData& levelGraphicsData__, EditableStandardPalettes& standardPalettes__) : tileMaps_(tileMaps__), levelGraphicsData_(levelGraphicsData__), standardPalettes_(standardPalettes__), currentIndex_(0), gridEnabled_(true) { changeTileMap(0); setGridEnabled(true); }
bool VCProperties::loadProperties(const QDomElement& root) { if (root.tagName() != KXMLQLCVCProperties) { qWarning() << Q_FUNC_INFO << "Virtual console properties node not found"; return false; } QString str; QDomNode node = root.firstChild(); while (node.isNull() == false) { QDomElement tag = node.toElement(); if (tag.tagName() == KXMLQLCVCPropertiesGrid) { /* Grid X resolution */ str = tag.attribute(KXMLQLCVCPropertiesGridXResolution); setGridX(str.toInt()); /* Grid Y resolution */ str = tag.attribute(KXMLQLCVCPropertiesGridYResolution); setGridY(str.toInt()); /* Grid enabled */ str = tag.attribute(KXMLQLCVCPropertiesGridEnabled); if (str == KXMLQLCTrue) setGridEnabled(true); else setGridEnabled(false); } else if (tag.tagName() == KXMLQLCVCPropertiesKeyboard) { /* Keyboard grab */ str = tag.attribute(KXMLQLCVCPropertiesKeyboardGrab); if (str == KXMLQLCTrue) setGrabKeyboard(true); else setGrabKeyboard(false); /* Key repeat */ str = tag.attribute(KXMLQLCVCPropertiesKeyboardRepeatOff); if (str == KXMLQLCTrue) setKeyRepeatOff(true); else setKeyRepeatOff(false); } else if (tag.tagName() == KXMLQLCVCPropertiesDefaultSlider) { quint32 low = 0; quint32 high = 10; quint32 universe = InputMap::invalidUniverse(); quint32 channel = InputMap::invalidChannel(); QDomElement subtag; /* Bus low limit */ str = tag.attribute(KXMLQLCVCPropertiesLowLimit); if (str.isEmpty() == false) low = quint32(str.toUInt()); /* Bus high limit */ str = tag.attribute(KXMLQLCVCPropertiesHighLimit); if (str.isEmpty() == false) high = quint32(str.toUInt()); /* Sliders' visibility (on by default) */ str = tag.attribute(KXMLQLCVCPropertiesDefaultSliderVisible); if (str.isEmpty() == false) { if (str == KXMLQLCTrue) setSlidersVisible(true); else setSlidersVisible(false); } /* External input */ bool ok = loadXMLInput(tag.firstChild().toElement(), &universe, &channel); if (tag.attribute(KXMLQLCBusRole) == KXMLQLCBusFade) { setFadeLimits(low, high); if (ok == true) setFadeInputSource(universe, channel); } else { setHoldLimits(low, high); if (ok == true) setHoldInputSource(universe, channel); } } else if (tag.tagName() == KXMLQLCVCPropertiesGrandMaster) { quint32 universe = InputMap::invalidUniverse(); quint32 channel = InputMap::invalidChannel(); str = tag.attribute(KXMLQLCVCPropertiesGrandMasterChannelMode); setGrandMasterChannelMode(UniverseArray::stringToGMChannelMode(str)); str = tag.attribute(KXMLQLCVCPropertiesGrandMasterValueMode); setGrandMasterValueMode(UniverseArray::stringToGMValueMode(str)); /* External input */ if (loadXMLInput(tag.firstChild().toElement(), &universe, &channel) == true) setGrandMasterInputSource(universe, channel); } else if (tag.tagName() == KXMLQLCVCPropertiesBlackout) { /* External input */ quint32 universe = InputMap::invalidUniverse(); quint32 channel = InputMap::invalidChannel(); if (loadXMLInput(tag.firstChild().toElement(), &universe, &channel) == true) setBlackoutInputSource(universe, channel); } else if (tag.tagName() == KXMLQLCWidgetProperties) { VCWidgetProperties::loadXML(tag); } else { qWarning() << Q_FUNC_INFO << "Unknown virtual console property tag:" << tag.tagName(); } /* Next node */ node = node.nextSibling(); } return true; }
bool VCProperties::loadProperties(const QDomElement* root) { QDomElement tag; QDomNode node; QString str; Q_ASSERT(root != NULL); if (root->tagName() != KXMLQLCVCProperties) { qDebug() << "Virtual console properties node not found!"; return false; } node = root->firstChild(); while (node.isNull() == false) { tag = node.toElement(); if (tag.tagName() == KXMLQLCVCPropertiesGrid) { /* Grid X resolution */ str = tag.attribute(KXMLQLCVCPropertiesGridXResolution); setGridX(str.toInt()); /* Grid Y resolution */ str = tag.attribute(KXMLQLCVCPropertiesGridYResolution); setGridY(str.toInt()); /* Grid enabled */ str = tag.attribute(KXMLQLCVCPropertiesGridEnabled); if (str == KXMLQLCTrue) setGridEnabled(true); else setGridEnabled(false); } else if (tag.tagName() == KXMLQLCVCPropertiesKeyboard) { /* Keyboard grab */ str = tag.attribute(KXMLQLCVCPropertiesKeyboardGrab); if (str == KXMLQLCTrue) setGrabKeyboard(true); else setGrabKeyboard(false); /* Key repeat */ str = tag.attribute(KXMLQLCVCPropertiesKeyboardRepeatOff); if (str == KXMLQLCTrue) setKeyRepeatOff(true); else setKeyRepeatOff(false); } else if (tag.tagName() == KXMLQLCVCPropertiesDefaultSlider) { quint32 low = 0; quint32 high = 10; t_input_universe universe = KInputUniverseInvalid; t_input_channel channel = KInputChannelInvalid; QDomElement subtag; /* Bus low limit */ str = tag.attribute(KXMLQLCVCPropertiesLowLimit); if (str.isNull() == false) low = quint32(str.toUInt()); /* Bus high limit */ str = tag.attribute(KXMLQLCVCPropertiesHighLimit); if (str.isNull() == false) high = quint32(str.toUInt()); /* Sliders' visibility (on by default) */ str = tag.attribute(KXMLQLCVCPropertiesDefaultSliderVisible); if (str == KXMLQLCFalse) setSlidersVisible(false); else setSlidersVisible(true); /* External input */ subtag = tag.firstChild().toElement(); if (subtag.isNull() == false && subtag.tagName() == KXMLQLCVCPropertiesInput) { /* Universe */ str = subtag.attribute(KXMLQLCVCPropertiesInputUniverse); if (str.isNull() == false) universe = str.toInt(); /* Channel */ str = subtag.attribute(KXMLQLCVCPropertiesInputChannel); if (str.isNull() == false) channel = str.toInt(); } /* Set the gathered properties to the correct slider */ if (tag.attribute(KXMLQLCBusRole) == KXMLQLCBusFade) { setFadeLimits(low, high); setFadeInputSource(universe, channel); } else { setHoldLimits(low, high); setHoldInputSource(universe, channel); } } else if (tag.tagName() == KXMLQLCWidgetProperties) { QLCWidgetProperties::loadXML(&tag); } else { qDebug() << "Unknown virtual console property tag:" << tag.tagName(); } /* Next node */ node = node.nextSibling(); } return true; }