• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ idParser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中idParser的典型用法代码示例。如果您正苦于以下问题:C++ idParser类的具体用法?C++ idParser怎么用?C++ idParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了idParser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: MA_ParseEdge

bool MA_ParseEdge(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->edges) {
        pMesh->numEdges = header->size;
        pMesh->edges = (idVec3 *)Mem_Alloc( sizeof( idVec3 ) * pMesh->numEdges );
    }

    //Get the start and end index for this attribute
    int minIndex, maxIndex;
    if(!MA_ParseHeaderIndex(header, minIndex, maxIndex, "EdgeHeader", NULL)) {
        //This was just a header
        return true;
    }

    //Read each vert
    for(int i = minIndex; i <= maxIndex; i++) {
        pMesh->edges[i].x = parser.ParseFloat();
        pMesh->edges[i].y = parser.ParseFloat();
        pMesh->edges[i].z = parser.ParseFloat();
    }

    return true;
}
开发者ID:boscorillium,项目名称:dhewm3,代码行数:27,代码来源:Model_ma.cpp


示例2: MA_ParseNodeHeader

void MA_ParseNodeHeader( idParser &parser, maNodeHeader_t *header )
{

	memset( header, 0, sizeof( maNodeHeader_t ) );
	
	idToken token;
	
	while( parser.ReadToken( &token ) )
	{
		if( !token.Icmp( "-" ) )
		{
			parser.ReadToken( &token );
			
			if( !token.Icmp( "n" ) )
			{
				parser.ReadToken( &token );
				strcpy( header->name, token.c_str() );
			}
			else if( !token.Icmp( "p" ) )
			{
				parser.ReadToken( &token );
				strcpy( header->parent, token.c_str() );
			}
		}
		else if( !token.Icmp( ";" ) )
		{
			break;
		}
	}
}
开发者ID:revelator,项目名称:MHDoom,代码行数:30,代码来源:Model_ma.cpp


示例3: MA_ParseColor

bool MA_ParseColor(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->colors) {
        pMesh->numColors = header->size;
        pMesh->colors = (byte *)Mem_Alloc( sizeof( byte ) * pMesh->numColors * 4 );
    }

    //Get the start and end index for this attribute
    int minIndex, maxIndex;
    if(!MA_ParseHeaderIndex(header, minIndex, maxIndex, "ColorHeader", NULL)) {
        //This was just a header
        return true;
    }

    //Read each vert
    for(int i = minIndex; i <= maxIndex; i++) {
        pMesh->colors[i*4] = parser.ParseFloat() * 255;
        pMesh->colors[i*4+1] = parser.ParseFloat() * 255;
        pMesh->colors[i*4+2] = parser.ParseFloat() * 255;
        pMesh->colors[i*4+3] = parser.ParseFloat() * 255;
    }

    return true;
}
开发者ID:boscorillium,项目名称:dhewm3,代码行数:28,代码来源:Model_ma.cpp


示例4: ParseConstantValue

/*
================
idTypeInfoGen::ParseConstantValue
================
*/
void idTypeInfoGen::ParseConstantValue( const char *scope, idParser &src, idStr &value ) {
	idToken token;
	idStr constantString;

	int indent = 0;
	while( src.ReadToken( &token ) ) {
		if ( token == "(" ) {
			indent++;
		} else if ( token == ")" ) {
			indent--;
		} else if ( indent == 0 && ( token == ";" || token == "," || token == "}" ) ) {
			src.UnreadToken( &token );
			break;
		} else if ( token.type == TT_NAME ) {
			constantString = token;
			while( src.CheckTokenString( "::" ) ) {
				src.ExpectTokenType( TT_NAME, 0, &token );
				constantString += "::" + token;
			}
			value += va( "%d", GetIntegerConstant( scope, constantString, src ) );
			continue;
		}
		value += token;
	}
}
开发者ID:Deepfreeze32,项目名称:idtech4cdk,代码行数:30,代码来源:TypeInfoGen.cpp


示例5: ParseFilter

/*
================
sdDeclDamageFilter::ParseFilter
================
*/
bool sdDeclDamageFilter::ParseFilter( damageFilter_t& filter, idParser& src ) {
	idToken token;

	if( !src.ReadToken( &token ) || token.Cmp( "{" ) ) {
		return false;
	}

	while ( true ) {
		if ( !src.ReadToken( &token ) ) {
			return false;
		}

		if ( !token.Cmp( "}" ) ) {
			break;
		}

		if( !token.Icmp( "damage" ) ) {

			bool error;
			filter.damage = src.ParseFloat( &error );
			if ( error ) {
				src.Error( "sdDeclDamageFilter::ParseLevel Invalid Parm for 'damage'" );
				return false;
			}

			if ( src.PeekTokenString( "%" ) ) {
				src.ReadToken( &token );
				filter.mode = DFM_PERCENT;
			} else {
				filter.mode = DFM_NORMAL;
			}

		} else if( !token.Icmp( "target" ) ) {

			if ( !src.ReadToken( &token ) ) {
				src.Error( "sdDeclDamageFilter::ParseLevel Missing Parm for 'target'" );
				return false;
			}

			filter.target = gameLocal.declTargetInfoType.LocalFind( token, false );
			if ( !filter.target ) {
				src.Error( "sdDeclDamageFilter::ParseLevel Invalid Target '%s'", token.c_str() );
				return false;
			}

		} else if( !token.Icmp( "noScale" ) ) {

			filter.noScale = true;

		} else {

			src.Error( "sdDeclDamageFilter::ParseLevel Unknown Parameter %s", token.c_str() );
			return false;
		}
	}

	return true;
}
开发者ID:,项目名称:,代码行数:63,代码来源:


