当前位置: 首页>>代码示例>>C++>>正文


C++ ObjectType::get_handle方法代码示例

本文整理汇总了C++中ObjectType::get_handle方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectType::get_handle方法的具体用法?C++ ObjectType::get_handle怎么用?C++ ObjectType::get_handle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObjectType的用法示例。


在下文中一共展示了ObjectType::get_handle方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: current

void
dmz::CyclesPluginWallOSG::_create_object_wall (
      const Handle ObjectHandle,
      const ObjectType &Type) {

   WallStruct *wall (0);

   ObjectType current (Type);

   while (current && !wall) {

      wall = _wallTable.lookup (Type.get_handle ());

      Config wallDef;

      if (!wall && current.get_config ().lookup_all_config_merged ("wall", wallDef)) {

         const Float32 Red (config_to_float32 ("color.r", wallDef, 1.0));
         const Float32 Green (config_to_float32 ("color.g", wallDef, 1.0));
         const Float32 Blue (config_to_float32 ("color.b", wallDef, 1.0));
         const Float32 Alpha (config_to_float32 ("color.a", wallDef, 1.0));
         const Float32 Height (config_to_float32 ("height.value", wallDef, 1.0));
         const Float32 Offset (config_to_float32 ("offset.value", wallDef, 1.0));

         _log.info << " " << Type.get_name () << " wall information." << endl
            << "\t   Red : " << Red << endl
            << "\t Green : " << Green << endl
            << "\t  Blue : " << Blue << endl
            << "\t Alpha : " << Alpha << endl
            << "\tHeight : " << Height << endl
            << "\tOffset : " << Offset << endl;

         wall = new WallStruct (
            True,
            osg::Vec4 (Red, Green, Blue, Alpha),
            Height,
            Offset);

         if (wall && !_wallTable.store (Type.get_handle (), wall)) {

            delete wall; wall = 0;
         }
      }
      else { current.become_parent (); }
   }

   if (wall && wall->ColorDefined) {

      _create_wall (ObjectHandle, *wall);
   }
   else if (!wall) {

      wall = new WallStruct (False, osg::Vec4 (0.0f, 0.0f, 0.0f, 0.0f), 0.0f, 0.0f);

      if (wall && !_wallTable.store (Type.get_handle (), wall)) {

         delete wall; wall = 0;
      }
   }
}
开发者ID:ben-sangster,项目名称:cycles,代码行数:60,代码来源:dmzCyclesPluginWallOSG.cpp

示例2: vel

void
dmz::WeaponPluginGravityBullet::_store_speed (
      const Handle ObjectHandle,
      const ObjectType &Type) {

   Float64 *ptr (_speedTable.lookup (Type.get_handle ()));

   if (!ptr) {

      ptr = new Float64 (_defaultSpeed);

      if (ptr && !_speedTable.store (Type.get_handle (), ptr)) {

         delete ptr; ptr = 0;
      }
   }

   if (ptr) {

      _objectTable.store (ObjectHandle, ptr);

      ObjectModule *objMod (get_object_module ());

      if (objMod) {

         Matrix ori;
         objMod->lookup_orientation (ObjectHandle, _defaultHandle, ori);
         Vector vel (0.0, 0.0, -(*ptr));
         ori.transform_vector (vel);
         objMod->store_velocity (ObjectHandle, _defaultHandle, vel);
      }
   }
}
开发者ID:Andais,项目名称:dmz,代码行数:33,代码来源:dmzWeaponPluginGravityBullet.cpp

示例3: current

dmz::NetModuleLocalDRBasic::ObjectUpdate *
dmz::NetModuleLocalDRBasic::_create_test_from_type (const ObjectType &Type) {

   ObjectUpdate *result (0);

   ObjectType current (Type);

   while (current && !result) {

      result = _typeTable.lookup (current.get_handle ());

      if (!result) {

         result = _baseTable.lookup (current.get_handle ());

         if (result) { _typeTable.store (Type.get_handle (), result); }
      }

      if (!result) {

         Config listData;

         if (current.get_config ().lookup_all_config (
               "net.rule",
               listData)) {

            _log.info << "Creating network transmission rules for: " << Type.get_name ()
               << endl;

            result = _create_update_list (listData);

            if (result) {

               if (_baseTable.store (current.get_handle (), result)) {

                  _typeTable.store (Type.get_handle (), result);
               }
            }
         }
         else { current.become_parent (); }
      }
   }

   if (!result) {

      result = _defaultTest;

      if (result) { _typeTable.store (Type.get_handle (), result); }
   }

   return result;
}
开发者ID:Andais,项目名称:dmz,代码行数:52,代码来源:dmzNetModuleLocalDRBasic.cpp

