|
Rumba C++ SDK
|
An immutable scene node value. More...
#include <Scene.h>
Classes | |
| class | Attributes |
| An node's attribute iteration. More... | |
| class | Traversal |
| A scene iterator. More... | |
| class | TraversalAttributes |
| An attribute iteration on a traversal node. More... | |
Public Member Functions | |
| SceneConst () | |
| SceneConst (const Value &v) | |
| const std::string & | name () const |
| Returns the node name. More... | |
| const Imath::M44d & | matrix () const |
| Returns the node transform. More... | |
| bool | is_shown () const |
| Returns true if this Scene node is shown. More... | |
| bool | is_selected () const |
| Returns true if this Scene node is selected. More... | |
| bool | reset_matrix () const |
| Returns true if this Scene node reset its world matrix (does not inherit the parent matrix). More... | |
| bool | has_geometry () const |
| Returns true if this node has a geometry. More... | |
| const Shape | geometry () const |
| Get the node geometry. More... | |
| Imath::Box3d | bounding_box () const |
| Compute the bounding box of the scene and all its children. More... | |
| bool | has_attribute (const StringView &attribute) const |
| Returns true if this node has the attribute defined on the node. More... | |
| const Value | attribute (const StringView &attribute) const |
| Return an attribute. More... | |
| Attributes | read_attributes () const |
| Return a read-only attribute iteration. More... | |
| std::shared_ptr< SceneConst > | child (const std::string &path, Imath::M44d *world_matrix=nullptr) const |
| Return a child scene node. More... | |
| std::pair< SceneConst, bool > | filter (const std::function< std::pair< SceneConst, bool >(const SceneConst &scene, const StringView &path, const Imath::M44d *parent_world)> &filter_func, const StringView &root_path="", const Imath::M44d *root_world=nullptr) const |
| Filtering (or smart duplication) of a Scene. More... | |
| Traversal | read_children (bool children_only=false, bool shapes_only=false) const |
| Get the scene traversal. More... | |
Public Member Functions inherited from maquina::Value | |
| Value () | |
| Value | duplicate () const |
| Duplicate the value. More... | |
| bool | as_bool () const |
| Returns the value as a bool. More... | |
| int | as_int () const |
| Returns the value as an integer. More... | |
| float | as_float () const |
| Returns the value as a float. More... | |
| double | as_double () const |
| Returns the value as a double. More... | |
| const std::string & | as_string () const |
| Returns the value as a string. More... | |
| std::wstring | as_wstring () const |
| Returns the value as a wstring. More... | |
| Imath::V2f | as_V2f () const |
| Returns the value as a V2f. More... | |
| Imath::V3f | as_V3f () const |
| Returns the value as a V3f. More... | |
| Imath::V4f | as_V4f () const |
| Returns the value as a V4f. More... | |
| const Imath::V2d & | as_V2d () const |
| Returns the value as a V2d. More... | |
| const Imath::V3d & | as_V3d () const |
| Returns the value as a V3d. More... | |
| const Imath::V4d & | as_V4d () const |
| Returns the value as a V4d. More... | |
| const Imath::V2i & | as_V2i () const |
| Returns the value as a V2i. More... | |
| const Imath::V3i & | as_V3i () const |
| Returns the value as a V3i. More... | |
| const Imath::V4i & | as_V4i () const |
| Returns the value as a V4i. More... | |
| Imath::M44f | as_M44f () const |
| Returns the value as a M44f. More... | |
| const Imath::M44d & | as_M44d () const |
| Returns the value as a M44d. More... | |
| const Imath::Box3f & | as_Box3f () const |
| Returns the value as a Box3f. More... | |
| const Imath::Color4f & | as_Color4f () const |
| Returns the value as a Color4f. More... | |
| Imath::Quatf | as_Quatf () const |
| Returns the value as a Quatf. More... | |
| const Imath::Quatd & | as_Quatd () const |
| Returns the value as a Quatd. More... | |
| std::shared_ptr< const UserData > | as_user_data () const |
| Returns the value as a user data. More... | |
| StringView | type_name () const |
| Return the type name of the Value. More... | |
| bool | has_node_delegate () const |
| Check if this value can produces a NodeDelegate. More... | |
| std::shared_ptr< NodeDelegate > | node_delegate (const std::shared_ptr< NodeDelegate > &parent, const StringView &name) const |
| bool | operator== (const Value &o) const |
| Compare the two values. More... | |
| bool | operator!= (const Value &o) const |
| bool | is_instance (const char *value_type_name) const |
| Check if this type derives from another value type. More... | |
| bool | is_interpolable () const |
| Checks if the value is interpolable. More... | |
| Value | lerp (const Value &other, double weight) const |
| Performs linear interpolation between this value and another value. More... | |
| Value (bool) | |
| Create a boolean value. More... | |
| Value (int) | |
| Create an integer value. More... | |
| Value (float) | |
| Create a float value. More... | |
| Value (double) | |
| Create a double value. More... | |
| Value (const char *string) | |
| Create a string value. More... | |
| Value (const wchar_t *string) | |
| Create a string value. More... | |
| Value (const std::string &string) | |
| Create a string value. More... | |
| Value (const std::wstring &string) | |
| Create a wide string value. More... | |
| Value (const Imath::V2f &) | |
| Create a Imath::V2f value. More... | |
| Value (const Imath::V3f &) | |
| Create a Imath::V3f value. More... | |
| Value (const Imath::V4f &) | |
| Create a Imath::V4f value. More... | |
| Value (const Imath::V2d &) | |
| Create a Imath::V2d value. More... | |
| Value (const Imath::V3d &) | |
| Create a Imath::V3d value. More... | |
| Value (const Imath::V4d &) | |
| Create a Imath::V4d value. More... | |
| Value (const Imath::V2i &) | |
| Create a Imath::V2i value. More... | |
| Value (const Imath::V3i &) | |
| Create a Imath::V3i value. More... | |
| Value (const Imath::V4i &) | |
| Create a Imath::V4i value. More... | |
| Value (const Imath::Color4f &) | |
| Create a Imath::Color4f value. More... | |
| Value (const Imath::M44f &) | |
| Create a Imath::M44f value. More... | |
| Value (const Imath::M44d &) | |
| Create a Imath::M44d value. More... | |
| Value (const Imath::Box3f &) | |
| Create a Imath::Box3f value. More... | |
| Value (const Imath::Quatf &) | |
| Create a Imath::Quatf value. More... | |
| Value (const Imath::Quatd &) | |
| Create a Imath::Quatd value. More... | |
| Value (const std::shared_ptr< const UserData > &user_data) | |
| Create a user data value. More... | |
Static Public Attributes | |
| static const SceneConst | default_value |
| The default value. More... | |
Static Public Attributes inherited from maquina::Value | |
| static const Value | default_value |
| The default value. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from maquina::Value | |
| static bool | validate_type_name (const char *type_name) |
| Return true if the name is a valid type name. More... | |
| static Value | get_default_value (const char *type_name) |
| Return a default value for a given type. More... | |
An immutable scene node value.
This value is a scene graph, with at each node, an inherited world matrix, a visibility, an optional geometry, child nodes and arbitrary attributes.
About the visibility.
There is a difference between hidding and deactivating nodes. A SceneGraphNode node generating such Scene values might be deactivated using the inactive tag. In that case, the SceneGraphNode simply does not generate the value. The inactive tag can't be animated. The exported geometry caches do not include the deactivated nodes.
If the SceneGraphNode is hidden using the show attribute, the Scene value is generated, but with a show attribute at false. The Scene inherited visibility can be queried using the Scene's traversal. The visibility can be animated. The exported geometry caches include the geometries at every frames, no matter the visibility state.
| maquina::SceneConst::SceneConst | ( | ) |
| maquina::SceneConst::SceneConst | ( | const Value & | v | ) |
| const Value maquina::SceneConst::attribute | ( | const StringView & | attribute | ) | const |
Return an attribute.
This method returns a node attribute if it exists. Use the iterators to access the inherited attributes.
| std::runtime_error | If the attribute does not exist. |
| Imath::Box3d maquina::SceneConst::bounding_box | ( | ) | const |
Compute the bounding box of the scene and all its children.
For each scene node in the hierarchy, if the node has a non empty geometry, the bounding box is extended using the geometry's bounding box in world space. If the node has an empty geometry bounding box, the bounding box is extended using the node's world matrix translation.
| std::shared_ptr<SceneConst> maquina::SceneConst::child | ( | const std::string & | path, |
| Imath::M44d * | world_matrix = nullptr |
||
| ) | const |
Return a child scene node.
| path | The child path from this node, like "child0/child1/child2" |
| world_matrix | If not null and the child exists, world_matrix is filled with the child's world matrix |
| std::pair<SceneConst, bool> maquina::SceneConst::filter | ( | const std::function< std::pair< SceneConst, bool >(const SceneConst &scene, const StringView &path, const Imath::M44d *parent_world)> & | filter_func, |
| const StringView & | root_path = "", |
||
| const Imath::M44d * | root_world = nullptr |
||
| ) | const |
Filtering (or smart duplication) of a Scene.
This method performs a smart duplication of a Scene value using a user-provided function, which optionally duplicates each node within the hierarchy. The resulting Scene is returned.
| filter_func | is a user-provided function that takes a SceneConst scene parameter and its path. The function must return the filtered scene. The filtered scene can either be the scene parameter itself if unchanged or a new Scene object duplicated from scene and modified. Note that the filter function is recursively called on the new node's children. The function returns a pair <SceneConst scene, bool keep>. If keep is true, the returned scene object is the new scene to use. If keep is false, the corresponding scene node must be removed from the resulting parent scene node. In that case, the returned SceneConst object is ignored. |
| root_path | is the prefix for the path parameter passed to the user-provided function. |
| world | if not null, the world matrix will be computed during the Scene traversal and given to filter_func. |
Here is an exemple where we hide the nodes named "hide", remove the nodes named "remove" and keep the others.
| const Shape maquina::SceneConst::geometry | ( | ) | const |
Get the node geometry.
| bool maquina::SceneConst::has_attribute | ( | const StringView & | attribute | ) | const |
Returns true if this node has the attribute defined on the node.
This method returns true only if the node itself as attribute. If the attribute is inherited from the parents, it returns false. Use the iterators to access the inherited attributes.
| bool maquina::SceneConst::has_geometry | ( | ) | const |
Returns true if this node has a geometry.
| bool maquina::SceneConst::is_selected | ( | ) | const |
Returns true if this Scene node is selected.
| bool maquina::SceneConst::is_shown | ( | ) | const |
Returns true if this Scene node is shown.
In order to be visible, a node must have its shown attribute and the ones from its parents set to true.
| const Imath::M44d& maquina::SceneConst::matrix | ( | ) | const |
Returns the node transform.
| const std::string& maquina::SceneConst::name | ( | ) | const |
Returns the node name.
| Attributes maquina::SceneConst::read_attributes | ( | ) | const |
Return a read-only attribute iteration.
| Traversal maquina::SceneConst::read_children | ( | bool | children_only = false, |
| bool | shapes_only = false |
||
| ) | const |
Get the scene traversal.
| bool maquina::SceneConst::reset_matrix | ( | ) | const |
Returns true if this Scene node reset its world matrix (does not inherit the parent matrix).
|
static |
The default value.