}
else
{
char t:
if ( (tmp » t ) )
Приложение В. Некоторые полезные классы и служебные подпрограммы
{
сегг « "Line " « line « ": bum chars in number" « endl: // неверные символы в числе exit(-l): }
}
return number:
}
//««««««««< isidentifier »»»»»»»»
bool Scene :: isidentifier(string keyword) { //////////////////
isidentifier
string temp - keyword:
if (!isa1pha(temp[0])) return(false):
for (int count - 1; count < temp.lengthO; count++) {
if ((!isalnum(temp[count]))&& (temp[count]!-'.')) return(false):
}
return(true):
}
//«««««««« cleanllp »»»»»»»» void Scene :: cleanUpO //IIIIIIillIIIIII cleanUp { // release stuff after parsing file // освобождаем место после анализа файла
affStk.releaseAffі nes(): // delete affine stack // удаляем аффинный стек
def_stack->release():
delete def_stack: // release the DefUnitStack memory }
//««««««««< freeScene »»»»»»»
void Scene :: freeSceneО
{ // release the object and light lists
// освобождаем списки объектов и источников света
GeomObj *р - obj:
while(p)
{
GeomObj* q - p: p - p->next: delete q:
}
Light * q - light:
while(q)
{
Light* r - q: q - q->next: delete r:
}
}
//««««««««< whichToken »»»»»»»> mTokenType Scene :: whichtoken(string keyword) {
string temp - keyword:
ВЗ. Класс SCENE и сопутствующие классы
if ( | temp |
- |
"light" ) return LIGHT; |
if ( | temp | rata | "rotate" ) return ROTATE; |
if ( | temp | na | "translate" ) return TRANSLATE: |
if ( | temp |
вя |
"scale") return (SCALE): |
if ( | temp |
еж |
"push") return (PUSH): |
if ( | temp |
- |
"pop") return (POP): |
if ( | temp |
- |
"identityAffine") return (IDENTITYAFFINE); |
if ( | temp |
- |
"cube") return (CUBE); |
if ( | temp | "sphere") return (SPHERE): | |
if ( | temp | "torus") return (TORUS): | |
if ( | temp |
- |
"plane") return (PLANE): |
if ( | temp | mm | "square") return (SQUARE): |
if ( | temp | "cylinder") return (CYLINDER); | |
if ( | temp |
- |
"taperedCylinder") return (TAPEREDCYLINDER): |
if ( | temp |
- |
"cone") return (CONE): |
if ( | temp |
- |
"tetrahedron") return (TETRAHEDRON): |
if ( | temp | "octahedron") return (OCTAHEDRON); | |
if ( | temp |
- |
"dodecahedron") return (DODECAHEDRON): |
if ( | temp |
- |
"icosahedron") return (ICOSAHEDRON): |
if ( | temp |
- |
"buckyball") return (BUCKYBALL); |
if ( | temp |
еж |
"diamond") return (DIAMOND): |
if ( | temp |
- |
"teapot") return (TEAPOT): |
if ( | temp | "union") return (UNION); | |
if ( | temp |
- |
"intersection") return (INTERSECTION): |
if ( | temp |
- |
"difference") return (DIFFERENCEa): |
if ( | temp |
- |
"mesh") return (MESH): |
if ( | temp |
еж |
"makePixmap") return (MAKEPIXMAP); |
if ( | temp |
- |
"defaultMaterials") return (DEFAULTMATERIALS); |
if ( | temp |
- |
"ambient") return (AMBIENT): |
if ( | temp | "diffuse") return (DIFFUSE): | |
if ( | temp |
- |
"specular" return (SPECULAR): |
if ( | temp |
еж |
"specularFraction") return (SPECULARFRACTION); |
if ( | temp |
- |
"surfaceRoughness") return (SURFACEROUGHNESS); |
if ( | temp | dm | "emissive") return (EMISSIVE): |
if ( | temp |
еж |
"specularExponent") return (.SPECULAREXPONENT): |
if ( | temp | mm | "speedOfLight") return (SPEEDOFLIGHT); |
if ( | temp |
еж |
"transparency") return (TRANSPARENCY): |
if ( | temp |
- |
"reflectivity") return (REFLECTIVITY): |
if ( | temp |
- |
"parameters") return (PARAMETERS): |
if ( | temp |
- |
"texture") return (TEXTURE): |
if ( | temp |
- |
"globalAmbient") return (GLOBALAMBIENT): |
if ( | temp |
еж |
"minReflectivity") return (MINREFLECTIVITY): |
if ( | temp |
еж |
"minTransparency") return (MINTRANSPARENCY): |
if ( | temp |
еж |
"maxRecursionDepth") return (MAXRECURSIONDEPTH) |
if ( | temp |
- |
"background") return (BACKGROUND); |
if ( | temp |
- |
"{") return (LFTCURLY): |
1f ( | temp |
яа |
"}") return (RGHTCURLY): |
if ( | temp | mm | "def") return (DEF); |
if ( | temp | ex | "use") return (USE): |
if С | temp |
- |
" " ) return (TJULL): |
if ( |
|
||
cout |
|
« ":" « temp.lengthO « endl: |
return(UNKNOWN);