18 #ifndef ION_GFX_NODE_H_
19 #define ION_GFX_NODE_H_
50 const std::string&
GetLabel()
const {
return label_; }
55 state_table_ = state_table;
61 shader_program_ = shader_program;
69 uniform_blocks_.push_back(block);
72 if (index < uniform_blocks_.size() && block.
Get())
73 uniform_blocks_[index] = block;
77 return uniform_blocks_;
88 index = shapes_.size();
89 shapes_.push_back(shape);
94 if (index < shapes_.size() && shape.
Get())
95 shapes_[index] = shape;
100 for (
auto it = shapes_.begin(); it != shapes_.end();) {
102 it = shapes_.erase(it);
110 if (index < shapes_.size()) {
111 auto it = shapes_.begin() + index;
125 index = children_.size();
126 children_.push_back(child);
131 if (index < children_.size() && child.
Get())
132 children_[index] = child;
138 for (
auto it = children_.begin(); it != children_.end();) {
140 it = children_.erase(it);
148 if (index < children_.size()) {
149 auto it = children_.begin() + index;
175 #endif // ION_GFX_NODE_H_
size_t AddShape(const ShapePtr &shape)
Child node management.
void SetShaderProgram(const ShaderProgramPtr &shader_program)
Shader program management.
base::ReferentPtr< Node >::Type NodePtr
void RemoveChild(const NodePtr &child)
Removes all instances of child from this' children if it is actually a child of this.
const base::AllocVector< NodePtr > & GetChildren() const
void ReplaceUniformBlock(size_t index, const UniformBlockPtr &block)
void RemoveChildAt(size_t index)
Removes the child Node at the passed index if the index is valid.
const size_t kInvalidIndex
kInvalidIndex is a size_t value that is very unlikely to be a valid index.
void SetStateTable(const StateTablePtr &state_table)
StateTable management.
void ReplaceShape(size_t index, const ShapePtr &shape)
const ShaderProgramPtr & GetShaderProgram() const
void RemoveShape(const ShapePtr &shape)
Removes all instances of the shape if it is contained in this' shapes.
const base::AllocVector< UniformBlockPtr > & GetUniformBlocks() const
void RemoveShapeAt(size_t index)
Removes the Shape at the passed index if the index is valid.
const StateTablePtr & GetStateTable() const
Thread-safe abstract base class.
const base::AllocVector< ShapePtr > & GetShapes() const
void SetLabel(const std::string &label)
T * Get() const
Returns a raw pointer to the instance, which may be NULL.
void ReplaceChild(size_t index, const NodePtr &child)
size_t AddChild(const NodePtr &child)
Child node management.
const std::string & GetLabel() const
Returns/sets the label of this.
A Node instance represents a node in a scene graph.
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting...
void AddUniformBlock(const UniformBlockPtr &block)
UniformBlock management.
void ClearUniformBlocks()
This class can be used in place of std::vector to allow an Ion Allocator to be used for memory alloca...