void UMDSoMeasureTool::getObject() { // EventCallback fuer die Mousebutton-Ereignisse SoEventCallback* eventCB = new SoEventCallback; _root->addChild(eventCB); eventCB->addEventCallback(SoMouseButtonEvent::getClassTypeId(), mousePressedCB, this); eventCB->addEventCallback(SoKeyboardEvent::getClassTypeId(), cursorPressCB, this); // hier wird ein LevelOfDetail-Knoten angehaengt, // der fuer die Font-Groesse verantwortlich ist SoLevelOfDetail* lod = (SoLevelOfDetail*) getLOD(); _root->addChild(lod); // Das Material und die Linienstaerke _objectMaterial = new SoMaterial; _root->addChild(_objectMaterial); _objectMaterial->diffuseColor.connectFrom(&color); // Switch-Knoten, der die Dragger enthaelt _switchDragger = new SoSwitch; _root->addChild(_switchDragger); // der Inhaber aller LocateHighlight-Knoten _highlightSep = new SoSeparator; _root->addChild(_highlightSep); _textSep = new SoAnnotation; _root->addChild(_textSep); // der Text soll zwar sichtbar, aber nicht // selektierbar sein SoPickStyle* pickstyle = new SoPickStyle; _textSep->addChild(pickstyle); pickstyle->style.setValue(SoPickStyle::UNPICKABLE); } //getObject
/* * find the Most Recent Common Ancestor * uses getLOD to get a list of ancestors (oldest first). seaches the list for the first ancestor with a referenceCounter > 1 * that is the first reference counter with more then one offspring. * If none are found, then return "from" * Note: a currently active genome has a referenceCounter = 1 (it has not reproduced yet, it only has 1 for it's self) * a dead Organism with a referenceCounter = 0 will not be in the LOD (it has no offspring and will have been pruned) * a dead Organism with a referenceCounter = 1 has only one offspring. * a dead Organism with a referenceCounter > 1 has more then one spring with surviving lines of decent. */ shared_ptr<Organism> Organism::getMostRecentCommonAncestor(shared_ptr<Organism> org) { vector<shared_ptr<Organism>> LOD = getLOD(org); // get line of decent parent "parent" for (auto org : LOD) { // starting at the oldest parent, moving to the youngest if (org->offspringCount > 1) // the first (oldest) ancestor with more then one surviving offspring return org; } return org; // a currently active genome will have referenceCounter = 1 but may be the Most Recent Common Ancestor }
void MetavoxelSystem::render() { // update the frustum ViewFrustum* viewFrustum = Application::getInstance()->getViewFrustum(); _frustum.set(viewFrustum->getFarTopLeft(), viewFrustum->getFarTopRight(), viewFrustum->getFarBottomLeft(), viewFrustum->getFarBottomRight(), viewFrustum->getNearTopLeft(), viewFrustum->getNearTopRight(), viewFrustum->getNearBottomLeft(), viewFrustum->getNearBottomRight()); RenderVisitor renderVisitor(getLOD()); guideToAugmented(renderVisitor); }
bool MetavoxelClientManager::findFirstRayHeightfieldIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance) { RayHeightfieldIntersectionVisitor visitor(origin, direction, getLOD()); guide(visitor); if (visitor.intersectionDistance == FLT_MAX) { return false; } distance = visitor.intersectionDistance; return true; }
void MetavoxelClient::simulate(float deltaTime) { Bitstream& out = _sequencer.startPacket(); ClientStateMessage state = { getLOD() }; out << QVariant::fromValue(state); _sequencer.endPacket(); // record the send SendRecord record = { _sequencer.getOutgoingPacketNumber(), state.lod }; _sendRecords.append(record); }
void MetavoxelSystem::simulate(float deltaTime) { // update the lod { // the LOD threshold is temporarily tied to the avatar LOD parameter QWriteLocker locker(&_lodLock); const float BASE_LOD_THRESHOLD = 0.01f; _lod = MetavoxelLOD(Application::getInstance()->getCamera()->getPosition(), BASE_LOD_THRESHOLD * Menu::getInstance()->getAvatarLODDistanceMultiplier()); } SimulateVisitor simulateVisitor(deltaTime, getLOD()); guideToAugmented(simulateVisitor); }
bool TowerVariable::getNextProductions(std::list<BuildingVariable>& out) { //From tower, create more refined version via extrusions switch (getLOD()) { case 1: { //Basic bounds in place, so we need to create extrusions } case 2: { //Has been extruded, add some basic decoration to the building } }; return true; }
float MetavoxelClientManager::getHeightfieldHeight(const glm::vec3& location) { HeightfieldHeightVisitor visitor(getLOD(), location); guide(visitor); return visitor.height; }
void MetavoxelClient::guide(MetavoxelVisitor& visitor) { visitor.setLOD(getLOD()); _data.guide(visitor); }