00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #include <OSGSplitGraphOp.h>
00045 #include <OSGDirectionalLight.h>
00046 #include <OSGSpotLight.h>
00047 #include <OSGLight.h>
00048 #include <OSGPointLight.h>
00049 #include <OSGSwitch.h>
00050 #include <OSGDistanceLOD.h>
00051 #include <OSGBillboard.h>
00052 #include <OSGMaterialGroup.h>
00053 #include <OSGComponentTransform.h>
00054 #include <OSGPrimitiveIterator.h>
00055 #include <OSGGeometry.h>
00056
00057 OSG_USING_NAMESPACE
00058
00059
00060
00061
00062
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 SplitGraphOp::SplitGraphOp(const char* name, UInt16 max_polygons):
00082 GraphOp(name), _max_polygons(max_polygons)
00083 {
00084 }
00085
00086 SplitGraphOp::~SplitGraphOp(void)
00087 {
00088 }
00089
00090 GraphOp* SplitGraphOp::create()
00091 {
00092 SplitGraphOp * inst = new SplitGraphOp();
00093 return inst;
00094 }
00095
00096 bool SplitGraphOp::traverse(NodePtr& root)
00097 {
00098
00099 if (isLeaf(root))
00100 {
00101 NodePtr n = makeNodeFor(root->getCore());
00102
00103 beginEditCP(root);
00104 root->setCore(Group::create());
00105 root->addChild(n);
00106 endEditCP(root);
00107 }
00108
00109 return GraphOp::traverse(root);
00110 }
00111
00112 void SplitGraphOp::setParams(const std::string params)
00113 {
00114 ParamSet ps(params);
00115
00116 ps("max_polygons", _max_polygons);
00117
00118 std::string out = ps.getUnusedParams();
00119 if(out.length())
00120 {
00121 FWARNING(("SplitGraphOp doesn't have parameters '%s'.\n",
00122 out.c_str()));
00123 }
00124 }
00125
00126 std::string SplitGraphOp::usage(void)
00127 {
00128 return
00129 "Split: Split large geometries into smaller ones\n"
00130 "Params: name (type, default)\n"
00131 " max_polygons (UInt32, 1000): maximum number of polygons allowed per Geo\n";
00132 }
00133
00134 void SplitGraphOp::setMaxPolygons(UInt16 max_polygons)
00135 {
00136 _max_polygons = max_polygons;
00137 }
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148 Action::ResultE SplitGraphOp::traverseEnter(NodePtr& node)
00149 {
00150 if (isLeaf(node)) return Action::Skip;
00151
00152 SwitchPtr switch_ = SwitchPtr::dcast(node->getCore());
00153 if (switch_!=NullFC) return Action::Skip;
00154
00155 DistanceLODPtr dlod = DistanceLODPtr::dcast(node->getCore());
00156 if (dlod!=NullFC) return Action::Skip;
00157
00158 return Action::Continue;
00159 }
00160
00161 #define addPoints( INDEX , LENGTH ) \
00162 for (UInt32 k=0; k<LENGTH; k++) \
00163 { \
00164 int posInd=it.getPositionIndex(k+INDEX); \
00165 if (pni[geoIndex]) \
00166 { \
00167 if (pni[geoIndex][posInd]==-1) \
00168 { \
00169 pnts[geoIndex]->push_back(it.getPosition(k+INDEX)); \
00170 pni[geoIndex][posInd]=pnts[geoIndex]->size()-1; \
00171 } \
00172 } \
00173 int normInd=it.getNormalIndex(k+INDEX); \
00174 if (nni[geoIndex]) \
00175 { \
00176 if (nni[geoIndex][normInd]==-1) \
00177 { \
00178 normals[geoIndex]->push_back(it.getNormal(k+INDEX)); \
00179 nni[geoIndex][normInd]=normals[geoIndex]->size()-1; \
00180 } \
00181 } \
00182 int colInd=it.getColorIndex(k+INDEX); \
00183 if (cni[geoIndex]) \
00184 { \
00185 if (cni[geoIndex][colInd]==-1) \
00186 { \
00187 colors[geoIndex]->push_back(it.getColor(k+INDEX)); \
00188 cni[geoIndex][colInd]=colors[geoIndex]->size()-1; \
00189 } \
00190 } \
00191 int scolInd=it.getSecondaryColorIndex(k+INDEX); \
00192 if (sni[geoIndex]) \
00193 { \
00194 if (sni[geoIndex][scolInd]==-1) \
00195 { \
00196 scolors[geoIndex]->push_back(it.getSecondaryColor(k+INDEX));\
00197 sni[geoIndex][scolInd]=scolors[geoIndex]->size()-1; \
00198 } \
00199 } \
00200 int texInd=it.getTexCoordsIndex(k+INDEX); \
00201 if (tni[geoIndex]) \
00202 { \
00203 if (tni[geoIndex][texInd]==-1) \
00204 { \
00205 tex[geoIndex]->push_back(it.getTexCoords(k+INDEX)); \
00206 tni[geoIndex][texInd]=tex[geoIndex]->size()-1; \
00207 } \
00208 } \
00209 int tex1Ind=it.getTexCoordsIndex1(k+INDEX); \
00210 if (t1ni[geoIndex]) \
00211 { \
00212 if (t1ni[geoIndex][tex1Ind]==-1) \
00213 { \
00214 tex1[geoIndex]->push_back(it.getTexCoords1(k+INDEX)); \
00215 t1ni[geoIndex][tex1Ind]=tex1[geoIndex]->size()-1; \
00216 } \
00217 } \
00218 int tex2Ind=it.getTexCoordsIndex2(k+INDEX); \
00219 if (t2ni[geoIndex]) \
00220 { \
00221 if (t2ni[geoIndex][tex2Ind]==-1) \
00222 { \
00223 tex2[geoIndex]->push_back(it.getTexCoords2(k+INDEX)); \
00224 t2ni[geoIndex][tex2Ind]=tex2[geoIndex]->size()-1; \
00225 } \
00226 } \
00227 int tex3Ind=it.getTexCoordsIndex3(k+INDEX); \
00228 if (t3ni[geoIndex]) \
00229 { \
00230 if (t3ni[geoIndex][tex3Ind]==-1) \
00231 { \
00232 tex3[geoIndex]->push_back(it.getTexCoords3(k+INDEX)); \
00233 t3ni[geoIndex][tex3Ind]=tex3[geoIndex]->size()-1; \
00234 } \
00235 } \
00236 if (indices[geoIndex]!=NullFC) \
00237 { \
00238 if (geos[geoIndex]->getMFIndexMapping()->size()<2) \
00239 { \
00240 indices[geoIndex]->push_back(pni[geoIndex][posInd]); \
00241 } \
00242 else \
00243 { \
00244 UInt32 * offsets = new UInt32 [ geos[geoIndex]->getMFIndexMapping()->size() ]; \
00245 Int16 mind; \
00246 if ( ( mind = geos[geoIndex]->calcMappingIndex( Geometry::MapPosition ) ) >= 0 ) \
00247 offsets[ mind ] = pni[geoIndex][posInd]; \
00248 if ( ( mind = geos[geoIndex]->calcMappingIndex( Geometry::MapNormal ) ) >= 0 ) \
00249 offsets[ mind ] = nni[geoIndex][normInd]; \
00250 if ( ( mind = geos[geoIndex]->calcMappingIndex( Geometry::MapColor ) ) >= 0 ) \
00251 offsets[ mind ] = cni[geoIndex][colInd]; \
00252 if ( ( mind = geos[geoIndex]->calcMappingIndex( Geometry::MapSecondaryColor ) ) >= 0 ) \
00253 offsets[ mind ] = sni[geoIndex][scolInd]; \
00254 if ( ( mind = geos[geoIndex]->calcMappingIndex( Geometry::MapTexCoords ) ) >= 0 ) \
00255 offsets[ mind ] = tni[geoIndex][texInd]; \
00256 if ( ( mind = geos[geoIndex]->calcMappingIndex( Geometry::MapTexCoords1 ) ) >= 0 ) \
00257 offsets[ mind ] = t1ni[geoIndex][tex1Ind]; \
00258 if ( ( mind = geos[geoIndex]->calcMappingIndex( Geometry::MapTexCoords2 ) ) >= 0 ) \
00259 offsets[ mind ] = t2ni[geoIndex][tex2Ind]; \
00260 if ( ( mind = geos[geoIndex]->calcMappingIndex( Geometry::MapTexCoords3 ) ) >= 0 ) \
00261 offsets[ mind ] = t3ni[geoIndex][tex3Ind]; \
00262 for (UInt32 j=0; j<geos[geoIndex]->getMFIndexMapping()->size(); j++) \
00263 indices[geoIndex]->push_back(offsets[j]); \
00264 delete [] offsets; \
00265 } \
00266 } \
00267 }
00268
00269 #define setupAttr( type , arr1 , arr2 , getmethod ) \
00270 if (geo->getmethod()!=NullFC && geo->getmethod()->size()>0) \
00271 { \
00272 arr1[i] = type::dcast(geo->getmethod()->getType().createFieldContainer()); \
00273 beginEditCP(arr1[i]); \
00274 arr2[i] = new int[geo->getmethod()->size()]; \
00275 for (UInt32 j=0; j<geo->getmethod()->size(); j++) \
00276 arr2[i][j]=-1; \
00277 } else { arr2[i]=0; arr1[i]=NullFC; }
00278
00279 Action::ResultE SplitGraphOp::traverseLeave(NodePtr& node, Action::ResultE res)
00280 {
00281 std::vector<NodePtr>::iterator it = node->editMFChildren()->getValues().begin();
00282 std::vector<NodePtr>::iterator en = node->editMFChildren()->getValues().end ();
00283 std::vector<NodePtr> toAdd;
00284 std::vector<NodePtr> toSub;
00285
00286 for ( ; it != en; ++it )
00287 {
00288 bool special=isInExcludeList(*it);
00289 bool leaf=isLeaf(*it);
00290
00291 if (!special && leaf)
00292 {
00293 if (splitNode(*it, toAdd))
00294 toSub.push_back(*it);
00295 }
00296 }
00297
00298 it = toAdd.begin();
00299 en = toAdd.end ();
00300
00301 for ( ; it != en; ++it )
00302 {
00303 beginEditCP(node, Node::ChildrenFieldMask);
00304 node->addChild(*it);
00305 endEditCP (node, Node::ChildrenFieldMask);
00306 }
00307
00308 it = toSub.begin();
00309 en = toSub.end ();
00310
00311 for ( ; it != en; ++it )
00312 {
00313 beginEditCP(node, Node::ChildrenFieldMask);
00314 addRefCP(*it);
00315 node->subChild(*it);
00316 endEditCP (node, Node::ChildrenFieldMask);
00317 }
00318 return res;
00319 }
00320
00321 bool SplitGraphOp::splitNode(NodePtr& node, std::vector<NodePtr> &split)
00322 {
00323
00324 if (!isLeaf(node) || isInExcludeList(node) ||
00325 !node->getCore()->getType().isDerivedFrom(Geometry::getClassType())) return false;
00326
00327 GeometryPtr geo = GeometryPtr::dcast(node->getCore());
00328
00329 if ( geo->getPositions() == NullFC || geo->getPositions()->size() == 0 ||
00330 geo->getLengths() == NullFC || geo->getLengths()->size() == 0 ||
00331 geo->getTypes() == NullFC || geo->getTypes()->size() == 0 ) return false;
00332
00333
00334 std::vector<Pnt3f> centers;
00335 int ind;
00336
00337 PrimitiveIterator it(geo);
00338
00339 while (!it.isAtEnd())
00340 {
00341 switch(it.getType())
00342 {
00343 case GL_POINTS:
00344 case GL_LINES:
00345 case GL_LINE_STRIP:
00346 case GL_LINE_LOOP:
00347 case GL_TRIANGLE_FAN:
00348 case GL_TRIANGLE_STRIP:
00349 case GL_QUAD_STRIP:
00350 case GL_POLYGON:
00351 {
00352 Pnt3f center(0,0,0);
00353 for (UInt32 i=0; i<it.getLength(); i++)
00354 center+=Vec3f(it.getPosition(i));
00355 center/=Real32(it.getLength());
00356 centers.push_back(center);
00357 }
00358 break;
00359
00360 case GL_TRIANGLES:
00361 ind=0;
00362 while(it.getLength()-ind>=3)
00363 {
00364 Pnt3f center(0,0,0);
00365 for (UInt32 i=0; i<3; i++, ind++)
00366 center+=Vec3f(it.getPosition(ind));
00367 center/=3;
00368 centers.push_back(center);
00369 }
00370 break;
00371
00372 case GL_QUADS:
00373 ind=0;
00374 while(it.getLength()-ind>=4)
00375 {
00376 Pnt3f center(0,0,0);
00377 for (UInt32 i=0; i<4; i++, ind++)
00378 center+=Vec3f(it.getPosition(ind));
00379 center/=4;
00380 centers.push_back(center);
00381 }
00382 break;
00383
00384
00385 default:
00386 SWARNING << "SplitGraphOp::splitLeave: encountered "
00387 << "unknown primitive type "
00388 << it.getType()
00389 << ", ignoring!" << std::endl;
00390 break;
00391 }
00392
00393 ++it;
00394 }
00395
00396 std::vector<int> order;
00397 for (UInt32 i=0; i<centers.size(); i++)
00398 order.push_back(i);
00399
00400 Pnt3fComparator comp(centers);
00401 std::sort(order.begin(), order.end(), comp);
00402
00403
00404 int ngeos=int(ceil(double(centers.size())/double(_max_polygons)));
00405
00406 if (ngeos<=1) return false;
00407
00408 GeometryPtr *geos = new GeometryPtr[ngeos];
00409 GeoPTypesPtr *types = new GeoPTypesPtr[ngeos];
00410 GeoPLengthsPtr *lens = new GeoPLengthsPtr[ngeos];
00411 GeoPositionsPtr *pnts = new GeoPositionsPtr[ngeos];
00412 GeoNormalsPtr *normals = new GeoNormalsPtr[ngeos];
00413 GeoColorsPtr *colors = new GeoColorsPtr[ngeos];
00414 GeoColorsPtr *scolors = new GeoColorsPtr[ngeos];
00415 GeoTexCoordsPtr *tex = new GeoTexCoordsPtr[ngeos];
00416 GeoTexCoordsPtr *tex1 = new GeoTexCoordsPtr[ngeos];
00417 GeoTexCoordsPtr *tex2 = new GeoTexCoordsPtr[ngeos];
00418 GeoTexCoordsPtr *tex3 = new GeoTexCoordsPtr[ngeos];
00419 GeoIndicesPtr *indices = new GeoIndicesPtr[ngeos];
00420
00421 int **pni = new int*[ngeos];
00422 int **nni = new int*[ngeos];
00423 int **cni = new int*[ngeos];
00424 int **sni = new int*[ngeos];
00425 int **tni = new int*[ngeos];
00426 int **t1ni = new int*[ngeos];
00427 int **t2ni = new int*[ngeos];
00428 int **t3ni = new int*[ngeos];
00429
00430 for (Int32 i=0; i<ngeos; i++)
00431 {
00432 geos[i] = Geometry::create();
00433
00434 beginEditCP(geos[i]);
00435
00436 geos[i]->setMaterial(geo->getMaterial());
00437
00438 if(geo->getMFIndexMapping() != NULL)
00439 geos[i]->editMFIndexMapping()->setValues(*(geo->getMFIndexMapping()));
00440
00441 types[i] = GeoPTypesPtr::dcast(geo->getTypes()->getType().createFieldContainer());
00442 lens[i] = GeoPLengthsPtr::dcast(geo->getLengths()->getType().createFieldContainer());
00443
00444 if (geo->getIndices()!=NullFC)
00445 {
00446 indices[i] = GeoIndicesPtr::dcast(geo->getIndices()->getType().createFieldContainer());
00447 beginEditCP(indices[i]);
00448 }
00449 else
00450 indices[i] = NullFC;
00451
00452 beginEditCP(types[i]);
00453 beginEditCP(lens[i]);
00454
00455 setupAttr( GeoPositionsPtr , pnts , pni , getPositions );
00456 setupAttr( GeoNormalsPtr , normals , nni , getNormals );
00457 setupAttr( GeoColorsPtr , colors , cni , getColors );
00458 setupAttr( GeoColorsPtr , scolors , sni , getSecondaryColors );
00459 setupAttr( GeoTexCoordsPtr , tex , tni , getTexCoords );
00460 setupAttr( GeoTexCoordsPtr , tex1 , t1ni , getTexCoords1 );
00461 setupAttr( GeoTexCoordsPtr , tex2 , t2ni , getTexCoords2 );
00462 setupAttr( GeoTexCoordsPtr , tex3 , t3ni , getTexCoords3 );
00463 }
00464
00465 ind=0;
00466 it.setToBegin();
00467
00468 while (!it.isAtEnd())
00469 {
00470 switch(it.getType())
00471 {
00472 case GL_POINTS:
00473 case GL_LINES:
00474 case GL_LINE_STRIP:
00475 case GL_LINE_LOOP:
00476 case GL_TRIANGLE_FAN:
00477 case GL_TRIANGLE_STRIP:
00478 case GL_QUAD_STRIP:
00479 case GL_POLYGON:
00480 {
00481 int geoIndex=order[ind]/_max_polygons;
00482
00483 types[geoIndex]->push_back(it.getType());
00484 lens[geoIndex]->push_back(it.getLength());
00485
00486 addPoints( 0 , it.getLength() );
00487 ++ind;
00488 } break;
00489
00490 case GL_TRIANGLES:
00491 {
00492 UInt32 i=0;
00493 while(it.getLength()-i>=3)
00494 {
00495 i+=3;
00496 ++ind;
00497 }
00498 } break;
00499
00500 case GL_QUADS:
00501 {
00502 UInt32 i=0;
00503 while(it.getLength()-i>=4)
00504 {
00505 i+=4;
00506 ++ind;
00507 }
00508 } break;
00509
00510
00511 default:
00512 SWARNING << "SplitGraphOp::splitLeave: encountered "
00513 << "unknown primitive type "
00514 << it.getType()
00515 << ", ignoring!" << std::endl;
00516 break;
00517 }
00518 ++it;
00519 }
00520
00521 ind=0;
00522 it.setToBegin();
00523
00524 while (!it.isAtEnd())
00525 {
00526 switch(it.getType())
00527 {
00528 case GL_POINTS:
00529 case GL_LINES:
00530 case GL_LINE_STRIP:
00531 case GL_LINE_LOOP:
00532 case GL_TRIANGLE_FAN:
00533 case GL_TRIANGLE_STRIP:
00534 case GL_QUAD_STRIP:
00535 case GL_POLYGON:
00536 {
00537 ++ind;
00538 } break;
00539
00540 case GL_TRIANGLES:
00541 {
00542 UInt32 i=0;
00543 int geoIndex;
00544 while(it.getLength()-i>=3)
00545 {
00546 geoIndex = order[ind]/_max_polygons;
00547 if (types[geoIndex]->size()>0 && types[geoIndex]->getValue(types[geoIndex]->size()-1) == GL_TRIANGLES)
00548 {
00549 int lind;
00550 if ((lind=lens[geoIndex]->size()-1)>=0)
00551 lens[geoIndex]->setValue(lens[geoIndex]->getValue(lind)+3, lind);
00552 else
00553 lens[geoIndex]->push_back(3);
00554 }
00555 else
00556 {
00557 types[geoIndex]->push_back(GL_TRIANGLES);
00558 lens[geoIndex]->push_back(3);
00559 }
00560
00561 addPoints( i ,3 );
00562 i+=3;
00563 ++ind;
00564 }
00565 } break;
00566
00567 case GL_QUADS:
00568 {
00569 UInt32 i=0;
00570 while(it.getLength()-i>=4)
00571 {
00572 i+=4;
00573 ++ind;
00574 }
00575 } break;
00576
00577
00578 default:
00579 SWARNING << "SplitGraphOp::splitLeave: encountered "
00580 << "unknown primitive type "
00581 << it.getType()
00582 << ", ignoring!" << std::endl;
00583 break;
00584 }
00585 ++it;
00586 }
00587
00588 ind=0;
00589 it.setToBegin();
00590
00591 while (!it.isAtEnd())
00592 {
00593 switch(it.getType())
00594 {
00595 case GL_POINTS:
00596 case GL_LINES:
00597 case GL_LINE_STRIP:
00598 case GL_LINE_LOOP:
00599 case GL_TRIANGLE_FAN:
00600 case GL_TRIANGLE_STRIP:
00601 case GL_QUAD_STRIP:
00602 case GL_POLYGON:
00603 {
00604 ++ind;
00605 } break;
00606
00607 case GL_TRIANGLES:
00608 {
00609 UInt32 i=0;
00610 while(it.getLength()-i>=3)
00611 {
00612 i+=3;
00613 ++ind;
00614 }
00615 } break;
00616
00617 case GL_QUADS:
00618 {
00619 UInt32 i=0;
00620 int geoIndex;
00621 while(it.getLength()-i>=4)
00622 {
00623 geoIndex = order[ind]/_max_polygons;
00624 if (types[geoIndex]->size()>0 && types[geoIndex]->getValue(types[geoIndex]->size()-1) == GL_QUADS)
00625 {
00626 int lind;
00627 if ((lind=lens[geoIndex]->size()-1)>=0)
00628 lens[geoIndex]->setValue(lens[geoIndex]->getValue(lind)+4, lind);
00629 else
00630 lens[geoIndex]->push_back(4);
00631 }
00632 else
00633 {
00634 types[geoIndex]->push_back(GL_QUADS);
00635 lens[geoIndex]->push_back(4);
00636 }
00637
00638 addPoints( i , 4 );
00639 i+=4;
00640 ++ind;
00641 }
00642 } break;
00643
00644 default:
00645 SWARNING << "SplitGraphOp::splitLeave: encountered "
00646 << "unknown primitive type "
00647 << it.getType()
00648 << ", ignoring!" << std::endl;
00649 break;
00650 }
00651 ++it;
00652 }
00653
00654 for (Int32 i=0; i<ngeos; i++)
00655 {
00656 geos[i]->setTypes(types[i]);
00657 geos[i]->setLengths(lens[i]);
00658 geos[i]->setPositions(pnts[i]);
00659
00660
00661
00662 endEditCP(types[i]);
00663 endEditCP(lens[i]);
00664 endEditCP(pnts[i]);
00665
00666 if (indices[i]!=NullFC)
00667 {
00668 geos[i]->setIndices(indices[i]);
00669 endEditCP(indices[i]);
00670 }
00671
00672 if (normals[i]!=NullFC)
00673 {
00674 geos[i]->setNormals(normals[i]);
00675 endEditCP(normals[i]);
00676 }
00677
00678 if (colors[i]!=NullFC)
00679 {
00680 geos[i]->setColors(colors[i]);
00681 endEditCP(colors[i]);
00682 }
00683
00684 if (scolors[i]!=NullFC)
00685 {
00686 geos[i]->setSecondaryColors(scolors[i]);
00687 endEditCP(scolors[i]);
00688 }
00689
00690 if (tex[i]!=NullFC)
00691 {
00692 geos[i]->setTexCoords(tex[i]);
00693 endEditCP(tex[i]);
00694 }
00695
00696 if (tex1[i]!=NullFC)
00697 {
00698 geos[i]->setTexCoords1(tex1[i]);
00699 endEditCP(tex1[i]);
00700 }
00701
00702 if (tex2[i]!=NullFC)
00703 {
00704 geos[i]->setTexCoords2(tex2[i]);
00705 endEditCP(tex2[i]);
00706 }
00707
00708 if (tex3[i]!=NullFC)
00709 {
00710 geos[i]->setTexCoords3(tex3[i]);
00711 endEditCP(tex3[i]);
00712 }
00713
00714 endEditCP(geos[i]);
00715
00716 if (node->getParent()!=NullFC)
00717 {
00718 NodePtr n=Node::create();
00719 beginEditCP(n, Node::CoreFieldMask);
00720 n->setCore(geos[i]);
00721 endEditCP (n, Node::CoreFieldMask);
00722 split.push_back(n);
00723 }
00724 }
00725
00726 for (Int32 i=0; i<ngeos; i++)
00727 {
00728 if (pni[i]) delete [] pni[i];
00729 if (nni[i]) delete [] nni[i];
00730 if (cni[i]) delete [] cni[i];
00731 if (sni[i]) delete [] sni[i];
00732 if (tni[i]) delete [] tni[i];
00733 if (t1ni[i]) delete [] t1ni[i];
00734 if (t2ni[i]) delete [] t2ni[i];
00735 if (t3ni[i]) delete [] t3ni[i];
00736 }
00737
00738 delete [] pni;
00739 delete [] nni;
00740 delete [] cni;
00741 delete [] sni;
00742 delete [] tni;
00743 delete [] t1ni;
00744 delete [] t2ni;
00745 delete [] t3ni;
00746
00747 return true;
00748 }
00749
00750 bool SplitGraphOp::isLeaf(NodePtr& node)
00751 {
00752 if (node->getMFChildren()->getValues().begin()==
00753 node->getMFChildren()->getValues().end()) return true;
00754 else return false;
00755 }
00756
00759 bool SplitGraphOp::isGroup(NodePtr& node)
00760 {
00761 if( node->getCore()->getType().isDerivedFrom( Group::getClassType() ) &&
00762 !node->getCore()->getType().isDerivedFrom( Transform::getClassType() ) &&
00763 !node->getCore()->getType().isDerivedFrom( ComponentTransform::getClassType() ) &&
00764 !node->getCore()->getType().isDerivedFrom( Switch::getClassType() ) &&
00765 !node->getCore()->getType().isDerivedFrom( MaterialGroup::getClassType() ) &&
00766 !node->getCore()->getType().isDerivedFrom( DistanceLOD::getClassType() ) &&
00767 !node->getCore()->getType().isDerivedFrom( Billboard::getClassType() ))
00768 return true;
00769 else return false;
00770 }