void dmz::EntityPluginPortalFollow3D::_init (Config &local) { Definitions defs (get_plugin_runtime_context (), &_log); _defaultHandle = defs.create_named_handle (ObjectAttributeDefaultName); _hilAttrHandle = activate_object_attribute ( ObjectAttributeHumanInTheLoopName, ObjectFlagMask); Boolean foundOffset (False); Config cameraParams; if (local.lookup_config ("offset", cameraParams)) { foundOffset = True; _offset = config_to_vector (cameraParams, _offset); } init_input_channels (local, InputEventChannelStateMask, &_log); _log.info << "Using " << (foundOffset ? "" : "default ") << "camera offset: " << _offset << endl; }
void dmz::QtPluginCanvasObjectBasic::_init (Config &local) { _canvasModuleName = config_to_string ("module.canvas.name", local); _defaultAttributeHandle = activate_default_object_attribute ( ObjectCreateMask | ObjectDestroyMask); const String StateAttrName ( config_to_string ("attribute.state.name", local, ObjectAttributeDefaultName)); _stateAttributeHandle = activate_object_attribute (StateAttrName, ObjectStateMask); _zValue = config_to_int32 ("defaults.zValue", local, _zValue); _itemIgnoresTransformations = config_to_boolean ( "defaults.itemIgnoresTransformations", local, _itemIgnoresTransformations); Config templ; if (local.lookup_all_config ("template", templ)) { ConfigIterator it; Config objTemplate; while (templ.get_next_config (it, objTemplate)) { String templateName = config_to_string ("name", objTemplate, ""); Config *config = new Config (objTemplate); if (templateName != "" && config && *config && _templateConfigTable.store (templateName, config)) {} else { delete config; config = 0; } } } }
// ObjectPluginHighlight Interface void dmz::ObjectPluginHighlight::_init (Config &local) { _highlightAttr = activate_object_attribute ( ObjectAttributeHighlightName, ObjectFlagMask); _convert.set_handle ( config_to_string ("data-convert-handle.name", local, "handle"), get_plugin_runtime_context ()); _mouseMoveMsg = config_create_message ( "mouse-move-message.name", local, "Mouse_Move_Message", get_plugin_runtime_context ()); _deactivateMsg = config_create_message ( "deactivate-message.name", local, "Object_Highlight_Deactivate_Message", get_plugin_runtime_context ()); subscribe_to_message (_mouseMoveMsg); subscribe_to_message (_deactivateMsg); }
void dmz::EntityPluginFreeFly::_init (Config &local) { Definitions defs (get_plugin_runtime_context (), &_log); _defaultHandle = defs.create_named_handle (ObjectAttributeDefaultName); _hilHandle = activate_object_attribute ( ObjectAttributeHumanInTheLoopName, ObjectFlagMask); _move.moveSpeed = config_to_float64 ("movement.speed", local, _move.moveSpeed); _move.turnRate = config_to_float64 ("movement.turn-rate", local, _move.turnRate); init_input_channels ( local, InputEventButtonMask | InputEventAxisMask | InputEventChannelStateMask, &_log); _isectParameters.set_test_result_type (IsectClosestPoint); _isectParameters.set_calculate_normal (False); _isectParameters.set_calculate_object_handle (False); _isectParameters.set_calculate_distance (True); _isectParameters.set_calculate_cull_mode (False); }
void dmz::RenderPluginHighlightOSG::_init (Config &local) { Config highlightList; if (local.lookup_all_config ("highlight", highlightList)) { const osg::Vec4 None (0.0f, 0.0f, 0.0f, 1.0f); ConfigIterator it; Config highlight; while (highlightList.get_prev_config (it, highlight)) { const String AttrName = config_to_string ("attribute", highlight); const Handle Attr = activate_object_attribute ( AttrName, ObjectRemoveAttributeMask | ObjectFlagMask); if (Attr) { HighlightStruct *hs = new HighlightStruct (Attr); if (hs) { hs->color = new osg::StateSet; osg::ref_ptr <osg::Material> material = new osg::Material; material->setColorMode (osg::Material::OFF); osg::Vec4 color (None); color = config_to_osg_vec4_color ("ambient", highlight, None); material->setAmbient (osg::Material::FRONT_AND_BACK, color); color = config_to_osg_vec4_color ("diffuse", highlight, None); material->setDiffuse (osg::Material::FRONT_AND_BACK, color); color = config_to_osg_vec4_color ("specular", highlight, None); material->setSpecular (osg::Material::FRONT_AND_BACK, color); color = config_to_osg_vec4_color ("emission", highlight, None); material->setEmission (osg::Material::FRONT_AND_BACK, color); hs->color->setAttributeAndModes ( material.get (), osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON); hs->color->setMode ( GL_LIGHTING, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON); hs->color->setTextureMode ( 0, GL_TEXTURE_2D, osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF); } hs->next = _highlightList; _highlightList = hs; } } } }
void dmz::RenderPluginObjectLoaderOSG::_init (Config &local) { activate_default_object_attribute (ObjectDestroyMask); _modelAttrHandle = activate_object_attribute ( config_to_string ("attribute.model.name", local, "Object_Model_Attribute"), ObjectTextMask | ObjectRemoveAttributeMask); }
void dmz::QtPluginCanvasObject::_init (Config &local, Config &global) { _canvasModuleName = config_to_string ("module.canvas.name", local); Config pluginList; if (local.lookup_all_config ("plugins.plugin", pluginList)) { RuntimeContext *context (get_plugin_runtime_context ()); if (dmz::load_plugins (context, pluginList, local, global, _extensions, &_log)) { _extensions.discover_plugins (); } } _defaultAttributeHandle = activate_default_object_attribute ( ObjectCreateMask | ObjectDestroyMask | ObjectPositionMask | ObjectOrientationMask); _linkAttributeHandle = activate_object_attribute ( ObjectAttributeLayerLinkName, ObjectLinkMask | ObjectUnlinkMask); #if 0 Config preLoadList; if (local.lookup_all_config ("preload", preLoadList)) { Config data; ConfigIterator it; Boolean done (!preLoadList.get_first_config (it, data)); while (!done) { ObjectType objType; Mask objState; if (_defs.lookup_object_type (config_to_string ("type", data), objType)) { _defs.lookup_state (config_to_string ("state", data), objState); _log.info << "Pre-Loading object of type: " << objType.get_name () << endl; _get_model_struct (objType, objState); } done = !preLoadList.get_next_config (it, data); } } #endif }
//! \cond dmz::NetPluginRemoteDR::NetPluginRemoteDR (const PluginInfo &Info, Config &local) : Plugin (Info), TimeSlice (Info), ObjectObserverUtil (Info, local), _log (Info), _time (Info.get_context ()), _objMod (0), _defaultHandle (0), _lnvHandle (0) { _init (local); _defaultHandle = activate_object_attribute ( ObjectAttributeDefaultName, ObjectCreateMask | ObjectDestroyMask | ObjectLocalityMask); _lnvHandle = activate_object_attribute ( ObjectAttributeLastNetworkValueName, ObjectCreateMask); }
void dmz::MBRAPluginArchiveSupport::_init (Config &local) { RuntimeContext *context = get_plugin_runtime_context (); init_archive (local); _defaultAttrHandle = activate_default_object_attribute (ObjectCreateMask); _ecAttrHandle = activate_object_attribute ( config_to_string ("elimination-cost.name", local, "NA_Node_Elimination_Cost"), ObjectScalarMask); _typeSet = config_to_object_type_set ("object-type-list", local, context); if (_typeSet.get_count () == 0) { _typeSet.add_object_type ("na_node", context); } _toggleMapMessage = config_create_message ( "message.toggle-map.name", local, "ToggleMapMessage", context, &_log); _threatAttrHandle = config_to_named_handle ( "threat.name", local, "NA_Node_Threat", context); _vulAttrHandle = config_to_named_handle ( "vulnerability.name", local, "NA_Node_Vulnerability", context); _pcAttrHandle = config_to_named_handle ( "prevention-cost.name", local, "NA_Node_Prevention_Cost", context); _toggleHandle = config_to_named_handle ("toggle.name", local, "toggle", context); _toggleTargetHandle = config_to_named_handle ( "toggle-target.name", local, "dmzQtPluginMapProperties", context); }
void dmz::RenderPluginObjectOSG::_init (Config &local) { activate_default_object_attribute ( ObjectCreateMask | ObjectDestroyMask | ObjectStateMask); activate_object_attribute ( config_to_string ("hide-object-flag.name", local, ObjectAttributeHideName), ObjectFlagMask); }
void dmz::StarfighterPluginSpaceBoxOSG::_init (Config &local) { Definitions defs (get_plugin_runtime_context ()); _defaultHandle = defs.create_named_handle (ObjectAttributeDefaultName); _imgRc = config_to_string ("image.resource", local, _imgRc); _offset = config_to_float64 ("box.offset", local, _offset); activate_object_attribute (ObjectAttributeHumanInTheLoopName, ObjectFlagMask); _create_box (); }
void dmz::EntityPluginGroundSimple::_init (Config &local) { Definitions defs (get_plugin_runtime_context (), &_log); defs.lookup_state (DefaultStateNameDead, _deadState); defs.lookup_state (DefaultStateNameAirBorn, _airBornState); _defaultHandle = activate_default_object_attribute (ObjectStateMask); _hilHandle = activate_object_attribute ( ObjectAttributeHumanInTheLoopName, ObjectFlagMask); _throttleHandle = activate_object_attribute ( ObjectAttributeScalarThrottleName, ObjectScalarMask); _move.maxSpeed = config_to_float64 ("movement.speed", local, _move.maxSpeed); _move.maxAccel = config_to_float64 ("movement.acceleration", local, _move.maxAccel); _move.maxDecel = config_to_float64 ("movement.deceleration", local, _move.maxDecel); _move.turnRate = config_to_float64 ("movement.turn", local, _move.turnRate); _move.brakeRate = config_to_float64 ("movement.brake", local, _move.brakeRate); _move.whiskerLength = config_to_float64 ("whisker.length", local, _move.whiskerLength); _move.whiskerHeight = config_to_float64 ("whisker.height", local, _move.whiskerHeight); init_input_channels ( local, InputEventButtonMask | InputEventAxisMask | InputEventChannelStateMask, &_log); _isectParameters.set_test_result_type (IsectAllPoints); _isectParameters.set_calculate_normal (True); _isectParameters.set_calculate_object_handle (True); _isectParameters.set_calculate_distance (False); _isectParameters.set_calculate_cull_mode (True); }
void dmz::MBRAPluginFaultTreeAutoLayout::_init (Config &local) { const Mask EmptyMask; RuntimeContext *context = get_plugin_runtime_context (); _canvasModuleName = config_to_string ("module.canvas.name", local); _defaultAttrHandle = activate_default_object_attribute (EmptyMask); _activeAttrHandle = activate_object_attribute ( config_to_string ("attribute.activate.name", local, "FT_Active_Fault_Tree"), ObjectFlagMask); _linkAttrHandle = activate_object_attribute ( config_to_string ("attribute.link.name", local, "FT_Link"), ObjectLinkMask | ObjectUnlinkMask); _logicAttrHandle = config_to_named_handle ( "attribute.logic.name", local, "FT_Logic_Link", context); _nameAttrHandle = config_to_named_handle ( "attribute.threat.name", local, "FT_Name", context); _hideAttrHandle = config_to_named_handle ( "attribute.hide.name", local, ObjectAttributeHideName, context); Definitions defs (get_plugin_runtime_context (), &_log); defs.lookup_object_type ( config_to_string ("root.type", local, "ft_component_root"), _rootType); _rootText = config_to_string ("root.text", local, _rootText); _hOffset = config_to_float64 ("offset.horizontal", local, _hOffset); _vOffset = config_to_float64 ("offset.vertical", local, _vOffset); }
void dmz::EntityPluginDeadTimer::_init (Config &local) { Definitions defs (get_plugin_runtime_context (), &_log); defs.lookup_state (DefaultStateNameDead, _deadState); _defaultHandle = activate_default_object_attribute (ObjectDestroyMask | ObjectStateMask); _hilHandle = activate_object_attribute ( ObjectAttributeHumanInTheLoopName, ObjectFlagMask); set_time_slice_interval ( config_to_float64 ("timer.value", local, get_time_slice_interval ())); }
void dmz::EntityPluginOverlayDead::_init (Config &local) { Definitions defs (get_plugin_runtime_context (), &_log); defs.lookup_state (DefaultStateNameDead, _deadState); activate_default_object_attribute (ObjectStateMask); _hilAttrHandle = activate_object_attribute ( ObjectAttributeHumanInTheLoopName, ObjectFlagMask); _overlaySwitchName = config_to_string ("overlay.switch.name", local, _overlaySwitchName); _overlayScaleName = config_to_string ("overlay.scale.name", local, _overlayScaleName); }
void dmz::EntityPluginDamage::_init (Config &local) { Definitions defs (get_plugin_runtime_context (), &_log); _targetHandle = defs.create_named_handle (EventAttributeTargetName); const String StateNames = config_to_string ("state.name", local, DefaultStateNameDead); defs.lookup_state (StateNames, _deadState); _defaultObjectHandle = activate_default_object_attribute (ObjectDestroyMask); _hilHandle = activate_object_attribute ( ObjectAttributeHumanInTheLoopName, ObjectFlagMask); _detonationType = activate_event_callback (EventDetonationName, EventCloseMask); }
void dmz::AudioPluginObject::_init_sound_struct (Config &data, SoundDefStruct &ss) { ss.activateName = _rc.find_file (config_to_string ("activate-resource", data)); ss.deactivateName = _rc.find_file (config_to_string ("deactivate-resource", data)); ss.loopName = _rc.find_file (config_to_string ("looped-resource", data)); _lookup_sound_handles (ss); const String ScalarName (config_to_string ("scalar", data)); if (ScalarName) { ss.scalarAttributeHandle = activate_object_attribute (ScalarName, ObjectScalarMask); } ss.offset = config_to_float64 ("offset", data, ss.offset); ss.scale = config_to_float64 ("scale", data, ss.scale); ss.relative = config_to_boolean ("relative", data, ss.relative); }
void dmz::WeaponPluginFixedLauncher::_init (Config &local) { RuntimeContext *context (get_plugin_runtime_context ()); Definitions defs (context, &_log); _defaultHandle = activate_default_object_attribute ( ObjectStateMask); _hilAttrHandle = activate_object_attribute ( ObjectAttributeHumanInTheLoopName, ObjectFlagMask); _deadState = config_to_state ( "state.dead.value", local, DefaultStateNameDead, context); _delay = config_to_float64 ("delay.value", local, _delay); _launcherOffset = config_to_vector ("offset", local); const Vector HPR = config_to_vector ("rotation", local); _launcherRotation.roll_in_place (HPR.get_z ()); _launcherRotation.pitch_in_place (HPR.get_x ()); _launcherRotation.yaw_in_place (HPR.get_y ()); _launchButton = config_to_uint32 ("button.value", local, _launchButton); init_input_channels ( local, InputEventButtonMask | InputEventChannelStateMask, &_log); }
void dmz::QtPluginGraph::_init (Config &local) { RuntimeContext *context (get_plugin_runtime_context ()); Definitions defs (context); _scene = new QGraphicsScene; _view = new QGraphicsView (_scene); _view->setAlignment (Qt::AlignLeft); // | Qt::AlignBottom); _typeSet = config_to_object_type_set ("set", local, context); if (_typeSet.get_count () == 0) { _log.info << "No object types specified. Using root type." << endl; _typeSet.add_object_type (defs.get_root_object_type ()); } activate_default_object_attribute (ObjectCreateMask | ObjectDestroyMask); Config attrList; if (local.lookup_all_config ("attribute", attrList)) { ConfigIterator it; Config attr; while (attrList.get_next_config (it, attr)) { const String Type = config_to_string ("type", attr).get_lower (); const String AttrName = config_to_string ("name", attr); if (AttrName) { if (Type == "link") { activate_object_attribute (AttrName, ObjectLinkMask | ObjectUnlinkMask); } else if (Type == "counter") { activate_object_attribute (AttrName, ObjectCounterMask); } else { _log.error << "Unknown attribute type: " << Type << endl; } } else { _log.error << "Attribute missing name." << endl; } } } _ascendingOrder = config_to_boolean ("ascending.value", local, _ascendingOrder); _maxCount = config_to_int32 ("start.value", local, _maxCount); _showPowerLaw = config_to_boolean ("power-law.show", local, _showPowerLaw); _powerStroke = config_to_qpen ("power-law.stroke", local, _powerStroke); _barStroke = config_to_qpen ("bar.stroke", local, _barStroke); _barFill = config_to_qbrush ("bar.fill", local, _barFill); _barWidth = config_to_int32 ("bar.width", local, _barWidth); _barHeight = config_to_int32 ("bar.height", local, _barHeight); _spaceWidth = config_to_int32 ("bar.space", local, _spaceWidth); _steps = config_to_int32 ("bar.steps", local, _steps); _yDivisions = config_to_int32 ("bar.divisions", local, _yDivisions); _yLabels = new QGraphicsTextItem*[_yDivisions]; for (Int32 ix = 0; ix < _yDivisions; ix++) { const Float32 Offset (-_barHeight * ((Float32)(ix + 1)) / (Float32)_yDivisions); _yLabels[ix] = new QGraphicsTextItem; _yLabels[ix]->setPlainText ( QString::number (100 * (ix +1) / _yDivisions) + QString ("%")); _yLabels[ix]->setZValue (1.0f); QRectF rect = _yLabels[ix]->boundingRect (); _yLabels[ix]->setPos (-5.0 - rect.width (), Offset - (rect.height () * 0.5f)); _scene->addItem (_yLabels[ix]); QGraphicsLineItem *line = new QGraphicsLineItem (-4.0, Offset, 0.0f, Offset); line->setZValue (1.0f); _scene->addItem (line); } }
void dmz::RenderPluginWavesOSG::_init (Config &local) { activate_object_attribute ( config_to_string ("wave-time.attribute", local, "DMZ_Wave_State_Time_Seed"), ObjectTimeStampMask); _waveSpeedAttributeHandle = activate_object_attribute ( config_to_string ("wave-speed.attribute", local, "DMZ_Wave_State_Speed"), ObjectScalarMask); _waveAmplitudeAttributeHandle = activate_object_attribute ( config_to_string ("wave-amplitude.attribute", local, "DMZ_Wave_State_Amplitude"), ObjectScalarMask); _waveNumberAttributeHandle = activate_object_attribute ( config_to_string ("wave-number.attribute", local, "DMZ_Wave_State_Number"), ObjectScalarMask); _imageResource = config_to_string ("image.resource", local, "water"); _tileCountX = config_to_int32 ("count.x", local, _tileCountX); _tileCountY = config_to_int32 ("count.y", local, _tileCountY); if (_tileCountX < 1) { _log.error << "Tile count in the X axis is: " << _tileCountX << " Value must be greater than zero. Setting to 1." << endl; _tileCountX = 1; } if (_tileCountY < 1) { _log.error << "Tile count in the Y axis is: " << _tileCountY << " Value must be greater than zero. Setting to 1." << endl; _tileCountY = 1; } _minGrid = config_to_float64 ("grid.min", local, _minGrid); _maxGrid = config_to_float64 ("grid.max", local, _maxGrid); if (_minGrid >= _maxGrid) { _log.error << "Minimum grid value must be less than the maximum grid value." << endl; _maxGrid = _minGrid + 1.0f; } _tileSizeX = (_maxGrid - _minGrid) / Float32 (_tileCountX); _tileSizeY = (_maxGrid - _minGrid) / Float32 (_tileCountY); Float32 &texA = (_tileCountY > _tileCountX ? _texFactorX : _texFactorY); Float32 &texB = (_tileCountY > _tileCountX ? _texFactorY : _texFactorX); texA = 1.0f; texB = ((_tileCountY > _tileCountX) ? (Float32 (_tileCountY) / Float32 (_tileCountX)) : (Float32 (_tileCountY) / Float32 (_tileCountX))); const Float32 FloorValue = floor (texB); if ((texB - FloorValue) > 0.5f) { texB = FloorValue + 1; } else { texB = FloorValue; } }
void dmz::QtPluginCanvasLink::_init (Config &local) { RuntimeContext *context = get_plugin_runtime_context (); _canvasModuleName = config_to_string ("module.canvas.name", local); const String PosAttrName ( config_to_string ("attribute.position.name", local, ObjectAttributeDefaultName)); _defaultAttrHandle = activate_default_object_attribute (ObjectStateMask); _positionAttrHandle = activate_object_attribute ( PosAttrName, ObjectPositionMask); const String FlowAttrName = config_to_string ("flow-attribute.name", local); if (FlowAttrName) { _flowAttrHandle = activate_object_attribute (FlowAttrName, ObjectStateMask); } _defs.lookup_state ( config_to_string ("forward-flow-state.name", local), _forwardState); _defs.lookup_state ( config_to_string ("reverse-flow-state.name", local), _reverseState); _flowStateMask = _forwardState | _reverseState; Handle attrHandle = activate_object_attribute ( config_to_string ("link.name", local, ObjectAttributeNodeLinkName), ObjectLinkMask | ObjectUnlinkMask | ObjectLinkAttributeMask); _linkAttrTable.store (attrHandle, this); Config colorList; if (local.lookup_all_config ("state-color-list.state-color", colorList)) { QColor defaultColor (Qt::black); defaultColor.setAlphaF (0.75); ConfigIterator it; Config color; while (colorList.get_prev_config (it, color)) { const Mask State = config_to_state ("name", color, context); const QColor Value = config_to_qcolor (color, defaultColor); if (State) { ColorStruct *cs = new ColorStruct (State, Value); if (cs) { cs->next = _stateList; _stateList = cs; } } } } _penWidth = config_to_float32 ("pen-width.value", local, _penWidth); _arrowMultiplier = config_to_int32 ("arrow-multiplier.value", local, _arrowMultiplier); }