示例6: MA_ParseTransform

bool MA_ParseTransform(idParser& parser) {

    maNodeHeader_t	header;
    maTransform_t*	transform;
    memset(&header, 0, sizeof(header));

    //Allocate room for the transform
    transform = (maTransform_t *)Mem_Alloc( sizeof( maTransform_t ) );
    memset(transform, 0, sizeof(maTransform_t));
    transform->scale.x = transform->scale.y = transform->scale.z = 1;

    //Get the header info from the transform
    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")) {
            parser.ReadToken(&token);
            if(!token.Icmp(".t")) {
                if(!MA_ReadVec3(parser, transform->translate)) {
                    return false;
                }
                transform->translate.y *=  -1;
            } else if (!token.Icmp(".r")) {
                if(!MA_ReadVec3(parser, transform->rotate)) {
                    return false;
                }
            } else if (!token.Icmp(".s")) {
                if(!MA_ReadVec3(parser, transform->scale)) {
                    return false;
                }
            } else {
                parser.SkipRestOfLine();
            }
        }
    }

    if(header.parent[0] != 0) {
        //Find the parent
        maTransform_t**	parent;
        maGlobal.model->transforms.Get(header.parent, &parent);
        if(parent) {
            transform->parent = *parent;
        }
    }

    //Add this transform to the list
    maGlobal.model->transforms.Set(header.name, transform);
    return true;
}
开发者ID:boscorillium,项目名称:dhewm3,代码行数:55,代码来源:Model_ma.cpp


示例7: Parse

/*
================
idDict::Parse
================
*/
bool idDict::Parse( idParser &parser ) {
	idToken	token;
	idToken	token2;
	bool	errors;

	errors = false;

	parser.ExpectTokenString( "{" );
	parser.ReadToken( &token );
	while( ( token.type != TT_PUNCTUATION ) || ( token != "}" ) ) {
		if ( token.type != TT_STRING ) {
			parser.Error( "Expected quoted string, but found '%s'", token.c_str() );
		}

		if ( !parser.ReadToken( &token2 ) ) {
			parser.Error( "Unexpected end of file" );
		}

		if ( FindKey( token ) ) {
			parser.Warning( "'%s' already defined", token.c_str() );
			errors = true;
		}
		Set( token, token2 );

		if ( !parser.ReadToken( &token ) ) {
			parser.Error( "Unexpected end of file" );
		}
	}

	return !errors;
}
开发者ID:Afr0,项目名称:idtech4.net,代码行数:36,代码来源:Dict.cpp


示例8: 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;
}
开发者ID:boscorillium,项目名称:dhewm3,代码行数:14,代码来源:Model_ma.cpp


示例9: ParsePage

/*
============
sdDeclRadialMenu::ParsePage
============
*/
bool sdDeclRadialMenu::ParsePage( idParser& src ) {
	idToken token;
	if( !src.ReadToken( &token )) {
		src.Error( "sdDeclRadialMenu::ParsePage: Unexpected end of file while parsing declName" );
		return false;
	}
	if( token.Length() > 0 ) {
		pages.Append( gameLocal.declRadialMenuType.LocalFind( token ) );
	} else {
		gameLocal.Warning( "sdDeclRadialMenu::ParsePage: parsed an empty page in '%s'", GetName() );
	}
	
	return true;
}
开发者ID:,项目名称:,代码行数:19,代码来源:


示例10: 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;
}
开发者ID:revelator,项目名称:MHDoom,代码行数:59,代码来源:Model_ma.cpp


示例11: ParseItem

/*
============
sdDeclRadialMenu::ParseItem
============
*/
bool sdDeclRadialMenu::ParseItem( idParser& src ) {
	idToken token;
	if( !src.ReadToken( &token )) {
		src.Error( "sdDeclRadialMenu::ParseItem: Unexpected end of file while parsing itemName" );
		return false;
	}
	item_t& item = items.Alloc();
	item.title = declHolder.FindLocStr( token.c_str() );

	bool success = ParseKeys( src, item.keys );

	gameLocal.CacheDictionaryMedia( item.keys );

	return success;
}
开发者ID:,项目名称:,代码行数:20,代码来源:


