• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ CUtlVector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: KeyValues

//-----------------------------------------------------------------------------
// Purpose: Creates the build mode editing controls
//-----------------------------------------------------------------------------
void BuildModeDialog::CreateControls()
{
	int i;
	m_pPanelList = new PanelList;
	m_pPanelList->m_pResourceData = new KeyValues( "BuildDialog" );
	m_pPanelList->m_pControls = new PanelListPanel(this, "BuildModeControls");

	// file to edit combo box is first
	m_pFileSelectionCombo = new ComboBox(this, "FileSelectionCombo", 10, false);
	for ( i = 0; i < m_pBuildGroup->GetRegisteredControlSettingsFileCount(); i++)
	{
		m_pFileSelectionCombo->AddItem(m_pBuildGroup->GetRegisteredControlSettingsFileByIndex(i), NULL);
	}
	if (m_pFileSelectionCombo->GetItemCount() < 2)
	{
		m_pFileSelectionCombo->SetEnabled(false);
	}

	int buttonH = 18;

	// status info at top of dialog
	m_pStatusLabel = new Label(this, "StatusLabel", "[nothing currently selected]");
	m_pStatusLabel->SetTextColorState(Label::CS_DULL);
	m_pStatusLabel->SetTall( buttonH );
	m_pDivider = new Divider(this, "Divider");
	// drop-down combo box for adding new controls
	m_pAddNewControlCombo = new ComboBox(this, NULL, 30, false);
	m_pAddNewControlCombo->SetSize(116, buttonH);
	m_pAddNewControlCombo->SetOpenDirection(Menu::DOWN);

	m_pEditableParents = new CBuildModeNavCombo( this, NULL, 15, false, true, m_pBuildGroup->GetContextPanel() );
	m_pEditableParents->SetSize(116, buttonH);
	m_pEditableParents->SetOpenDirection(Menu::DOWN);

	m_pEditableChildren = new CBuildModeNavCombo( this, NULL, 15, false, false, m_pBuildGroup->GetContextPanel() );
	m_pEditableChildren->SetSize(116, buttonH);
	m_pEditableChildren->SetOpenDirection(Menu::DOWN);

	m_pNextChild = new Button( this, "NextChild", "Next", this );
	m_pNextChild->SetCommand( new KeyValues( "OnChangeChild", "direction", 1 ) );

	m_pPrevChild = new Button( this, "PrevChild", "Prev", this );
	m_pPrevChild->SetCommand( new KeyValues( "OnChangeChild", "direction", -1 ) );

	// controls that can be added
	// this list comes from controls EditablePanel can create by name.
	int defaultItem = m_pAddNewControlCombo->AddItem("None", NULL);

	CUtlVector< char const * >	names;
	CBuildFactoryHelper::GetFactoryNames( names );
	// Sort the names
	CUtlRBTree< char const *, int > sorted( 0, 0, StringLessThan );

	for ( i = 0; i < names.Count(); ++i )
	{
		sorted.Insert( names[ i ] );
	}

	for ( i = sorted.FirstInorder(); i != sorted.InvalidIndex(); i = sorted.NextInorder( i ) )
	{
		m_pAddNewControlCombo->AddItem( sorted[ i ], NULL );
	}

	m_pAddNewControlCombo->ActivateItem(defaultItem);

	m_pExitButton = new Button(this, "ExitButton", "&Exit");
	m_pExitButton->SetSize(64, buttonH);

	m_pSaveButton = new Button(this, "SaveButton", "&Save");
	m_pSaveButton->SetSize(64, buttonH);
	
	m_pApplyButton = new Button(this, "ApplyButton", "&Apply");
	m_pApplyButton->SetSize(64, buttonH);

	m_pReloadLocalization = new Button( this, "Localization", "&Reload Localization" );
	m_pReloadLocalization->SetSize( 100, buttonH );

	m_pExitButton->SetCommand("Exit");
	m_pSaveButton->SetCommand("Save");
	m_pApplyButton->SetCommand("Apply");
	m_pReloadLocalization->SetCommand( new KeyValues( "ReloadLocalization" ) );

	m_pDeleteButton = new Button(this, "DeletePanelButton", "Delete");
	m_pDeleteButton->SetSize(64, buttonH);
	m_pDeleteButton->SetCommand("DeletePanel");

	m_pVarsButton = new MenuButton(this, "VarsButton", "Variables");
	m_pVarsButton->SetSize(72, buttonH);
	m_pVarsButton->SetOpenDirection(Menu::UP);
	
	// iterate the vars
	KeyValues *vars = m_pBuildGroup->GetDialogVariables();
	if (vars && vars->GetFirstSubKey())
	{
		// create the menu
		m_pVarsButton->SetEnabled(true);
		Menu *menu = new Menu(m_pVarsButton, "VarsMenu");
//.........这里部分代码省略.........
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:101,代码来源:BuildModeDialog.cpp


示例2: AddSampleToList

// add the sample to the list.  If we exceed the maximum number of samples, the worst sample will
// be discarded.  This has the effect of converging on the best samples when enough are added.
void AddSampleToList( CUtlVector<ambientsample_t> &list, const Vector &samplePosition, Vector *pCube )
{
	const int MAX_SAMPLES = 16;

	int index = list.AddToTail();
	list[index].pos = samplePosition;
	for ( int i = 0; i < 6; i++ )
	{
		list[index].cube[i] = pCube[i];
	}

	if ( list.Count() <= MAX_SAMPLES )
		return;

	int nearestNeighborIndex = 0;
	float nearestNeighborDist = FLT_MAX;
	float nearestNeighborTotal = 0;
	for ( int i = 0; i < list.Count(); i++ )
	{
		int closestIndex = 0;
		float closestDist = FLT_MAX;
		float totalDC = 0;
		for ( int j = 0; j < list.Count(); j++ )
		{
			if ( j == i )
				continue;
			float dist = (list[i].pos - list[j].pos).Length();
			float maxDC = 0;
			for ( int k = 0; k < 6; k++ )
			{
				// color delta is computed per-component, per cube side
				for (int s = 0; s < 3; s++ )
				{
					float dc = fabs(list[i].cube[k][s] - list[j].cube[k][s]);
					maxDC = max(maxDC,dc);
				}
				totalDC += maxDC;
			}
			// need a measurable difference in color or we'll just rely on position
			if ( maxDC < 1e-4f )
			{
				maxDC = 0;
			}
			else if ( maxDC > 1.0f )
			{
				maxDC = 1.0f;
			}
			// selection criteria is 10% distance, 90% color difference
			// choose samples that fill the space (large distance from each other)
			// and have largest color variation
			float distanceFactor = 0.1f + (maxDC * 0.9f);
			dist *= distanceFactor;

			// find the "closest" sample to this one
			if ( dist < closestDist )
			{
				closestDist = dist;
				closestIndex = j;
			}
		}
		// the sample with the "closest" neighbor is rejected
		if ( closestDist < nearestNeighborDist || (closestDist == nearestNeighborDist && totalDC < nearestNeighborTotal) )
		{
			nearestNeighborDist = closestDist;
			nearestNeighborIndex = i;
		}
	}
	list.FastRemove( nearestNeighborIndex );
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:71,代码来源:leaf_ambient_lighting.cpp


示例3: TransferToFloat

//-----------------------------------------------------------------------------
// Purpose: Applies dialog data to the list of selected faces.
// Input  : *pOnlyFace - 
//			bAll - 
//-----------------------------------------------------------------------------
void CFaceEditMaterialPage::Apply( CMapFace *pOnlyFace, int flags )
{
	int			i;
	CString		str;
	float		fshiftX = NOT_INIT;
	float		fshiftY = NOT_INIT;
	float		fscaleX = NOT_INIT;
	float		fscaleY = NOT_INIT;
	float		frotate = NOT_INIT;
	int			material = NOT_INIT;
	int			nLightmapScale = NOT_INIT;
	IEditorTexture	*pTex = m_TexturePic.GetTexture();

	//
	// Get numeric data.
	//
	if (flags & FACE_APPLY_MAPPING)
	{
		TransferToFloat( &m_shiftX, fshiftX );
		TransferToFloat( &m_shiftY, fshiftY );
		TransferToFloat( &m_scaleX, fscaleX );
		TransferToFloat( &m_scaleY, fscaleY );
		TransferToFloat( &m_rotate, frotate );
	}

	if (flags & FACE_APPLY_LIGHTMAP_SCALE)
	{
		TransferToInteger( &m_cLightmapScale, nLightmapScale );
	}

	if ( !pOnlyFace )
	{
		GetHistory()->MarkUndoPosition( NULL, "Apply Face Attributes" );

		// make sure we apply everything in this case.
		flags |= FACE_APPLY_ALL;

		// Keep the solids that we are about to change.
		// In the pOnlyFace case we do the Keep before calling ClickFace. Why?
		CUtlVector<CMapSolid *> kept;
		CFaceEditSheet *pSheet = ( CFaceEditSheet* )GetParent();
		for( i = 0; i < pSheet->GetFaceListCount(); i++ )
		{
			CMapSolid *pSolid = pSheet->GetFaceListDataSolid( i );
			if ( kept.Find( pSolid ) == -1 )
			{
				GetHistory()->Keep( pSolid );
				kept.AddToTail( pSolid );
			}
		}
	}
		
	//
	// Run thru stored faces & apply.
	//
	CFaceEditSheet *pSheet = ( CFaceEditSheet* )GetParent();
	int faceCount = pSheet->GetFaceListCount();
	for( i = 0; i < faceCount || pOnlyFace; i++ )
	{
		CMapFace *pFace;
		if( pOnlyFace )
		{
			pFace = pOnlyFace;
		}
		else
		{
			pFace = pSheet->GetFaceListDataFace( i );
		}

		//
		// Get values for texture shift, scale, rotate, and material.
		//
		if ((flags & FACE_APPLY_MAPPING) && (!(flags & FACE_APPLY_ALIGN_EDGE)))
		{
			if ( fshiftX != NOT_INIT )
			{
				pFace->texture.UAxis[3] = fshiftX;
			}

			if ( fshiftY != NOT_INIT )
			{
				pFace->texture.VAxis[3] = fshiftY;
			}

			if ( fscaleX != NOT_INIT )
			{
				pFace->texture.scale[0] = fscaleX;
			}
			
			if ( fscaleY != NOT_INIT )
			{
				pFace->texture.scale[1] = fscaleY;
			}

			if ( frotate != NOT_INIT )
//.........这里部分代码省略.........
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:101,代码来源:faceedit_materialpage.cpp


示例4: ConvertModelToPhysCollide

// adds a collision entry for this brush model
static void ConvertModelToPhysCollide( CUtlVector<CPhysCollisionEntry *> &collisionList, int modelIndex, int contents, float shrinkSize, float mergeTolerance )
{
	int i;
	CPlaneList planes( shrinkSize, mergeTolerance );

	planes.m_contentsMask = contents;

	dmodel_t *pModel = dmodels + modelIndex;
	VisitLeaves_r( planes, pModel->headnode );
	planes.AddBrushes();
	int count = planes.m_convex.Count();
	convertconvexparams_t params;
	params.Defaults();
	params.buildOuterConvexHull = count > 1 ? true : false;
	params.buildDragAxisAreas = true;
	Vector size = pModel->maxs - pModel->mins;

	float minSurfaceArea = -1.0f;
	for ( i = 0; i < 3; i++ )
	{
		int other = (i+1)%3;
		int cross = (i+2)%3;
		float surfaceArea = size[other] * size[cross];
		if ( minSurfaceArea < 0 || surfaceArea < minSurfaceArea )
		{
			minSurfaceArea = surfaceArea;
		}
	}
	// this can be really slow with super-large models and a low error tolerance
	// Basically you get a ray cast through each square of epsilon surface area on each OBB side
	// So compute it for 1% error (on the smallest side, less on larger sides)
	params.dragAreaEpsilon = clamp( minSurfaceArea * 1e-2f, 1.0f, 1024.0f );
	CPhysCollide *pCollide = physcollision->ConvertConvexToCollideParams( planes.m_convex.Base(), count, params );
	
	if ( !pCollide )
		return;

	struct 
	{
		int prop;
		float area;
	} proplist[256];
	int numprops = 1;

	proplist[0].prop = -1;
	proplist[0].area = 1;
	// compute the array of props on the surface of this model

	// NODRAW brushes no longer have any faces
	if ( !dmodels[modelIndex].numfaces )
	{
		int sideIndex = planes.GetFirstBrushSide();
		int texdata = texinfo[dbrushsides[sideIndex].texinfo].texdata;
		int prop = g_SurfaceProperties[texdata];
		proplist[numprops].prop = prop;
		proplist[numprops].area = 2;
		numprops++;
	}

	for ( i = 0; i < dmodels[modelIndex].numfaces; i++ )
	{
		dface_t *face = dfaces + i + dmodels[modelIndex].firstface;
		int texdata = texinfo[face->texinfo].texdata;
		int prop = g_SurfaceProperties[texdata];
		int j;
		for ( j = 0; j < numprops; j++ )
		{
			if ( proplist[j].prop == prop )
			{
				proplist[j].area += face->area;
				break;
			}
		}

		if ( (!numprops || j >= numprops) && numprops < ARRAYSIZE(proplist) )
		{
			proplist[numprops].prop = prop;
			proplist[numprops].area = face->area;
			numprops++;
		}
	}


	// choose the prop with the most surface area
	int maxIndex = -1;
	float maxArea = 0;
	float totalArea = 0;

	for ( i = 0; i < numprops; i++ )
	{
		if ( proplist[i].area > maxArea )
		{
			maxIndex = i;
			maxArea = proplist[i].area;
		}
		// add up the total surface area
		totalArea += proplist[i].area;
	}
	
//.........这里部分代码省略.........
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:101,代码来源:ivp.cpp


示例5: ComputePerLeafAmbientLighting

void ComputePerLeafAmbientLighting()
{
	// Figure out which lights should go in the per-leaf ambient cubes.
	int nInAmbientCube = 0;
	int nSurfaceLights = 0;
	for ( int i=0; i < *pNumworldlights; i++ )
	{
		dworldlight_t *wl = &dworldlights[i];
		
		if ( IsLeafAmbientSurfaceLight( wl ) )
			wl->flags |= DWL_FLAGS_INAMBIENTCUBE;
		else
			wl->flags &= ~DWL_FLAGS_INAMBIENTCUBE;
	
		if ( wl->type == emit_surface )
			++nSurfaceLights;

		if ( wl->flags & DWL_FLAGS_INAMBIENTCUBE )
			++nInAmbientCube;
	}

	Msg( "%d of %d (%d%% of) surface lights went in leaf ambient cubes.\n", nInAmbientCube, nSurfaceLights, nSurfaceLights ? ((nInAmbientCube*100) / nSurfaceLights) : 0 );

	g_LeafAmbientSamples.SetCount(numleafs);

	if ( g_bUseMPI )
	{
		// Distribute the work among the workers.
		VMPI_SetCurrentStage( "ComputeLeafAmbientLighting" );
		DistributeWork( numleafs, VMPI_DISTRIBUTEWORK_PACKETID, VMPI_ProcessLeafAmbient, VMPI_ReceiveLeafAmbientResults );
	}
	else
	{
		RunThreadsOn(numleafs, true, ThreadComputeLeafAmbient);
	}

	// now write out the data
	Msg("Writing leaf ambient...");
	g_pLeafAmbientIndex->RemoveAll();
	g_pLeafAmbientLighting->RemoveAll();
	g_pLeafAmbientIndex->SetCount( numleafs );
	g_pLeafAmbientLighting->EnsureCapacity( numleafs*4 );
	for ( int leafID = 0; leafID < numleafs; leafID++ )
	{
		const CUtlVector<ambientsample_t> &list = g_LeafAmbientSamples[leafID];
		g_pLeafAmbientIndex->Element(leafID).ambientSampleCount = list.Count();
		if ( !list.Count() )
		{
			g_pLeafAmbientIndex->Element(leafID).firstAmbientSample = 0;
		}
		else
		{
			g_pLeafAmbientIndex->Element(leafID).firstAmbientSample = g_pLeafAmbientLighting->Count();
			// compute the samples in disk format.  Encode the positions in 8-bits using leaf bounds fractions
			for ( int i = 0; i < list.Count(); i++ )
			{
				int outIndex = g_pLeafAmbientLighting->AddToTail();
				dleafambientlighting_t &light = g_pLeafAmbientLighting->Element(outIndex);

				light.x = Fixed8Fraction( list[i].pos.x, dleafs[leafID].mins[0], dleafs[leafID].maxs[0] );
				light.y = Fixed8Fraction( list[i].pos.y, dleafs[leafID].mins[1], dleafs[leafID].maxs[1] );
				light.z = Fixed8Fraction( list[i].pos.z, dleafs[leafID].mins[2], dleafs[leafID].maxs[2] );
				light.pad = 0;
				for ( int side = 0; side < 6; side++ )
				{
					VectorToColorRGBExp32( list[i].cube[side], light.cube.m_Color[side] );
				}
			}
		}
	}
	for ( int i = 0; i < numleafs; i++ )
	{
		// UNDONE: Do this dynamically in the engine instead.  This will allow us to sample across leaf
		// boundaries always which should improve the quality of lighting in general
		if ( g_pLeafAmbientIndex->Element(i).ambientSampleCount == 0 )
		{
			if ( !(dleafs[i].contents & CONTENTS_SOLID) )
			{
				Msg("Bad leaf ambient for leaf %d\n", i );
			}

			int refLeaf = NearestNeighborWithLight(i);
			g_pLeafAmbientIndex->Element(i).ambientSampleCount = 0;
			g_pLeafAmbientIndex->Element(i).firstAmbientSample = refLeaf;
		}
	}
	Msg("done\n");
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:88,代码来源:leaf_ambient_lighting.cpp


示例6: EmitPhysCollision

// This is the only public entry to this file.
// The global data touched in the file is:
// from bsplib.h:
//		g_pPhysCollide		: This is an output from this file.
//		g_PhysCollideSize	: This is set in this file.
//		g_numdispinfo		: This is an input to this file.
//		g_dispinfo			: This is an input to this file.
//		numnodewaterdata	: This is an output from this file.
//		dleafwaterdata		: This is an output from this file.
// from vbsp.h:
//		g_SurfaceProperties : This is an input to this file.
void EmitPhysCollision()
{
	ClearLeafWaterData();
	
	CreateInterfaceFn physicsFactory = GetPhysicsFactory();
	if ( physicsFactory )
	{
		physcollision = (IPhysicsCollision *)physicsFactory( VPHYSICS_COLLISION_INTERFACE_VERSION, NULL );
	}

	if ( !physcollision )
	{
		Warning("!!! WARNING: Can't build collision data!\n" );
		return;
	}

	CUtlVector<CPhysCollisionEntry *> collisionList[MAX_MAP_MODELS];
	CTextBuffer *pTextBuffer[MAX_MAP_MODELS];

	int physModelCount = 0, totalSize = 0;

	int start = Plat_FloatTime();

	Msg("Building Physics collision data...\n" );

	int i, j;
	for ( i = 0; i < nummodels; i++ )
	{
		// Build a list of collision models for this brush model section
		if ( i == 0 )
		{
			// world is the only model that processes water separately.
			// other brushes are assumed to be completely solid or completely liquid
			BuildWorldPhysModel( collisionList[i], NO_SHRINK, VPHYSICS_MERGE);
		}
		else
		{
			ConvertModelToPhysCollide( collisionList[i], i, MASK_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_MONSTERCLIP|MASK_WATER, VPHYSICS_SHRINK, VPHYSICS_MERGE );
		}
		
		pTextBuffer[i] = NULL;
		if ( !collisionList[i].Count() )
			continue;

		// if we've got collision models, write their script for processing in the game
		pTextBuffer[i] = new CTextBuffer;
		for ( j = 0; j < collisionList[i].Count(); j++ )
		{
			// dump a text file for visualization
			if ( dumpcollide )
			{
				collisionList[i][j]->DumpCollide( pTextBuffer[i], i, j );
			}
			// each model knows how to write its script
			collisionList[i][j]->WriteToTextBuffer( pTextBuffer[i], i, j );
			// total up the binary section's size
			totalSize += collisionList[i][j]->GetCollisionBinarySize() + sizeof(int);
		}

		// These sections only appear in the world's collision text
		if ( i == 0 )
		{
			if ( !g_bNoVirtualMesh && physcollision->SupportsVirtualMesh() )
			{
				pTextBuffer[i]->WriteText("virtualterrain {}\n");
			}
			if ( s_WorldPropList.Count() )
			{
				pTextBuffer[i]->WriteText( "materialtable {\n" );
				for ( j = 0; j < s_WorldPropList.Count(); j++ )
				{
					int propIndex = s_WorldPropList[j];
					if ( propIndex < 0 )
					{
						pTextBuffer[i]->WriteIntKey( "default", j+1 );
					}
					else
					{
						pTextBuffer[i]->WriteIntKey( physprops->GetPropName( propIndex ), j+1 );
					}
				}
				pTextBuffer[i]->WriteText( "}\n" );
			}
		}

		pTextBuffer[i]->Terminate();

		// total lump size includes the text buffers (scripts)
		totalSize += pTextBuffer[i]->GetSize();
//.........这里部分代码省略.........
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:101,代码来源:ivp.cpp


示例7: CountSelected

void PhonemeEditor::CloseCaption_MergeSelected( void )
{
	CountSelected();
	if ( m_nSelectedPhraseCount < 2 )
	{
		Con_Printf( "CloseCaption_MergeSelected:  requires 2 or more selected phrases\n" );
		return;
	}

	if ( !CloseCaption_AreSelectedPhrasesContiguous() )
	{
		Con_Printf( "CloseCaption_MergeSelected:  selected phrases must be contiguous\n" );
		return;
	}

	SetDirty( true );

	PushUndo();

	CUtlVector< CCloseCaptionPhrase * > selected;

	float beststart = 100000.0f;
	float bestend = -100000.0f;

	int c = m_Tags.GetCloseCaptionPhraseCount( CC_ENGLISH );
	int i;
	int insertslot = c -1;

	// Walk backwards and remove
	for ( i = c - 1; i >= 0; i-- )
	{
		CCloseCaptionPhrase *phrase = m_Tags.GetCloseCaptionPhrase( CC_ENGLISH, i );
		if ( !phrase || !phrase->GetSelected() )
			continue;

		if ( phrase->GetStartTime() < beststart )
		{
			beststart = phrase->GetStartTime();
		}
		if ( phrase->GetEndTime() > bestend )
		{
			bestend = phrase->GetEndTime();
		}

		selected.AddToHead( new CCloseCaptionPhrase( *phrase ) );

		// Remember the earliest slot
		if ( i < insertslot )
		{
			insertslot = i;
		}

		m_Tags.RemoveCloseCaptionPhrase( CC_ENGLISH, i );
	}

	if ( selected.Count() <= 0 )
		return;

	CCloseCaptionPhrase *newphrase = new CCloseCaptionPhrase( selected[ 0 ]->GetStream() );
	Assert( newphrase );
	wchar_t sz[ 4096 ];
	delete selected[ 0 ];
	for ( i = 1; i < selected.Count(); i++ )
	{
		_snwprintf( sz, sizeof( sz ), newphrase->GetStream() );
		// Phrases don't have leading/trailing spaces so it should be safe to just append a space here
		wcscat( sz, L" " );
		wcscat( sz, selected[ i ]->GetStream() );
		newphrase->SetStream( sz );
		delete selected[ i ];
	}
	selected.RemoveAll();

	m_Tags.InsertCloseCaptionPhraseAtIndex( CC_ENGLISH, newphrase, insertslot );
	newphrase->SetSelected( true );
	newphrase->SetStartTime( beststart );
	newphrase->SetEndTime( bestend );

	PushRedo();

	redraw();
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:82,代码来源:PhonemeEditor_CloseCaption.cpp


示例8: SoundPlayed

//-----------------------------------------------------------------------------
// Purpose: Hook for the sound system to tell us when a sound's been played
//-----------------------------------------------------------------------------
MicrophoneResult_t CEnvMicrophone::SoundPlayed( int entindex, const char *soundname, soundlevel_t soundlevel, float flVolume, int iFlags, int iPitch, const Vector *pOrigin, float soundtime, CUtlVector< Vector >& soundorigins )
{
	if ( m_bAvoidFeedback )
		return MicrophoneResult_Ok;

	// Don't hear sounds that have already been heard by a microphone to avoid feedback!
	if ( iFlags & SND_SPEAKER )
		return MicrophoneResult_Ok;

#ifdef DEBUG_MICROPHONE
	Msg("%s heard %s: ", STRING(GetEntityName()), soundname );
#endif

	if ( !CanHearSound( entindex, soundlevel, flVolume, pOrigin ) )
		return MicrophoneResult_Ok;

	// We've heard it. Play it out our speaker. If our speaker's gone away, we're done.
	if ( !m_hSpeaker )
	{
		// First time, find our speaker. Done here, because finding it in Activate() wouldn't
		// find players, and we need to be able to specify !player for a speaker.
		if ( m_iszSpeakerName != NULL_STRING )
		{
			m_hSpeaker = gEntList.FindEntityByName(NULL, STRING(m_iszSpeakerName) );

			if ( !m_hSpeaker )
			{
				Warning( "EnvMicrophone %s specifies a non-existent speaker name: %s\n", STRING(GetEntityName()), STRING(m_iszSpeakerName) );
				m_iszSpeakerName = NULL_STRING;
			}
		}

		if ( !m_hSpeaker )
		{
			return MicrophoneResult_Remove;
		}
	}

	m_bAvoidFeedback = true;

	// Add the speaker flag. Detected at playback and applies the speaker filter.
	iFlags |= SND_SPEAKER;
	CPASAttenuationFilter filter( m_hSpeaker );

	EmitSound_t ep;
	ep.m_nChannel = CHAN_STATIC;
	ep.m_pSoundName = soundname;
	ep.m_flVolume = flVolume;
	ep.m_SoundLevel = soundlevel;
	ep.m_nFlags = iFlags;
	ep.m_nPitch = iPitch;
	ep.m_pOrigin = &m_hSpeaker->GetAbsOrigin();
	ep.m_flSoundTime = soundtime;
	ep.m_nSpeakerEntity = entindex;

	CBaseEntity::EmitSound( filter, m_hSpeaker->entindex(), ep );

	Q_strncpy( m_szLastSound, soundname, sizeof(m_szLastSound) );
	m_OnRoutedSound.FireOutput( this, this, 0 );

	m_bAvoidFeedback = false;

	// Copy emitted origin to soundorigins array
	for ( int i = 0; i < ep.m_UtlVecSoundOrigin.Count(); ++i )
	{
		soundorigins.AddToTail( ep.m_UtlVecSoundOrigin[ i ] );
	}

	// Do we want to allow the original sound to play?
	if ( m_spawnflags & SF_MICROPHONE_SWALLOW_ROUTED_SOUNDS )
	{
		return MicrophoneResult_Swallow;
	}

	return MicrophoneResult_Ok;
}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:79,代码来源:envmicrophone.cpp


示例9: PushEncountersApart

void CASWMissionChooserNPCs::PushEncountersApart( CMapLayout *pLayout )
{
	// get a list of valid rooms
	int iRooms = pLayout->m_PlacedRooms.Count();
	CUtlVector<CRoom*> candidates;
	float flTotalWeight = 0;
	for ( int i = 0; i < iRooms; i++ )
	{
		CRoom *pRoom = pLayout->m_PlacedRooms[i];
		if ( pRoom->GetSpawnWeight() > 0
			&& !pRoom->m_pRoomTemplate->IsEscapeRoom() 
			&& !pRoom->m_pRoomTemplate->IsStartRoom() 
			&& !pRoom->m_pRoomTemplate->IsBorderRoom() )
		{
			// skip 1x1 rooms
			if ( pRoom->m_pRoomTemplate->GetTilesX() * pRoom->m_pRoomTemplate->GetTilesY() <= 1 )
				continue;

			flTotalWeight += pRoom->GetSpawnWeight();
			candidates.AddToTail( pRoom );
		}
	}

	// push the encounters apart 
	int iSteps = 6;
	for ( int i = 0; i < iSteps; i++ )
	{
		int iEncounters = pLayout->m_Encounters.Count();
		for ( int e = 0; e < iEncounters; e++ )
		{
			Vector vecPush = vec3_origin;
			CASW_Encounter *pEncounter = pLayout->m_Encounters[ e ];
			// accumulate a force from all other nearby encounters
			for ( int k = 0; k < iEncounters; k++ )
			{
				if ( e == k )
					continue;
				CASW_Encounter *pOther = pLayout->m_Encounters[ k ];
				Vector dir = pEncounter->GetEncounterPosition() - pOther->GetEncounterPosition();	// direction from other to us
				float dist = dir.NormalizeInPlace();
				float flMinDistance = asw_encounters_distance_min.GetFloat() + pEncounter->GetEncounterRadius() + pOther->GetEncounterRadius();
				if ( dist < flMinDistance )
				{
					float flPush = flMinDistance - dist;		// push us exactly out of the min
					vecPush += dir * flPush;
				}
			}
			pEncounter->SetEncounterPosition( pEncounter->GetEncounterPosition() + vecPush );

			// clamp encounters to room bounds
			CRoom *pClosestRoom = NULL;
			float flClosestDist = 65535.0f;
			bool bWithinARoom = false;
			Vector pos = pEncounter->GetEncounterPosition();
			for ( int k = 0; k < candidates.Count(); k++ )
			{
				CRoom *pRoom = candidates[k];
				Vector vecMins, vecMaxs;
				pRoom->GetWorldBounds( &vecMins, &vecMaxs );
				if ( pos.x >= vecMins.x && pos.x <= vecMaxs.x
								&& pos.y >= vecMins.y && pos.y <= vecMaxs.y )
				{
					bWithinARoom = true;
					break;
				}
				Vector vecMiddle = ( vecMins + vecMaxs ) * 0.5f;
				float flDist = vecMiddle.DistTo( pos );
				if ( flDist < flClosestDist )
				{
					flClosestDist = flDist;
					pClosestRoom = pRoom;
				}
			}
			// if encounter wasn't in any room, then clamp to the closest
			if ( !bWithinARoom && pClosestRoom )
			{
				Vector vecMins, vecMaxs;
				pClosestRoom->GetWorldBounds( &vecMins, &vecMaxs );
				pos.x = clamp( pos.x, vecMins.x, vecMaxs.x );
				pos.y = clamp( pos.y, vecMins.y, vecMaxs.y );
				pEncounter->SetEncounterPosition( pos );
			}

			/*
			// put encounter in the center of its room
			for ( int k = 0; k < candidates.Count(); k++ )
			{
				CRoom *pRoom = candidates[k];
				Vector vecMins, vecMaxs;
				pRoom->GetWorldBounds( &vecMins, &vecMaxs );
				if ( pos.x >= vecMins.x && pos.x <= vecMaxs.x
					&& pos.y >= vecMins.y && pos.y <= vecMaxs.y )
				{
					Vector mid = ( vecMins + vecMaxs ) * 0.5f;
					mid.z = 0;
					pEncounter->SetEncounterPosition ( mid );
					break;
				}
			}
			*/
//.........这里部分代码省略.........
开发者ID:Ch1ckenscoop,项目名称:svn,代码行数:101,代码来源:asw_npcs.cpp


示例10: Warning

void CASWMissionChooserNPCs::InitFixedSpawns( CLayoutSystem *pLayoutSystem, CMapLayout *pLayout )
{
	// init the spawn set for this mission
	KeyValues *pGenerationOptions = pLayout->GetGenerationOptions();
	if ( !pGenerationOptions )
	{
		Warning( "Error placed fixed alien spawns, no generation options in this layout." );
		return;
	}

	bool bChosenSpawnSet = false;
	const char *szNamedSpawnSet = pGenerationOptions->GetString( "AlienSpawnSet" );
	if ( szNamedSpawnSet && szNamedSpawnSet[0] )
	{
		bChosenSpawnSet = SpawnSelection()->SetCurrentSpawnSet( szNamedSpawnSet );
	}

	if ( !bChosenSpawnSet )
	{
		SpawnSelection()->SetCurrentSpawnSet( pGenerationOptions->GetInt( "Difficulty", 5 ) );
	}

	// if we have any rooms with the alien encounter tag, then just use those for fixed spawn locations
	bool bAlienEncounterTag = false;
	int iRooms = pLayout->m_PlacedRooms.Count();
	for ( int i = 0; i < iRooms; i++ )
	{
		CRoom *pRoom = pLayout->m_PlacedRooms[i];
		if ( pRoom && pRoom->m_pRoomTemplate && pRoom->m_pRoomTemplate->HasTag( "AlienEncounter" ) )
		{
			bAlienEncounterTag = true;

			CASW_Encounter *pEncounter = new CASW_Encounter();

			// pick a random spot in this room
			Vector vecWorldMins, vecWorldMaxs;
			pRoom->GetWorldBounds( &vecWorldMins, &vecWorldMaxs );
			Vector vecPos = vecWorldMins + pLayoutSystem->GetRandomFloat( 0, 1 ) * ( vecWorldMaxs - vecWorldMins );
			vecPos.z = 0;
			pEncounter->SetEncounterPosition( vecPos );
			pEncounter->SetEncounterRadius( pLayoutSystem->GetRandomFloat( asw_encounter_radius_min.GetFloat(), asw_encounter_radius_max.GetFloat() ) );

			// add spawn defs
			// TODO: more spawns in bigger rooms? or rooms with higher weights?
			int iSpawnsPerEncounter = pLayoutSystem->GetRandomInt( CurrentSpawnSet()->GetMinSpawnsPerEncounter(), CurrentSpawnSet()->GetMaxSpawnsPerEncounter() );
			for ( int i = 0; i < iSpawnsPerEncounter; i++ )
			{
				CASW_Spawn_Definition* pSpawnDef = CurrentSpawnSet()->GetSpawnDef( ASW_NPC_SPAWN_TYPE_FIXED );
				if ( !pSpawnDef )
					continue;
				pEncounter->AddSpawnDef( pSpawnDef );
			}

			pLayout->m_Encounters.AddToTail( pEncounter );
		}
	}

	if ( bAlienEncounterTag )
	{
		pLayout->MarkEncounterRooms();
		return;
	}

	// find area of the mission
	int iTotalArea = 0;
	for ( int i = 0; i < iRooms; i++ )
	{
		CRoom *pRoom = pLayout->m_PlacedRooms[i];
		iTotalArea += ( pRoom->m_pRoomTemplate->GetTilesX() * ASW_TILE_SIZE ) * ( pRoom->m_pRoomTemplate->GetTilesY() * ASW_TILE_SIZE );
	}

	// decide how many encounters we want
	int iEncounters = pLayoutSystem->GetRandomInt( CurrentSpawnSet()->GetMinEncounters(), CurrentSpawnSet()->GetMaxEncounters() );

	// distance between encounters
	//float flMinDistance = asw_encounters_distance_min.GetFloat();

	// randomly pick rooms for the encounters to be in, using the room weights
	CUtlVector<CRoom*> candidates;
	float flTotalWeight = 0;
	for ( int i = 0; i < iRooms; i++ )
	{
		CRoom *pRoom = pLayout->m_PlacedRooms[i];
		if ( pRoom->GetSpawnWeight() > 0
				&& !pRoom->m_pRoomTemplate->IsEscapeRoom() 
				&& !pRoom->m_pRoomTemplate->IsStartRoom() 
				&& !pRoom->m_pRoomTemplate->IsBorderRoom() )
		{
			flTotalWeight += pRoom->GetSpawnWeight();
			candidates.AddToTail( pRoom );
		}
	}

	for ( int e = 0; e < iEncounters; e++ )
	{
		float flChosen = pLayoutSystem->GetRandomFloat( 0, flTotalWeight );
		CRoom *pChosenRoom = NULL;
		for ( int i = 0; i < candidates.Count(); i++ )
		{
			CRoom *pRoom = candidates[i];
//.........这里部分代码省略.........
开发者ID:Ch1ckenscoop,项目名称:svn,代码行数:101,代码来源:asw_npcs.cpp


示例11: EmitWaterVolumesForBSP

// Creates a list of watermodel_t for later processing by EmitPhysCollision
void EmitWaterVolumesForBSP( dmodel_t *pModel, node_t *node )
{
	CUtlVector<node_t *> leafListAnyWater;
	// build the list of all leaves containing water
	EnumLeaves_r( leafListAnyWater, node, MASK_WATER );

	// make a sorted list to flood fill
	CUtlVector<waterleaf_t>	list;
	
	int i;
	for ( i = 0; i < leafListAnyWater.Count(); i++ )
	{
		waterleaf_t waterLeaf;
		BuildWaterLeaf( leafListAnyWater[i], waterLeaf );
		InsertSortWaterLeaf( list, waterLeaf );
	}

	leafbitarray_t visited;
	CUtlVector<node_t *> waterAreaList;
	for ( i = 0; i < list.Count(); i++ )
	{
		Flood_FindConnectedWaterVolumes_r( waterAreaList, list[i].pNode, list[i], visited );

		// did we find a list of leaves connected to this one?
		// remember the list is sorted, so this one may have been attached to a previous
		// leaf.  So it could have nothing hanging off of it.
		if ( waterAreaList.Count() )
		{
			// yes, emit a watermodel
			watermodel_t tmp;
			tmp.modelIndex = nummodels;
			tmp.contents = list[i].pNode->contents;
			tmp.waterLeafData = list[i];
			tmp.firstWaterLeafIndex = g_WaterLeafList.Count();
			tmp.waterLeafCount = waterAreaList.Count();
			
			float waterDepth = tmp.waterLeafData.surfaceDist - tmp.waterLeafData.minZ;
			if ( tmp.waterLeafData.surfaceTexInfo < 0 )
			{
				// the map has probably leaked in this case, but output something anyway.
				Assert(list[i].pNode->planenum == PLANENUM_LEAF);
				tmp.waterLeafData.surfaceTexInfo = FirstWaterTexinfo( list[i].pNode->brushlist, tmp.contents );
			}
			tmp.depthTexinfo = FindOrCreateWaterTexInfo( &texinfo[ tmp.waterLeafData.surfaceTexInfo ], waterDepth );
			tmp.fogVolumeIndex = FindOrCreateLeafWaterData( tmp.waterLeafData.surfaceDist, tmp.waterLeafData.minZ, tmp.waterLeafData.surfaceTexInfo );

			for ( int j = 0; j < waterAreaList.Count(); j++ )
			{
				g_WaterLeafList.AddToTail( waterAreaList[j]->diskId );
			}
			waterAreaList.RemoveAll();
			g_WaterModels.AddToTail( tmp );
		}
	}

	WriteFogVolumeIDs( pModel );
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:58,代码来源:ivp.cpp


示例12: ConvertWaterModelToPhysCollide

static void ConvertWaterModelToPhysCollide( CUtlVector<CPhysCollisionEntry *> &collisionList, int modelIndex, 
										    float shrinkSize, float mergeTolerance )
{
	dmodel_t *pModel = dmodels + modelIndex;

	for ( int i = 0; i < g_WaterModels.Count(); i++ )
	{
		watermodel_t &waterModel = g_WaterModels[i];
		if ( waterModel.modelIndex != modelIndex )
			continue;

		CPlaneList planes( shrinkSize, mergeTolerance );
		int firstLeaf = waterModel.firstWaterLeafIndex;
		planes.m_contentsMask = waterModel.contents;
		
		// push all of the leaves into the collision list
		for ( int j = 0; j < waterModel.waterLeafCount; j++ )
		{
			int leafIndex = g_WaterLeafList[firstLeaf + j];

			dleaf_t *pLeaf = dleafs + leafIndex;
			// fixup waterdata
			pLeaf->leafWaterDataID = waterModel.fogVolumeIndex;
			planes.ReferenceLeaf( leafIndex );
		}
	
		// visit the referenced leaves that belong to this model
		VisitLeaves_r( planes, pModel->headnode );

		// Now add the brushes from those leaves as convex

		// BUGBUG: NOTE: If your map has a brush that crosses the surface, it will be added to two water
		// volumes.  This only happens with connected water volumes with multiple surface heights
		// UNDONE: Right now map makers must cut such brushes.  It could be automatically cut by adding the
		// surface plane to the list for each brush before calling ConvexFromPlanes()
		planes.AddBrushes();

		int count = planes.m_convex.Count();
		if ( !count )
			continue;

		// Save off the plane of the surface for this group as well as the collision model
		// for all convex objects in the group.
		CPhysCollide *pCollide = physcollision->ConvertConvexToCollide( planes.m_convex.Base(), count );
		if ( pCollide )
		{
			int waterSurfaceTexInfoID = -1;
			// use defaults
			const char *pSurfaceProp = "water";
			float damping = 0.01;
			if ( waterSurfaceTexInfoID >= 0 )
			{
				// material override
				int texdata = texinfo[waterSurfaceTexInfoID].texdata;
				int prop = g_SurfaceProperties[texdata];
				pSurfaceProp = physprops->GetPropName( prop );
			}

			if ( !waterModel.waterLeafData.hasSurface )
			{
				waterModel.waterLeafData.surfaceNormal.Init( 0,0,1 );
				Vector top = physcollision->CollideGetExtent( pCollide, vec3_origin, vec3_angle, waterModel.waterLeafData.surfaceNormal );
				waterModel.waterLeafData.surfaceDist = top.z;
			}
			CPhysCollisionEntryFluid *pCollisionEntryFuild = new CPhysCollisionEntryFluid( pCollide, 
				pSurfaceProp, damping, waterModel.waterLeafData.surfaceNormal, waterModel.waterLeafData.surfaceDist, waterModel.contents );
			collisionList.AddToTail( pCollisionEntryFuild );
		}
	}
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:70,代码来源:ivp.cpp


示例13: main

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

	// Figure out a random port to use.
	CCycleCount cnt;
	cnt.Sample();
	CUniformRandomStream randomStream;
	randomStream.SetSeed( cnt.GetMicroseconds() );
	int iPort = randomStream.RandomInt( 20000, 30000 );


	g_ClientPacketEvent.Init( false, false );

	
	// Setup the "server".
	CHandlerCreator_Server serverHandler;
	CIPAddr addr( 127, 0, 0, 1, iPort );

	ITCPConnectSocket *pListener = ThreadedTCP_CreateListener( 
		&serverHandler,
		(unsigned short)iPort );

	
	// Setup the "client".
	CHandlerCreator_Client clientCreator;
	ITCPConnectSocket *pConnector = ThreadedTCP_CreateConnector( 
		CIPAddr( 127, 0, 0, 1, iPort ),
		CIPAddr(),
		&clientCreator );


	// Wait for them to connect.
	while ( !g_pClientSocket )
	{
		if ( !pConnector->Update( &g_pClientSocket ) )
		{
			Error( "Error in client connector!\n" );
		}
	}
	pConnector->Release();


	while ( !g_pServerSocket )
	{
		if ( !pListener->Update( &g_pServerSocket ) )
			Error( "Error in server connector!\n" );
	}
	pListener->Release();


	// Send some data.
	__int64 totalBytes = 0;
	CCycleCount startTime;
	int iPacket = 1;

	startTime.Sample();
	CUtlVector<char> buf;

	while ( (GetAsyncKeyState( VK_SHIFT ) & 0x8000) == 0 )
	{
		int size = randomStream.RandomInt( 1024*0, 1024*320 );
		if ( buf.Count() < size )
			buf.SetSize( size );

		if ( g_pClientSocket->Send( buf.Base(), size ) )
		{
			// Server receives the data and echoes it back. Verify that the data is good.
			WaitForSingleObject( g_ClientPacketEvent.GetEventHandle(), INFINITE );
			Assert( memcmp( g_ClientPacket.Base(), buf.Base(), size ) == 0 );

			totalBytes += size;
			CCycleCount curTime, elapsed;
			curTime.Sample();
			CCycleCount::Sub( curTime, startTime, elapsed );
			double flSeconds = elapsed.GetSeconds();
			Msg( "Packet %d, %d bytes, %dk/sec\n", iPacket++, size, (int)(((totalBytes+511)/1024) / flSeconds) );
		}
	}
	
	g_pClientSocket->Release();
	g_pServerSocket->Release();
	return 0;
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:84,代码来源:ThreadedTCPSocketTest.cpp


示例14: CreateScreenshot

void CHLSL_Image::CreateScreenshot( CNodeView *n, const char *filepath )
{
	Vector4D graphBounds;
	n->GetGraphBoundaries( graphBounds );

	int vsize_x, vsize_y;
	n->GetSize( vsize_x, vsize_y );
	const float zoomFactor = 1.0f / clamp( sedit_screenshot_zoom.GetFloat(), 0.01f, 100.0f );

	float nodespace_width = graphBounds.z - graphBounds.x;
	float nodespace_height = graphBounds.w - graphBounds.y;
	float nodespace_width_pershot = vsize_x * zoomFactor;
	float nodespace_height_pershot = vsize_y * zoomFactor;

	int numshots_x = ceil( nodespace_width / nodespace_width_pershot );
	int numshots_y = ceil( nodespace_height / nodespace_height_pershot );

	Vector2D extraSpace;
	extraSpace.x = (nodespace_width_pershot*numshots_x) - nodespace_width;
	extraSpace.y = (nodespace_height_pershot*numshots_y) - nodespace_height;
	extraSpace *= 0.5f;

	n->vecScreenshotBounds.Init( graphBounds.x - extraSpace.x,
								graphBounds.y - extraSpace.y,
								graphBounds.z + extraSpace.x,
								graphBounds.w + extraSpace.y );

	int tgapixels_x = numshots_x * vsize_x - numshots_x;
	int tgapixels_y = numshots_y * vsize_y - numshots_y;

	unsigned int targetSize = tgapixels_x * 3 * tgapixels_y;
	unsigned char *pTGA = ( unsigned char * )malloc( targetSize );
	if ( !pTGA )
	{
		Warning( "Not enough memory available (failed to malloc %u bytes).\n", targetSize );
	}

	Vector2D pos_old = n->AccessViewPos();
	float zoom_old = n->AccessViewZoom();
	n->bRenderingScreenShot = true;

	n->AccessViewZoom() = zoomFactor;

	int vp_x, vp_y;
	vp_x = vp_y = 0;
	n->LocalToScreen( vp_x, vp_y );
	int screen_sx, screen_sy;
	engine->GetScreenSize( screen_sx, screen_sy );

	vp_x++;
	vp_y++;
	vsize_x--;
	vsize_y--;

	n->AccessViewPos().Init();

	CViewSetup view2D;
	view2D.x = 0;
	view2D.y = 0;
	view2D.width = screen_sx;
	view2D.height = screen_sy;
	view2D.m_bRenderToSubrectOfLargerScreen = false;
	Frustum _fplanes;

	CMatRenderContextPtr pRenderContext( materials );

#ifdef SHADER_EDITOR_DLL_2006
	render->Push2DView( view2D, 0, false, NULL, _fplanes );
#else
	render->Push2DView( view2D, 0, NULL, _fplanes );
#endif
	pRenderContext->PushRenderTargetAndViewport( NULL, view2D.x, view2D.y, view2D.width, view2D.height );

//	bool bSuccess = TGAWriter::WriteDummyFileNoAlloc( filepath, tgapixels_x, tgapixels_y, IMAGE_FORMAT_RGBA8888 );
//	Assert( bSuccess );

	if ( pTGA )
	{
		for ( int sX = 0; sX < numshots_x; sX ++ )
		{
			for ( int sY = 0; sY < numshots_y; sY ++ )
			{
				Vector2D basepos( graphBounds.x + nodespace_width_pershot * 0.5f, graphBounds.w - nodespace_height_pershot * 0.5f );
				basepos.x += sX * nodespace_width_pershot;
				basepos.y -= sY * nodespace_height_pershot;
				basepos.x *= -1.0f;
				basepos += extraSpace;
				n->AccessViewPos() = basepos;

				pRenderContext->ClearColor4ub( 0, 0, 0, 0 );
				pRenderContext->ClearBuffers( true, true );
				vgui::ipanel()->PaintTraverse( n->GetVPanel(), true );

				unsigned int sizeimg = vsize_x * 3 * vsize_y;
				unsigned char *pImage = ( unsigned char * )malloc( sizeimg );
				if ( pImage )
				{
					pRenderContext->ReadPixels( vp_x, vp_y, vsize_x, vsize_y, pImage, IMAGE_FORMAT_RGB888 );

					for ( int pX = 0; pX < vsize_x; pX ++ )
//.........这里部分代码省略.........
开发者ID:Biohazard90,项目名称:source-shader-editor,代码行数:101,代码来源:chlsl_image.cpp


示例15: Remove

void CBuildModeDialogMgr::Remove( BuildModeDialog *pDlg )
{
	m_vecBuildDialogs.FindAndRemove( pDlg );
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:4,代码来源:BuildModeDialog.cpp


示例16: ResetDeleteList

int CGlobalEntityList::ResetDeleteList( void )
{
	int result = g_DeleteList.Count();
	g_DeleteList.RemoveAll();
	return result;
}
开发者ID:WorldGamers,项目名称:Mobile-Forces-Source,代码行数:6,代码来源:entitylist.cpp


示例17: EndGroupingSounds

	void EndGroupingSounds()
	{
		g_GroupedSounds.Purge();
		SetImpactSoundRoute( NULL );
	}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:5,

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CVConGuard类代码示例发布时间:2022-05-31
下一篇:
C++ CUtlString类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap