#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_GENERICVERTEXBUFFER_H #define NUCLEX_GRAPHICS_RASTERIZATION_GENERICVERTEXBUFFER_H #include "Buffer.h" #include "../VertexElement.h" namespace Nuclex { namespace Graphics { namespace Rasterization { // ------------------------------------------------------------------------------------------- // ///Stores vertices used to define geometric features for rasterization class GenericVertexBuffer : public Buffer { /// Initializes a new vertex buffer with the specified capacity /// Number of bytes to reserve for this buffer /// How the vertex buffer will be accessed protected: NUCLEX_GRAPHICS_API GenericVertexBuffer( 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 GenericVertexBuffer(const GenericVertexBuffer &other) : Buffer(other), usage(other.usage) {} /// Retrieves the stride to get from one vertex to the next /// The stride of the vertex buffer in bytes public: virtual std::size_t GetStride() const = 0; /// Retrieves the total capacity of the vertex buffer in vertices /// The capacity of the vertex buffer in vertices public: virtual std::size_t GetCapacityInVertices() const = 0; /// Counts the number of vertices that have been used /// The number of used vertices in the vertex buffer public: virtual std::size_t CountUsedVertices() const = 0; /// Counts the number of elements a vertex consists of /// The number of elements in a vertex public: virtual std::size_t CountVertexElements() const = 0; /// Retrieves an array describing the elements a vertex consists of /// An array describing the elements a vertices are made up from public: virtual const VertexElement *GetVertexElements() const = 0; /// Returns the usage this vertex buffer is intended for /// The intended usage pattern of the vertex 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 GenericVertexBuffer &operator =( const GenericVertexBuffer &other ) { Buffer::operator=(other); this->usage = other.usage; return *this; } /// How the vertex buffer will be accessed private: Usage::Enum usage; }; // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Graphics::Rasterization #endif // NUCLEX_GRAPHICS_RASTERIZATION_GENERICVERTEXBUFFER_H