00001 // Filename: sceneGraphReducer.I 00002 // Created by: drose (14Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: SceneGraphReducer::Constructor 00022 // Access: Published 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE SceneGraphReducer:: 00026 SceneGraphReducer() { 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: SceneGraphReducer::Destructor 00031 // Access: Published 00032 // Description: 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE SceneGraphReducer:: 00035 ~SceneGraphReducer() { 00036 } 00037 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: SceneGraphReducer::apply_attribs 00041 // Access: Published 00042 // Description: Walks the scene graph, accumulating attribs of 00043 // the indicated types, applying them to the vertices, 00044 // and removing them from the scene graph. This has a 00045 // performance optimization benefit in itself, but is 00046 // especially useful to pave the way for a call to 00047 // flatten() and greatly improve the effectiveness of 00048 // the flattening operation. 00049 // 00050 // Multiply instanced geometry is duplicated before the 00051 // attribs are applied. 00052 // 00053 // Of course, this operation does make certain dynamic 00054 // operations impossible. 00055 //////////////////////////////////////////////////////////////////// 00056 INLINE void SceneGraphReducer:: 00057 apply_attribs(PandaNode *node, int attrib_types) { 00058 AccumulatedAttribs attribs; 00059 r_apply_attribs(node, attribs, attrib_types, _transformer); 00060 } 00061 00062 //////////////////////////////////////////////////////////////////// 00063 // Function: SceneGraphReducer::apply_attribs 00064 // Access: Published 00065 // Description: This flavor of apply_attribs() can be called 00066 // recursively from within another flatten process 00067 // (e.g. from PandaNode::apply_attribs_to_vertices()). 00068 // The parameters were presumably received from a parent 00069 // SceneGraphReducer object. 00070 //////////////////////////////////////////////////////////////////// 00071 INLINE void SceneGraphReducer:: 00072 apply_attribs(PandaNode *node, const AccumulatedAttribs &attribs, 00073 int attrib_types, GeomTransformer &transformer) { 00074 r_apply_attribs(node, attribs, attrib_types, transformer); 00075 }