Ion
|
A Node instance represents a node in a scene graph. More...
#include "node.h"
Public Member Functions | |
Node () | |
const std::string & | GetLabel () const |
Returns/sets the label of this. More... | |
void | SetLabel (const std::string &label) |
void | SetStateTable (const StateTablePtr &state_table) |
StateTable management. More... | |
const StateTablePtr & | GetStateTable () const |
void | SetShaderProgram (const ShaderProgramPtr &shader_program) |
Shader program management. More... | |
const ShaderProgramPtr & | GetShaderProgram () const |
void | AddUniformBlock (const UniformBlockPtr &block) |
UniformBlock management. More... | |
void | ReplaceUniformBlock (size_t index, const UniformBlockPtr &block) |
void | ClearUniformBlocks () |
const base::AllocVector < UniformBlockPtr > & | GetUniformBlocks () const |
size_t | AddShape (const ShapePtr &shape) |
Child node management. More... | |
void | ReplaceShape (size_t index, const ShapePtr &shape) |
void | RemoveShape (const ShapePtr &shape) |
Removes all instances of the shape if it is contained in this' shapes. More... | |
void | RemoveShapeAt (size_t index) |
Removes the Shape at the passed index if the index is valid. More... | |
void | ClearShapes () |
const base::AllocVector < ShapePtr > & | GetShapes () const |
size_t | AddChild (const NodePtr &child) |
Child node management. More... | |
void | ReplaceChild (size_t index, const NodePtr &child) |
void | RemoveChild (const NodePtr &child) |
Removes all instances of child from this' children if it is actually a child of this. More... | |
void | RemoveChildAt (size_t index) |
Removes the child Node at the passed index if the index is valid. More... | |
void | ClearChildren () |
const base::AllocVector < NodePtr > & | GetChildren () const |
const AllocatorPtr & | GetAllocator () const |
Returns the Allocator that was used for the instance. More... | |
const AllocatorPtr & | GetNonNullAllocator () const |
Return our allocator, or the default allocator if the instance was declared on the stack. More... | |
const AllocatorPtr & | GetAllocatorForLifetime (AllocationLifetime lifetime) const |
Convenience function that returns the Allocator to use to allocate an object with a specific lifetime. More... | |
void * | operator new (size_t size) |
The standard no-parameter new operator uses the default Allocator. More... | |
void * | operator new (size_t size, AllocationLifetime lifetime) |
This overloaded version of the new operator uses the AllocationManager's default Allocator for the specified lifetime. More... | |
void * | operator new (size_t size, const AllocatorPtr &allocator) |
This overloaded version of the new operator takes the Allocator to use directly as a parameter. More... | |
void * | operator new (size_t size, const AllocatorPtr &allocator, void *ptr) |
Special operator new for using placement new with Allocatables. More... | |
void * | operator new (size_t size, void *ptr) |
The placement new operator is defined conventionally. More... | |
void | operator delete (void *ptr) |
Define the delete operator to use specialized functions dealing with an Allocator. More... | |
void | operator delete (void *ptr, AllocationLifetime lifetime) |
Windows requires these (or it issues C4291 warnings). More... | |
void | operator delete (void *ptr, const AllocatorPtr &allocator) |
void | operator delete (void *ptr, void *ptr2) |
The placement delete operator does nothing, as usual. More... | |
int | GetRefCount () const |
GetRefCount() is part of the interface necessary for SharedPtr. More... | |
size_t | AddUniform (const Uniform &uniform) |
Adds a uniform to this and returns an index that can be used to refer to the uniform. More... | |
bool | ReplaceUniform (size_t index, const Uniform &uniform) |
Replaces the uniform at an index with the passed value, if the index is valid. More... | |
bool | RemoveUniformByName (const std::string &name) |
Removes the uniform with the passed name if it exists. More... | |
void | ClearUniforms () |
Clears the vector of uniforms in this. More... | |
const base::AllocVector < Uniform > & | GetUniforms () const |
Gets the vector of uniforms. More... | |
template<typename T > | |
bool | SetUniformValue (size_t index, const T &value) |
Sets the value of the uniform at an index if the index is valid. More... | |
template<typename T > | |
bool | SetUniformValueAt (size_t index, size_t array_index, const T &value) |
Sets the value of the array uniform at an index if the index is valid. More... | |
size_t | GetUniformIndex (const std::string &name) const |
Returns the index of the uniform this with the given name, if it exists. More... | |
template<typename T > | |
bool | SetUniformByName (const std::string &name, const T &value) |
Convenience function to set the value of a uniform specified by name. More... | |
template<typename T > | |
bool | SetUniformByNameAt (const std::string &name, size_t array_index, const T &value) |
Convenience function to set the value of an element of an array uniform designated by name . More... | |
void | Enable (bool enable) |
Enables or disables the UniformHolder. More... | |
bool | IsEnabled () const |
Protected Member Functions | |
~Node () override | |
The destructor is protected because all base::Referent classes must have protected or private destructors. More... | |
A Node instance represents a node in a scene graph.
It can have any or all of the following:
|
overrideprotected |
The destructor is protected because all base::Referent classes must have protected or private destructors.
Child node management.
NULL children are not added, and ReplaceChild() does nothing if the index is invalid. AddChild() returns the index of the child added, or base::kInvalidIndex if the child is NULL. Note that the index may change after a call to RemoveChild[At]().
Definition at line 122 of file node.h.
References ion::base::SharedPtr< T >::Get(), and ion::base::kInvalidIndex.
Child node management.
NULL children are not added, and ReplaceChild() Shape management. NULL shapes are not added, and ReplaceShape() does nothing if the index is invalid. AddShape returns the index of the Shape added, or base::kInvaidIndex if the Shape is NULL. Note that the index may change if RemoveShape[At]() is called.
Definition at line 85 of file node.h.
References ion::base::SharedPtr< T >::Get(), and ion::base::kInvalidIndex.
Adds a uniform to this and returns an index that can be used to refer to the uniform.
Note that this index is invalid if ClearUniforms() is ever used, and may refer to a different uniform if the uniform is ever replaced with ReplaceUniform(). Returns base::kInvalidIndex if an attempt is made to add an invalid uniform.
Definition at line 46 of file uniformholder.h.
References ion::gfx::ShaderInput< ValueHolderType, ValueEnumType >::IsValid(), and ion::base::kInvalidIndex.
Referenced by ion::text::BasicBuilder::UpdateUniforms(), and ion::text::OutlineBuilder::UpdateUniforms().
|
inline |
UniformBlock management.
NULL blocks are not added, and ReplaceUniformBlock() does nothing if the index is invalid.
Definition at line 67 of file node.h.
References ion::base::SharedPtr< T >::Get().
|
inlineinherited |
Clears the vector of uniforms in this.
Definition at line 78 of file uniformholder.h.
Referenced by ion::text::BasicBuilder::UpdateUniforms(), and ion::text::OutlineBuilder::UpdateUniforms().
|
inlineinherited |
Enables or disables the UniformHolder.
Disabled holders are skipped over during rendering; their values are not sent to OpenGL. UniformHolders are enabled by default.
Definition at line 137 of file uniformholder.h.
|
inlineinherited |
Returns the Allocator that was used for the instance.
This will be NULL if the instance was declared on the stack or created with normal placement new.
Definition at line 68 of file allocatable.h.
References allocator_.
Referenced by ion::base::DataContainer::CreateAndCopy(), ion::text::DynamicFontImage::FindContainingImageDataIndex(), and ion::text::DynamicFontImage::FindImageDataIndex().
|
inlineinherited |
Convenience function that returns the Allocator to use to allocate an object with a specific lifetime.
Definition at line 78 of file allocatable.h.
References ion::base::Allocator::GetAllocatorForLifetime().
Referenced by ion::text::BasicBuilder::BuildVertexData(), ion::text::OutlineBuilder::BuildVertexData(), ion::gfxutils::ShaderManager::CreateShaderProgram(), ion::text::DynamicFontImage::FindContainingImageDataIndex(), ion::text::DynamicFontImage::FindImageDataIndex(), ion::gfx::Renderer::Renderer(), and ion::gfx::UpdateStateTable().
|
inline |
|
inline |
|
inlineinherited |
Return our allocator, or the default allocator if the instance was declared on the stack.
Definition at line 72 of file allocatable.h.
References allocator_, and ion::base::AllocationManager::GetNonNullAllocator().
|
inlineinherited |
GetRefCount() is part of the interface necessary for SharedPtr.
Definition at line 34 of file shareable.h.
Referenced by ion::base::Notifier::RemoveReceiver().
|
inline |
|
inline |
|
inline |
|
inline |
|
inherited |
Returns the index of the uniform this with the given name, if it exists.
The Uniform must have been added with AddUniform() or ReplaceUniform(). If no uniform with the name exists in this then returns ion::base::kInvalidIndex. Note that this is a relatively slow operation and should be used sparingly.
Definition at line 30 of file uniformholder.cc.
References DCHECK, ion::gfx::ShaderInput< ValueHolderType, ValueEnumType >::GetIndexInRegistry(), ion::gfx::ShaderInput< ValueHolderType, ValueEnumType >::GetRegistry(), ion::gfx::ShaderInputRegistry::GetSpecs(), ion::gfx::ShaderInput< ValueHolderType, ValueEnumType >::IsValid(), and ion::base::kInvalidIndex.
|
inlineinherited |
Gets the vector of uniforms.
Definition at line 81 of file uniformholder.h.
Referenced by ion::text::Builder::UpdateFontImageTextureUniform(), ion::text::BasicBuilder::UpdateUniforms(), and ion::text::OutlineBuilder::UpdateUniforms().
|
inlineinherited |
Definition at line 138 of file uniformholder.h.
|
inlineinherited |
Define the delete operator to use specialized functions dealing with an Allocator.
Definition at line 109 of file allocatable.h.
|
inlineinherited |
Windows requires these (or it issues C4291 warnings).
Definition at line 112 of file allocatable.h.
|
inlineinherited |
Definition at line 113 of file allocatable.h.
|
inlineinherited |
The placement delete operator does nothing, as usual.
Definition at line 118 of file allocatable.h.
|
inlineinherited |
The standard no-parameter new operator uses the default Allocator.
Definition at line 84 of file allocatable.h.
|
inlineinherited |
This overloaded version of the new operator uses the AllocationManager's default Allocator for the specified lifetime.
Definition at line 88 of file allocatable.h.
|
inlineinherited |
This overloaded version of the new operator takes the Allocator to use directly as a parameter.
If the Allocator pointer is NULL, this uses the default Allocator.
Definition at line 95 of file allocatable.h.
|
inlineinherited |
Special operator new for using placement new with Allocatables.
Definition at line 100 of file allocatable.h.
|
inlineinherited |
The placement new operator is defined conventionally.
Definition at line 105 of file allocatable.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineinherited |
Removes the uniform with the passed name if it exists.
Returns true iff the uniform existed and hence got removed. Note that this will change the indices of other uniforms within the holder.
Definition at line 69 of file uniformholder.h.
References ion::base::kInvalidIndex.
Definition at line 130 of file node.h.
References ion::base::SharedPtr< T >::Get().
Definition at line 93 of file node.h.
References ion::base::SharedPtr< T >::Get().
|
inlineinherited |
Replaces the uniform at an index with the passed value, if the index is valid.
Returns if the replacement is successful.
Definition at line 57 of file uniformholder.h.
References ion::gfx::ShaderInput< ValueHolderType, ValueEnumType >::IsValid().
|
inline |
Definition at line 71 of file node.h.
References ion::base::SharedPtr< T >::Get().
|
inline |
|
inline |
|
inline |
StateTable management.
|
inlineinherited |
Convenience function to set the value of a uniform specified by name.
This returns false if there is no uniform with that name or the value type does not match.
Definition at line 113 of file uniformholder.h.
References ion::base::kInvalidIndex, and value.
|
inlineinherited |
Convenience function to set the value of an element of an array uniform designated by name
.
This returns false if:
name
.array_index
exceeds the size of the uniform array. Definition at line 125 of file uniformholder.h.
References ion::base::kInvalidIndex.
|
inlineinherited |
Sets the value of the uniform at an index if the index is valid.
Returns true if the index is valid and the set was successful (i.e., T is a valid type for the selected uniform), and false otherwise.
Definition at line 86 of file uniformholder.h.
Referenced by ion::text::Builder::UpdateFontImageTextureUniform(), ion::text::BasicBuilder::UpdateUniforms(), and ion::text::OutlineBuilder::UpdateUniforms().
|
inlineinherited |
Sets the value of the array uniform at an index if the index is valid.
Returns true if the index is valid and the set was successful (i.e., T is a valid type for the selected uniform), and false otherwise.
Definition at line 95 of file uniformholder.h.