Panda3D
|
An interface for simplifying ("flattening") scene graphs by eliminating unneeded nodes and collapsing out unneeded state changes and transforms. More...
#include "sceneGraphReducer.h"
Public Types | |
enum | AttribTypes { TT_transform = 0x001, TT_color = 0x002, TT_color_scale = 0x004, TT_tex_matrix = 0x008, TT_clip_plane = 0x010, TT_cull_face = 0x020, TT_apply_texture_color = 0x040, TT_other = 0x080 } |
enum | CollectVertexData { CVD_name = 0x001, CVD_model = 0x002, CVD_transform = 0x004, CVD_avoid_dynamic = 0x008, CVD_one_node_only = 0x010, CVD_format = 0x020, CVD_usage_hint = 0x040, CVD_animation_type = 0x080 } |
enum | CombineSiblings { CS_geom_node = 0x001, CS_within_radius = 0x002, CS_other = 0x004, CS_recurse = 0x008 } |
enum | MakeNonindexed { MN_composite_only = 0x001, MN_avoid_animated = 0x002, MN_avoid_dynamic = 0x004 } |
Public Member Functions | |
SceneGraphReducer (GraphicsStateGuardianBase *gsg=NULL) | |
void | apply_attribs (PandaNode *node, int attrib_types=~(TT_clip_plane|TT_cull_face|TT_apply_texture_color)) |
Walks the scene graph, accumulating attribs of the indicated types, applying them to the vertices, and removing them from the scene graph. | |
void | apply_attribs (PandaNode *node, const AccumulatedAttribs &attribs, int attrib_types, GeomTransformer &transformer) |
This flavor of apply_attribs() can be called recursively from within another flatten process (e.g. | |
bool | check_live_flatten (PandaNode *node) |
In a non-release build, returns false if the node is correctly not in a live scene graph. | |
void | clear_gsg () |
Specifies that no particular GraphicsStateGuardian will be used to guide the optimization. | |
int | collect_vertex_data (PandaNode *root, int collect_bits=~0) |
Collects all different GeomVertexData blocks that have compatible formats at this node and below into a single, unified block (or at least multiple larger blocks). | |
void | decompose (PandaNode *root) |
Calls decompose() on every GeomNode at this level and below. | |
int | flatten (PandaNode *root, int combine_siblings_bits) |
Simplifies the graph by removing unnecessary nodes and nodes. | |
PN_stdfloat | get_combine_radius () const |
Returns the radius that is used in conjunction with CS_within_radius. | |
GraphicsStateGuardianBase * | get_gsg () const |
Returns the particular GraphicsStateGuardian that this object will attempt to optimize to. | |
int | make_compatible_format (PandaNode *root, int collect_bits=~0) |
Walks through the tree at this node and below and unifies the GeomVertexFormat for any GeomVertexData objects that are found, so that all eligible vdatas (according to collect_bits; see collect_vertex_data) will share the same vertex format. | |
int | make_compatible_state (PandaNode *root) |
Searches for GeomNodes that contain multiple Geoms that differ only in their ColorAttribs. | |
int | make_nonindexed (PandaNode *root, int nonindexed_bits=~0) |
Converts indexed geometry to nonindexed geometry at the indicated node and below, by duplicating vertices where necessary. | |
void | premunge (PandaNode *root, const RenderState *initial_state) |
Walks the scene graph rooted at this node and below, and uses the indicated GSG to premunge every Geom found to optimize it for eventual rendering on the indicated GSG. | |
int | remove_column (PandaNode *root, const InternalName *column) |
Removes the indicated data column from any GeomVertexDatas found at the indicated root and below. | |
void | remove_unused_vertices (PandaNode *root) |
Removes any vertices in GeomVertexDatas that are no longer used at this level and below. | |
void | set_combine_radius (PN_stdfloat combine_radius) |
Specifies the radius that is used in conjunction with CS_within_radius to decide whether a subgraph's siblings should be combined into a single node or not. | |
void | set_gsg (GraphicsStateGuardianBase *gsg) |
Specifies the particular GraphicsStateGuardian that this object will attempt to optimize to. | |
void | unify (PandaNode *root, bool preserve_order) |
Calls unify() on every GeomNode at this level and below. | |
Protected Member Functions | |
void | choose_name (PandaNode *preserve, PandaNode *source1, PandaNode *source2) |
Chooses a suitable name for the collapsed node, based on the names of the two sources nodes. | |
bool | consider_child (PandaNode *grandparent_node, PandaNode *parent_node, PandaNode *child_node) |
Decides whether or not the indicated child node is a suitable candidate for removal. | |
bool | consider_siblings (PandaNode *parent_node, PandaNode *child1, PandaNode *child2) |
Decides whether or not the indicated sibling nodes should be collapsed into a single node or not. | |
bool | do_flatten_child (PandaNode *grandparent_node, PandaNode *parent_node, PandaNode *child_node) |
Collapses together the indicated parent node and child node and leaves the result attached to the grandparent. | |
PandaNode * | do_flatten_siblings (PandaNode *parent_node, PandaNode *child1, PandaNode *child2) |
Performs the work of collapsing two sibling nodes together into a single node, leaving the resulting node attached to the parent. | |
int | flatten_siblings (PandaNode *parent_node, int combine_siblings_bits) |
Attempts to collapse together any pairs of siblings of the indicated node that share the same properties. | |
PT (PandaNode) collapse_nodes(PandaNode *node1 | |
void | r_apply_attribs (PandaNode *node, const AccumulatedAttribs &attribs, int attrib_types, GeomTransformer &transformer) |
The recursive implementation of apply_attribs(). | |
int | r_collect_vertex_data (PandaNode *node, int collect_bits, GeomTransformer &transformer, bool format_only) |
The recursive implementation of collect_vertex_data(). | |
void | r_decompose (PandaNode *node) |
The recursive implementation of decompose(). | |
int | r_flatten (PandaNode *grandparent_node, PandaNode *parent_node, int combine_siblings_bits) |
The recursive implementation of flatten(). | |
int | r_make_compatible_state (PandaNode *node, GeomTransformer &transformer) |
The recursive implementation of make_compatible_state(). | |
int | r_make_nonindexed (PandaNode *node, int collect_bits) |
The recursive implementation of make_nonindexed(). | |
void | r_premunge (PandaNode *node, const RenderState *state) |
The recursive implementation of premunge(). | |
void | r_register_vertices (PandaNode *node, GeomTransformer &transformer) |
Recursively calls GeomTransformer::register_vertices() on all GeomNodes at the indicated root and below. | |
int | r_remove_column (PandaNode *node, const InternalName *column, GeomTransformer &transformer) |
The recursive implementation of remove_column(). | |
void | r_unify (PandaNode *node, int max_indices, bool preserve_order) |
The recursive implementation of unify(). | |
Protected Attributes | |
PandaNode * | node2 |
PandaNode bool | siblings |
An interface for simplifying ("flattening") scene graphs by eliminating unneeded nodes and collapsing out unneeded state changes and transforms.
This class is designed so that it may be inherited from and specialized, if needed, to fine-tune the flattening behavior, but normally the default behavior is sufficient.
Definition at line 43 of file sceneGraphReducer.h.
void SceneGraphReducer::apply_attribs | ( | PandaNode * | node, |
int | attrib_types = ~(TT_clip_plane | TT_cull_face | TT_apply_texture_color) |
||
) | [inline] |
Walks the scene graph, accumulating attribs of the indicated types, applying them to the vertices, and removing them from the scene graph.
This has a performance optimization benefit in itself, but is especially useful to pave the way for a call to flatten() and greatly improve the effectiveness of the flattening operation.
Multiply instanced geometry is duplicated before the attribs are applied.
Of course, this operation does make certain dynamic operations impossible.
Definition at line 99 of file sceneGraphReducer.I.
References check_live_flatten(), GeomTransformer::finish_apply(), and r_apply_attribs().
Referenced by TextNode::apply_attribs_to_vertices(), NodePath::apply_texture_colors(), RigidBodyCombiner::collect(), NodePath::flatten_light(), NodePath::flatten_medium(), NodePath::flatten_strong(), and PGItem::xform().
void SceneGraphReducer::apply_attribs | ( | PandaNode * | node, |
const AccumulatedAttribs & | attribs, | ||
int | attrib_types, | ||
GeomTransformer & | transformer | ||
) | [inline] |
This flavor of apply_attribs() can be called recursively from within another flatten process (e.g.
from PandaNode::apply_attribs_to_vertices()). The parameters were presumably received from a parent SceneGraphReducer object.
Definition at line 118 of file sceneGraphReducer.I.
References r_apply_attribs().
bool SceneGraphReducer::check_live_flatten | ( | PandaNode * | node | ) |
In a non-release build, returns false if the node is correctly not in a live scene graph.
(Calling flatten on a node that is part of a live scene graph, for instance, a node somewhere under render, can cause problems in a multithreaded environment.)
If allow_live_flatten is true, or in a release build, this always returns true.
Definition at line 251 of file sceneGraphReducer.cxx.
References PandaNode::is_under_scene_root().
Referenced by apply_attribs(), collect_vertex_data(), decompose(), flatten(), make_compatible_format(), make_compatible_state(), make_nonindexed(), premunge(), remove_column(), remove_unused_vertices(), and unify().
void SceneGraphReducer::choose_name | ( | PandaNode * | preserve, |
PandaNode * | source1, | ||
PandaNode * | source2 | ||
) | [protected] |
Chooses a suitable name for the collapsed node, based on the names of the two sources nodes.
Definition at line 791 of file sceneGraphReducer.cxx.
References PandaNode::preserve_name().
Referenced by do_flatten_child(), and do_flatten_siblings().
void SceneGraphReducer::clear_gsg | ( | ) |
Specifies that no particular GraphicsStateGuardian will be used to guide the optimization.
The SceneGraphReducer will instead use config variables such as max-collect-vertices and max-collect-indices.
Definition at line 74 of file sceneGraphReducer.cxx.
References GeomTransformer::set_max_collect_vertices().
int SceneGraphReducer::collect_vertex_data | ( | PandaNode * | root, |
int | collect_bits = ~0 |
||
) | [inline] |
Collects all different GeomVertexData blocks that have compatible formats at this node and below into a single, unified block (or at least multiple larger blocks).
This is intended to reduce rendering overhead incurred by switching vertex buffers. It can also make a subsequent call to unify() much more effective than it would have been otherwise.
The set of bits passed in collect_bits indicates which properties are used to differentiate GeomVertexData blocks. If it is 0, then more blocks will be combined together than if it is nonzero.
Definition at line 174 of file sceneGraphReducer.I.
References check_live_flatten(), GeomTransformer::finish_collect(), and r_collect_vertex_data().
Referenced by RigidBodyCombiner::collect(), NodePath::flatten_medium(), and NodePath::flatten_strong().
bool SceneGraphReducer::consider_child | ( | PandaNode * | grandparent_node, |
PandaNode * | parent_node, | ||
PandaNode * | child_node | ||
) | [protected] |
Decides whether or not the indicated child node is a suitable candidate for removal.
Returns true if the node may be removed, false if it should be kept.
Definition at line 647 of file sceneGraphReducer.cxx.
References PandaNode::compare_tags(), PandaNode::get_draw_control_mask(), PandaNode::get_draw_show_mask(), PandaNode::get_effects(), PandaNode::get_state(), PandaNode::get_transform(), RenderEffects::safe_to_combine(), and PandaNode::safe_to_combine().
Referenced by r_flatten().
bool SceneGraphReducer::consider_siblings | ( | PandaNode * | parent_node, |
PandaNode * | child1, | ||
PandaNode * | child2 | ||
) | [protected] |
Decides whether or not the indicated sibling nodes should be collapsed into a single node or not.
Returns true if the nodes may be collapsed, false if they should be kept distinct.
Definition at line 682 of file sceneGraphReducer.cxx.
Referenced by flatten_siblings().
void SceneGraphReducer::decompose | ( | PandaNode * | root | ) |
Calls decompose() on every GeomNode at this level and below.
There is usually no reason to call this explicitly, since unify() will do this anyway if it needs to be done. However, calling it ahead of time can make that future call to unify() run a little bit faster.
This operation has no effect if the config variable preserve-triangle-strips has been set true.
Definition at line 188 of file sceneGraphReducer.cxx.
References check_live_flatten(), and r_decompose().
bool SceneGraphReducer::do_flatten_child | ( | PandaNode * | grandparent_node, |
PandaNode * | parent_node, | ||
PandaNode * | child_node | ||
) | [protected] |
Collapses together the indicated parent node and child node and leaves the result attached to the grandparent.
The return value is true if the node is successfully collapsed, false if we chickened out.
Definition at line 699 of file sceneGraphReducer.cxx.
References choose_name().
Referenced by r_flatten().
PandaNode * SceneGraphReducer::do_flatten_siblings | ( | PandaNode * | parent_node, |
PandaNode * | child1, | ||
PandaNode * | child2 | ||
) | [protected] |
Performs the work of collapsing two sibling nodes together into a single node, leaving the resulting node attached to the parent.
Returns a pointer to a PandaNode that reflects the combined node (which may be either of the source nodes, or a new node altogether) if the siblings are successfully collapsed, or NULL if we chickened out.
Definition at line 737 of file sceneGraphReducer.cxx.
References choose_name(), and PandaNode::replace_node().
Referenced by flatten_siblings().
int SceneGraphReducer::flatten | ( | PandaNode * | root, |
int | combine_siblings_bits | ||
) |
Simplifies the graph by removing unnecessary nodes and nodes.
In general, a node (and its parent node) is a candidate for removal if the node has no siblings and the node has no special properties.
If combine_siblings_bits is nonzero, some sibling nodes (according to the bits set in combine_siblings_bits) may also be collapsed into a single node. This will further reduce scene graph complexity, sometimes substantially, at the cost of reduced spatial separation.
Returns the number of nodes removed from the graph.
Definition at line 99 of file sceneGraphReducer.cxx.
References check_live_flatten(), flatten_siblings(), PandaNode::Children::get_child(), PandaNode::get_children(), PandaNode::get_num_children(), PandaNode::Children::get_num_children(), r_flatten(), and PandaNode::safe_to_combine_children().
Referenced by NodePath::flatten_medium(), and NodePath::flatten_strong().
int SceneGraphReducer::flatten_siblings | ( | PandaNode * | parent_node, |
int | combine_siblings_bits | ||
) | [protected] |
Attempts to collapse together any pairs of siblings of the indicated node that share the same properties.
Definition at line 565 of file sceneGraphReducer.cxx.
References consider_siblings(), do_flatten_siblings(), PandaNode::Children::get_child(), PandaNode::get_children(), PandaNode::Children::get_num_children(), PandaNode::is_geom_node(), RenderEffects::safe_to_combine(), and PandaNode::safe_to_combine().
Referenced by flatten(), and r_flatten().
PN_stdfloat SceneGraphReducer::get_combine_radius | ( | ) | const [inline] |
Returns the radius that is used in conjunction with CS_within_radius.
See set_combine_radius().
Definition at line 76 of file sceneGraphReducer.I.
GraphicsStateGuardianBase * SceneGraphReducer::get_gsg | ( | ) | const [inline] |
Returns the particular GraphicsStateGuardian that this object will attempt to optimize to.
See set_gsg().
Definition at line 45 of file sceneGraphReducer.I.
int SceneGraphReducer::make_compatible_format | ( | PandaNode * | root, |
int | collect_bits = ~0 |
||
) | [inline] |
Walks through the tree at this node and below and unifies the GeomVertexFormat for any GeomVertexData objects that are found, so that all eligible vdatas (according to collect_bits; see collect_vertex_data) will share the same vertex format.
This will add unused columns where necessary to match formats. It can result in suboptimal performance if used needlessly.
There is usually no reason to call this explicitly, since collect_vertex_data() will do this anyway if it has not been done already. However, calling it ahead of time can make that future call to collect_vertex_data() run a little bit faster.
The return value is the number of vertex datas modified.
Definition at line 147 of file sceneGraphReducer.I.
References check_live_flatten(), GeomTransformer::finish_collect(), and r_collect_vertex_data().
int SceneGraphReducer::make_compatible_state | ( | PandaNode * | root | ) |
Searches for GeomNodes that contain multiple Geoms that differ only in their ColorAttribs.
If such a GeomNode is found, then all the colors are pushed down into the vertices. This makes it feasible for the geoms to be unified later.
Definition at line 164 of file sceneGraphReducer.cxx.
References check_live_flatten(), GeomTransformer::finish_apply(), and r_make_compatible_state().
Referenced by NodePath::flatten_medium(), and NodePath::flatten_strong().
int SceneGraphReducer::make_nonindexed | ( | PandaNode * | root, |
int | nonindexed_bits = ~0 |
||
) | [inline] |
Converts indexed geometry to nonindexed geometry at the indicated node and below, by duplicating vertices where necessary.
The parameter nonindexed_bits is a union of bits defined in SceneGraphReducer::MakeNonindexed, which specifes which types of geometry to avoid making nonindexed.
Definition at line 195 of file sceneGraphReducer.I.
References check_live_flatten(), and r_make_nonindexed().
void SceneGraphReducer::premunge | ( | PandaNode * | root, |
const RenderState * | initial_state | ||
) | [inline] |
Walks the scene graph rooted at this node and below, and uses the indicated GSG to premunge every Geom found to optimize it for eventual rendering on the indicated GSG.
If there is no GSG indicated for the SceneGraphReducer, this is a no-op.
This operation will also apply to stashed children.
Definition at line 214 of file sceneGraphReducer.I.
References check_live_flatten(), and r_premunge().
Referenced by NodePath::premunge_scene().
void SceneGraphReducer::r_apply_attribs | ( | PandaNode * | node, |
const AccumulatedAttribs & | attribs, | ||
int | attrib_types, | ||
GeomTransformer & | transformer | ||
) | [protected] |
The recursive implementation of apply_attribs().
Definition at line 271 of file sceneGraphReducer.cxx.
References PandaNode::apply_attribs_to_vertices(), AccumulatedAttribs::apply_to_node(), AccumulatedAttribs::collect(), Thread::consider_yield(), PandaNode::copy_children(), PandaNode::dupe_for_flatten(), PandaNode::get_child(), PandaNode::get_effects(), PandaNode::get_num_children(), PandaNode::get_num_parents(), PandaNode::get_state(), PandaNode::get_transform(), PandaNode::get_unsafe_to_apply_attribs(), PandaNode::replace_child(), PandaNode::safe_to_flatten(), PandaNode::safe_to_flatten_below(), PandaNode::safe_to_modify_transform(), RenderEffects::safe_to_transform(), and PandaNode::safe_to_transform().
Referenced by apply_attribs().
int SceneGraphReducer::r_collect_vertex_data | ( | PandaNode * | node, |
int | collect_bits, | ||
GeomTransformer & | transformer, | ||
bool | format_only | ||
) | [protected] |
The recursive implementation of collect_vertex_data().
Definition at line 866 of file sceneGraphReducer.cxx.
References GeomTransformer::collect_vertex_data(), Thread::consider_yield(), GeomTransformer::finish_collect(), PandaNode::Children::get_child(), PandaNode::get_children(), PandaNode::Children::get_num_children(), PandaNode::get_transform(), PandaNode::is_geom_node(), TransformState::is_identity(), and TypedObject::is_of_type().
Referenced by collect_vertex_data(), and make_compatible_format().
void SceneGraphReducer::r_decompose | ( | PandaNode * | node | ) | [protected] |
The recursive implementation of decompose().
Definition at line 1013 of file sceneGraphReducer.cxx.
References GeomNode::decompose(), PandaNode::Children::get_child(), PandaNode::get_children(), PandaNode::Children::get_num_children(), and PandaNode::is_geom_node().
Referenced by decompose().
int SceneGraphReducer::r_flatten | ( | PandaNode * | grandparent_node, |
PandaNode * | parent_node, | ||
int | combine_siblings_bits | ||
) | [protected] |
The recursive implementation of flatten().
Definition at line 415 of file sceneGraphReducer.cxx.
References PandaNode::add_child(), consider_child(), do_flatten_child(), flatten_siblings(), PandaNode::get_child(), PandaNode::Children::get_child(), PandaNode::get_child_sort(), PandaNode::get_children(), PandaNode::get_effects(), PandaNode::get_num_children(), PandaNode::Children::get_num_children(), PandaNode::get_transform(), BoundingVolume::is_empty(), RenderEffects::is_empty(), TypedObject::is_exact_type(), TransformState::is_identity(), BoundingVolume::is_infinite(), PandaNode::remove_child(), PandaNode::safe_to_combine_children(), and PandaNode::safe_to_flatten_below().
Referenced by flatten().
int SceneGraphReducer::r_make_compatible_state | ( | PandaNode * | node, |
GeomTransformer & | transformer | ||
) | [protected] |
The recursive implementation of make_compatible_state().
Definition at line 840 of file sceneGraphReducer.cxx.
References PandaNode::Children::get_child(), PandaNode::get_children(), PandaNode::Children::get_num_children(), PandaNode::is_geom_node(), and GeomTransformer::make_compatible_state().
Referenced by make_compatible_state().
int SceneGraphReducer::r_make_nonindexed | ( | PandaNode * | node, |
int | collect_bits | ||
) | [protected] |
The recursive implementation of make_nonindexed().
Definition at line 925 of file sceneGraphReducer.cxx.
References GeomVertexFormat::get_animation(), GeomVertexAnimationSpec::get_animation_type(), PandaNode::Children::get_child(), PandaNode::get_children(), GeomVertexData::get_format(), PandaNode::Children::get_num_children(), GeomNode::get_num_geoms(), Geom::get_usage_hint(), GeomVertexData::get_usage_hint(), PandaNode::is_geom_node(), and Geom::make_nonindexed().
Referenced by make_nonindexed().
void SceneGraphReducer::r_premunge | ( | PandaNode * | node, |
const RenderState * | state | ||
) | [protected] |
The recursive implementation of premunge().
Definition at line 1032 of file sceneGraphReducer.cxx.
References GeomNode::do_premunge(), PandaNode::Children::get_child(), PandaNode::get_children(), PandaNode::Children::get_num_children(), PandaNode::Stashed::get_num_stashed(), PandaNode::get_stashed(), PandaNode::Stashed::get_stashed(), PandaNode::get_state(), and PandaNode::is_geom_node().
Referenced by premunge().
void SceneGraphReducer::r_register_vertices | ( | PandaNode * | node, |
GeomTransformer & | transformer | ||
) | [protected] |
Recursively calls GeomTransformer::register_vertices() on all GeomNodes at the indicated root and below.
Definition at line 994 of file sceneGraphReducer.cxx.
References PandaNode::Children::get_child(), PandaNode::get_children(), PandaNode::Children::get_num_children(), PandaNode::is_geom_node(), and GeomTransformer::register_vertices().
Referenced by remove_unused_vertices().
int SceneGraphReducer::r_remove_column | ( | PandaNode * | node, |
const InternalName * | column, | ||
GeomTransformer & | transformer | ||
) | [protected] |
The recursive implementation of remove_column().
Definition at line 814 of file sceneGraphReducer.cxx.
References PandaNode::Children::get_child(), PandaNode::get_children(), PandaNode::Children::get_num_children(), PandaNode::is_geom_node(), and GeomTransformer::remove_column().
Referenced by remove_column().
void SceneGraphReducer::r_unify | ( | PandaNode * | node, |
int | max_indices, | ||
bool | preserve_order | ||
) | [protected] |
The recursive implementation of unify().
Definition at line 972 of file sceneGraphReducer.cxx.
References Thread::consider_yield(), PandaNode::Children::get_child(), PandaNode::get_children(), PandaNode::Children::get_num_children(), PandaNode::is_geom_node(), and GeomNode::unify().
Referenced by unify().
int SceneGraphReducer::remove_column | ( | PandaNode * | root, |
const InternalName * | column | ||
) |
Removes the indicated data column from any GeomVertexDatas found at the indicated root and below.
Returns the number of GeomNodes modified.
Definition at line 145 of file sceneGraphReducer.cxx.
References check_live_flatten(), GeomTransformer::finish_apply(), and r_remove_column().
void SceneGraphReducer::remove_unused_vertices | ( | PandaNode * | root | ) |
Removes any vertices in GeomVertexDatas that are no longer used at this level and below.
This requires remapping vertex indices in all of the GeomPrimitives, to remove holes in the GeomVertexDatas. It is normally not necessary to call this explicitly.
Definition at line 229 of file sceneGraphReducer.cxx.
References check_live_flatten(), Thread::consider_yield(), GeomTransformer::finish_apply(), and r_register_vertices().
void SceneGraphReducer::set_combine_radius | ( | PN_stdfloat | combine_radius | ) | [inline] |
Specifies the radius that is used in conjunction with CS_within_radius to decide whether a subgraph's siblings should be combined into a single node or not.
If the CS_within_radius bit is included in the combine_siblings_bits parameter passed to flatten, than any nodes whose bounding volume is smaller than the indicated radius will be combined together (as if CS_other were set).
Definition at line 65 of file sceneGraphReducer.I.
void SceneGraphReducer::set_gsg | ( | GraphicsStateGuardianBase * | gsg | ) |
Specifies the particular GraphicsStateGuardian that this object will attempt to optimize to.
The GSG may specify parameters such as maximum number of vertices per vertex data, max number of vertices per primitive, and whether triangle strips are preferred. It also affects the types of vertex column data that is created by premunge().
Definition at line 49 of file sceneGraphReducer.cxx.
References GraphicsStateGuardianBase::get_default_gsg(), and GeomTransformer::set_max_collect_vertices().
void SceneGraphReducer::unify | ( | PandaNode * | root, |
bool | preserve_order | ||
) |
Calls unify() on every GeomNode at this level and below.
This attempts to reduce the total number of individual Geoms and GeomPrimitives by combining these objects wherever possible. See GeomNode::unify().
Definition at line 207 of file sceneGraphReducer.cxx.
References check_live_flatten(), and r_unify().
Referenced by RigidBodyCombiner::collect(), NodePath::flatten_medium(), and NodePath::flatten_strong().