예제 #1
0
dmz::RenderPluginEventOSG::TypeStruct *
dmz::RenderPluginEventOSG::_create_type (
      const Handle EventHandle,
      const EventType &Event,
      const ObjectType &Object,
      TypeTable &table) {

   TypeStruct *result (0);

   Config info;

   Config list;

   if (Object.get_config ().lookup_all_config ("render.event", list)) {

      ConfigIterator it;
      Config next;

      const String EventName = Event.get_name ();

      while (!info && list.get_next_config (it, next)) {

         if (EventName == config_to_string ("name", next)) { info = next; }
      }
   }

   if (info) {

      const String ImageRc = config_to_string ("image.resource", info);
      const Float64 Offset = config_to_float64 ("offset.value", info, 10);
      const Float64 Scale = config_to_float64 ("scale.value", info, 1.1);
      const Float64 Rate = config_to_float64 ("rate.value", info, 0.1);

      if (ImageRc) {

         const String ImageName = _rc.find_file (ImageRc);

         if (ImageName) {

            result = new TypeStruct (Offset, Scale, Rate);

            if (result) {

               result->image = osgDB::readImageFile (ImageName.get_buffer ());

               if (result->image.valid ()) {

                  if (table.table.store (Object.get_handle (), result)) {

                     _create_model (*result);
                     table.map.store (Object.get_handle (), result);
                  }
                  else { delete result; result = 0; }
               }
               else {

                  _log.error << "Failed to load image resource: " << ImageRc
                     << " -> " << ImageName << endl;
                  _ignore.add (Object.get_handle ());
               }
            }
         }
         else {

            _log.error << "Failed to find image resource: " << ImageRc << endl;
            _ignore.add (Object.get_handle ());
         }
      }
   }

   return result;
}
예제 #2
0
 jspace::Model * create_fork_4R_model() throw(std::runtime_error)
 {
   return _create_model(create_fork_4R_brep);
 }
예제 #3
0
 jspace::Model * create_unit_inertia_RR_model() throw(runtime_error)
 {
   return _create_model(create_unit_inertia_RR_brep);
 }
예제 #4
0
 jspace::Model * create_unit_mass_RP_model() throw(runtime_error)
 {
   return _create_model(create_unit_mass_RP_brep);
 }
예제 #5
0
 jspace::Model * create_puma_model() throw(runtime_error)
 {
   return _create_model(create_puma_brep);
 }