Skylicht Engine
Loading...
Searching...
No Matches
IIndexBuffer.h
1// Copyright (C) 2012 Patryk Nadrowski
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_INDEX_BUFFER_H_INCLUDED__
6#define __I_INDEX_BUFFER_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "irrArray.h"
10#include "IHardwareBuffer.h"
11
12namespace irr
13{
14namespace video
15{
16 enum E_INDEX_TYPE
17 {
18 EIT_16BIT = 0,
19 EIT_32BIT
20 };
21}
22namespace scene
23{
24 class IIndexBuffer : public virtual IReferenceCounted
25 {
26 public:
27 IIndexBuffer() : HardwareBuffer(0)
28 {
29 }
30
31 virtual ~IIndexBuffer()
32 {
33 if (HardwareBuffer)
34 HardwareBuffer->drop();
35 }
36
37 virtual void clear() = 0;
38
39 virtual u32 getLast() = 0;
40
41 virtual void set_used(u32 used) = 0;
42
43 virtual void reallocate(u32 size) = 0;
44
45 virtual u32 allocated_size() const = 0;
46
47 virtual s32 linear_reverse_search(const u32& element) const = 0;
48
49 virtual video::E_INDEX_TYPE getType() const = 0;
50
51 virtual void setType(video::E_INDEX_TYPE type) = 0;
52
53 virtual E_HARDWARE_MAPPING getHardwareMappingHint() const = 0;
54
55 virtual void setHardwareMappingHint(E_HARDWARE_MAPPING hardwareMappingHint) = 0;
56
57 virtual void addIndex(const u32& index) = 0;
58
59 virtual u32 getIndex(u32 id) const = 0;
60
61 virtual void* getIndices() = 0;
62
63 virtual u32 getIndexCount() const = 0;
64
65 virtual u32 getIndexSize() const = 0;
66
67 virtual void setIndex(u32 id, u32 index) = 0;
68
69 virtual void setDirty() = 0;
70
71 virtual u32 getChangedID() const = 0;
72
73 video::IHardwareBuffer* getHardwareBuffer() const
74 {
75 return HardwareBuffer;
76 }
77
78 // externalMemoryHandler parameter is used only by hardware buffers.
79 void setHardwareBuffer(video::IHardwareBuffer* hardwareBuffer, bool externalMemoryHandler = false)
80 {
81 if (!externalMemoryHandler && HardwareBuffer)
82 HardwareBuffer->drop();
83
84 HardwareBuffer = hardwareBuffer;
85
86 if (!externalMemoryHandler && HardwareBuffer)
87 HardwareBuffer->grab();
88 }
89
90 protected:
91 video::IHardwareBuffer* HardwareBuffer;
92 };
93}
94}
95
96#endif
bool drop() const
Drops the object. Decrements the reference counter by one.
Definition IReferenceCounted.h:126
void grab() const
Grabs the object. Increments the reference counter by one.
Definition IReferenceCounted.h:96
IReferenceCounted()
Constructor.
Definition IReferenceCounted.h:50
Definition IHardwareBuffer.h:60
All scene management can be found in this namespace: Mesh loading, special scene nodes like octrees a...
Definition CIndexBuffer.h:13
E_HARDWARE_MAPPING
Definition EHardwareBufferFlags.h:14
The video namespace contains classes for accessing the video driver. All 2d and 3d rendering is done ...
Definition EDriverFeatures.h:11
Everything in the Irrlicht Engine can be found in this namespace.
Definition Skylicht.h:33
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.h:58
signed int s32
32 bit signed variable.
Definition irrTypes.h:66