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


C++ SetIndex函数代码示例

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


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

示例1: SetIndex

/*
object		prepare GPU memory, transfer KDTree to array
*/
void KDTree::PrepareMemory()
{ 

	leafNode = new KDLeafNode[numLeafNode];
	insideNode = new KDInsideNode[numInsideNode];

	KDNode* cur = root;

	int indexNode =0;
	int inter_size =1;
	int leaf_size =0;
	leafNodeIndex = new int[SizeofLeafNode];
	SizeofLeafNode =0;

	insideNode[0].splitValue = root->splitValue;
	insideNode[0].splitAxis = root->splitAxis;

	insideNode[0].aabb.maxPoint.x=root->aabb.maxPoint.x;
	insideNode[0].aabb.maxPoint.y=root->aabb.maxPoint.y;
	insideNode[0].aabb.maxPoint.z=root->aabb.maxPoint.z;
	insideNode[0].aabb.minPoint.x=root->aabb.minPoint.x;
	insideNode[0].aabb.minPoint.y=root->aabb.minPoint.y;
	insideNode[0].aabb.minPoint.z=root->aabb.minPoint.z;
	insideNode[0].LeftLeaf = false;
	insideNode[0].RightLeaf = false;
	SetIndex(indexNode,cur->left, inter_size,leaf_size,true);
	SetIndex(indexNode,cur->right, inter_size,leaf_size,false);
}
开发者ID:peng-mi,项目名称:path-tracer,代码行数:31,代码来源:KDTree.cpp

示例2: ClearAll

void	idBoundsTrack::Test()
{
	ClearAll();
	idRandom	r;
	
	for( int i = 0 ; i < 1800 ; i++ )
	{
		idBounds b;
		for( int j = 0 ; j < 3 ; j++ )
		{
			b[0][j] = r.RandomInt( 20000 ) - 10000;
			b[1][j] = b[0][j] + r.RandomInt( 1000 );
		}
		SetIndex( i, b );
	}
	
	const idBounds testBounds( idVec3( -1000, 2000, -3000 ), idVec3( 1500, 4500, -500 ) );
	SetIndex( 1800, testBounds );
	SetIndex( 0, testBounds );
	
	const shortBounds_t	shortTestBounds( testBounds );
	
	int intersectedIndexes1[ MAX_BOUNDS_TRACK_INDEXES ];
	const int numHits1 = FindBoundsIntersectionsTEST( shortTestBounds, boundsList, maxIndex, intersectedIndexes1 );
	
	int intersectedIndexes2[ MAX_BOUNDS_TRACK_INDEXES ];
	const int numHits2 = FindBoundsIntersectionsSimSIMD( shortTestBounds, boundsList, maxIndex, intersectedIndexes2 );
	idLib::Printf( "%i intersections\n", numHits1 );
	if( numHits1 != numHits2 )
	{
		idLib::Printf( "different results\n" );
	}
	else
	{
		for( int i = 0 ; i < numHits1 ; i++ )
		{
			if( intersectedIndexes1[i] != intersectedIndexes2[i] )
			{
				idLib::Printf( "different results\n" );
				break;
			}
		}
	}
	
	// run again for debugging failure
	FindBoundsIntersectionsTEST( shortTestBounds, boundsList, maxIndex, intersectedIndexes1 );
	FindBoundsIntersectionsSimSIMD( shortTestBounds, boundsList, maxIndex, intersectedIndexes2 );
	
	// timing
	const int64 start = Sys_Microseconds();
	for( int i = 0 ; i < 40 ; i++ )
	{
		FindBoundsIntersectionsSimSIMD( shortTestBounds, boundsList, maxIndex, intersectedIndexes2 );
	}
	const int64 stop = Sys_Microseconds();
	idLib::Printf( "%" PRId64 " microseconds for 40 itterations\n", stop - start );
}
开发者ID:Yetta1,项目名称:OpenTechBFG,代码行数:57,代码来源:BoundsTrack.cpp

