| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #include "DXBuffer.h"
- using namespace Framework;
- // Contents of the DXBuffer class
- // Constructor
- // bind: The usage purpose of the buffer. Example: D3D11_BIND_INDEX_BUFFER,
- // D3D11_BIND_VERTEX_BUFFER. eLaen: Length of a single element in bytes
- DXBuffer::DXBuffer(int eLen)
- : ReferenceCounter()
- {
- data = 0;
- changed = 0;
- len = 0;
- elLen = eLen;
- }
- // Destructor
- DXBuffer::~DXBuffer() {}
- // Sets the changed flag so that data is re-copied on the next call to
- // 'copy'
- void DXBuffer::setChanged()
- {
- changed = 1;
- }
- // Changes the length of the buffer on the next call to 'copy'
- // laen: The length in bytes
- void DXBuffer::setLength(__int64 len)
- {
- if (this->len != len)
- {
- this->len = len;
- changed = 1;
- }
- }
- // Sets what will be copied on the next call to 'copy'
- // data: A pointer to the data
- void DXBuffer::setData(void* data, bool shureChanged)
- {
- if (this->data != data || shureChanged)
- {
- this->data = data;
- changed = 1;
- }
- }
- // Returns the length of an element in bytes
- int DXBuffer::getElementLength() const
- {
- return elLen;
- }
- // Returns the number of elements in the buffer
- __int64 DXBuffer::getElementCount() const
- {
- return len / elLen;
- }
|