本文整理汇总了C++中idList::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ idList::Clear方法的具体用法?C++ idList::Clear怎么用?C++ idList::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idList
的用法示例。
在下文中一共展示了idList::Clear方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Shutdown
/*
============
idCmdSystemLocal::Shutdown
============
*/
void idCmdSystemLocal::Shutdown( void ) {
commandDef_t *cmd;
for ( cmd = commands; cmd; cmd = commands ) {
commands = commands->next;
// jmarshall
// Mem_Free( cmd->name );
// Mem_Free( cmd->description );
// jmarshall end
delete cmd;
}
completionString.Clear();
completionParms.Clear();
tokenizedCmds.Clear();
postReload.Clear();
}
示例2: InitScriptEvents
/*
================
DialogScriptEditor::InitScriptEvents
================
*/
void DialogScriptEditor::InitScriptEvents( void ) {
int index;
idParser src;
idToken token;
idStr whiteSpace;
scriptEventInfo_t info;
if ( !src.LoadFile( "script/doom_events.script" ) ) {
return;
}
scriptEvents.Clear();
while( src.ReadToken( &token ) ) {
if ( token == "scriptEvent" ) {
src.GetLastWhiteSpace( whiteSpace );
index = whiteSpace.Find( "//" );
if ( index != -1 ) {
info.help = whiteSpace.Right( whiteSpace.Length() - index );
info.help.Remove( '\r' );
info.help.Replace( "\n", "\r\n" );
} else {
info.help = "";
}
src.ExpectTokenType( TT_NAME, 0, &token );
info.parms = token;
src.ExpectTokenType( TT_NAME, 0, &token );
info.name = token;
src.ExpectTokenString( "(" );
info.parms += " " + info.name + "(";
while( src.ReadToken( &token ) && token != ";" ) {
info.parms.Append( " " + token );
}
scriptEvents.Append( info );
}
}
}
示例3: R_GetModeListForDisplay
/*
====================
R_GetModeListForDisplay
====================
*/
bool R_GetModeListForDisplay( const int requestedDisplayNum, idList<vidMode_t>& modeList ) {
assert( requestedDisplayNum >= 0 );
modeList.Clear();
if( requestedDisplayNum >= SDL_GetNumVideoDisplays() ) {
// requested invalid displaynum
return false;
}
int numModes = SDL_GetNumDisplayModes( requestedDisplayNum );
if( numModes > 0 ) {
for( int i = 0; i < numModes; i++ ) {
SDL_DisplayMode m;
int ret = SDL_GetDisplayMode( requestedDisplayNum, i, &m );
if( ret != 0 ) {
common->Warning( "Can't get video mode no %i, because of %s\n", i, SDL_GetError() );
continue;
}
vidMode_t mode;
mode.width = m.w;
mode.height = m.h;
mode.displayHz = m.refresh_rate ? m.refresh_rate : 60; // default to 60 if unknown (0)
modeList.AddUnique( mode );
}
if( modeList.Num() < 1 ) {
common->Warning( "Couldn't get a single video mode for display %i, using default ones..!\n", requestedDisplayNum );
FillStaticVidModes( modeList );
}
// sort with lowest resolution first
modeList.SortWithTemplate( idSort_VidMode() );
} else {
common->Warning( "Can't get Video Info, using default modes...\n" );
if( numModes < 0 ) {
common->Warning( "Reason was: %s\n", SDL_GetError() );
}
FillStaticVidModes( modeList );
}
return true;
}
示例4: FindSkeletalMeshes
/*
=================
idRenderModelManagerLocal::FindSkeletalMeshes
=================
*/
void idRenderModelManagerLocal::FindSkeletalMeshes( idList<idStr> &skeletalMeshes ) {
const idDecl *decl;
skeletalMeshes.Clear();
for(int i = 0; i < declManager->GetNumDecls( DECL_MODELDEF ); i++)
{
decl = declManager->DeclByIndex( DECL_MODELDEF, i, false );
// This probley isn't the best way to do this, just check to see if the decl def has the skeletal model extension.
char *text = (char *)_alloca( decl->GetTextLength() + 1 );
decl->GetText( text );
if(!strstr(text, ".md5mesh"))
{
_resetstkoflw();
continue;
}
_resetstkoflw();
skeletalMeshes.Append( decl->GetName() );
}
}
示例5: R_GetModeListForDisplay
/*
====================
R_GetModeListForDisplay
====================
*/
bool R_GetModeListForDisplay( const int requestedDisplayNum, idList<vidMode_t>& modeList )
{
modeList.Clear();
bool verbose = false;
for( int displayNum = requestedDisplayNum; ; displayNum++ )
{
DISPLAY_DEVICE device;
device.cb = sizeof( device );
if( !EnumDisplayDevices(
0, // lpDevice
displayNum,
&device,
0 /* dwFlags */ ) )
{
return false;
}
// get the monitor for this display
if( !( device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP ) )
{
continue;
}
DISPLAY_DEVICE monitor;
monitor.cb = sizeof( monitor );
if( !EnumDisplayDevices(
device.DeviceName,
0,
&monitor,
0 /* dwFlags */ ) )
{
continue;
}
DEVMODE devmode;
devmode.dmSize = sizeof( devmode );
if( verbose )
{
common->Printf( "display device: %i\n", displayNum );
common->Printf( " DeviceName : %s\n", device.DeviceName );
common->Printf( " DeviceString: %s\n", device.DeviceString );
common->Printf( " StateFlags : 0x%x\n", device.StateFlags );
common->Printf( " DeviceID : %s\n", device.DeviceID );
common->Printf( " DeviceKey : %s\n", device.DeviceKey );
common->Printf( " DeviceName : %s\n", monitor.DeviceName );
common->Printf( " DeviceString: %s\n", monitor.DeviceString );
common->Printf( " StateFlags : 0x%x\n", monitor.StateFlags );
common->Printf( " DeviceID : %s\n", monitor.DeviceID );
common->Printf( " DeviceKey : %s\n", monitor.DeviceKey );
}
for( int modeNum = 0 ; ; modeNum++ )
{
if( !EnumDisplaySettings( device.DeviceName, modeNum, &devmode ) )
{
break;
}
if( devmode.dmBitsPerPel != 32 )
{
continue;
}
if( ( devmode.dmDisplayFrequency != 60 ) && ( devmode.dmDisplayFrequency != 120 ) )
{
continue;
}
if( devmode.dmPelsHeight < 720 )
{
continue;
}
if( verbose )
{
common->Printf( " -------------------\n" );
common->Printf( " modeNum : %i\n", modeNum );
common->Printf( " dmPosition.x : %i\n", devmode.dmPosition.x );
common->Printf( " dmPosition.y : %i\n", devmode.dmPosition.y );
common->Printf( " dmBitsPerPel : %i\n", devmode.dmBitsPerPel );
common->Printf( " dmPelsWidth : %i\n", devmode.dmPelsWidth );
common->Printf( " dmPelsHeight : %i\n", devmode.dmPelsHeight );
common->Printf( " dmDisplayFixedOutput: %s\n", DMDFO( devmode.dmDisplayFixedOutput ) );
common->Printf( " dmDisplayFlags : 0x%x\n", devmode.dmDisplayFlags );
common->Printf( " dmDisplayFrequency : %i\n", devmode.dmDisplayFrequency );
}
vidMode_t mode;
mode.width = devmode.dmPelsWidth;
mode.height = devmode.dmPelsHeight;
mode.displayHz = devmode.dmDisplayFrequency;
modeList.AddUnique( mode );
}
if( modeList.Num() > 0 )
{
//.........这里部分代码省略.........
示例6: SetupPath
/*
================
sdVehiclePathGrid::SetupPath
================
*/
void sdVehiclePathGrid::SetupPath( const idVec3& position, idList< splineSection_t >& inSpline, idList< splineSection_t >& outSpline, int seed ) const {
int x, y;
int xmin, ymin;
GetCoordsForPoint( x, y, xmin, ymin, position );
int nx, ny;
GetEdgePoint( x, y, nx, ny, seed, 0, 0 );
idVec3 edgePos;
GetPointInternal( nx, ny, edgePos );
AdjustTargetForStart( edgePos, position, x, y, xmin, ymin );
bool ymainaxis = abs( ny - y ) > abs( nx - x );
int loopPos;
int loopDir;
int loopStart;
int loopEnd;
float loopLen;
if ( ymainaxis ) {
loopPos = ny;
loopStart = ny;
loopDir = ny > y ? -1 : 1;
loopLen = ny - y;
loopEnd = y;
} else {
loopPos = nx;
loopStart = nx;
loopDir = nx > x ? -1 : 1;
loopLen = nx - x;
loopEnd = x;
}
idVec3 endPoint;
GetPoint( x, y, endPoint );
idVec3 lastPos;
GetPoint( nx, ny, lastPos );
idVec3 inVector = ( endPoint - lastPos );
inVector[ 2 ] = 0.f;
inVector.Normalize();
float scale = 64.f; // inVector.Normalize();
inSpline.Clear();
while ( loopPos != loopEnd ) {
int currentPos[ 2 ];
loopPos += loopDir;
float frac = ( loopPos - loopStart ) / loopLen;
if ( ymainaxis ) {
currentPos[ 0 ] = nx + ( ( nx - x ) * frac );
currentPos[ 1 ] = loopPos;
} else {
currentPos[ 0 ] = loopPos;
currentPos[ 1 ] = ny + ( ( ny - y ) * frac );
}
idVec3 newPos;
GetPointInternal( currentPos[ 0 ], currentPos[ 1 ], newPos );
AddSection( lastPos, inVector, newPos, endPoint, loopPos != loopEnd, inSpline );
}
{
idVec3 hoverPos = position;
hoverPos[ 2 ] = lastPos[ 2 ];
idVec3 temp = ( hoverPos - lastPos );
scale = temp.Normalize() * 0.125f;
idVec3 newInVector( 0.f, 0.f, -1.f );
newInVector += temp * 0.2f;
newInVector.Normalize();
splineSection_t& section = inSpline.Alloc();
section.AddValue( 0.f, lastPos );
section.AddValue( 1.f / 3.f, lastPos + ( inVector * ( scale ) ) );
section.AddValue( 2.f / 3.f, hoverPos - ( newInVector * ( scale ) ) );
section.AddValue( 1.f, hoverPos );
lastPos = hoverPos;
inVector = newInVector;
}
{
GetCoordsForPoint( nx, ny, xmin, ymin, lastPos );
idVec3 startPoint;
GetPoint( nx, ny, startPoint );
//.........这里部分代码省略.........
示例7: Sys_ShutdownInput
/*
=================
Sys_ShutdownInput
=================
*/
void Sys_ShutdownInput() {
kbd_polls.Clear();
mouse_polls.Clear();
}
示例8: ScriptEditorShutdown
/*
================
ScriptEditorShutdown
================
*/
void ScriptEditorShutdown( void ) {
delete g_ScriptDialog;
g_ScriptDialog = NULL;
scriptEvents.Clear();
}
示例9: R_GetModeListForDisplay
/*
====================
R_GetModeListForDisplay
====================
*/
bool R_GetModeListForDisplay( const int requestedDisplayNum, idList<vidMode_t>& modeList )
{
assert( requestedDisplayNum >= 0 );
modeList.Clear();
#if SDL_VERSION_ATLEAST(2, 0, 0)
// DG: SDL2 implementation
if( requestedDisplayNum >= SDL_GetNumVideoDisplays() )
{
// requested invalid displaynum
return false;
}
int numModes = SDL_GetNumDisplayModes( requestedDisplayNum );
if( numModes > 0 )
{
for( int i = 0; i < numModes; i++ )
{
SDL_DisplayMode m;
int ret = SDL_GetDisplayMode( requestedDisplayNum, i, &m );
if( ret != 0 )
{
common->Warning( "Can't get video mode no %i, because of %s\n", i, SDL_GetError() );
continue;
}
vidMode_t mode;
mode.width = m.w;
mode.height = m.h;
mode.displayHz = m.refresh_rate ? m.refresh_rate : 60; // default to 60 if unknown (0)
modeList.AddUnique( mode );
}
if( modeList.Num() < 1 )
{
common->Warning( "Couldn't get a single video mode for display %i, using default ones..!\n", requestedDisplayNum );
FillStaticVidModes( modeList );
}
// sort with lowest resolution first
modeList.SortWithTemplate( idSort_VidMode() );
}
else
{
common->Warning( "Can't get Video Info, using default modes...\n" );
if( numModes < 0 )
{
common->Warning( "Reason was: %s\n", SDL_GetError() );
}
FillStaticVidModes( modeList );
}
return true;
// DG end
#else // SDL 1
// DG: SDL1 only knows of one display - some functions rely on
// R_GetModeListForDisplay() returning false for invalid displaynum to iterate all displays
if( requestedDisplayNum >= 1 )
{
return false;
}
// DG end
const SDL_VideoInfo* videoInfo = SDL_GetVideoInfo();
if( videoInfo == NULL )
{
// DG: yes, this can actually fail, e.g. if SDL_Init( SDL_INIT_VIDEO ) wasn't called
common->Warning( "Can't get Video Info, using default modes...\n" );
FillStaticVidModes( modeList );
return true;
}
SDL_Rect** modes = SDL_ListModes( videoInfo->vfmt, SDL_OPENGL | SDL_FULLSCREEN );
if( !modes )
{
common->Warning( "Can't get list of available modes, using default ones...\n" );
FillStaticVidModes( modeList );
return true;
}
if( modes == ( SDL_Rect** ) - 1 )
{
common->Printf( "Display supports any resolution\n" );
FillStaticVidModes( modeList );
return true;
}
int numModes;
for( numModes = 0; modes[numModes]; numModes++ );
if( numModes > 1 )
{
//.........这里部分代码省略.........
示例10: LoadGLSLShader
/*
================================================================================================
idRenderProgManager::LoadGLSLShader
================================================================================================
*/
GLuint idRenderProgManager::LoadGLSLShader( GLenum target, const char * name, idList<int> & uniforms ) {
idStr inFile;
idStr outFileHLSL;
idStr outFileGLSL;
idStr outFileUniforms;
inFile.Format( "renderprogs\\%s", name );
inFile.StripFileExtension();
outFileHLSL.Format( "renderprogs\\glsl\\%s", name );
outFileHLSL.StripFileExtension();
outFileGLSL.Format( "renderprogs\\glsl\\%s", name );
outFileGLSL.StripFileExtension();
outFileUniforms.Format( "renderprogs\\glsl\\%s", name );
outFileUniforms.StripFileExtension();
if ( target == GL_FRAGMENT_SHADER ) {
inFile += ".pixel";
outFileHLSL += "_fragment.hlsl";
outFileGLSL += "_fragment.glsl";
outFileUniforms += "_fragment.uniforms";
} else {
inFile += ".vertex";
outFileHLSL += "_vertex.hlsl";
outFileGLSL += "_vertex.glsl";
outFileUniforms += "_vertex.uniforms";
}
// first check whether we already have a valid GLSL file and compare it to the hlsl timestamp;
ID_TIME_T hlslTimeStamp;
int hlslFileLength = fileSystem->ReadFile( inFile.c_str(), NULL, &hlslTimeStamp );
ID_TIME_T glslTimeStamp;
int glslFileLength = fileSystem->ReadFile( outFileGLSL.c_str(), NULL, &glslTimeStamp );
// if the glsl file doesn't exist or we have a newer HLSL file we need to recreate the glsl file.
idStr programGLSL;
idStr programUniforms;
if ( ( glslFileLength <= 0 ) || ( hlslTimeStamp > glslTimeStamp ) ) {
if ( hlslFileLength <= 0 ) {
// hlsl file doesn't even exist bail out
return false;
}
void * hlslFileBuffer = NULL;
int len = fileSystem->ReadFile( inFile.c_str(), &hlslFileBuffer );
if ( len <= 0 ) {
return false;
}
idStr hlslCode( ( const char* ) hlslFileBuffer );
idStr programHLSL = StripDeadCode( hlslCode, inFile );
programGLSL = ConvertCG2GLSL( programHLSL, inFile, target == GL_VERTEX_SHADER, programUniforms );
fileSystem->WriteFile( outFileHLSL, programHLSL.c_str(), programHLSL.Length(), "fs_basepath" );
fileSystem->WriteFile( outFileGLSL, programGLSL.c_str(), programGLSL.Length(), "fs_basepath" );
if ( r_useUniformArrays.GetBool() ) {
fileSystem->WriteFile( outFileUniforms, programUniforms.c_str(), programUniforms.Length(), "fs_basepath" );
}
} else {
// read in the glsl file
void * fileBufferGLSL = NULL;
int lengthGLSL = fileSystem->ReadFile( outFileGLSL.c_str(), &fileBufferGLSL );
if ( lengthGLSL <= 0 ) {
idLib::Error( "GLSL file %s could not be loaded and may be corrupt", outFileGLSL.c_str() );
}
programGLSL = ( const char * ) fileBufferGLSL;
Mem_Free( fileBufferGLSL );
if ( r_useUniformArrays.GetBool() ) {
// read in the uniform file
void * fileBufferUniforms = NULL;
int lengthUniforms = fileSystem->ReadFile( outFileUniforms.c_str(), &fileBufferUniforms );
if ( lengthUniforms <= 0 ) {
idLib::Error( "uniform file %s could not be loaded and may be corrupt", outFileUniforms.c_str() );
}
programUniforms = ( const char* ) fileBufferUniforms;
Mem_Free( fileBufferUniforms );
}
}
// find the uniforms locations in either the vertex or fragment uniform array
if ( r_useUniformArrays.GetBool() ) {
uniforms.Clear();
idLexer src( programUniforms, programUniforms.Length(), "uniforms" );
idToken token;
while ( src.ReadToken( &token ) ) {
int index = -1;
for ( int i = 0; i < RENDERPARM_TOTAL && index == -1; i++ ) {
const char * parmName = GetGLSLParmName( i );
if ( token == parmName ) {
index = i;
}
}
for ( int i = 0; i < MAX_GLSL_USER_PARMS && index == -1; i++ ) {
const char * parmName = GetGLSLParmName( RENDERPARM_USER + i );
if ( token == parmName ) {
//.........这里部分代码省略.........
示例11: Select_AutoCaulk
void Select_AutoCaulk()
{
/*Sys_Printf*/common->Printf("Caulking...\n");
FacesToCaulk.Clear();
int iSystemBrushesSkipped = 0;
face_t *pSelectedFace;
brush_t *next;
for (brush_t *pSelectedBrush = selected_brushes.next ; pSelectedBrush != &selected_brushes ; pSelectedBrush = next)
{
next = pSelectedBrush->next;
if (pSelectedBrush->owner->eclass->fixedsize)
continue; // apparently this means it's a model, so skip it...
// new check, we can't caulk a brush that has any "system/" faces...
//
bool bSystemFacePresent = false;
for ( pSelectedFace = pSelectedBrush->brush_faces; pSelectedFace; pSelectedFace = pSelectedFace->next)
{
if (!strnicmp(pSelectedFace->d_texture->GetName(),"system/",7))
{
bSystemFacePresent = true;
break;
}
}
if (bSystemFacePresent)
{
iSystemBrushesSkipped++;
continue; // verboten to caulk this.
}
for (int iBrushListToScan = 0; iBrushListToScan<2; iBrushListToScan++)
{
brush_t *snext;
for (brush_t *pScannedBrush = (iBrushListToScan?active_brushes.next:selected_brushes.next); pScannedBrush != (iBrushListToScan?&active_brushes:&selected_brushes) ; pScannedBrush = snext)
{
snext = pScannedBrush->next;
if ( pScannedBrush == pSelectedBrush)
continue;
if (pScannedBrush->owner->eclass->fixedsize || pScannedBrush->pPatch || pScannedBrush->hiddenBrush)
continue;
if (FilterBrush(pScannedBrush))
continue;
// idMaterial stuff no longer support this, not sure what else to do.
// Searching for other occurences of QER_NOCARVE just shows people REMing the code and ignoring ths issue...
//
// if (pScannedBrush->brush_faces->d_texture->bFromShader && (pScannedBrush->brush_faces->d_texture->TestMaterialFlag(QER_NOCARVE)))
// continue;
// basic-reject first to see if brushes can even possibly touch (coplanar counts as touching)
//
int i;
for (i=0 ; i<3 ; i++)
{
if (pSelectedBrush->mins[i] > pScannedBrush->maxs[i] ||
pSelectedBrush->maxs[i] < pScannedBrush->mins[i])
{
break;
}
}
if (i != 3)
continue; // can't be touching
// ok, now for the clever stuff, we need to detect only those faces that are both coplanar and smaller
// or equal to the face they're coplanar with...
//
for (pSelectedFace = pSelectedBrush->brush_faces; pSelectedFace; pSelectedFace = pSelectedFace->next)
{
idWinding *pSelectedWinding = pSelectedFace->face_winding;
if (!pSelectedWinding)
continue; // freed face, probably won't happen here, but who knows with this program?
// SquaredFace_t SelectedSquaredFace;
// WindingToSquaredFace( &SelectedSquaredFace, pSelectedWinding);
for (face_t *pScannedFace = pScannedBrush->brush_faces; pScannedFace; pScannedFace = pScannedFace->next)
{
// don't even try caulking against a system face, because these are often transparent and will leave holes
//
if (!strnicmp(pScannedFace->d_texture->GetName(),"system/",7))
continue;
// and don't try caulking against something inherently transparent...
//
if (pScannedFace->d_texture->TestMaterialFlag(QER_TRANS))
continue;
idWinding *pScannedWinding = pScannedFace->face_winding;
if (!pScannedWinding)
continue; // freed face, probably won't happen here, but who knows with this program?
//.........这里部分代码省略.........
示例12: GetSearchResults
/*
========================
idLobbyBackendDirect::GetSearchResults
========================
*/
void idLobbyBackendDirect::GetSearchResults( idList< lobbyConnectInfo_t >& searchResults )
{
lobbyConnectInfo_t fakeResult;
searchResults.Clear();
searchResults.Append( fakeResult );
}
示例13: Sys_ShutdownInput
/*
=================
Sys_ShutdownInput
=================
*/
void Sys_ShutdownInput() {
kbd_polls.Clear();
mouse_polls.Clear();
joystick_polls.Clear();
event_overflow.Clear();
}