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


C++ WorldModel类代码示例

本文整理汇总了C++中WorldModel的典型用法代码示例。如果您正苦于以下问题:C++ WorldModel类的具体用法?C++ WorldModel怎么用?C++ WorldModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: quickWorldModelTest

void quickWorldModelTest() {
    gSystem->Load("lib/libPropagation.so");
//    BedmapTable *iceTable = new BedmapTable (RyansCons::kBathymetry);
    WorldModel *myWorld = new WorldModel();
    TH2F *iceHist = new TH2F("iceHist","Ice Thickness",1000,-3e6,3e6,1000,-3e6,3e6);
    TH2F *iceHist2 = new TH2F("iceHist2","Ice Thickness (Bedmap)",1000,-3e6,3e6,1000,-3e6,3e6);
    TH2F *surfaceHist = new TH2F("surfaceHist","Surface",1000,-3e6,3e6,1000,-3e6,3e6);
//    int goodFlag;
    for(int binx=1;binx<=iceHist->GetNbinsX();binx++) {
	Double_t x=iceHist->GetXaxis()->GetBinCenter(binx);
	for(int biny=1;biny<=iceHist->GetNbinsY();biny++) {
	    Double_t y=iceHist->GetYaxis()->GetBinCenter(biny);
	    Double_t value=myWorld->getCrust2Data(x,y,RyansCons::kThicknessOfIce);
	    iceHist->SetBinContent(binx,biny,value);
	    value=myWorld->getIceThickness(x,y);
	    iceHist2->SetBinContent(binx,biny,value);
	    value=myWorld->getSurface(x,y);
	    surfaceHist->SetBinContent(binx,biny,value/1e6);
	    if(value>1e7 || value<1e6) cout << x << "\t" << y << "\t" << value << endl;
	}
    }
    TCanvas *can = new TCanvas("can","can");
    can->Divide(1,2);
    can->cd(1);
    iceHist->Draw("colz");
    can->cd(2);
    iceHist2->Draw("colz");
	
    TCanvas *can2 = new TCanvas("can2","can2");
    surfaceHist->Draw("colz");
    
}
开发者ID:nichol77,项目名称:monte,代码行数:32,代码来源:quickWorldModelTest.C

示例2: convertRawFile

    //=================================================================
    bool TileAssembler::convertRawFile(const std::string& pModelFilename)
    {
        bool success = true;
        std::string filename = iSrcDir;
        if (filename.length() >0)
            filename.push_back('/');
        filename.append(pModelFilename);

        WorldModel_Raw raw_model;
        if (!raw_model.Read(filename.c_str()))
            return false;

        // write WorldModel
        WorldModel model;
        model.setRootWmoID(raw_model.RootWMOID);
        if (!raw_model.groupsArray.empty())
        {
            std::vector<GroupModel> groupsArray;

            uint32 groups = raw_model.groupsArray.size();
            for (uint32 g = 0; g < groups; ++g)
            {
                GroupModel_Raw& raw_group = raw_model.groupsArray[g];
                groupsArray.push_back(GroupModel(raw_group.mogpflags, raw_group.GroupWMOID, raw_group.bounds ));
                groupsArray.back().setMeshData(raw_group.vertexArray, raw_group.triangles);
                groupsArray.back().setLiquidData(raw_group.liquid);
            }

            model.setGroupModels(groupsArray);
        }

        success = model.writeFile(iDestDir + "/" + pModelFilename + ".vmo");
        //std::cout << "readRawFile2: '" << pModelFilename << "' tris: " << nElements << " nodes: " << nNodes << std::endl;
        return success;
    }
开发者ID:Arkania,项目名称:ArkCORE-NG,代码行数:36,代码来源:TileAssembler.cpp

示例3: pos

/*!

 */
