rem: subRefCP(clusterWindow);
context: void key(unsigned char key, int /*x*/, int /*y*/){	switch ( key )	{        case 'l':        {            loadAnim();            break;        }        case 'c':        {            FILE *file=fopen(animName.c_str(),"w");            fclose(file);            animOri.clear();            animPos.clear();            break;        }        case 's':        {            FILE *file=fopen(animName.c_str(),"a");            Matrix m=cam_trans->getMatrix();            Quaternion q(m);            Real32 ax,ay,az,r;            animPos.push_back(Vec3f(m[3][0],                                    m[3][1],                                    m[3][2]));            animOri.push_back(q);            q.getValueAsAxisRad(ax,ay,az,r);            fprintf(file,"%f %f %f %f,%f %f %f\n",ax,ay,az,r,                    m[3][0],                    m[3][1],                    m[3][2]);            fclose(file);            break;        }        case 'S':        {            FILE *file=fopen((animName+".wrl").c_str(),"w");            std::vector<Quaternion>::iterator qit;                        fprintf(file,"DEF OriInter OrientationInterpolator {\n\tkey [");            for(int i = 0; i < animOri.size(); ++i)            {                               fprintf(file, "%f", i / (Real32)(animOri.size() - 1) );                if(i < animOri.size() - 1)                    fprintf(file,", ");            }            fprintf(file,"]\n\tkeyValue [");            for(qit = animOri.begin(); qit != animOri.end(); ++qit)            {                Real32 ax,ay,az,r;                (*qit).getValueAsAxisRad(ax,ay,az,r);                                fprintf(file, "%f %f %f %f", ax, ay, az, r );                if(qit < animOri.end() - 1)                    fprintf(file,", ");            }            fprintf(file,"]\n}\n\n");            std::vector<Vec3f>::iterator vit;                        fprintf(file,"DEF PosInter PositionInterpolator {\n\tkey [");            for(int i = 0; i < animPos.size(); ++i)            {                               fprintf(file, "%f", i / (Real32)(animPos.size() - 1) );                if(i < animPos.size() - 1)                    fprintf(file,", ");            }            fprintf(file,"]\n\tkeyValue [");            for(vit = animPos.begin(); vit != animPos.end(); ++vit)            {                Vec3f v = *vit;                                fprintf(file, "%f %f %f, ", v[0], v[1], v[2] );            }            fprintf(file,"]\n}\n\n");            fclose(file);            break;        }         case 'b':	// switch wire frame            if(ract==ract1)                ract=ract2;            else                ract=ract1;            break;        case 'j':            if(sortfirst!=NullFC)            {                beginEditCP(sortfirst);                sortfirst->setCompression("JPEG");                endEditCP(sortfirst);            }            break;        case 'r':            if(sortfirst!=NullFC)            {                beginEditCP(sortfirst);                sortfirst->setCompression("RLE");                endEditCP(sortfirst);            }            break;        case 'n':            if(sortfirst!=NullFC)            {                beginEditCP(sortfirst);                sortfirst->getCompression().erase();                endEditCP(sortfirst);            }            break;        case 'a':            if(animate)            {                glutIdleFunc(NULL);                       animate=false;            }            else            {                glutIdleFunc(display);                       animate=true;            }            break;        case 'd':            // remove tree            beginEditCP(root);            while(root->getNChildren())            {                root->subChild(0);            }            endEditCP(root);            break;        case 27:	// should kill the clients here            // exit            subRefCP(clusterWindow);            osgExit();             exit(0);	}		glutPostRedisplay();}