Пример #1
0
void
countPrimitives(SoNode *root, int32_t &numTris, int32_t &numLines, int32_t &numPoints,
		int32_t &numNodes)
//
////////////////////////////////////////////////////////////////////////
{
    numTris = 0;
    numLines = 0;
    numPoints = 0;
    numNodes = 0;
    SoCallbackAction	ca;

    ca.addPointCallback(SoShape::getClassTypeId(),
			   countPointsCB,
			   (void *) &numPoints);
    ca.addLineSegmentCallback(SoShape::getClassTypeId(),
			   countLinesCB,
			   (void *) &numLines);
    ca.addTriangleCallback(SoShape::getClassTypeId(),
			   countTriangleCB,
			   (void *) &numTris);
    ca.addPreCallback( SoNode::getClassTypeId(),
			countNodesCB, (void *)&numNodes
		    );
    ca.apply(root);
}