void
CrossGenerator::updateOpponents( const WorldModel & wm )
{
    const double opponent_dist_thr2 = std::pow( 20.0, 2 );

    const Vector2D goal = ServerParam::i().theirTeamGoalPos();
    const AngleDeg goal_angle_from_ball = ( goal - M_first_point ).th();

    for ( AbstractPlayerCont::const_iterator
              p = wm.theirPlayers().begin(),
              end = wm.theirPlayers().end();
          p != end;
          ++p )
    {
        AngleDeg opponent_angle_from_ball = ( (*p)->pos() - M_first_point ).th();
        if ( ( opponent_angle_from_ball - goal_angle_from_ball ).abs() > 90.0 )
        {
            continue;
        }

        if ( (*p)->pos().dist2( M_first_point ) > opponent_dist_thr2 )
        {
            continue;
        }

        M_opponents.push_back( *p );

#ifdef DEBUG_PRINT
        dlog.addText( Logger::PASS,
                      "Cross opponent %d pos(%.1f %.1f)",
                      (*p)->unum(),
                      (*p)->pos().x, (*p)->pos().y );
#endif
    }
}
开发者ID:4SkyNet,项目名称:HFO,代码行数:38,代码来源:cross_generator.cpp

示例4: DetachObject

HOBJECT WorldModel::AttachObject( HOBJECT hObj )
{
	if( !hObj ) return LTNULL;

	// Make sure the object is detached first.
	DetachObject( hObj );

	LTVector	vPos, vParentPos;
	LTRotation	rRot, rParentRot;

	// Get our position and rotation

	g_pLTServer->GetObjectPos( m_hObject, &vParentPos );
	g_pLTServer->GetObjectRotation( m_hObject, &rParentRot );
	
	LTMatrix mRot;
	rParentRot.ConvertToMatrix( mRot );

	// Get the attachment object pos / rot

	g_pLTServer->GetObjectPos( hObj, &vPos );
	g_pLTServer->GetObjectRotation( hObj, &rRot );

	// Calculate the offsets...

	LTVector	vPosOffset( ~mRot * (vPos - vParentPos) );
	LTRotation	rRotOffset = rRot * ~rParentRot;

	// Attach it...

	HATTACHMENT	hAttachment;
	LTRESULT	LTRes = g_pLTServer->CreateAttachment( m_hObject, hObj, LTNULL, 
													   &vPosOffset, &rRotOffset, &hAttachment );
	if( LTRes != LT_OK )
		return NULL;

	LTObjRefNotifier ref( *this );
	ref = hObj;
	m_AttachmentList.push_back( ref );

	// If the object is a WorldModel set it's activate parent...

	if( IsWorldModel( hObj ))
	{
		WorldModel *pWorldModel = dynamic_cast<WorldModel*>(g_pLTServer->HandleToObject( hObj ));
		if( pWorldModel )
		{
			// Send any activate messages the WorldModel recevies to us...

			pWorldModel->SetActivateParent( m_hObject );

			// Add the WorldModel to our list of objects to inherit our ActivateType...

			m_ActivateTypeHandler.InheritObject( hObj );
		}
	}

	return hObj;
}
开发者ID:rickyharis39,项目名称:nolf2,代码行数:59,代码来源:WorldModel.cpp

示例5: lidarlocalizorapp

