本文整理汇总了C++中idLexer::CheckTokenString方法的典型用法代码示例。如果您正苦于以下问题:C++ idLexer::CheckTokenString方法的具体用法?C++ idLexer::CheckTokenString怎么用?C++ idLexer::CheckTokenString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idLexer
的用法示例。
在下文中一共展示了idLexer::CheckTokenString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseInOutStruct
/*
========================
ParseInOutStruct
========================
*/
void ParseInOutStruct( idLexer & src, int attribType, idList< inOutVariable_t > & inOutVars ) {
src.ExpectTokenString( "{" );
while( !src.CheckTokenString( "}" ) ) {
inOutVariable_t var;
idToken token;
src.ReadToken( &token );
var.type = token;
src.ReadToken( &token );
var.nameCg = token;
if ( !src.CheckTokenString( ":" ) ) {
src.SkipUntilString( ";" );
continue;
}
src.ReadToken( &token );
var.nameGLSL = token;
src.ExpectTokenString( ";" );
// convert the type
for ( int i = 0; typeConversion[i].typeCG != NULL; i++ ) {
if ( var.type.Cmp( typeConversion[i].typeCG ) == 0 ) {
var.type = typeConversion[i].typeGLSL;
break;
}
}
// convert the semantic to a GLSL name
for ( int i = 0; attribsPC[i].semantic != NULL; i++ ) {
if ( ( attribsPC[i].flags & attribType ) != 0 ) {
if ( var.nameGLSL.Cmp( attribsPC[i].semantic ) == 0 ) {
var.nameGLSL = attribsPC[i].glsl;
break;
}
}
}
// check if it was defined previously
var.declareInOut = true;
for ( int i = 0; i < inOutVars.Num(); i++ ) {
if ( var.nameGLSL == inOutVars[i].nameGLSL ) {
var.declareInOut = false;
break;
}
}
inOutVars.Append( var );
}
src.ExpectTokenString( ";" );
}
示例2: ParseContents
/*
================
idDeclAF::ParseContents
================
*/
bool idDeclAF::ParseContents( idLexer &src, int &c ) const {
idToken token;
idStr str;
while( src.ReadToken( &token ) ) {
str += token;
if ( !src.CheckTokenString( "," ) ) {
break;
}
str += ",";
}
c = ContentsFromString( str );
return true;
}
示例3: ParseSettings
/*
================
idDeclAF::ParseSettings
================
*/
bool idDeclAF::ParseSettings( idLexer &src ) {
idToken token;
if ( !src.ExpectTokenString( "{" ) ) {
return false;
}
while( src.ReadToken( &token ) ) {
if ( !token.Icmp( "mesh" ) ) {
if ( !src.ExpectTokenType( TT_STRING, 0, &token ) ) {
return false;
}
} else if ( !token.Icmp( "anim" ) ) {
if ( !src.ExpectTokenType( TT_STRING, 0, &token ) ) {
return false;
}
} else if ( !token.Icmp( "model" ) ) {
if ( !src.ExpectTokenType( TT_STRING, 0, &token ) ) {
return false;
}
model = token;
} else if ( !token.Icmp( "skin" ) ) {
if ( !src.ExpectTokenType( TT_STRING, 0, &token ) ) {
return false;
}
skin = token;
} else if ( !token.Icmp( "friction" ) ) {
defaultLinearFriction = src.ParseFloat();
if ( !src.ExpectTokenString( "," ) ) {
return false;
}
defaultAngularFriction = src.ParseFloat();
if ( !src.ExpectTokenString( "," ) ) {
return false;
}
defaultContactFriction = src.ParseFloat();
if ( src.CheckTokenString( "," ) ) {
defaultConstraintFriction = src.ParseFloat();
}
} else if ( !token.Icmp( "totalMass" ) ) {
totalMass = src.ParseFloat();
} else if ( !token.Icmp( "suspendSpeed" ) ) {
suspendVelocity[0] = src.ParseFloat();
if ( !src.ExpectTokenString( "," ) ) {
return false;
}
suspendVelocity[1] = src.ParseFloat();
if ( !src.ExpectTokenString( "," ) ) {
return false;
}
suspendAcceleration[0] = src.ParseFloat();
if ( !src.ExpectTokenString( "," ) ) {
return false;
}
suspendAcceleration[1] = src.ParseFloat();
} else if ( !token.Icmp( "noMoveTime" ) ) {
noMoveTime = src.ParseFloat();
} else if ( !token.Icmp( "noMoveTranslation" ) ) {
noMoveTranslation = src.ParseFloat();
} else if ( !token.Icmp( "noMoveRotation" ) ) {
noMoveRotation = src.ParseFloat();
} else if ( !token.Icmp( "minMoveTime" ) ) {
minMoveTime = src.ParseFloat();
} else if ( !token.Icmp( "maxMoveTime" ) ) {
maxMoveTime = src.ParseFloat();
} else if ( !token.Icmp( "contents" ) ) {
ParseContents( src, contents );
} else if ( !token.Icmp( "clipMask" ) ) {
ParseContents( src, clipMask );
} else if ( !token.Icmp( "selfCollision" ) ) {
selfCollision = src.ParseBool();
} else if ( token == "}" ) {
break;
} else {
src.Error( "unknown token %s in settings", token.c_str() );
return false;
}
}
return true;
}
示例4: model
/*
====================
idMD5Mesh::ParseMesh
====================
*/
void idMD5Mesh::ParseMesh( idLexer& parser, int numJoints, const idJointMat* joints )
{
idToken token;
idToken name;
parser.ExpectTokenString( "{" );
//
// parse name
//
if( parser.CheckTokenString( "name" ) )
{
parser.ReadToken( &name );
}
//
// parse shader
//
parser.ExpectTokenString( "shader" );
parser.ReadToken( &token );
idStr shaderName = token;
shader = declManager->FindMaterial( shaderName );
//
// parse texture coordinates
//
parser.ExpectTokenString( "numverts" );
int count = parser.ParseInt();
if( count < 0 )
{
parser.Error( "Invalid size: %s", token.c_str() );
}
this->numVerts = count;
idList<idVec2> texCoords;
idList<int> firstWeightForVertex;
idList<int> numWeightsForVertex;
texCoords.SetNum( count );
firstWeightForVertex.SetNum( count );
numWeightsForVertex.SetNum( count );
int numWeights = 0;
int maxweight = 0;
for( int i = 0; i < texCoords.Num(); i++ )
{
parser.ExpectTokenString( "vert" );
parser.ParseInt();
parser.Parse1DMatrix( 2, texCoords[ i ].ToFloatPtr() );
firstWeightForVertex[ i ] = parser.ParseInt();
numWeightsForVertex[ i ] = parser.ParseInt();
if( !numWeightsForVertex[ i ] )
{
parser.Error( "Vertex without any joint weights." );
}
numWeights += numWeightsForVertex[ i ];
if( numWeightsForVertex[ i ] + firstWeightForVertex[ i ] > maxweight )
{
maxweight = numWeightsForVertex[ i ] + firstWeightForVertex[ i ];
}
}
//
// parse tris
//
parser.ExpectTokenString( "numtris" );
count = parser.ParseInt();
if( count < 0 )
{
parser.Error( "Invalid size: %d", count );
}
idList<int> tris;
tris.SetNum( count * 3 );
numTris = count;
for( int i = 0; i < count; i++ )
{
parser.ExpectTokenString( "tri" );
parser.ParseInt();
tris[ i * 3 + 0 ] = parser.ParseInt();
tris[ i * 3 + 1 ] = parser.ParseInt();
tris[ i * 3 + 2 ] = parser.ParseInt();
}
//
// parse weights
//
//.........这里部分代码省略.........
示例5: model
/*
====================
idMD5Mesh::ParseMesh
====================
*/
void idMD5Mesh::ParseMesh( idLexer &parser, int numJoints, const idJointMat *joints ) {
idToken token;
idToken name;
int num;
int count;
int jointnum;
idStr shaderName;
int i, j;
idList<int> tris;
idList<int> firstWeightForVertex;
idList<int> numWeightsForVertex;
int maxweight;
idList<vertexWeight_t> tempWeights;
parser.ExpectTokenString( "{" );
//
// parse name
//
if ( parser.CheckTokenString( "name" ) ) {
parser.ReadToken( &name );
}
//
// parse shader
//
parser.ExpectTokenString( "shader" );
parser.ReadToken( &token );
shaderName = token;
shader = declManager->FindMaterial( shaderName );
//
// parse texture coordinates
//
parser.ExpectTokenString( "numverts" );
count = parser.ParseInt();
if ( count < 0 ) {
parser.Error( "Invalid size: %s", token.c_str() );
}
texCoords.SetNum( count );
firstWeightForVertex.SetNum( count );
numWeightsForVertex.SetNum( count );
numWeights = 0;
maxweight = 0;
for( i = 0; i < texCoords.Num(); i++ ) {
parser.ExpectTokenString( "vert" );
parser.ParseInt();
parser.Parse1DMatrix( 2, texCoords[ i ].ToFloatPtr() );
firstWeightForVertex[ i ] = parser.ParseInt();
numWeightsForVertex[ i ] = parser.ParseInt();
if ( !numWeightsForVertex[ i ] ) {
parser.Error( "Vertex without any joint weights." );
}
numWeights += numWeightsForVertex[ i ];
if ( numWeightsForVertex[ i ] + firstWeightForVertex[ i ] > maxweight ) {
maxweight = numWeightsForVertex[ i ] + firstWeightForVertex[ i ];
}
}
//
// parse tris
//
parser.ExpectTokenString( "numtris" );
count = parser.ParseInt();
if ( count < 0 ) {
parser.Error( "Invalid size: %d", count );
}
tris.SetNum( count * 3 );
numTris = count;
for( i = 0; i < count; i++ ) {
parser.ExpectTokenString( "tri" );
parser.ParseInt();
tris[ i * 3 + 0 ] = parser.ParseInt();
tris[ i * 3 + 1 ] = parser.ParseInt();
tris[ i * 3 + 2 ] = parser.ParseInt();
}
//
// parse weights
//
parser.ExpectTokenString( "numweights" );
count = parser.ParseInt();
if ( count < 0 ) {
parser.Error( "Invalid size: %d", count );
}
//.........这里部分代码省略.........