![]() |
NDEVR
API Documentation
|
A convenience subclass of ModelIterator that delegates processing to user-supplied std::function callbacks rather than requiring a full subclass override. More...
Public Member Functions | |
| BasicModelIterator () | |
| Default constructor. | |
| BasicModelIterator (const Buffer< Model > &models) | |
| Constructs an iterator initialized with multiple root models. | |
| BasicModelIterator (const Model &model) | |
| Constructs an iterator initialized with a single root model. | |
| BasicModelIterator (const std::function< ParseResult(Model &)> &model_callback) | |
| Constructs an iterator with a model processing callback. | |
| BasicModelIterator (const std::function< ParseResult(Model &, Geometry &)> &geo_callback) | |
| Constructs an iterator with a geometry processing callback. | |
| BasicModelIterator (const std::function< ParseResult(Model &, Material &)> &material_callback) | |
| Constructs an iterator with a material processing callback. | |
| void | setCallback (const std::function< ParseResult(Model &)> &model_callback) |
| Sets the callback invoked for each model during traversal. | |
| void | setCallback (const std::function< ParseResult(Model &, Geometry &)> &geo_callback) |
| Sets the callback invoked for each geometry during traversal. | |
| void | setCallback (const std::function< ParseResult(Model &, Material &)> &material_callback) |
| Sets the callback invoked for each material during traversal. | |
| Public Member Functions inherited from ModelIterator | |
| ModelIterator () | |
| Default constructor. | |
| ModelIterator (Buffer< Model > models) | |
| Constructs an iterator initialized with multiple root models. | |
| ModelIterator (const Model &model) | |
| Constructs an iterator initialized with a single root model. | |
| void | addToStack (const Model &model) |
| Adds a model to the internal traversal stack without starting iteration. | |
| Model | currentModel () const |
| Returns the model currently at the top of the traversal stack. | |
| void | parseAll () |
| Parses all models currently on the internal stack and their descendants. | |
| void | parseAll (const Model &model) |
| Parses the given model and all of its descendants. | |
| void | parseAllChildren (const Model &parent) |
| Parses all children of the given parent model, but not the parent itself. | |
| void | parseAllModels (const Buffer< Model > &models) |
| Parses all models in the given buffer and their descendants. | |
| ParseResult | parseNext () |
| Parses the next model on the stack, processing it and optionally its geometry and material. | |
Protected Member Functions | |
| ParseResult | process (Model &model) final override |
| Dispatches to m_model_callback if set; otherwise returns e_continue_parsing. | |
| ParseResult | process (Model &model, Geometry &geo) final override |
| Dispatches to m_geo_callback if set; otherwise returns e_continue_parsing. | |
| ParseResult | process (Model &model, Material &mat) final override |
| Dispatches to m_material_callback if set; otherwise returns e_continue_parsing. | |
| Protected Member Functions inherited from ModelIterator | |
| virtual void | _parseAllModels () |
| Internal method that drives the main parsing loop over all stacked models. | |
| Model | popNextModel () |
| Pops and returns the next model from the traversal stack. | |
| virtual ParseResult | postProcess (Model &model) |
| Called after all children of a model have been processed, when post_process_model is true. | |
| void | removeFromPostProcessStack () |
| Removes the current model from the post-process stack. | |
Protected Attributes | |
| std::function< ParseResult(Model &, Geometry &)> | m_geo_callback |
| Callback invoked for each geometry during traversal. | |
| std::function< ParseResult(Model &, Material &)> | m_material_callback |
| Callback invoked for each material during traversal. | |
| std::function< ParseResult(Model &)> | m_model_callback |
| Callback invoked for each model during traversal. | |
| Protected Attributes inherited from ModelIterator | |
| uint04 | m_forward_position = 0U |
| Current forward index position used in breadth-first traversal. | |
| Buffer< std::pair< Model, uint04 > > | m_model_parent_stack |
| Stack tracking parent models and their child indices for post-processing. | |
| Buffer< Model > | m_model_stack |
| The stack of models pending traversal. | |
Additional Inherited Members | |
| Public Types inherited from ModelIterator | |
| enum | ParseResult { e_continue_parsing , e_do_not_parse_children , e_finish_parsing } |
| The result returned by process functions to control iteration flow. More... | |
| Public Attributes inherited from ModelIterator | |
| bool | depth_first = true |
| Whether to traverse depth-first (true) or breadth-first (false). | |
| std::function< bool(const Model &, const Geometry &)> | geo_filter |
| Optional filter predicate for geometry processing. Returns true to include. | |
| bool | is_recursive = true |
| Whether to recurse into child models. | |
| std::function< bool(const Model &, const Material &)> | material_filter |
| Optional filter predicate for material processing. Returns true to include. | |
| std::function< bool(const Model &)> | model_filter |
| Optional filter predicate for model processing. Returns true to include. | |
| bool | post_process_model = false |
| Whether to invoke postProcess() after a model's children have been parsed. | |
| bool | process_geometry = true |
| Whether to invoke process() for each Geometry on a model. | |
| bool | process_material = false |
| Whether to invoke process() for each Material on a model. | |
| bool | process_model = true |
| Whether to invoke process() for the model itself. | |
| bool | use_unit = false |
| Whether to apply unit conversions during processing. | |
A convenience subclass of ModelIterator that delegates processing to user-supplied std::function callbacks rather than requiring a full subclass override.
Allows setting geometry, material, and model callbacks either via the constructor or through setCallback(). The appropriate callback is invoked during traversal.
Definition at line 189 of file ModelIterator.h.
| BasicModelIterator::BasicModelIterator | ( | ) |
Default constructor.
Creates an iterator with no callbacks set.
|
explicit |
Constructs an iterator initialized with a single root model.
| [in] | model | The root model to begin iteration from. |
Constructs an iterator initialized with multiple root models.
| [in] | models | The collection of models to iterate over. |
|
explicit |
Constructs an iterator with a geometry processing callback.
| [in] | geo_callback | The function to invoke for each geometry encountered. |
|
explicit |
Constructs an iterator with a material processing callback.
| [in] | material_callback | The function to invoke for each material encountered. |
|
explicit |
Constructs an iterator with a model processing callback.
| [in] | model_callback | The function to invoke for each model encountered. |
|
finaloverrideprotectedvirtual |
Dispatches to m_model_callback if set; otherwise returns e_continue_parsing.
| [in] | model | The model being processed. |
Reimplemented from ModelIterator.
|
finaloverrideprotectedvirtual |
Dispatches to m_geo_callback if set; otherwise returns e_continue_parsing.
| [in] | model | The model that owns the geometry. |
| [in] | geo | The geometry being processed. |
Reimplemented from ModelIterator.
|
finaloverrideprotectedvirtual |
Dispatches to m_material_callback if set; otherwise returns e_continue_parsing.
| [in] | model | The model that owns the material. |
| [in] | mat | The material being processed. |
Reimplemented from ModelIterator.
| void BasicModelIterator::setCallback | ( | const std::function< ParseResult(Model &)> & | model_callback | ) |
Sets the callback invoked for each model during traversal.
| [in] | model_callback | The model processing function. |
| void BasicModelIterator::setCallback | ( | const std::function< ParseResult(Model &, Geometry &)> & | geo_callback | ) |
Sets the callback invoked for each geometry during traversal.
| [in] | geo_callback | The geometry processing function. |
| void BasicModelIterator::setCallback | ( | const std::function< ParseResult(Model &, Material &)> & | material_callback | ) |
Sets the callback invoked for each material during traversal.
| [in] | material_callback | The material processing function. |