void lidarlocalizorapp(){
  printf("starting\n");
 
  Lidar lidar;
  lidar.init("lidar/lidarconfig.conf");
  
  LidarManager lidarManager;
  lidarManager.lidar=&lidar; 
  
  lidarManager.init("lidar/lidarpositionconfig.conf");
  
  
  LidarLocalizer localizer;
  localizer.loadPresetMap();
  
  WorldModel model;
  model.init("indoorlidarconf.conf");
  model.lidar=&lidarManager;
  model.lidarLocalizer=&localizer;
  
  Network network;  
  model.network=&network;
  
	Display display=Display(&model);
  
  //start timer
  TimeKeeper::start_time();

  printf("made all objects\n");
  int key = 0;	
  long start=0;
  double x;
  double y;
  try {
	while((key&255)!=27){

	  start=TimeKeeper::GetTime();
	 // printf("loop start\n");
	  
	  model.updateModel();
	//  localizer.estimatePosition(&state,&scanpoints,fake_scan_point_count);

	//  printf("model updated\n");
	  //display.displayModel();
      key=cvWaitKey(15);
	  
	  cout<<"position "<<model.state.crioPosition.x<<" "<<model.state.crioPosition.y<<" "<<model.state.crioRot<<endl;
	  cout<<"time elapsed "<<(TimeKeeper::GetTime()-start)/1000000.0<<endl;
	
	}
  }
  catch(...) {
	cerr << "we are catching an uncaught exception. bad things happened" << endl;
  }
  
}
开发者ID:erebuswolf,项目名称:IGVC-Code,代码行数:56,代码来源:lidarlocalizorapp.cpp

示例6: get_ball_area

/*!

 */
Strategy::BallArea
Strategy::get_ball_area( const WorldModel & wm )
{
    int ball_step = 1000;
    ball_step = std::min( ball_step, wm.interceptTable()->teammateReachCycle() );
    ball_step = std::min( ball_step, wm.interceptTable()->opponentReachCycle() );
    ball_step = std::min( ball_step, wm.interceptTable()->selfReachCycle() );

    return get_ball_area( wm.ball().inertiaPoint( ball_step ) );
}
开发者ID:Aanal,项目名称:RobosoccerAttack-Athena,代码行数:13,代码来源:strategy.cpp

示例7: ball_ray

/*!

 */
int
TackleGenerator::predictOpponentsReachStep( const WorldModel & wm,
                                            const Vector2D & first_ball_pos,
                                            const Vector2D & first_ball_vel,
                                            const AngleDeg & ball_move_angle )
{
    int first_min_step = 50;

#if 1
    const ServerParam & SP = ServerParam::i();
    const Vector2D ball_end_point = inertia_final_point( first_ball_pos,
                                                         first_ball_vel,
                                                         SP.ballDecay() );
    if ( ball_end_point.absX() > SP.pitchHalfLength()
         || ball_end_point.absY() > SP.pitchHalfWidth() )
    {
        Rect2D pitch = Rect2D::from_center( 0.0, 0.0, SP.pitchLength(), SP.pitchWidth() );
        Ray2D ball_ray( first_ball_pos, ball_move_angle );
        Vector2D sol1, sol2;
        int n_sol = pitch.intersection( ball_ray, &sol1, &sol2 );
        if ( n_sol == 1 )
        {
            first_min_step = SP.ballMoveStep( first_ball_vel.r(), first_ball_pos.dist( sol1 ) );
#ifdef DEBUG_PRINT
            dlog.addText( Logger::CLEAR,
                          "(predictOpponent) ball will be out. step=%d reach_point=(%.2f %.2f)",
                          first_min_step,
                          sol1.x, sol1.y );
#endif
        }
    }
#endif

    int min_step = first_min_step;
    for ( AbstractPlayerCont::const_iterator
              o = wm.theirPlayers().begin(),
              end = wm.theirPlayers().end();
          o != end;
          ++o )
    {
        int step = predictOpponentReachStep( *o,
                                             first_ball_pos,
                                             first_ball_vel,
                                             ball_move_angle,
                                             min_step );
        if ( step < min_step )
        {
            min_step = step;
        }
    }

    return ( min_step == first_min_step
             ? 1000
             : min_step );
}
开发者ID:Aanal,项目名称:RobosoccerAttack-Athena,代码行数:58,代码来源:tackle_generator.cpp

