33#include <NDEVR/Model.h>
34#include <NDEVR/Geometry.h>
BasicModelIterator(const Buffer< Model > &models)
Constructs an iterator initialized with multiple root models.
void setCallback(const std::function< ParseResult(Model &, Material &)> &material_callback)
Sets the callback invoked for each material during traversal.
void setCallback(const std::function< ParseResult(Model &, Geometry &)> &geo_callback)
Sets the callback invoked for each geometry during traversal.
BasicModelIterator(const std::function< ParseResult(Model &)> &model_callback)
Constructs an iterator with a model processing callback.
ParseResult process(Model &model) final override
Dispatches to m_model_callback if set; otherwise returns e_continue_parsing.
BasicModelIterator(const Model &model)
Constructs an iterator initialized with a single root model.
ParseResult process(Model &model, Geometry &geo) final override
Dispatches to m_geo_callback if set; otherwise returns e_continue_parsing.
std::function< ParseResult(Model &)> m_model_callback
Callback invoked for each model during traversal.
BasicModelIterator(const std::function< ParseResult(Model &, Geometry &)> &geo_callback)
Constructs an iterator with a geometry processing callback.
void setCallback(const std::function< ParseResult(Model &)> &model_callback)
Sets the callback invoked for each model during traversal.
BasicModelIterator(const std::function< ParseResult(Model &, Material &)> &material_callback)
Constructs an iterator with a material processing callback.
std::function< ParseResult(Model &, Geometry &)> m_geo_callback
Callback invoked for each geometry during traversal.
ParseResult process(Model &model, Material &mat) final override
Dispatches to m_material_callback if set; otherwise returns e_continue_parsing.
std::function< ParseResult(Model &, Material &)> m_material_callback
Callback invoked for each material during traversal.
BasicModelIterator()
Default constructor.
The equivelent of std::vector but with a bit more control.
A core class within the model hierarchy containing vertex-based data (Usually 3D data) within a set c...
Container responsible for storing and setting the appearance of a Model or Geometry within the NDEVR ...
bool use_unit
Whether to apply unit conversions during processing.
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.
virtual ParseResult postProcess(Model &model)
Called after all children of a model have been processed, when post_process_model is true.
bool depth_first
Whether to traverse depth-first (true) or breadth-first (false).
virtual void _parseAllModels()
Internal method that drives the main parsing loop over all stacked models.
bool process_material
Whether to invoke process() for each Material on a model.
Buffer< std::pair< Model, uint04 > > m_model_parent_stack
Stack tracking parent models and their child indices for post-processing.
ParseResult parseNext()
Parses the next model on the stack, processing it and optionally its geometry and material.
std::function< bool(const Model &, const Material &)> material_filter
Optional filter predicate for material processing. Returns true to include.
ModelIterator(const Model &model)
Constructs an iterator initialized with a single root model.
std::function< bool(const Model &)> model_filter
Optional filter predicate for model processing. Returns true to include.
std::function< bool(const Model &, const Geometry &)> geo_filter
Optional filter predicate for geometry processing. Returns true to include.
uint04 m_forward_position
Current forward index position used in breadth-first traversal.
Model currentModel() const
Returns the model currently at the top of the traversal stack.
ModelIterator(Buffer< Model > models)
Constructs an iterator initialized with multiple root models.
bool post_process_model
Whether to invoke postProcess() after a model's children have been parsed.
Buffer< Model > m_model_stack
The stack of models pending traversal.
void removeFromPostProcessStack()
Removes the current model from the post-process stack.
void parseAll()
Parses all models currently on the internal stack and their descendants.
void addToStack(const Model &model)
Adds a model to the internal traversal stack without starting iteration.
ParseResult
The result returned by process functions to control iteration flow.
@ e_continue_parsing
Continue normal traversal to sibling and child nodes.
@ e_do_not_parse_children
Skip the children of the current node but continue with siblings.
@ e_finish_parsing
Stop all traversal immediately.
bool process_geometry
Whether to invoke process() for each Geometry on a model.
ModelIterator()
Default constructor.
virtual ParseResult process(Model &model, Geometry &geo)
Called for each geometry associated with a model.
virtual ParseResult process(Model &model)
Called for each model node during traversal.
void parseAllModels(const Buffer< Model > &models)
Parses all models in the given buffer and their descendants.
Model popNextModel()
Pops and returns the next model from the traversal stack.
bool is_recursive
Whether to recurse into child models.
bool process_model
Whether to invoke process() for the model itself.
virtual ParseResult process(Model &model, Material &mat)
Called for each material associated with a model.
A core class that represents a node on model hierarchy.
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...