#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2013 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #ifndef NUCLEX_GRAPHICS_RASTERIZATION_GENERICINDEXBUFFER_H #define NUCLEX_GRAPHICS_RASTERIZATION_GENERICINDEXBUFFER_H #include "Buffer.h" namespace Nuclex { namespace Graphics { namespace Rasterization { // ------------------------------------------------------------------------------------------- // /// Stores indices used to connect vertices to primitives class GenericIndexBuffer : public Buffer { /// Initializes a new index buffer with the specified capacity /// Number of bytes to reserve for this buffer /// How the index buffer is going to be accessed protected: NUCLEX_GRAPHICS_API GenericIndexBuffer( std::size_t capacityInBytes, Usage::Enum usage ) : Buffer(capacityInBytes), usage(usage) {} /// Initializes a new index buffer by copying an existing index buffer /// Existing index buffer that will be copied protected: NUCLEX_GRAPHICS_API GenericIndexBuffer(const GenericIndexBuffer &other) : Buffer(other), usage(other.usage) {} /// Checks whether this index buffer is using 32 bit indices /// True if the index buffer uses 32 bit indices public: virtual bool Is32BitIndexBuffer() const = 0; /// Retrieves the total capacity of the index buffer in indices /// The capacity of the index buffer in indices public: virtual std::size_t GetCapacityInIndices() const = 0; /// Retrieves the number of indices that have been used /// The number of used indices in the index buffer public: virtual std::size_t CountUsedIndices() const = 0; /// Returns the usage this index buffer is intended for /// The intended usage pattern of the index buffer public: NUCLEX_GRAPHICS_API Usage::Enum GetUsage() const { return this->usage; } /// Copies the contents of another buffer into this buffer /// Other buffer whose contents will be copied /// A reference to this buffer protected: NUCLEX_GRAPHICS_API GenericIndexBuffer &operator =( const GenericIndexBuffer &other ) { Buffer::operator=(other); this->usage = other.usage; return *this; } /// How the index buffer will be accessed private: Usage::Enum usage; }; // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Graphics::Rasterization #endif // NUCLEX_GRAPHICS_RASTERIZATION_GENERICINDEXBUFFER_H