//----------------------------------------------------------------------------------- // //----------------------------------------------------------------------------------- #include "EffekseerRenderer.IndexBufferBase.h" //----------------------------------------------------------------------------------- // //----------------------------------------------------------------------------------- namespace EffekseerRenderer { //----------------------------------------------------------------------------------- // //----------------------------------------------------------------------------------- IndexBufferBase::IndexBufferBase(int maxCount, bool isDynamic) : m_indexMaxCount(maxCount) , m_indexCount(0) , m_isDynamic(false) , m_isLock(false) , m_resource(nullptr) { } //----------------------------------------------------------------------------------- // //----------------------------------------------------------------------------------- IndexBufferBase::~IndexBufferBase() { } //----------------------------------------------------------------------------------- // //----------------------------------------------------------------------------------- void IndexBufferBase::Push(const void* buffer, int count) { assert(m_isLock); memcpy(GetBufferDirect(count), buffer, count * stride_); } //----------------------------------------------------------------------------------- // //----------------------------------------------------------------------------------- int IndexBufferBase::GetCount() const { return m_indexCount; } //----------------------------------------------------------------------------------- // //----------------------------------------------------------------------------------- int IndexBufferBase::GetMaxCount() const { return m_indexMaxCount; } //----------------------------------------------------------------------------------- // //----------------------------------------------------------------------------------- void* IndexBufferBase::GetBufferDirect(int count) { assert(m_isLock); assert(m_indexMaxCount >= m_indexCount + count); uint8_t* pBuffer = nullptr; pBuffer = (uint8_t*)m_resource + (m_indexCount * stride_); m_indexCount += count; return pBuffer; } //----------------------------------------------------------------------------------- // //----------------------------------------------------------------------------------- } // namespace EffekseerRenderer //----------------------------------------------------------------------------------- // //-----------------------------------------------------------------------------------