Ion: gfx/node.h Source File

1 

18 #ifndef ION_GFX_NODE_H_

19 #define ION_GFX_NODE_H_

20 

28 

29 namespace ion {

30 namespace gfx {

31 

35 

46  public:

48 

50  const std::string& GetLabel() const { return label_; }

52 

55  state_table_ = state_table;

56  }

58 

61  shader_program_ = shader_program;

62  }

64 

68  if (block.Get())

69  uniform_blocks_.push_back(block);

70  }

72  if (index < uniform_blocks_.size() && block.Get())

73  uniform_blocks_[index] = block;

74  }

77  return uniform_blocks_;

78  }

79 

87  if (shape.Get()) {

88  index = shapes_.size();

89  shapes_.push_back(shape);

90  }

91  return index;

92  }

94  if (index < shapes_.size() && shape.Get())

95  shapes_[index] = shape;

96  }

100  for (auto it = shapes_.begin(); it != shapes_.end();) {

101  if (*it == shape)

102  it = shapes_.erase(it);

103  else

104  ++it;

105  }

106  }

110  if (index < shapes_.size()) {

111  auto it = shapes_.begin() + index;

112  shapes_.erase(it);

113  }

114  }

117 

124  if (child.Get()) {

125  index = children_.size();

126  children_.push_back(child);

127  }

128  return index;

129  }

131  if (index < children_.size() && child.Get())

132  children_[index] = child;

133  }

138  for (auto it = children_.begin(); it != children_.end();) {

139  if (*it == child)

140  it = children_.erase(it);

141  else

142  ++it;

143  }

144  }

148  if (index < children_.size()) {

149  auto it = children_.begin() + index;

150  children_.erase(it);

151  }

152  }

155 

156  protected:

159  ~Node() override;

160 

161  private:

169  std::string label_;

170 };

171 

172 }

173 }

174 

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.

A UniformHolder is a base class for an object that holds Uniforms.

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)

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.

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...