示例12: 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;
}
开发者ID:boscorillium,项目名称:dhewm3,代码行数:51,代码来源:Model_ma.cpp


示例13: 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;
}
开发者ID:boscorillium,项目名称:dhewm3,代码行数:17,代码来源:Model_ma.cpp


示例14: Parse

/*
================
sdPersistentRankInfo::Parse
================
*/
bool sdPersistentRankInfo::Parse( idParser& src ) {
	idToken token;

	while ( true ) {
		if ( src.ReadToken( &token ) == 0 ) {
			break;
		}

		if ( token.Icmp( "badge" ) == 0 ) {
			if ( !ParseBadge( src ) ) {
				return false;
			}
		} else {
			src.Warning( "Unexpected Token: '%s'", token.c_str() );
			return false;
		}
	}

	return true;
}
开发者ID:,项目名称:,代码行数:25,代码来源:


示例15: GetFloatConstant

/*
================
idTypeInfoGen::GetFloatConstant
================
*/
float idTypeInfoGen::GetFloatConstant( const char *scope, const char *name, idParser &src ) {
	idConstantInfo *constant = FindConstant( idStr( scope ) + name );
	if ( constant == NULL ) {
		constant = FindConstant( name );
	}
	if ( constant ) {
		return EvaluateFloatString( constant->value );
	}
	src.Warning( "unknown value '%s' in constant expression", name );
	return 0;
}
开发者ID:Deepfreeze32,项目名称:idtech4cdk,代码行数:16,代码来源:TypeInfoGen.cpp


示例16: 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;
}
开发者ID:boscorillium,项目名称:dhewm3,代码行数:51,代码来源:Model_ma.cpp


示例17: LoadFromParser

void idTokenParser::LoadFromParser( idParser& parser, const char* guiName )
{
	idToken tok;
	idTokenIndexes tokIdxs;
	tokIdxs.SetName( guiName );
	while( parser.ReadToken( &tok ) )
	{
		tokIdxs.Append( tokens.AddUnique( idBinaryToken( tok ) ) );
	}
	guiTokenIndexes.Append( tokIdxs );
	currentToken = 0;
}
开发者ID:Yetta1,项目名称:OpenTechBFG,代码行数:12,代码来源:TokenParser.cpp


示例18: ParseKey

/*
============
sdDemoCamera::ParseKey
============
*/
bool sdDemoCamera::ParseKey( const idToken& key, idParser& src ) {
	idToken token;

	if ( !key.Icmp( "name" ) ) {
		if ( !src.ExpectAnyToken( &token ) ) {
			return false;
		}

		name = token;
		return true;
	}

	return false;		
}
开发者ID:,项目名称:,代码行数:19,代码来源:


示例19: ParseArraySize

/*
================
idTypeInfoGen::ParseArraySize
================
*/
int idTypeInfoGen::ParseArraySize( const char *scope, idParser &src ) {
	idToken token;
	idStr sizeString, constantString;
	int size, totalSize;

	if ( !src.CheckTokenString( "[" ) ) {
		return 0;
	}

	totalSize = 1;
	sizeString = "";
	while( src.ReadToken( &token ) ) {
		if ( token == "]" ) {
			if ( sizeString.Length() ) {
				size = EvaluateIntegerString( sizeString );
				if ( size ) {
					totalSize *= size;
				}
				sizeString = "";
			}
			if ( !src.CheckTokenString( "[" ) ) {
				break;
			}
		} else if ( token.type == TT_NAME ) {
			constantString = token;
			while( src.CheckTokenString( "::" ) ) {
				src.ExpectTokenType( TT_NAME, 0, &token );
				constantString += "::" + token;
			}
			sizeString += va( "%d", GetIntegerConstant( scope, constantString, src ) );
		} else {
			sizeString += token;
		}
	}

	return totalSize;
}
开发者ID:Deepfreeze32,项目名称:idtech4cdk,代码行数:42,代码来源:TypeInfoGen.cpp


示例20: MA_ParseCreateNode

void MA_ParseCreateNode(idParser& parser) {

    idToken token;
    parser.ReadToken(&token);

    if(!token.Icmp("transform")) {
        MA_ParseTransform(parser);
    } else if(!token.Icmp("mesh")) {
        MA_ParseMesh(parser);
    } else if(!token.Icmp("file")) {
        MA_ParseFileNode(parser);
    } else if(!token.Icmp("shadingEngine") || !token.Icmp("lambert") || !token.Icmp("phong") || !token.Icmp("blinn") ) {
        MA_ParseMaterialNode(parser);
    }
}
开发者ID:boscorillium,项目名称:dhewm3,代码行数:15,代码来源:Model_ma.cpp



注:本文中的idParser类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ idPlane类代码示例发布时间:2022-05-31
下一篇:
C++ idMat3类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap