本文整理汇总了C++中idParser::ParseInt方法的典型用法代码示例。如果您正苦于以下问题:C++ idParser::ParseInt方法的具体用法?C++ idParser::ParseInt怎么用?C++ idParser::ParseInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idParser
的用法示例。
在下文中一共展示了idParser::ParseInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MA_ParseAttribHeader
bool MA_ParseAttribHeader(idParser &parser, maAttribHeader_t* header) {
idToken token;
memset(header, 0, sizeof(maAttribHeader_t));
parser.ReadToken(&token);
if(!token.Icmp("-")) {
parser.ReadToken(&token);
if (!token.Icmp("s")) {
header->size = parser.ParseInt();
parser.ReadToken(&token);
}
}
strcpy(header->name, token.c_str());
return true;
}
示例2: Parse
/*
============
sdDemoCamera_Anim::Parse
============
*/
bool sdDemoCamera_Anim::Parse( idParser& src ) {
if ( !src.ExpectTokenString( "{" ) ) {
return false;
}
idToken token;
int cycle = 1;
idVec3 offset( vec3_origin );
while( true ) {
if ( !src.ExpectAnyToken( &token ) ) {
return false;
}
if ( !token.Cmp( "}" ) ) {
break;
} else if ( !token.Icmp( "anim" ) ) {
if ( !src.ExpectAnyToken( &token ) ) {
return false;
}
if ( !cameraMD5.LoadAnim( token ) ) {
return false;
}
} else if ( !token.Icmp( "cycle" ) ) {
cycle = src.ParseInt();
} else if ( !token.Icmp( "offset" ) ) {
if ( !src.Parse1DMatrix( 3, offset.ToFloatPtr() ) ) {
return false;
}
} else if ( !sdDemoCamera::ParseKey( token, src ) ) {
src.Error( "sdDemoCamera_Anim::Parse : Unknown keyword '%s'", token.c_str() );
return false;
}
}
if ( !cycle ) {
cycle = 1;
}
cameraMD5.SetCycle( cycle );
cameraMD5.SetOffset( offset );
return true;
}
示例3: MA_ParseFace
bool MA_ParseFace(idParser& parser, maAttribHeader_t* header) {
maMesh_t* pMesh = &maGlobal.currentObject->mesh;
idToken token;
//Allocate enough space for all the verts if this is the first attribute for verticies
if(!pMesh->faces) {
pMesh->numFaces = header->size;
pMesh->faces = (maFace_t *)Mem_Alloc( sizeof( maFace_t ) * pMesh->numFaces );
}
//Get the start and end index for this attribute
int minIndex, maxIndex;
if(!MA_ParseHeaderIndex(header, minIndex, maxIndex, "FaceHeader", NULL)) {
//This was just a header
return true;
}
//Read the face data
int currentFace = minIndex-1;
while(parser.ReadToken(&token)) {
if(IsNodeComplete(token)) {
parser.UnreadToken(&token);
break;
}
if(!token.Icmp("f")) {
int count = parser.ParseInt();
if(count != 3) {
throw idException(va("Maya Loader '%s': Face is not a triangle.", parser.GetFileName()));
}
//Increment the face number because a new face always starts with an "f" token
currentFace++;
//We cannot reorder edges until later because the normal processing
//assumes the edges are in the original order
pMesh->faces[currentFace].edge[0] = parser.ParseInt();
pMesh->faces[currentFace].edge[1] = parser.ParseInt();
pMesh->faces[currentFace].edge[2] = parser.ParseInt();
//Some more init stuff
pMesh->faces[currentFace].vertexColors[0] = pMesh->faces[currentFace].vertexColors[1] = pMesh->faces[currentFace].vertexColors[2] = -1;
} else if(!token.Icmp("mu")) {
/* int uvstIndex = */ parser.ParseInt();
int count = parser.ParseInt();
if(count != 3) {
throw idException(va("Maya Loader '%s': Invalid texture coordinates.", parser.GetFileName()));
}
pMesh->faces[currentFace].tVertexNum[0] = parser.ParseInt();
pMesh->faces[currentFace].tVertexNum[1] = parser.ParseInt();
pMesh->faces[currentFace].tVertexNum[2] = parser.ParseInt();
} else if(!token.Icmp("mf")) {
int count = parser.ParseInt();
if(count != 3) {
throw idException(va("Maya Loader '%s': Invalid texture coordinates.", parser.GetFileName()));
}
pMesh->faces[currentFace].tVertexNum[0] = parser.ParseInt();
pMesh->faces[currentFace].tVertexNum[1] = parser.ParseInt();
pMesh->faces[currentFace].tVertexNum[2] = parser.ParseInt();
} else if(!token.Icmp("fc")) {
int count = parser.ParseInt();
if(count != 3) {
throw idException(va("Maya Loader '%s': Invalid vertex color.", parser.GetFileName()));
}
pMesh->faces[currentFace].vertexColors[0] = parser.ParseInt();
pMesh->faces[currentFace].vertexColors[1] = parser.ParseInt();
pMesh->faces[currentFace].vertexColors[2] = parser.ParseInt();
}
}
return true;
}