本文整理汇总了C++中idLexer::Parse1DMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ idLexer::Parse1DMatrix方法的具体用法?C++ idLexer::Parse1DMatrix怎么用?C++ idLexer::Parse1DMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idLexer
的用法示例。
在下文中一共展示了idLexer::Parse1DMatrix方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseBBoxes
/*
============
idAASSettings::ParseBBoxes
============
*/
bool idAASSettings::ParseBBoxes( idLexer &src )
{
idToken token;
idBounds bounds;
numBoundingBoxes = 0;
if ( !src.ExpectTokenString( "{" ) )
{
return false;
}
while( src.ReadToken( &token ) )
{
if ( token == "}" )
{
return true;
}
src.UnreadToken( &token );
src.Parse1DMatrix( 3, bounds[0].ToFloatPtr() );
if ( !src.ExpectTokenString( "-" ) )
{
return false;
}
src.Parse1DMatrix( 3, bounds[1].ToFloatPtr() );
boundingBoxes[numBoundingBoxes++] = bounds;
}
return false;
}
示例2: Reachability_Read
/*
================
Reachability_Read
================
*/
bool Reachability_Read( idLexer &src, idReachability *reach ) {
reach->travelType = src.ParseInt();
reach->toAreaNum = src.ParseInt();
src.Parse1DMatrix( 3, reach->start.ToFloatPtr() );
src.Parse1DMatrix( 3, reach->end.ToFloatPtr() );
reach->edgeNum = src.ParseInt();
reach->travelTime = src.ParseInt();
return true;
}
示例3:
/*
====================
idRenderModelMD5::ParseJoint
====================
*/
void idRenderModelMD5::ParseJoint( idLexer& parser, idMD5Joint* joint, idJointQuat* defaultPose )
{
//
// parse name
//
idToken token;
parser.ReadToken( &token );
joint->name = token;
//
// parse parent
//
int num = parser.ParseInt();
if( num < 0 )
{
joint->parent = NULL;
}
else
{
if( num >= joints.Num() - 1 )
{
parser.Error( "Invalid parent for joint '%s'", joint->name.c_str() );
}
joint->parent = &joints[ num ];
}
//
// parse default pose
//
parser.Parse1DMatrix( 3, defaultPose->t.ToFloatPtr() );
parser.Parse1DMatrix( 3, defaultPose->q.ToFloatPtr() );
defaultPose->q.w = defaultPose->q.CalcW();
}
示例4: ParseVertices
/*
================
idAASFileLocal::ParseVertices
================
*/
bool idAASFileLocal::ParseVertices( idLexer &src )
{
int numVertices, i;
idVec3 vec;
numVertices = src.ParseInt();
vertices.Resize( numVertices );
if ( !src.ExpectTokenString( "{" ) )
{
return false;
}
for ( i = 0; i < numVertices; i++ )
{
src.ParseInt();
if ( !src.Parse1DMatrix( 3, vec.ToFloatPtr() ) )
{
return false;
}
vertices.Append( vec );
}
if ( !src.ExpectTokenString( "}" ) )
{
return false;
}
return true;
}
示例5: ParsePlanes
/*
================
idAASFileLocal::ParsePlanes
================
*/
bool idAASFileLocal::ParsePlanes( idLexer &src )
{
int numPlanes, i;
idPlane plane;
idVec4 vec;
numPlanes = src.ParseInt();
planeList.Resize( numPlanes );
if ( !src.ExpectTokenString( "{" ) )
{
return false;
}
for ( i = 0; i < numPlanes; i++ )
{
src.ParseInt();
if ( !src.Parse1DMatrix( 4, vec.ToFloatPtr() ) )
{
return false;
}
plane.SetNormal( vec.ToVec3() );
plane.SetDist( vec[3] );
planeList.Append( plane );
}
if ( !src.ExpectTokenString( "}" ) )
{
return false;
}
return true;
}
示例6: ParseVector
/*
============
idAASSettings::ParseVector
============
*/
bool idAASSettings::ParseVector( idLexer &src, idVec3 &vec )
{
if ( !src.ExpectTokenString( "=" ) )
{
return false;
}
return ( src.Parse1DMatrix( 3, vec.ToFloatPtr() ) != 0 );
}
示例7: ParseBody
//.........这里部分代码省略.........
!src.ExpectTokenString( "," ) ||
!body->v2.Parse( src ) ||
!src.ExpectTokenString( "," ) ) {
return false;
}
body->numSides = src.ParseInt();
if ( !src.ExpectTokenString( ")" ) ) {
return false;
}
} else if ( !token.Icmp( "bone" ) ) {
body->modelType = TRM_BONE;
if ( !src.ExpectTokenString( "(" ) ||
!body->v1.Parse( src ) ||
!src.ExpectTokenString( "," ) ||
!body->v2.Parse( src ) ||
!src.ExpectTokenString( "," ) ) {
return false;
}
body->width = src.ParseFloat();
if ( !src.ExpectTokenString( ")" ) ) {
return false;
}
} else if ( !token.Icmp( "custom" ) ) {
src.Error( "custom models not yet implemented" );
return false;
} else {
src.Error( "unkown model type %s", token.c_str() );
return false;
}
} else if ( !token.Icmp( "origin" ) ) {
if ( !body->origin.Parse( src ) ) {
return false;
}
} else if ( !token.Icmp( "angles" ) ) {
if ( !angles.Parse( src ) ) {
return false;
}
body->angles = idAngles( angles.ToVec3().x, angles.ToVec3().y, angles.ToVec3().z );
} else if ( !token.Icmp( "joint" ) ) {
if ( !src.ExpectTokenType( TT_STRING, 0, &token ) ) {
return false;
}
body->jointName = token;
hasJoint = true;
} else if ( !token.Icmp( "mod" ) ) {
if ( !src.ExpectAnyToken( &token ) ) {
return false;
}
body->jointMod = JointModFromString( token.c_str() );
} else if ( !token.Icmp( "density" ) ) {
body->density = src.ParseFloat();
} else if ( !token.Icmp( "inertiaScale" ) ) {
src.Parse1DMatrix( 9, body->inertiaScale[0].ToFloatPtr() );
} else if ( !token.Icmp( "friction" ) ) {
body->linearFriction = src.ParseFloat();
src.ExpectTokenString( "," );
body->angularFriction = src.ParseFloat();
src.ExpectTokenString( "," );
body->contactFriction = src.ParseFloat();
} else if ( !token.Icmp( "contents" ) ) {
ParseContents( src, body->contents );
} else if ( !token.Icmp( "clipMask" ) ) {
ParseContents( src, body->clipMask );
} else if ( !token.Icmp( "selfCollision" ) ) {
body->selfCollision = src.ParseBool();
} else if ( !token.Icmp( "containedjoints" ) ) {
if ( !src.ExpectTokenType( TT_STRING, 0, &token ) ) {
return false;
}
body->containedJoints = token;
} else if ( !token.Icmp( "frictionDirection" ) ) {
if ( !body->frictionDirection.Parse( src ) ) {
return false;
}
} else if ( !token.Icmp( "contactMotorDirection" ) ) {
if ( !body->contactMotorDirection.Parse( src ) ) {
return false;
}
} else if ( token == "}" ) {
break;
} else {
src.Error( "unknown token %s in body", token.c_str() );
return false;
}
}
if ( body->modelType == TRM_INVALID ) {
src.Error( "no model set for body" );
return false;
}
if ( !hasJoint ) {
src.Error( "no joint set for body" );
return false;
}
body->clipMask |= CONTENTS_MOVEABLECLIP;
return true;
}
示例8: 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
//
//.........这里部分代码省略.........
示例9: 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 );
}
//.........这里部分代码省略.........