123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #pragma once
- #include "IReferenceCounted.h"
- #include "EHardwareBufferFlags.h"
- #include "EPrimitiveTypes.h"
- #include "SVertexIndex.h"
- namespace irr
- {
- namespace scene
- {
- class IIndexBuffer : public virtual IReferenceCounted
- {
- public:
-
-
- virtual video::E_INDEX_TYPE getType() const = 0;
-
-
- virtual const void *getData() const = 0;
-
-
- virtual void *getData() = 0;
-
-
- virtual u32 getCount() const = 0;
-
- virtual E_HARDWARE_MAPPING getHardwareMappingHint() const = 0;
-
- virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint) = 0;
-
- virtual void setDirty() = 0;
-
-
- virtual u32 getChangedID() const = 0;
-
- virtual void setHWBuffer(void *ptr) const = 0;
- virtual void *getHWBuffer() const = 0;
-
- u32 getPrimitiveCount(E_PRIMITIVE_TYPE primitiveType) const
- {
- const u32 indexCount = getCount();
- switch (primitiveType) {
- case scene::EPT_POINTS:
- return indexCount;
- case scene::EPT_LINE_STRIP:
- return indexCount - 1;
- case scene::EPT_LINE_LOOP:
- return indexCount;
- case scene::EPT_LINES:
- return indexCount / 2;
- case scene::EPT_TRIANGLE_STRIP:
- return (indexCount - 2);
- case scene::EPT_TRIANGLE_FAN:
- return (indexCount - 2);
- case scene::EPT_TRIANGLES:
- return indexCount / 3;
- case scene::EPT_POINT_SPRITES:
- return indexCount;
- }
- return 0;
- }
- };
- }
- }
|