示例8: DEBUG_FILTER_LOG

    bool StaticMapTree::InitMap(const std::string& fname, VMapManager2* vm)
    {
        DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "Initializing StaticMapTree '%s'", fname.c_str());
        bool success = true;
        std::string fullname = iBasePath + fname;
        FILE* rf = fopen(fullname.c_str(), "rb");
        if (!rf)
            return false;
        else
        {
            char chunk[8];
            // general info
            if (!readChunk(rf, chunk, VMAP_MAGIC, 8)) success = false;
            char tiled;
            if (success && fread(&tiled, sizeof(char), 1, rf) != 1) success = false;
            iIsTiled = !!tiled;
            // Nodes
            if (success && !readChunk(rf, chunk, "NODE", 4)) success = false;
            if (success) success = iTree.readFromFile(rf);
            if (success)
            {
                iNTreeValues = iTree.primCount();
                iTreeValues = new ModelInstance[iNTreeValues];
            }

            if (success && !readChunk(rf, chunk, "GOBJ", 4)) success = false;
            // global model spawns
            // only non-tiled maps have them, and if so exactly one (so far at least...)
            ModelSpawn spawn;
#ifdef VMAP_DEBUG
            DEBUG_LOG("Map isTiled: %u", static_cast<uint32>(iIsTiled));
#endif
            if (!iIsTiled && ModelSpawn::readFromFile(rf, spawn))
            {
                WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name);
                DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "StaticMapTree::InitMap(): loading %s", spawn.name.c_str());
                if (model)
                {
                    model->setModelFlags(spawn.flags);
                    // assume that global model always is the first and only tree value (could be improved...)
                    iTreeValues[0] = ModelInstance(spawn, model);
                    iLoadedSpawns[0] = 1;
                }
                else
                {
                    success = false;
                    ERROR_LOG("StaticMapTree::InitMap() could not acquire WorldModel pointer for '%s'!", spawn.name.c_str());
                }
            }

            fclose(rf);
        }
        return success;
    }
开发者ID:cala,项目名称:mangos-classic,代码行数:54,代码来源:MapTree.cpp

示例9: s_update_time

/*!

 */
void
Strategy::update( const WorldModel & wm )
{
    static GameTime s_update_time( -1, 0 );

    if ( s_update_time == wm.time() )
    {
        return;
    }
    s_update_time = wm.time();

    updateSituation( wm );
    updatePosition( wm );
}
开发者ID:Aanal,项目名称:RobosoccerAttack-Athena,代码行数:17,代码来源:strategy.cpp

示例10: s_update_time

/*!

 */
void
TackleGenerator::generate( const WorldModel & wm )
{
    static GameTime s_update_time( 0, 0 );

    if ( s_update_time == wm.time() )
    {
        // dlog.addText( Logger::CLEAR,
        //               __FILE__": already updated" );
        return;
    }
    s_update_time = wm.time();

    clear();

    if ( wm.self().isKickable() )
    {
        // dlog.addText( Logger::CLEAR,
        //               __FILE__": kickable" );
        return;
    }

    if ( wm.self().tackleProbability() < 0.001
         && wm.self().foulProbability() < 0.001 )
    {
        // dlog.addText( Logger::CLEAR,
        //               __FILE__": never tacklable" );
        return;
    }

    if ( wm.time().stopped() > 0 )
    {
        // dlog.addText( Logger::CLEAR,
        //               __FILE__": time stopped" );
        return;
    }

    if ( wm.gameMode().type() != GameMode::PlayOn
         && ! wm.gameMode().isPenaltyKickMode() )
    {
        // dlog.addText( Logger::CLEAR,
        //               __FILE__": illegal playmode " );
        return;
    }


#ifdef DEBUG_PROFILE
    MSecTimer timer;
#endif

    calculate( wm );

#ifdef DEBUG_PROFILE
    dlog.addText( Logger::CLEAR,
                  __FILE__": PROFILE. elapsed=%.3f [ms]",
                  timer.elapsedReal() );
#endif

}
开发者ID:Aanal,项目名称:RobosoccerAttack-Athena,代码行数:62,代码来源:tackle_generator.cpp

示例11: Tick

