Ion
|
A Shape object represents a shape (vertices + indices) to draw. More...
#include "shape.h"
Public Types | |
enum | PrimitiveType { kLines, kLineLoop, kLineStrip, kPoints, kTriangles, kTriangleFan, kTriangleStrip } |
Supported primitive types. More... | |
Public Member Functions | |
Shape () | |
const std::string & | GetLabel () const |
Returns/sets the label of this. More... | |
void | SetLabel (const std::string &label) |
void | SetPrimitiveType (PrimitiveType type) |
Sets/returns the type of primitive to draw. More... | |
PrimitiveType | GetPrimitiveType () const |
void | SetAttributeArray (const AttributeArrayPtr &attribute_array) |
Sets/returns the vertices used to create the primitives. More... | |
const AttributeArrayPtr & | GetAttributeArray () const |
void | SetIndexBuffer (const IndexBufferPtr &index_buffer) |
Sets/returns the index buffer. More... | |
const IndexBufferPtr & | GetIndexBuffer () const |
size_t | AddVertexRange (const math::Range1i &range) |
By default, a Shape draws all of its vertices (if there is no IndexBuffer) or all of its indexed vertices (if there is an IndexBuffer). More... | |
void | SetVertexRange (size_t i, const math::Range1i &range) |
Modifies the specified vertex range if the passed index is valid (i.e., there is a range at i that has been added with AddVertexRange()); otherwise this logs an error message. More... | |
void | ClearVertexRanges () |
Removes all ranges from the Shape. More... | |
const math::Range1i | GetVertexRange (size_t i) const |
Returns the i-th vertex range. More... | |
size_t | GetVertexRangeCount () const |
Returns the number of vertex ranges in the Shape. More... | |
void | EnableVertexRange (size_t i, bool enable) |
Enables or disables a specific vertex range. More... | |
bool | IsVertexRangeEnabled (size_t i) const |
Returns whether the i-th vertex range is enabled, or false if i does not refer to a valid range. More... | |
void | SetInstanceCount (int count) |
Sets the instance count of the shape. More... | |
int | GetInstanceCount () const |
Returns the instance count that the shape is set to. More... | |
void | SetVertexRangeInstanceCount (size_t i, int instance_count) |
Sets/Gets the instance count of vertex range. More... | |
int | GetVertexRangeInstanceCount (size_t i) const |
Returns the instance count that the vertex range is set to. More... | |
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... | |
Protected Member Functions | |
~Shape () override | |
The destructor is protected because all base::Referent classes must have protected or private destructors. More... | |
A Shape object represents a shape (vertices + indices) to draw.
|
overrideprotected |
The destructor is protected because all base::Referent classes must have protected or private destructors.
size_t ion::gfx::Shape::AddVertexRange | ( | const math::Range1i & | range | ) |
By default, a Shape draws all of its vertices (if there is no IndexBuffer) or all of its indexed vertices (if there is an IndexBuffer).
This function modifies this behavior by adding a vertex range [min, max) to the Shape. The vertex range applies to the indices in the IndexBuffer if there is one; otherwise it applies to the vertices themselves. The new range is enabled by default. If the range is empty, a warning is printed and the range is not added. Returns the index of the added range, or base::kInvalidIndex if the range was not added.
Definition at line 34 of file shape.cc.
References ion::base::kInvalidIndex, LOG, and ion::port::WARNING.
|
inline |
|
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 |
|
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().
|
inline |
|
inlineinherited |
GetRefCount() is part of the interface necessary for SharedPtr.
Definition at line 34 of file shareable.h.
Referenced by ion::base::Notifier::RemoveReceiver().
const math::Range1i ion::gfx::Shape::GetVertexRange | ( | size_t | i | ) | const |
|
inline |
int ion::gfx::Shape::GetVertexRangeInstanceCount | ( | size_t | i | ) | const |
|
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 |
Sets the instance count of the shape.
If non-zero value is set, the shape will be drawn multiple times using the instanced drawing functions. The number of instances drawn depends on what instance_count is set to. Zero means instanced drawing is disabled and the shape will be drawn with the regular drawing functions.
|
inline |
|
inline |
void ion::gfx::Shape::SetVertexRange | ( | size_t | i, |
const math::Range1i & | range | ||
) |
Modifies the specified vertex range if the passed index is valid (i.e., there is a range at i that has been added with AddVertexRange()); otherwise this logs an error message.
Definition at line 45 of file shape.cc.
References LOG, and ion::port::WARNING.
void ion::gfx::Shape::SetVertexRangeInstanceCount | ( | size_t | i, |
int | instance_count | ||
) |
Sets/Gets the instance count of vertex range.
If non-zero value is set, the vertex range will be drawn multiple times using the instanced drawing functions. The number of instances drawn depends on what instance_count is set to. Zero means instanced drawing is disabled and the vertex range will be drawn with the regular drawing functions.