本文整理汇总了C++中idList::AddUnique方法的典型用法代码示例。如果您正苦于以下问题:C++ idList::AddUnique方法的具体用法?C++ idList::AddUnique怎么用?C++ idList::AddUnique使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idList
的用法示例。
在下文中一共展示了idList::AddUnique方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FillStaticVidModes
// RB: resolutions supported by XreaL
static void FillStaticVidModes( idList<vidMode_t>& modeList )
{
modeList.AddUnique( vidMode_t( 320, 240, 60 ) );
modeList.AddUnique( vidMode_t( 400, 300, 60 ) );
modeList.AddUnique( vidMode_t( 512, 384, 60 ) );
modeList.AddUnique( vidMode_t( 640, 480, 60 ) );
modeList.AddUnique( vidMode_t( 800, 600, 60 ) );
modeList.AddUnique( vidMode_t( 960, 720, 60 ) );
modeList.AddUnique( vidMode_t( 1024, 768, 60 ) );
modeList.AddUnique( vidMode_t( 1152, 864, 60 ) );
modeList.AddUnique( vidMode_t( 1280, 720, 60 ) );
modeList.AddUnique( vidMode_t( 1280, 768, 60 ) );
modeList.AddUnique( vidMode_t( 1280, 800, 60 ) );
modeList.AddUnique( vidMode_t( 1280, 1024, 60 ) );
modeList.AddUnique( vidMode_t( 1360, 768, 60 ) );
modeList.AddUnique( vidMode_t( 1440, 900, 60 ) );
modeList.AddUnique( vidMode_t( 1680, 1050, 60 ) );
modeList.AddUnique( vidMode_t( 1600, 1200, 60 ) );
modeList.AddUnique( vidMode_t( 1920, 1080, 60 ) );
modeList.AddUnique( vidMode_t( 1920, 1200, 60 ) );
modeList.AddUnique( vidMode_t( 2048, 1536, 60 ) );
modeList.AddUnique( vidMode_t( 2560, 1600, 60 ) );
modeList.SortWithTemplate( idSort_VidMode() );
}
示例2: ConvertMeshToOBJ
void OBJExporter::ConvertMeshToOBJ( OBJGroup& group, const MapPolygonMesh* mesh, int entityNum, int primitiveNum, const idMat4& transform )
{
OBJExporter::OBJObject& geometry = group.objects.Alloc();
geometry.name.Format( "Primitive.%i", primitiveNum );
const idList<idDrawVert>& verts = mesh->GetDrawVerts();
int numVerts = 0;
for( int i = 0; i < mesh->GetNumPolygons(); i++ )
{
const MapPolygon& poly = mesh->GetFace( i );
const idMaterial* material = declManager->FindMaterial( poly.GetMaterial() );
materials.AddUnique( material );
OBJExporter::OBJFace& face = geometry.faces.Alloc();
face.material = material;
const idList<int>& indexes = poly.GetIndexes();
for( int j = 0; j < verts.Num(); j++ )
{
idDrawVert& dv = face.verts.Alloc();
dv = verts[j];
dv.xyz = ( transform * idVec4( dv.xyz.x, dv.xyz.y, dv.xyz.z, 1 ) ).ToVec3();
}
#if 0
//for( int j = 0; j < indexes.Num(); j++ )
for( int j = 1; j < indexes.Num() - 1; j++ )
{
int index = indexes[j];
//face.indexes.Append( j );
face.indexes.Append( numVerts + j + 1 );
face.indexes.Append( numVerts + j );
face.indexes.Append( numVerts );
}
#else
for( int j = 0; j < indexes.Num(); j++ )
{
int index = indexes[j];
face.indexes.Append( numVerts + index );
}
#endif
numVerts += verts.Num();
}
}
示例3: ConvertPatchToOBJ
void OBJExporter::ConvertPatchToOBJ( OBJGroup& group, const idMapPatch* patch, int entityNum, int primitiveNum, const idMat4& transform )
{
OBJExporter::OBJObject& geometry = group.objects.Alloc();
geometry.name.Format( "Primitive.%i", primitiveNum );
idSurface_Patch* cp = new idSurface_Patch( *patch );
if( patch->GetExplicitlySubdivided() )
{
cp->SubdivideExplicit( patch->GetHorzSubdivisions(), patch->GetVertSubdivisions(), true );
}
else
{
cp->Subdivide( DEFAULT_CURVE_MAX_ERROR, DEFAULT_CURVE_MAX_ERROR, DEFAULT_CURVE_MAX_LENGTH, true );
}
const idMaterial* material = declManager->FindMaterial( patch->GetMaterial() );
materials.AddUnique( material );
for( int i = 0; i < cp->GetNumIndexes(); i += 3 )
{
OBJExporter::OBJFace& face = geometry.faces.Alloc();
face.material = material;
idDrawVert& dv0 = face.verts.Alloc();
idDrawVert& dv1 = face.verts.Alloc();
idDrawVert& dv2 = face.verts.Alloc();
dv0 = ( *cp )[cp->GetIndexes()[i + 1]];
dv1 = ( *cp )[cp->GetIndexes()[i + 2]];
dv2 = ( *cp )[cp->GetIndexes()[i + 0]];
dv0.xyz = ( transform * idVec4( dv0.xyz.x, dv0.xyz.y, dv0.xyz.z, 1 ) ).ToVec3();
dv1.xyz = ( transform * idVec4( dv1.xyz.x, dv1.xyz.y, dv1.xyz.z, 1 ) ).ToVec3();
dv2.xyz = ( transform * idVec4( dv2.xyz.x, dv2.xyz.y, dv2.xyz.z, 1 ) ).ToVec3();
//face.indexes.Append( cp->GetIndexes()[i + 0] );
//face.indexes.Append( cp->GetIndexes()[i + 1] );
//face.indexes.Append( cp->GetIndexes()[i + 2] );
face.indexes.Append( i + 0 );
face.indexes.Append( i + 1 );
face.indexes.Append( i + 2 );
}
delete cp;
}
示例4: 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;
}
示例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: ConvertBrushToOBJ
void OBJExporter::ConvertBrushToOBJ( OBJGroup& group, const idMapBrush* mapBrush, int entityNum, int primitiveNum, const idMat4& transform )
{
OBJExporter::OBJObject& geometry = group.objects.Alloc();
geometry.name.Format( "Primitive.%i", primitiveNum );
// fix degenerate planes
idPlane* planes = ( idPlane* ) _alloca16( mapBrush->GetNumSides() * sizeof( planes[0] ) );
for( int i = 0; i < mapBrush->GetNumSides(); i++ )
{
planes[i] = mapBrush->GetSide( i )->GetPlane();
planes[i].FixDegeneracies( DEGENERATE_DIST_EPSILON );
}
//idFixedWinding w;
idList<idFixedWinding> planeWindings;
idBounds bounds;
bounds.Clear();
int numVerts = 0;
int numIndexes = 0;
bool badBrush = false;
for( int i = 0; i < mapBrush->GetNumSides(); i++ )
{
idMapBrushSide* mapSide = mapBrush->GetSide( i );
const idMaterial* material = declManager->FindMaterial( mapSide->GetMaterial() );
//contents |= ( material->GetContentFlags() & CONTENTS_REMOVE_UTIL );
materials.AddUnique( material );
// chop base plane by other brush sides
idFixedWinding& w = planeWindings.Alloc();
w.BaseForPlane( -planes[i] );
if( !w.GetNumPoints() )
{
common->Printf( "Entity %i, Brush %i: base winding has no points\n", entityNum, primitiveNum );
badBrush = true;
}
for( int j = 0; j < mapBrush->GetNumSides() && w.GetNumPoints(); j++ )
{
if( i == j )
{
continue;
}
if( !w.ClipInPlace( -planes[j], 0 ) )
{
// no intersection
//badBrush = true;
common->Printf( "Entity %i, Brush %i: no intersection with other brush plane\n", entityNum, primitiveNum );
//break;
}
}
if( w.GetNumPoints() <= 2 )
{
continue;
}
for( int j = 0; j < w.GetNumPoints(); j++ )
{
const idVec3& v = w[j].ToVec3();
bounds.AddPoint( v );
}
}
// allocate the surface
// copy the data from the windings and build polygons
for( int i = 0; i < mapBrush->GetNumSides(); i++ )
{
idMapBrushSide* mapSide = mapBrush->GetSide( i );
idFixedWinding& w = planeWindings[i];
if( !w.GetNumPoints() )
{
continue;
}
OBJExporter::OBJFace& face = geometry.faces.Alloc();
face.material = declManager->FindMaterial( mapSide->GetMaterial() );
for( int j = 0; j < w.GetNumPoints(); j++ )
{
idDrawVert& dv = face.verts.Alloc();
const idVec3& xyz = w[j].ToVec3();
dv.xyz = ( transform * idVec4( xyz.x, xyz.y, xyz.z, 1 ) ).ToVec3();
// calculate texture s/t from brush primitive texture matrix
idVec4 texVec[2];
//.........这里部分代码省略.........
示例7: 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 )
{
//.........这里部分代码省略.........