5#ifndef DCPP_P_INDEX_BUFFER_HPP_INCLUDED
6#define DCPP_P_INDEX_BUFFER_HPP_INCLUDED
8#include <duckcpp/core/engine/IIndexBuffer.hpp>
21 virtual ~IIndexList(){};
30 virtual void reallocate(
dcpp::uint32_kt new_size,
bool canShrink=
true) =0;
32 virtual void* pointer() =0;
33 virtual const void* const_pointer()
const =0;
34 virtual dcpp::video::E_INDEX_TYPE getType()
const =0;
38 class PSpecificIndexList :
public IIndexList
49 Indices.push_back((T)value);
61 Indices[index]=(T)value;
66 Indices.set_used(usedNow);
69 virtual void reallocate(
dcpp::uint32_kt new_size,
bool canShrink)
override
71 Indices.reallocate(new_size, canShrink);
76 return Indices.allocated_size();
79 virtual void* pointer()
override {
return Indices.pointer(); }
80 virtual const void* const_pointer()
const override {
return Indices.const_pointer(); }
82 virtual dcpp::video::E_INDEX_TYPE getType()
const override
85 return dcpp::video::EIT_16BIT;
87 return dcpp::video::EIT_32BIT;
101 setType(IndexBufferCopy.getType());
102 reallocate(IndexBufferCopy.
size());
113 virtual void setType(dcpp::video::E_INDEX_TYPE indexType)
override
115 if ( Indices && Indices->getType() == indexType )
118 IIndexList *NewIndices=0;
122 case dcpp::video::EIT_16BIT:
124 NewIndices=
new PSpecificIndexList<dcpp::uint16_kt>;
127 case dcpp::video::EIT_32BIT:
129 NewIndices=
new PSpecificIndexList<dcpp::uint32_kt>;
136 NewIndices->reallocate( Indices->size() );
139 NewIndices->push_back((*Indices)[n]);
147 virtual void*
getData()
override {
return Indices->pointer();}
148 virtual const void*
getData()
const override {
return Indices->const_pointer(); }
150 virtual dcpp::video::E_INDEX_TYPE getType()
const override {
return Indices->getType();}
156 return Indices->size();
161 Indices->push_back(value);
166 return (*Indices)[index];
171 return Indices->getLast();
176 Indices->setValue(index, value);
181 Indices->set_used(usedNow);
184 virtual void reallocate(
dcpp::uint32_kt new_size,
bool canShrink=
true)
override
186 Indices->reallocate(new_size, canShrink);
191 return Indices->allocated_size();
203 MappingHint=NewMappingHint;
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.hpp:22
Definition IIndexBuffer.hpp:20
virtual dcpp::uint32_kt size() const =0
Number of elements.
Definition PIndexBuffer.hpp:16
virtual void setDirty() override
flags the mesh as changed, reloads hardware buffers
Definition PIndexBuffer.hpp:207
virtual dcpp::uint32_kt getChangedID() const override
Get the currently used ID for identification of changes.
Definition PIndexBuffer.hpp:214
virtual void push_back(dcpp::uint32_kt value) override
Add value to end. Note that for 16 bit index types values shouldn't be larger than dcpp::uint16_kt.
Definition PIndexBuffer.hpp:159
virtual void setValue(dcpp::uint32_kt index, dcpp::uint32_kt value) override
Set value at index. Note that for 16 bit index types values shouldn't be larger than dcpp::uint16_kt.
Definition PIndexBuffer.hpp:174
virtual void setType(dcpp::video::E_INDEX_TYPE indexType) override
Change between 16 and 32 bit indices.
Definition PIndexBuffer.hpp:113
virtual void setHardwareMappingHint(E_HARDWARE_MAPPING NewMappingHint) override
set the hardware mapping hint, for driver
Definition PIndexBuffer.hpp:201
virtual const void * getData() const override
Const pointer to first element.
Definition PIndexBuffer.hpp:148
virtual E_HARDWARE_MAPPING getHardwareMappingHint() const override
get the current hardware mapping hint
Definition PIndexBuffer.hpp:195
virtual dcpp::uint32_kt operator[](dcpp::uint32_kt index) const override
Access element value at given index.
Definition PIndexBuffer.hpp:164
virtual dcpp::uint32_kt size() const override
Number of elements.
Definition PIndexBuffer.hpp:154
virtual dcpp::uint32_kt stride() const override
Number of bytes per element.
Definition PIndexBuffer.hpp:152
virtual void * getData() override
Pointer to first element.
Definition PIndexBuffer.hpp:147
E_HARDWARE_MAPPING
Definition EHardwareBufferFlags.hpp:14
@ EHM_NEVER
Don't store on the hardware.
Definition EHardwareBufferFlags.hpp:16
As of Duckcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11
unsigned int uint32_kt
32 bit unsigned variable.
Definition irrTypes.hpp:64
unsigned short uint16_kt
16 bit unsigned variable.
Definition irrTypes.hpp:46