示例3: Find

int
DataFieldEnum::SetStringAutoAdd(const TCHAR *text)
{
    int index = Find(text);
    if (index >= 0) {
        SetIndex(index, false);
        return entries[index].GetId();
    } else {
        index = entries.size();
        unsigned id = addEnumText(text);
        SetIndex(index, false);
        return id;
    }
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:14,代码来源:Enum.cpp

示例4: SetIndex

	void FileSet::Reload(int whichList, const Path& dir)
	{
		SetIndex(whichList);
		SetPath(dir.c_str());
		RefreshPopup();
		StopTimer();
	}
开发者ID:ADVALAIN596,项目名称:PanelDue,代码行数:7,代码来源:FileManager.cpp

示例5: SetVariableName

void   
Edge::Set(std::string name, FADA_Index* i, Condition* valid,FADA_Index*s){
SetVariableName(name);
SetIndex(i);
SetCondition(valid);
SetSigma(s);
}
开发者ID:mbelaoucha,项目名称:fadalib,代码行数:7,代码来源:edge.cpp

示例6: Index

bool ON_Group::Internal_ReadV5(
       ON_BinaryArchive& file // restore definition from binary archive
     )
{
  *this = ON_Group::Unset;

  int major_version = 0;
  int minor_version = 0;
  bool rc = file.Read3dmChunkVersion(&major_version,&minor_version);
  if ( major_version == 1 ) 
  {
    int group_index = Index();
    if (rc) rc = file.ReadInt( &group_index );
    if (rc) SetIndex(group_index);
    ON_wString group_name;
    if (rc) rc = file.ReadString( group_name );
    if (rc)
      SetName(group_name);
    if ( minor_version >= 1 )
    {
      ON_UUID group_id = ON_nil_uuid;
      if (rc) rc = file.ReadUuid( group_id );
      if (rc) SetId(group_id);
    }
    if (rc && IdIsNil() )
    {
      // modern times require unique ids.
      SetId();
    }
  }
  else
    rc = false;
  return rc;
}
开发者ID:jiapei100,项目名称:opennurbs,代码行数:34,代码来源:opennurbs_group.cpp

示例7: Read

/**********************************************************************************************
    errorType STLServerCommandSetNoiseAmplitudeLUTValue::Read(const wxString &m_device)
;will have already read the Socket command type and the command id
A polymorphic Read()
We take a sock as a parameter even though this code has access to the sock
This is because it is called from a base class and some of the polymorphic
classes derived from the base will not have a sock. This overrides that Read(sock)
***********************************************************************************************/
errorType STLServerCommandSetNoiseAmplitudeLUTValueXXX::Read(wxSocketBase &sock)
{
errorType rv;
wxInt16 index;
wxInt16 value;

    sock.SetFlags(wxSOCKET_WAITALL);
	rv=ReadFixedFields(sock);		//reads qflag, at_tick
	if(rv)
		return rv;


//-----Read the index, a wxUint16 in this instance ----

    sock.Read(&index,sizeof(index));   //Read the index
    if(sock.Error())
        return(errFail);
	AppendToReadFromSocketString(index);
//-----Read the value

    sock.Read(&value,sizeof(value));   //Read the value
    if(sock.Error())
        return(errFail);
	AppendToReadFromSocketString(value);

	SetValue(value);
	SetIndex(index);

    SetReadFlag(true);
    return errNone;
}
开发者ID:glennspr,项目名称:iCanPic,代码行数:39,代码来源:STLServerCommands.cpp

示例8: Assert

void EnergyReceiver::WalkTo(Game::Square *sq)
{
	Game::Square *old_sq = GameSettings::gamefield[GetIndex()];

	// переставляем фишку с новой клетки
	Game::Square::SwapChips(old_sq, sq);

	// восстанавливаем старую клетку
	_saved_wall.Apply(old_sq);
	old_sq->SetFake(false);
	Energy::field.UpdateSquare(old_sq->address);

	//Тащим за собой точки привязки 
	for(size_t i = 0; i < _shapElements.size(); i++)
	{
		Assert(_shapElements[i]->GetIndex() == GetIndex());
		_shapElements[i]->SetIndex(sq->address.ToPoint()); 
	}


	// меняем новую клетку
	_saved_wall.Read(sq);
	sq->SetWall(0);
	sq->SetFake(true);
	Energy::field.UpdateSquare(sq->address);

	SetIndex(sq->address.ToPoint());

	if(_order) {
		_order->SetAddress(sq->address.ToPoint());
	}
}
开发者ID:code4funnn,项目名称:4-Elements-Test,代码行数:32,代码来源:EnergyReceiver.cpp

示例9: UI_Control

MI_SelectField::MI_SelectField(const MI_SelectField& other)
    : UI_Control(other)
{
    spr = other.spr;
    szName = new char[strlen(other.szName) + 1];
    strcpy(szName, other.szName);

    SetData(other.iValue, other.sValue, other.fValue);

    for (unsigned i = 0; i < other.items.size(); i++)
        items.push_back(new SF_ListItem(*other.items[i]));

    SetIndex(other.iIndex); // sets current and index

    for (unsigned i = 0; i < other.goodRandomItems.size(); i++)
        goodRandomItems.push_back(new SF_ListItem(*other.goodRandomItems[i]));

    iWidth = other.iWidth;
    iIndent = other.iIndent;

    miModifyImageLeft = new MI_Image(spr, ix + iIndent - 26, iy + 4, 32, 64, 26, 24, 4, 1, 8);
    miModifyImageLeft->Show(false);

    miModifyImageRight = new MI_Image(spr, ix + iWidth - 16, iy + 4, 32, 88, 26, 24, 4, 1, 8);
    miModifyImageRight->Show(false);

    mcItemChangedCode = other.mcItemChangedCode;
    mcControlSelectedCode = other.mcControlSelectedCode;

    fAutoAdvance = other.fAutoAdvance;
    fNoWrap = other.fNoWrap;
    iAdjustmentY = other.iAdjustmentY;
    fFastScroll = other.fFastScroll;
}
开发者ID:MisterTea,项目名称:supermariowar,代码行数:34,代码来源:uicontrol.cpp

示例10: SetName

void
Written_Reference::Set(string __name, FADA_Index* __index, Quast* __anti, Quast* __out){
SetName(__name);
SetIndex(__index);
SetAnti(__anti);
SetOutput(__out);
}
开发者ID:mbelaoucha,项目名称:fadalib,代码行数:7,代码来源:written_reference.cpp

示例11: SetReg

/*********************************************************************
* Function:  void  SetReg(BYTE index, WORD value)
*
* PreCondition: none
*
* Input: index - register number
*        value - value to be set
*
* Output: none
*
* Side Effects: none
*
* Overview: sets graphics controller register
*
* Note: none
*
********************************************************************/
void SetReg(WORD index, WORD value)
{
    CS_LAT_BIT = 0;
    SetIndex(index);
    WriteData(value);
    CS_LAT_BIT = 1;
}
开发者ID:WilliamAvila,项目名称:PIC32MX460F512L_Examples,代码行数:24,代码来源:drvTFT002.c

示例12: SetReg

/*********************************************************************
* Function:  void  SetReg(BYTE index, BYTE value)
*
* PreCondition: none
*
* Input: index - register number
*        value - value to be set
*
* Output: none
*
* Side Effects: none
*
* Overview: sets graphics controller register
*
* Note: none
*
********************************************************************/
void SetReg(BYTE index, BYTE value)
{
    CS_LAT_BIT = 0;
    SetIndex(index);
    WriteCommand(value);
    CS_LAT_BIT = 1;
}
开发者ID:WilliamAvila,项目名称:PIC32MX460F512L_Examples,代码行数:24,代码来源:HX8347.c

示例13: SetReg

/*********************************************************************
* Function:  void  SetReg(BYTE index, WORD value)
*
* PreCondition: none
*
* Input: index - register number
*        value - value to be set
*
* Output: none
*
* Side Effects: none
*
* Overview: sets graphics controller register
*
* Note: none
*
********************************************************************/
void  SetReg(BYTE index, WORD value){

    CS_LAT_BIT = 0;
    SetIndex(index);
    WriteData(((WORD_VAL)value).v[1],((WORD_VAL)value).v[0]);
    CS_LAT_BIT = 1;
}
开发者ID:mikewang01,项目名称:Zezus,代码行数:24,代码来源:SPFD5408.c

示例14: Geometry

Model::Model( const char * filename )
  : Geometry( GL_LINES, filename, FLAG_LINE )
{
  // LOGI("Model::cstr() file %s", filename );
  FILE * fp = fopen( filename, "r" );
  if ( fp != NULL ) {
    int ns;
    int nl;
    int nx;
    fscanf(fp, "%d %d %d", &ns, &nl, &nx );  // Nr.Stations Nr.Legs Nr.splays
    my_vertex = new float[ 3 * ( ns + nx ) ];
    my_index  = new unsigned short[ 2 * (nl + nx) ];

    char name[32];
    char name2[32];
    for ( int k=0; k<ns; ++k ) {
      float x, y, z;
      if ( fscanf( fp, "%s %f %f %f", name, &x, &y, &z ) != 4 ) break;
      my_vertex[ 3*k + 0 ] = x;
      my_vertex[ 3*k + 1 ] = y;
      my_vertex[ 3*k + 2 ] = z;
      stations.insert( std::pair<std::string, int>( name, k ) );
    }
    for ( int k=0; k<nl; ++k ) {
      int a, b;
      fscanf(fp, "%s %s", name, name2 );
      StationMapIterator it1 = stations.find( name );
      StationMapIterator it2 = stations.find( name2 );
      if ( it1 != stations.end() && it2 != stations.end() ) {
        my_index[ 2*k + 0 ] = it1->second;
        my_index[ 2*k + 1 ] = it2->second;
      } else {
        break;
      }
    }
    int cx = 0;
    for ( int k=0; k<nx; ++k ) {
      int a, b;
      float x, y, z;
      fscanf(fp, "%s %f %f %f", name, &x, &y, &z );
      StationMapIterator it1 = stations.find( name );
      if ( it1 == stations.end() ) break;
      sprintf(name2, "%s-%d", name, cx );
      ++ cx;
      my_vertex[ 3*ns + 3*k + 0 ] = x;
      my_vertex[ 3*ns + 3*k + 1 ] = y;
      my_vertex[ 3*ns + 3*k + 2 ] = z;
      // station name not inserted in the stations map for the TO of the splay 
      my_index[ 2 * nl + 2*k + 0 ] = it1->second;
      my_index[ 2 * nl + 2*k + 1 ] = ns + k;
    }  
    SetVertex( my_vertex );
    SetNVertex( ns + nx );
    SetIndex( my_index );
    SetNIndex( 2 * (nl+nx) );
    
    InitBBox();
  }
}
开发者ID:marcocorvi,项目名称:cave3dgl,代码行数:59,代码来源:Model.cpp

示例15: SetReg

/*********************************************************************
* Function:  void  SetReg(WORD index, WORD value)
*
* PreCondition: none
*
* Input: index - register number
*        value - value to be set
*
* Output: none
*
* Side Effects: none
*
* Overview: sets graphics controller register
*
* Note: none
*
********************************************************************/
void  SetReg(WORD index, WORD value){

    while(PMMODEbits.BUSY);
    CS_LAT_BIT = 0;
    SetIndex(index);
    WriteData(value);
    CS_LAT_BIT = 1;
}
开发者ID:gexueyuan,项目名称:11-ru,代码行数:25,代码来源:ST7789S.C


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