本文整理汇总了C++中idParser::SkipUntilString方法的典型用法代码示例。如果您正苦于以下问题:C++ idParser::SkipUntilString方法的具体用法?C++ idParser::SkipUntilString怎么用?C++ idParser::SkipUntilString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idParser
的用法示例。
在下文中一共展示了idParser::SkipUntilString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MA_ParseTVert
bool MA_ParseTVert( idParser &parser, maAttribHeader_t *header )
{
maMesh_t *pMesh = &maGlobal.currentObject->mesh;
idToken token;
//This is not the texture coordinates. It is just the name so ignore it
if( strstr( header->name, "uvsn" ) )
{
return true;
}
//Allocate enough space for all the data
if( !pMesh->tvertexes )
{
pMesh->numTVertexes = header->size;
pMesh->tvertexes = ( idVec2 * ) Mem_Alloc( sizeof( idVec2 ) * pMesh->numTVertexes );
}
//Get the start and end index for this attribute
int minIndex, maxIndex;
if( !MA_ParseHeaderIndex( header, minIndex, maxIndex, "TextureCoordHeader", "uvsp" ) )
{
//This was just a header
return true;
}
parser.ReadToken( &token );
if( !token.Icmp( "-" ) )
{
idToken tk2;
parser.ReadToken( &tk2 );
if( !tk2.Icmp( "type" ) )
{
parser.SkipUntilString( "float2" );
}
else
{
parser.UnreadToken( &tk2 );
parser.UnreadToken( &token );
}
}
else
{
parser.UnreadToken( &token );
}
//Read each tvert
for( int i = minIndex; i <= maxIndex; i++ )
{
pMesh->tvertexes[i].x = parser.ParseFloat();
pMesh->tvertexes[i].y = 1.0f - parser.ParseFloat();
}
return true;
}
示例2: MA_ParseNormal
bool MA_ParseNormal(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->normals) {
pMesh->numNormals = header->size;
pMesh->normals = (idVec3 *)Mem_Alloc( sizeof( idVec3 ) * pMesh->numNormals );
}
//Get the start and end index for this attribute
int minIndex, maxIndex;
if(!MA_ParseHeaderIndex(header, minIndex, maxIndex, "NormalHeader", NULL)) {
//This was just a header
return true;
}
parser.ReadToken(&token);
if(!token.Icmp("-")) {
idToken tk2;
parser.ReadToken(&tk2);
if(!tk2.Icmp("type")) {
parser.SkipUntilString("float3");
} else {
parser.UnreadToken(&tk2);
parser.UnreadToken(&token);
}
} else {
parser.UnreadToken(&token);
}
//Read each vert
for(int i = minIndex; i <= maxIndex; i++) {
pMesh->normals[i].x = parser.ParseFloat();
//Adjust the normals for the change in coordinate systems
pMesh->normals[i].z = parser.ParseFloat();
pMesh->normals[i].y = -parser.ParseFloat();
pMesh->normals[i].Normalize();
}
pMesh->normalsParsed = true;
pMesh->nextNormal = 0;
return true;
}
示例3: MA_ParseVertexTransforms
bool MA_ParseVertexTransforms(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->vertTransforms) {
if(header->size == 0) {
header->size = 1;
}
pMesh->numVertTransforms = header->size;
pMesh->vertTransforms = (idVec4 *)Mem_Alloc( sizeof( idVec4 ) * pMesh->numVertTransforms );
pMesh->nextVertTransformIndex = 0;
}
//Get the start and end index for this attribute
int minIndex, maxIndex;
if(!MA_ParseHeaderIndex(header, minIndex, maxIndex, "VertexTransformHeader", NULL)) {
//This was just a header
return true;
}
parser.ReadToken(&token);
if(!token.Icmp("-")) {
idToken tk2;
parser.ReadToken(&tk2);
if(!tk2.Icmp("type")) {
parser.SkipUntilString("float3");
} else {
parser.UnreadToken(&tk2);
parser.UnreadToken(&token);
}
} else {
parser.UnreadToken(&token);
}
//Read each vert
for(int i = minIndex; i <= maxIndex; i++) {
pMesh->vertTransforms[pMesh->nextVertTransformIndex].x = parser.ParseFloat();
pMesh->vertTransforms[pMesh->nextVertTransformIndex].z = parser.ParseFloat();
pMesh->vertTransforms[pMesh->nextVertTransformIndex].y = -parser.ParseFloat();
//w hold the vert index
pMesh->vertTransforms[pMesh->nextVertTransformIndex].w = i;
pMesh->nextVertTransformIndex++;
}
return true;
}
示例4: MA_ReadVec3
bool MA_ReadVec3(idParser& parser, idVec3& vec) {
idToken token;
if(!parser.SkipUntilString("double3")) {
throw idException( va("Maya Loader '%s': Invalid Vec3", parser.GetFileName()) );
}
//We need to flip y and z because of the maya coordinate system
vec.x = parser.ParseFloat();
vec.z = parser.ParseFloat();
vec.y = parser.ParseFloat();
return true;
}
示例5: MA_ParseFileNode
void MA_ParseFileNode( idParser &parser )
{
//Get the header info from the node
maNodeHeader_t header;
MA_ParseNodeHeader( parser, &header );
//Read the transform attributes
idToken token;
while( parser.ReadToken( &token ) )
{
if( IsNodeComplete( token ) )
{
parser.UnreadToken( &token );
break;
}
if( !token.Icmp( "setAttr" ) )
{
maAttribHeader_t attribHeader;
MA_ParseAttribHeader( parser, &attribHeader );
if( strstr( attribHeader.name, ".ftn" ) )
{
parser.SkipUntilString( "string" );
parser.ReadToken( &token );
if( !token.Icmp( "(" ) )
{
parser.ReadToken( &token );
}
maFileNode_t *fileNode;
fileNode = ( maFileNode_t * ) Mem_Alloc( sizeof( maFileNode_t ) );
strcpy( fileNode->name, header.name );
strcpy( fileNode->path, token.c_str() );
maGlobal.model->fileNodes.Set( fileNode->name, fileNode );
}
else
{
parser.SkipRestOfLine();
}
}
}
}
示例6: ParseTimeline
/*
================
sdDeclToolTip::ParseTimeline
================
*/
bool sdDeclToolTip::ParseTimeline( idParser& src ) {
idToken token;
src.SkipUntilString( "{", &token );
while ( true ) {
if( !src.ReadToken( &token ) ) {
return false;
}
if ( !token.Icmp( "onTime" ) ) {
src.ReadToken( &token );
int time;
if ( token.type == TT_NUMBER ) {
time = ( token.GetIntValue() / 100.0f ) * GetLength();
} else if ( token.type == TT_NAME && !token.Icmp( "end" ) ) {
time = TLTIME_END;
} else {
src.Error( "sdDeclToolTip::ParseTimeline number expected for 'onTime'" );
return false;
}
timelinePair_t event;
event.first = time;
if ( timeline.Num() > 0 ) {
timelinePair_t lastEvent = timeline.Back();
if ( lastEvent.first > time && time != TLTIME_END ) {
src.Error( "sdDeclToolTip::ParseTimeline time events must be in increasing order: '%i'", time );
return false;
}
}
src.ReadToken( &token );
if ( !token.Icmp( "guiEvent" ) ) {
event.second.eventType = TL_GUIEVENT;
if( !src.ExpectTokenType( TT_STRING, 0, &token ) ) {
src.Error( "sdDeclToolTip::ParseTimeline string expected after 'guiEvent'" );
return false;
}
event.second.arg1 = token;
} else if ( !token.Icmp( "pause" ) ) {
event.second.eventType = TL_PAUSE;
} else if ( !token.Icmp( "unpause" ) ) {
event.second.eventType = TL_UNPAUSE;
} else if ( !token.Icmp( "showInventory" ) ) {
event.second.eventType = TL_SHOWINVENTORY;
if( !src.ExpectTokenType( TT_STRING, 0, &token ) ) {
src.Error( "sdDeclToolTip::ParseTimeline string expected after 'guiEvent'" );
return false;
}
event.second.arg1 = token;
} else if ( !token.Icmp( "hideInventory" ) ) {
event.second.eventType = TL_HIDEINVENTORY;
} else if ( !token.Icmp( "waypointHighlight" ) ) {
event.second.eventType = TL_WAYPOINTHIGHLIGHT;
if( !src.ExpectTokenType( TT_STRING, 0, &token ) ) {
src.Error( "sdDeclToolTip::ParseTimeline string expected after 'guiEvent'" );
return false;
}
event.second.arg1 = token;
} else if ( !token.Icmp( "lookAtTask" ) ) {
event.second.eventType = TL_LOOKATTASK;
} else {
src.Error( "sdDeclToolTip::ParseTimeline unexpected timeline event '%s'", token.c_str() );
return false;
}
timeline.Append( event );
} else if ( !token.Icmp( "unpauseWeaponSlot" ) ) {
if( !src.ExpectTokenType( TT_NUMBER, 0, &token ) ) {
src.Error( "sdDeclToolTip::ParseTimeline number expected after 'unpauseWeaponSlot'" );
return false;
}
//.........这里部分代码省略.........