[Plib-users] Save *.ac Files, File empty
Brought to you by:
sjbaker
From: Michael W. <michael.wessels@z.zgs.de> - 2001-03-01 20:06:36
|
Hi all, with the following code I read a *.ac model and try to save it again. Code: static int countVertices ( ssgEntity *e ) { int count = 0 ; if ( e -> isAKindOf ( SSG_TYPE_BRANCH ) ) { ssgBranch *br = (ssgBranch *) e ; for ( int i = 0 ; i < br -> getNumKids () ; i++ ) count += countVertices ( br -> getKid ( i ) ) ; } else if ( e -> isAKindOf ( SSG_TYPE_VTABLE ) ) { ssgVTable *vt = (ssgVTable *) e ; count += vt -> getNumVertices () ; } return count ; } static int countTriangles ( ssgEntity *e ) { int count = 0 ; if ( e -> isAKindOf ( SSG_TYPE_BRANCH ) ) { ssgBranch *br = (ssgBranch *) e ; for ( int i = 0 ; i < br -> getNumKids () ; i++ ) count += countTriangles ( br -> getKid ( i ) ) ; } else if ( e -> isAKindOf ( SSG_TYPE_VTABLE ) ) { ssgVTable *vt = (ssgVTable *) e ; count += vt -> getNumTriangles () ; } return count ; } /* Load Model.ac with plib */ static void load_model() { char Data_Path[128]; char Type_Name[128]; int Num_Triangles; int Num_Vertices; test_obj = new ssgTransform ; sprintf(Data_Path,"..\\Data\\"); ssgModelPath (Data_Path) ; ssgTexturePath (Data_Path) ; ssgEntity *obj = ssgLoadAC ("cube.ac") ; // ssgFlatten ( obj ) ; test_obj -> addKid ( obj ) ; // ssgStripify ( test_obj ) ; root_scene = new ssgRoot; root_scene -> addKid(test_obj); Num_Triangles = countTriangles(test_obj); Num_Vertices = countVertices(test_obj); sprintf(Type_Name, obj->getTypeName()); ssgSaveAC("test.ac",test_obj); } But the file test.ac is empty without vertices. Num_Triangles and Num_Vertices gives zero. Using obj instead of test_obj I got the same result. Running this part of code in the complete code the cube is visible. What is wrong? With regards Michael |