18 #ifndef ION_GFX_ATTRIBUTEARRAY_H_
19 #define ION_GFX_ATTRIBUTEARRAY_H_
30 static const size_t kAttributeSlotCount = 32;
40 kAttributeChanged = kNumBaseChanges,
43 kAttributeEnabledChanged = kAttributeChanged + kAttributeSlotCount,
44 kNumChanges = kAttributeEnabledChanged + kAttributeSlotCount
53 size_t GetAttributeIndexByName(
const std::string&
name);
60 size_t AddAttribute(
const Attribute& attribute);
64 bool ReplaceAttribute(
size_t index,
const Attribute& attribute);
70 void EnableAttribute(
const size_t attribute_index,
bool enabled);
73 bool IsAttributeEnabled(
const size_t attribute_index)
const;
77 enables_.Set(i, enabled);
85 const bool&
value = enables_.Get(i);
91 return attribute_indices_.size();
95 return buffer_attributes_.GetCount();
99 return simple_attributes_.size();
106 const Attribute& GetAttribute(
const size_t attribute_index)
const;
108 return buffer_attributes_.Get(i);
111 if (i < simple_attributes_.size()) {
112 return simple_attributes_[i];
114 return base::InvalidReference<Attribute>();
123 Attribute* GetMutableAttribute(
const size_t attribute_index);
125 return buffer_attributes_.GetMutable(i);
128 if (i < simple_attributes_.size()) {
129 return &simple_attributes_[i];
148 Index(Type type_in,
size_t index_in) :
type(type_in), index(index_in) {}
152 return type == other.type && index == other.index;
159 Index* FindIndexOfAttribute(Index::Type
type,
size_t index);
163 void RemoveAttribute(
const Index& attr_index);
166 void OnNotify(
const base::Notifier* notifier)
override;
170 base::AllocVector<Index> attribute_indices_;
174 VectorField<Attribute> buffer_attributes_;
178 base::AllocVector<Attribute> simple_attributes_;
182 VectorField<bool> enables_;
191 #endif // ION_GFX_ATTRIBUTEARRAY_H_
bool IsInvalidReference(const T &value)
IsInvalidReference() returns true if a passed const reference of type T has an address of InvalidRefe...
Attribute * GetMutableBufferAttribute(const size_t i)
Attribute * GetMutableSimpleAttribute(const size_t i)
const Attribute & GetBufferAttribute(const size_t i) const
size_t GetAttributeCount() const
Gets the total number of Attributes in the AttributeArray.
void EnableBufferAttribute(const size_t i, bool enabled)
Enables or disables the ith buffer Attribute.
An AttributeArray represents a collection of Attributes used to describe the vertices of a Shape...
base::ReferentPtr< AttributeArray >::Type AttributeArrayPtr
Convenience typedef for shared pointer to a AttributeArray.
bool IsBufferAttributeEnabled(const size_t i) const
Returns if the ith buffer Attribute is enabled, or false if i is not a valid index.
Changes
Changes that affect the resource.
bool operator==(const StlAllocator< T1 > &lhs, const StlAllocator< T2 > &rhs)
Each StlAllocator holds an Allocator.
size_t GetSimpleAttributeCount() const
Gets the number of simple Attributes in the AttributeArray.
size_t GetBufferAttributeCount() const
Gets the number of buffer Attributes in the AttributeArray.
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting...
ResourceHolder is an internal base class for objects that hold resources managed by an outside entity...
const Attribute & GetSimpleAttribute(const size_t i) const