QuestTickResult ScanPlanetQuest::Tick(float, const WorldModel &worldModel) {
    int scanned = worldModel.GetMetaData(targetPlanet).GetValue(metaDataMarker);
    if (scanned >= 100) {
        //TODO improve sponsor relationship
        return QuestTickResult(QuestModelAction(QuestActionType::SUCCEED, GetId()));
    }
    return QuestTickResult(GetId());
}
开发者ID:Cultrarius,项目名称:QuestWeaver,代码行数:8,代码来源:ScanPlanetQuest.cpp

示例12: CreateServerMark

static void CreateServerMark(CLIENTWEAPONFX & theStruct)
{
	// If this isn't a GameBase object, return...

	if (!IsWorldModel(theStruct.hObj)) return;

	// See if we should create a mark, or simply move one of the GameBase's
	// marks.

	// If the GameBase has the max number of marks or this mark is very close
	// to a pre-existing mark, just move that mark to the new position.

    WorldModel* pObj = (WorldModel*) g_pLTServer->HandleToObject(theStruct.hObj);
	if (!pObj) return;

	pObj->CreateServerMark( theStruct );
}
开发者ID:Arc0re,项目名称:lithtech,代码行数:17,代码来源:ClientWeaponSFX.cpp

示例13: WorldModel

 WorldModel* VMapManager2::acquireModelInstance(const std::string &basepath, const std::string &filename)
 {
     ModelFileMap::iterator model = iLoadedModelFiles.find(filename);
     if (model == iLoadedModelFiles.end())
     {
         WorldModel *worldmodel = new WorldModel();
         if (!worldmodel->readFile(basepath + filename + ".vmo"))
         {
             ERROR_LOG("VMapManager2: could not load '%s%s.vmo'!", basepath.c_str(), filename.c_str());
             delete worldmodel;
             return NULL;
         }
         DEBUG_LOG("VMapManager2: loading file '%s%s'.", basepath.c_str(), filename.c_str());
         model = iLoadedModelFiles.insert(std::pair<std::string, ManagedModel>(filename, ManagedModel())).first;
         model->second.setModel(worldmodel);
     }
     model->second.incRefCount();
     return model->second.getModel();
 }
开发者ID:Aion2n,项目名称:mangos,代码行数:19,代码来源:VMapManager2.cpp

示例14: notify

void ExplosionView::notify(Subject* s)
{
    WorldModel* m;
    m = dynamic_cast<WorldModel *>(s);    
    if(start_animation)
    {
        float current_radius = timer.GetElapsedTime() * radius_per_second;
        int circle_complete = (current_radius / max_radius) * 100;
        int blue_value = (circle_complete * 255) / 100;
        std::cout << circle_complete << '\n';
        std::cout << blue_value << '\n';
        circle = sf::Shape::Circle(m->get_x_position(), m->get_y_position(), current_radius, sf::Color(255, blue_value, 0));
        app->Draw(circle);
        draw();
        
        if(current_radius > max_radius)
            m->dispose();
        
    }
}
开发者ID:stewartmatheson,项目名称:Melbourne,代码行数:20,代码来源:ExplosionView.cpp

示例15: s_update_time

/*!

 */
void
ActionChainHolder::update( const WorldModel & wm )
{
    static GameTime s_update_time( 0, 0 );
    static FieldEvaluator::ConstPtr s_update_evaluator;
    static ActionGenerator::ConstPtr s_update_generator;

    if ( s_update_time == wm.time()
         && s_update_evaluator == M_evaluator
         && s_update_generator == M_generator )
    {
        return;
    }
    s_update_time = wm.time();
    s_update_evaluator = M_evaluator;
    s_update_generator = M_generator;

    M_graph = ActionChainGraph::Ptr( new ActionChainGraph( M_evaluator, M_generator ) );
    M_graph->calculate( wm );
}
开发者ID:Aanal,项目名称:RobosoccerAttack-Athena,代码行数:23,代码来源:action_chain_holder.cpp


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