예제 #1
0
/// load the directory
void PlaceDirectory::Load( CUtlBuffer &fileBuffer, int version )
{
	// read number of entries
	IndexType count = fileBuffer.GetUnsignedShort();

	m_directory.RemoveAll();

	// read each entry
	char placeName[256];
	unsigned short len;
	for( int i=0; i<count; ++i )
	{
		len = fileBuffer.GetUnsignedShort();
		fileBuffer.Get( placeName, MIN( sizeof( placeName ), len ) );

		Place place = TheNavMesh->NameToPlace( placeName );
		if (place == UNDEFINED_PLACE)
		{
			Warning( "Warning: NavMesh place %s is undefined?\n", placeName );
		}
		AddPlace( place );
	}

	if ( version > 11 )
	{
		m_hasUnnamedAreas = fileBuffer.GetUnsignedChar() != 0;
	}
}
예제 #2
0
void PlaceMatcher::AddPlace(const ReferenceFrameId& id, const cv::Mat& place)
{
  unsigned int uint;
  {
    std::lock_guard<std::mutex> lock(m_mutex_uint);
    uint = m_frames.size() + 1;
    m_frames.emplace(id, uint);
    m_place_ids.emplace(uint, id);
  }
  AddPlace(uint, place);
}
예제 #3
0
void PlaceMatcher::GetPotentialPlaceMatchesOrAddPlace(
    const cv::Mat &place,
    std::vector<PlaceMatchCandidate>& vPlaceMatches,
    const unsigned int uFrameId,
    const std::vector<unsigned int> &vSubset)
{
  if (vSubset.empty()) {
    GetPotentialPlaceMatches(place, vPlaceMatches);
  } else {
    GetPotentialPlaceMatches(place, vSubset, vPlaceMatches);
  }

  if(vPlaceMatches.empty()) AddPlace(uFrameId, place);
}
예제 #4
0
	void CSimPetriDoc::CreateOMPDoc(CString pathToFile)
	{
		ompMode = TRUE;
		delete stepper;

		//Créer le squelette
		const std::wstring pathName(pathToFile);
		const wchar_t *separator = _T(";");
		omp::Reader dataReader(pathName, separator);
		omp::PetriOMP omp(dataReader, skeleton);

		//Créer le stepper
		stepper = new pm::TrackableStepper(&skeleton, &timer);

		//Ajouter les places
		double radiusPlaces = ((double)(3)/4) * min(size.cx/2, size.cy/2);
		pm::Places places = skeleton.getPlaces();
		unsigned index = 0;
		for(auto it=places.begin(); it!=places.end(); ++it)
		{
			int x(size.cx/2 + radiusPlaces*std::cos(((double)(index)/places.size())*2*3.14));
			int y(-size.cy/2 + radiusPlaces*std::sin(((double)(index)/places.size())*2*3.14));
			shapesMap.insert(std::make_pair(*it, AddPlace(Point(x,y), *it)));
			++index;
		}

		//Ajouter les transitions
		double radiusTrans = ((double)(1)/2) * min(size.cx/2, size.cy/2);
		pm::Transitions transitions = skeleton.getTransitions();
		index = 0;
		for(auto it=transitions.begin(); it!=transitions.end(); ++it)
		{
			Point source = shapesMap.at((*it)->getInputArcs().front()->getSourceNode())->GetPosition();
			Point end = shapesMap.at((*it)->getOutputArcs().front()->getEndNode())->GetPosition();
			//int x(size.cx/2 + radiusTrans*std::cos(((double)(index)/transitions.size())*2*3.14));
			//int y(-size.cy/2 + radiusTrans*std::sin(((double)(index)/transitions.size())*2*3.14));
			shapesMap.insert(std::make_pair(*it, AddTransition(Geometry::MiddlePoint(source, end), *it)));
			++index;
		}

		//Ajouter les arcs
		pm::Arcs arcs = skeleton.getArcs();
		std::vector<Point> nullVector;
		for(auto it=arcs.begin(); it!=arcs.end(); ++it)
			AddArc(shapesMap.at((*it)->getSourceNode()),
			shapesMap.at((*it)->getEndNode()),
			nullVector,
			*it);
	}
예제 #5
0
파일: nav_file.cpp 프로젝트: paralin/hl2sdk
	/// load the directory
	void Load( FileHandle_t file )
	{
		// read number of entries
		IndexType count;
		filesystem->Read( &count, sizeof(IndexType), file );

		m_directory.RemoveAll();

		// read each entry
		char placeName[256];
		unsigned short len;
		for( int i=0; i<count; ++i )
		{
			filesystem->Read( &len, sizeof(unsigned short), file );
			filesystem->Read( placeName, len, file );

			AddPlace( TheNavMesh->NameToPlace( placeName ) );
		}
	}
예제 #6
0
/* <4edfaa> ../game_shared/bot/nav_file.cpp:142 */
void PlaceDirectory::Load(SteamFile *file)
{
	// read number of entries
	EntryType count;
	file->Read(&count, sizeof(EntryType));

	m_directory.reserve(count);

	// read each entry
	char placeName[256];
	unsigned short len;
	for (int i = 0; i < count; ++i)
	{
		file->Read(&len, sizeof(unsigned short));
		file->Read(placeName, len);

		AddPlace(TheBotPhrases->NameToID(placeName));
	}
}