示例4: current

// Object Observer Interface
void
dmz::RenderPluginDisableObjectIsect::create_object (
      const UUID &Identity,
      const Handle ObjectHandle,
      const ObjectType &Type,
      const ObjectLocalityEnum Locality) {

   if (_isect) {

      Boolean *value (0);

      ObjectType current (Type);

      while (current && !value) {

         value = _isectTable.lookup (current.get_handle ());

         if (!value) {

            Config data;

            if (current.get_config ().lookup_config ("render.isect", data)) {

               Boolean disable = config_to_boolean ("disable", data, False);

               value = new Boolean (disable);

               if (!_isectTable.store (current.get_handle () , value)) {

                  delete value; value = 0;
               }
            }
         }

         current.become_parent ();
      }

      if (value && *value) {

         if (_isect->disable_isect (ObjectHandle) == 0) {

            *value = False;

            _log.error << "Unable to disable intersection for type: " << Type.get_name ()
               << endl;
         }
      }
   }
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:50,代码来源:dmzRenderPluginDisableObjectIsect.cpp

示例5: result

dmz::Boolean
dmz::NetModulePacketCodecBasic::register_object (
      const Handle ObjectHandle,
      const ObjectType &Type,
      Marshal &outData) {

   Boolean result (False);

   _objTable.remove (ObjectHandle);

   ObjectType current (Type);

   EncodeObjectStruct *eos (0);

   do {

      eos = _objTypeTable.lookup (current.get_handle ());
      current.become_parent ();

   } while (current && !eos);

   if (ObjectHandle && eos && _objTable.store (ObjectHandle, eos)) {

      result = _write_object (ObjectHandle, NetObjectActivate, outData);
   }

   return result;
}
开发者ID:Andais,项目名称:dmz,代码行数:28,代码来源:dmzNetModulePacketCodecBasic.cpp

示例6: result

dmz::Boolean
dmz::NetModuleLocalDRBasic::update_object (const Handle ObjectHandle) {

   Boolean result (False);

   if (_objMod) {

      const ObjectType Type (_objMod->lookup_object_type (ObjectHandle));

      if (Type) {

         ObjectUpdate *test (_typeTable.lookup (Type.get_handle ()));

         if (!test) { test = _create_test_from_type (Type); }

         Boolean limitRate (False);

         while (test && !result && !limitRate) {

            result = test->update_object (ObjectHandle, *_objMod, limitRate);
            test = test->next;
         }
      }
   }

   return result;
}
开发者ID:Andais,项目名称:dmz,代码行数:27,代码来源:dmzNetModuleLocalDRBasic.cpp

示例7: currentType

dmz::QtPluginCanvasObjectBasic::ModelStruct *
dmz::QtPluginCanvasObjectBasic::_get_model_struct (const ObjectType &ObjType) {

   ModelStruct *retVal (_masterModelTable.lookup (ObjType.get_handle ()));

   if (!retVal) {

      Config local;
      ObjectType currentType (ObjType);

      if (_find_config_from_type (local, currentType)) {

         ModelStruct *ms (_modelTable.lookup (currentType.get_handle ()));

         if (!ms) {

            ms = _config_to_model_struct (local, currentType);

            if (ms) {

               _modelTable.store (ms->ObjType.get_handle (), ms);
            }
         }

         retVal = ms;
      }
   }

   if (retVal) {

      _masterModelTable.store (ObjType.get_handle (), retVal);
   }

   return retVal;
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:35,代码来源:dmzQtPluginCanvasObjectBasic.cpp

示例8: event

// RenderPluginEventOSG Interface
dmz::RenderPluginEventOSG::TypeStruct *
dmz::RenderPluginEventOSG::_get_type (
      const Handle EventHandle,
      const EventType &Type) {

   TypeStruct *result (0);

   EventModule *module = get_event_module ();

   TypeTable *table (0);

   EventType event (Type);

   while (event && !result) {

      TypeTable *table = _get_type_table (Type);

      if (table) {

         ObjectType current;

         if (module) {

            module->lookup_object_type (EventHandle, table->TypeAttr, current);
         }

         const ObjectType Start (current);

         while (current && !result) {

            result = table->map.lookup (current.get_handle ());

            if (!result) {

               result = _create_type (EventHandle, event, current, *table);
            }

            if (!result) { current.become_parent (); }
         }

         if (result && (current != Start)) {

            table->map.store (Start.get_handle (), result);
         }
      }

      if (!result) { event.become_parent (); }
   }

   return result;
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:52,代码来源:dmzRenderPluginEventOSG.cpp

示例9: current

dmz::AudioPluginObject::SoundDefStruct *
dmz::AudioPluginObject::_get_sound_list (const ObjectType &Type) {

   ObjectType current (Type);

   SoundDefStruct *result (0);

   while (!result && current) {

      result = _soundTable.lookup (current.get_handle ());

      if (!result) {

         result = _object_type_to_sound_list (current);
      }

      current.become_parent ();
   }

   return result;
}
开发者ID:Andais,项目名称:dmz,代码行数:21,代码来源:dmzAudioPluginObject.cpp

示例10: current

dmz::RenderPluginObjectOSG::DefStruct *
dmz::RenderPluginObjectOSG::_lookup_def_struct (const ObjectType &Type) {

   ObjectType current (Type);

   DefStruct *result (0);

   while (!result && current) {

      result = _typeTable.lookup (current.get_handle ());

      if (!result) {

         result = _create_def_struct (current);

         if (result) { _typeTable.store (Type.get_handle (), result); }
         else { current.become_parent (); }
      }
   }

   return result;
}
开发者ID:,项目名称:,代码行数:22,代码来源:

示例11: if

//! Gets root object type.
dmz::ObjectType
dmz::Definitions::get_root_object_type () const {

   ObjectType result;

   if (_state.context && _state.defs) {

      ObjectType *ptr (_state.defs->objectNameTable.lookup (LocalRootObjectTypeName));

      if (!ptr) {

         TypeContext *rootTypeContext = new TypeContext (
            LocalRootObjectTypeName,
            _state.context,
            0,
            0);

         if (rootTypeContext) {

            ptr = new ObjectType (rootTypeContext);

            if (ptr && _state.defs->objectNameTable.store (ptr->get_name (), ptr)) {

               _state.defs->objectHandleTable.store (ptr->get_handle (), ptr);
            }
            else if (ptr) { delete ptr; ptr = 0; }

            rootTypeContext->unref ();
         }
      }

      if (ptr) { result = *ptr; }
   }

   return result;
}
开发者ID:ben-sangster,项目名称:dmz,代码行数:37,代码来源:dmzRuntimeInit.cpp

示例12: Name

void
dmz::NetModulePacketCodecBasic::_discover_codec (const Plugin *PluginPtr) {

   const String Name (PluginPtr ? PluginPtr->get_plugin_name () : "");

   NetExtPacketCodecObject *objCodec (NetExtPacketCodecObject::cast (PluginPtr));
   NetExtPacketCodecEvent *eventCodec (NetExtPacketCodecEvent::cast (PluginPtr));

   if (Name && (objCodec || eventCodec)) {

      PacketStruct *hs (_packetTable.lookup (Name));

      if (hs) {

         DecodeStruct *ds (0);
         if (objCodec) { ds = new DecodeStruct (hs->PacketID, *objCodec); }
         else if (eventCodec) { ds = new DecodeStruct (hs->PacketID, *eventCodec); }

         if (ds && _decodeTable.store (hs->PacketID, ds)) {

            if (objCodec && hs->objects.get_count ()) {

               EncodeObjectStruct *eos (
                  new EncodeObjectStruct (hs->PacketID, *objCodec));

               if (eos && _objEncodeTable.store (hs->PacketID, eos)) {

                  ObjectTypeIterator it;

                  ObjectType type;

                  Boolean found (hs->objects.get_first (it, type));

                  while (found) {

                     _objTypeTable.store (type.get_handle (), eos);
                     found = hs->objects.get_next (it, type);
                  }
               }
               else if (eos) { delete eos; eos = 0; }
            }
            else if (eventCodec && hs->events.get_count ()) {

               EncodeEventStruct *ees (
                  new EncodeEventStruct (hs->PacketID, *eventCodec));

               if (ees && _eventEncodeTable.store (hs->PacketID, ees)) {

                  EventTypeIterator it;

                  EventType type;

                  Boolean found (hs->events.get_first (it, type));

                  while (found) {

                     _eventTypeTable.store (type.get_handle (), ees);
                     found = hs->events.get_next (it, type);
                  }
               }
               else if (ees) { delete ees; ees = 0; }
            }
         }
         else if (ds) {

            delete ds; ds = 0;
         }
      }
   }
}
开发者ID:Andais,项目名称:dmz,代码行数:70,代码来源:dmzNetModulePacketCodecBasic.cpp

示例13: test

int
main (int argc, char *argv[]) {

   Test test ("dmzRuntimeObjectTypeTest", argc, argv);

   // test null contructor
   ObjectType testObjectType;
   test.validate (
      "test default constructor",
      !testObjectType.get_type_context () &&
      !testObjectType.get_name ().get_length ());


   RuntimeContext *context (test.rt.get_context ());
   Config config;

   if (test.validate (
         "Looking up runtime table",
         test.config.lookup_config ("dmz.runtime", config))) {

      runtime_init (config, test.rt.get_context (), &(test.log));
   }

   Definitions defs (context, &(test.log));

   const String CaracalName ("caracal");
   const String CatName ("cat");

   ObjectType rootObjectType;

   test.validate (
      "Looking up ObjectType: Caracal",
      defs.lookup_object_type (CaracalName, testObjectType));

   test.validate (
      "Looking up ObjectType: Cat",
      defs.lookup_object_type (CatName, rootObjectType));

   // ============================================================================ //
   // <validate constructors>

   ObjectType copyOfCaracalContext (testObjectType.get_type_context ());
   test.validate (
      "test (context) constructor",
      copyOfCaracalContext == testObjectType);

   ObjectType anotherCaracal (CaracalName, context);
   ObjectType anotherCat (CatName, context);

   test.validate (
      "test (Name, RuntimeContext) constructor",
      anotherCat == rootObjectType &&
      anotherCaracal == testObjectType);

   ObjectType yetAnotherCaracal (anotherCaracal.get_handle (), context);
   ObjectType yetAnotherCat (anotherCat.get_handle (), context);
   test.validate (
      "test (Handle, RuntimeContext) constructor",
      yetAnotherCat == rootObjectType &&
      yetAnotherCaracal == testObjectType);

   ObjectType stillAnotherCaracal (anotherCaracal);
   ObjectType stillAnotherCat (anotherCat);
   test.validate (
      "test copy constructor",
      stillAnotherCat == rootObjectType &&
      stillAnotherCaracal == testObjectType);

   // </validate constructors>
   // ============================================================================ //
   // <validate operators>

   ObjectType shouldBeNothing;
   ObjectType nothingThatBecomesSomething;
   test.validate (
      "test = operator - (pre state)",
      (nothingThatBecomesSomething == shouldBeNothing) &&
      !(nothingThatBecomesSomething == anotherCat));

   nothingThatBecomesSomething = anotherCat;
   test.validate (
      "test = operator - (equal something)",
      !(nothingThatBecomesSomething == shouldBeNothing) &&
      (nothingThatBecomesSomething == anotherCat));

   nothingThatBecomesSomething = shouldBeNothing;
   test.validate (
      "test = operator - (equal null)",
      (nothingThatBecomesSomething == shouldBeNothing) &&
      !(nothingThatBecomesSomething == anotherCat));

   ObjectType shouldBeACaracal (CaracalName, context);
   ObjectType shouldBeACat (CatName, context);
   test.validate (
      "test == operator",
      !(shouldBeNothing == anotherCat) &&
      !(shouldBeNothing == anotherCaracal) &&
      !(shouldBeACaracal == anotherCat) &&
      (shouldBeACaracal == anotherCaracal) &&
      (shouldBeACat == anotherCat) &&
//.........这里部分代码省略.........
开发者ID:Andais,项目名称:dmz,代码行数:101,代码来源:dmzRuntimeObjectTypeTest.cpp


注:本文中的ObjectType::get_handle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。