From bef228a5bf60905940cbf74eff430e4ecbf2a30c Mon Sep 17 00:00:00 2001 From: Lauchmelder Date: Sun, 26 Dec 2021 21:32:17 +0100 Subject: [PATCH] started documenting --- include/lol/Buffer.hpp | 25 ++++ include/lol/Camera.hpp | 6 +- include/lol/Drawable.hpp | 4 +- include/lol/Image.hpp | 69 +++++++++- include/lol/Shader.hpp | 6 +- include/lol/Texture.hpp | 77 +++++++++++- include/lol/Transformable.hpp | 7 +- include/lol/VertexArrayObject.hpp | 35 +++++- include/lol/util/Enums.hpp | 201 ++++++++++++++++++++---------- src/Image.cpp | 2 +- 10 files changed, 348 insertions(+), 84 deletions(-) diff --git a/include/lol/Buffer.hpp b/include/lol/Buffer.hpp index 9bf0f2b..a512945 100644 --- a/include/lol/Buffer.hpp +++ b/include/lol/Buffer.hpp @@ -10,17 +10,42 @@ namespace lol { /** * @brief Represents a generic buffer object. The buffer is destroyed together with the object + * + * For instantiation the derived types should be used (e.g. VertexBuffer) */ class Buffer : public NonCopyable { public: + /** + * @brief Maps the data of the Buffer to memory + * + * @param access The accessing mode for the memory buffer + * @return A pointer to the data in memory + */ void* Map(Access access); + + /** + * @brief Unmap the Buffer + */ void Unmap(); + /** + * @brief Binds the Buffer + * + */ void Bind(); + + /** + * @brief Unbinds the Buffer + */ void Unbind(); protected: + /** + * @brief Construct a new Buffer object of the desired type + * + * @param target Type of the buffer + */ Buffer(BufferType target); virtual ~Buffer(); diff --git a/include/lol/Camera.hpp b/include/lol/Camera.hpp index fe8aba8..65b3375 100644 --- a/include/lol/Camera.hpp +++ b/include/lol/Camera.hpp @@ -9,6 +9,8 @@ namespace lol // TODO: Find better name /** + * @brief A basic camera implementation + * * A base camera object. It hides away part of the interface of a Transformable * (because e.g. scaling doesn't make sense for a camera), and adds some other * transformation functions that are useful for cameras. @@ -65,7 +67,7 @@ namespace lol /** - * A camera using perspective projection + * @brief A camera using perspective projection */ class Camera : public CameraBase { @@ -99,7 +101,7 @@ namespace lol /** - * A camera using orthographic projection + * @brief A camera using orthographic projection */ class OrthogonalCamera : public CameraBase { diff --git a/include/lol/Drawable.hpp b/include/lol/Drawable.hpp index ef70106..773dcf9 100644 --- a/include/lol/Drawable.hpp +++ b/include/lol/Drawable.hpp @@ -11,7 +11,9 @@ namespace lol class CameraBase; /** - * A class that can be displayed on a screen. + * @brief A class that can be displayed on a screen. + * + * Has references to a VAO and a Shader that this class will use to render a scene to a camera */ class Drawable { diff --git a/include/lol/Image.hpp b/include/lol/Image.hpp index f09d8c0..96e7d06 100644 --- a/include/lol/Image.hpp +++ b/include/lol/Image.hpp @@ -7,22 +7,85 @@ namespace lol { - + /** + * @brief Stores and loads image data + * + * This class is used to store image pixel- and metadata as well as load + * image files from disk. It has no OpenGL equivalent + */ class Image { public: + /** + * @brief Create new "empty" Image + * + * An empty image has a width and height of 0, an empty pixel array and a default PixelFormat (RGB) and PixelType (UByte) + */ Image(); + + /** + * @brief Create a new Image with the given metadata + * + * @param width Width of the image + * @param height Height of the image + * @param pixelFormat Pixel format of the image (i.e. what color channels exist) + * @param pixelType Pixel type of the image (i.e. what datatype each component has) + */ Image(unsigned int width, unsigned int height, PixelFormat pixelFormat = PixelFormat::RGB, PixelType pixelType = PixelType::UByte); + + /** + * @brief Load an Image from disk. + * + * The meta- and pixeldata is acquired from an image file. + * + * @param filepath The image to be loaded + */ Image(const std::string& filepath); + ~Image(); + /** + * @brief Copy data of another Image + * + * @param other The Image to copy from + */ Image(const Image& other); + + /** + * @brief Assign this Image data of another Image + * + * @param other The Image to assign from + * @return The modified Image + */ Image& operator=(const Image& other); - inline const glm::uvec2& GetDimensions() const { return size; } - inline void* GetPixels() const { return pixels; } + /** + * @brief Get the dimensions of the image + * + * @return A glm::vec2 with the width and height of the image + */ + inline const glm::uvec2& GetDimensions() const { return size; } + + /** + * @brief Get the raw image pixel data + * + * @return A pointer to an array of pixels that can be directly modified + */ + inline uint8_t* GetPixels() const { return pixels; } + + /** + * @brief Get the format of the Image + * + * @return Format of the Image (i.e. what color channels it has) + */ inline PixelFormat GetPixelFormat() const { return format; } + + /** + * @brief Get the datatype of the pixels in the Image + * + * @return Type of the pixels (i.e. what datatype each color component has) + */ inline PixelType GetPixelType() const { return type; } private: diff --git a/include/lol/Shader.hpp b/include/lol/Shader.hpp index 8c28e96..b52145c 100644 --- a/include/lol/Shader.hpp +++ b/include/lol/Shader.hpp @@ -12,7 +12,7 @@ namespace lol { /** - * Compiles shaders into a program and manages access to that program + * @brief Compiles shaders into a program and manages access to that program */ class Shader : public NonCopyable { @@ -37,6 +37,10 @@ namespace lol * @brief Bind this shader program */ void Bind(); + + /** + * @brief Unbinds the shader program + */ void Unbind(); /** diff --git a/include/lol/Texture.hpp b/include/lol/Texture.hpp index 7e627f1..4379056 100644 --- a/include/lol/Texture.hpp +++ b/include/lol/Texture.hpp @@ -8,20 +8,58 @@ namespace lol { class Image; + /** + * @brief A generic OpenGL Texture + * + * This class is a *generic* texture object. It can represent *any* kind of OpenGL Texture. + * Consider using its derived classes (e.g. Texture1D, Texture2D, ...) + */ class Texture : public NonCopyable { public: + /** + * @brief Generate a new Texture of the specified target + * + * @param target The target of the Texture + */ Texture(TargetTexture target); ~Texture(); + /** + * @brief Bind the Texture + * + */ void Bind(); + + /** + * @brief Unbind the Texture + * + */ void Unbind(); - void SetWrap(TextureWrap s, TextureWrap t, TextureWrap r = TextureWrap::Repeat); - void SetBorderColor(float r, float g, float b, float a); + /** + * @brief Configures how the Texture should wrap + * + * Controls how the GPU will behave when sampling a Texture outside of the + * normal texture area ((0,0) to (1,1)) + * + * @param s Wrapping behaviour in `s` direction ("horizontal") + * @param t Wrapping behaviour in `t` direction ("vertical") + * @param r Wrapping behaviour in `r` direction ("depth") + */ + void SetWrap(TextureWrap s, TextureWrap t = TextureWrap::Repeat, TextureWrap r = TextureWrap::Repeat); - // TODO: Remove again later - inline unsigned int GetID() const { return id; } + /** + * @brief Sets the textures border color + * + * Only effects textures with wrapping mode TextureWrap::ClampToBorder + * + * @param r Red component + * @param g Green component + * @param b Blue component + * @param a Alpha component + */ + void SetBorderColor(float r, float g, float b, float a); protected: TargetTexture target; @@ -29,16 +67,47 @@ namespace lol }; + /** + * @brief A 2D Texture object + */ class Texture2D : public Texture { public: + /** + * @brief Construct a new 2D Texture from an Image + * + * @param image Image to fetch meta- and pixeldata from + * @param texFormat Format of the texture + */ Texture2D(const Image& image, TextureFormat texFormat = TextureFormat::RGB); }; + /** + * @brief A 1D Texture object + */ class Texture1D : public Texture { public: + /** + * @brief Construct a new 1D Texture from raw data + * + * @param width Width of the texture + * @param data Array with pixel color data + * @param pixFormat Format of the pixel data + * @param pixType Datatype of each pixel + * @param texFormat Format of the texture + */ Texture1D(unsigned int width, const void* data, PixelFormat pixFormat = PixelFormat::RGB, PixelType pixType = PixelType::UByte, TextureFormat texFormat = TextureFormat::RGB); + + /** + * @brief Construct a new 1D Texture from an Image + * + * The image doesn't have to have a height of 1 pixel. The texture + * will only use the first row of pixels in the Image + * + * @param image Image to fetch meta- and pixeldata from. + * @param texFormat Format of the texture + */ Texture1D(const Image& image, TextureFormat texFormat = TextureFormat::RGB); }; } \ No newline at end of file diff --git a/include/lol/Transformable.hpp b/include/lol/Transformable.hpp index 158c87c..4977bca 100644 --- a/include/lol/Transformable.hpp +++ b/include/lol/Transformable.hpp @@ -7,13 +7,16 @@ namespace lol { /** - * An object with a position, rotation and scale + * @brief An object with a position, rotation and scale + * + * Represents an object in 3D space. This class handles all the + * calculations needed to create a model matrix */ class Transformable { public: /** - * Create new object at (0, 0, 0), no rotation and default scaling (1) + * @brief Create new object at (0, 0, 0), no rotation and default scaling (1) */ Transformable(); diff --git a/include/lol/VertexArrayObject.hpp b/include/lol/VertexArrayObject.hpp index 2c5cd9f..c480aee 100644 --- a/include/lol/VertexArrayObject.hpp +++ b/include/lol/VertexArrayObject.hpp @@ -10,24 +10,55 @@ namespace lol { /** - * VAO structure that sets up the buffers and deletes them at the end of the lifecycle + * @brief VAO structure that sets up the buffers and deletes them at the end of the lifecycle */ class VertexArray : public NonCopyable { public: /** - * @brief Creates new VAO from a set of vertices and indices and a layout/usage description + * @brief Creates new VAO without binding any buffers and without setting up attribute pointers */ VertexArray(); + + /** + * @brief Construct a new VAO, binds the given buffers and sets up the attribute pointers + * + * @param vertexBuffer The VBO to bind to the VAO + * @param elementBuffer The EBO to bind to the VAO + */ VertexArray(const std::shared_ptr& vertexBuffer, const std::shared_ptr& elementBuffer); + virtual ~VertexArray(); + /** + * @brief Set the EBO the VAO should use for rendering + * + * @param buffer The index buffer that will be rendered + */ void SetElementBuffer(const std::shared_ptr& buffer); + + /** + * @brief Set the VBO the EBO is indexing + * + * @param buffer The vertex buffer that is being indexed in the VAO + */ void SetVertexBuffer(const std::shared_ptr& buffer); + /** + * @brief Binds the VAO + */ void Bind(); + + /** + * @brief Unbinds the VAO + */ void Unbind(); + /** + * @brief Returns the number of indices inside the element buffer + * + * @return Number of elements in the EBO + */ inline size_t GetIndexCount() { return elementBuffer->GetCount(); } private: diff --git a/include/lol/util/Enums.hpp b/include/lol/util/Enums.hpp index 9f3a645..d09d09e 100644 --- a/include/lol/util/Enums.hpp +++ b/include/lol/util/Enums.hpp @@ -13,15 +13,16 @@ namespace lol */ enum class Type : GLenum { - Byte = GL_BYTE, - UByte = GL_UNSIGNED_BYTE, - Short = GL_UNSIGNED_SHORT, - Int = GL_INT, - UInt = GL_UNSIGNED_INT, - Half = GL_HALF_FLOAT, - Float = GL_FLOAT, - Double = GL_DOUBLE, - Fixed = GL_FIXED + Byte = GL_BYTE, ///< Signed 8 bit integer + UByte = GL_UNSIGNED_BYTE, ///< Unsigned 8 bit integer + Short = GL_SHORT, ///< Signed 16 bit integer + UShort = GL_UNSIGNED_SHORT, ///< Unsigned 16 bit integer + Int = GL_INT, ///< Signed 32 bit integer + UInt = GL_UNSIGNED_INT, ///< Unsigned 32 bit integer + Half = GL_HALF_FLOAT, ///< 16 bit half-precision floating point number + Float = GL_FLOAT, ///< 32 bit single-precision floating point number + Double = GL_DOUBLE, ///< 64 bit double-precision floating point number + Fixed = GL_FIXED ///< 32 bit 16.16 fixed decimal number }; /** @@ -52,60 +53,124 @@ namespace lol */ enum class GLSLType : GLenum { - Float = GL_FLOAT, Float2 = GL_FLOAT_VEC2, Float3 = GL_FLOAT_VEC3, Float4 = GL_FLOAT_VEC4, - Double = GL_DOUBLE, Double2 = GL_DOUBLE_VEC2, Double3 = GL_DOUBLE_VEC3, Double4 = GL_DOUBLE_VEC4, - Int = GL_INT, Int2 = GL_INT_VEC2, Int3 = GL_INT_VEC3, Int4 = GL_INT_VEC4, - UInt = GL_UNSIGNED_INT, UInt2 = GL_UNSIGNED_INT_VEC2, UInt3 = GL_UNSIGNED_INT_VEC3, UInt4 = GL_UNSIGNED_INT_VEC4, - Bool = GL_BOOL, Bool2 = GL_BOOL_VEC2, Bool3 = GL_BOOL_VEC3, Bool4 = GL_BOOL_VEC4, + Float = GL_FLOAT, ///< `float` + Float2 = GL_FLOAT_VEC2, ///< `vec2` + Float3 = GL_FLOAT_VEC3, ///< `vec3` + Float4 = GL_FLOAT_VEC4, ///< `vec4` - Mat2 = GL_FLOAT_MAT2, Mat3 = GL_FLOAT_MAT3, Mat4 = GL_FLOAT_MAT4, - Mat2x3 = GL_FLOAT_MAT2x3, Mat2x4 = GL_FLOAT_MAT2x4, Mat3x2 = GL_FLOAT_MAT3x2, - Mat3x4 = GL_FLOAT_MAT3x4, Mat4x2 = GL_FLOAT_MAT4x2, Mat4x3 = GL_FLOAT_MAT4x3, + Double = GL_DOUBLE, ///< `double` + Double2 = GL_DOUBLE_VEC2, ///< `dvec2` + Double3 = GL_DOUBLE_VEC3, ///< `dvec3` + Double4 = GL_DOUBLE_VEC4, ///< `dvec4` - DMat2 = GL_DOUBLE_MAT2, DMat3 = GL_DOUBLE_MAT3, DMat4 = GL_DOUBLE_MAT4, - DMat2x3 = GL_DOUBLE_MAT2x3, DMat2x4 = GL_DOUBLE_MAT2x4, DMat3x2 = GL_DOUBLE_MAT3x2, - DMat3x4 = GL_DOUBLE_MAT3x4, DMat4x2 = GL_DOUBLE_MAT4x2, DMat4x3 = GL_DOUBLE_MAT4x3, + Int = GL_INT, ///< `int` + Int2 = GL_INT_VEC2, ///< `ivec2` + Int3 = GL_INT_VEC3, ///< `ivec3` + Int4 = GL_INT_VEC4, ///< `ivec4` - Sampler1D = GL_SAMPLER_1D, Sampler2D = GL_SAMPLER_2D, - Sampler3D = GL_SAMPLER_3D, SamplerCube = GL_SAMPLER_CUBE, - Sampler1DShadow = GL_SAMPLER_1D_SHADOW, Sampler2DShadow = GL_SAMPLER_2D_SHADOW, - Sampler1DArray = GL_SAMPLER_1D_ARRAY, Sampler2DArray = GL_SAMPLER_2D_ARRAY, - Sampler1DArrayShadow = GL_SAMPLER_1D_ARRAY_SHADOW, Sampler2DArrayShadow = GL_SAMPLER_2D_ARRAY_SHADOW, - Sampler2DMS = GL_SAMPLER_2D_MULTISAMPLE, Sampler2DMSArray = GL_SAMPLER_2D_MULTISAMPLE_ARRAY, - SamplerCubeShadow = GL_SAMPLER_CUBE_SHADOW, SamplerBuffer = GL_SAMPLER_BUFFER, - Sampler2DRect = GL_SAMPLER_2D_RECT, Sampler2DRectShadow = GL_SAMPLER_2D_RECT_SHADOW, + UInt = GL_UNSIGNED_INT, ///< `uint` + UInt2 = GL_UNSIGNED_INT_VEC2, ///< `uvec2` + UInt3 = GL_UNSIGNED_INT_VEC3, ///< `uvec3` + UInt4 = GL_UNSIGNED_INT_VEC4, ///< `uvec4` - ISampler1D = GL_INT_SAMPLER_1D, ISampler2D = GL_INT_SAMPLER_2D, - ISampler3D = GL_INT_SAMPLER_3D, ISamplerCube = GL_INT_SAMPLER_CUBE, - ISampler1DArray = GL_INT_SAMPLER_1D_ARRAY, ISampler2DArray = GL_INT_SAMPLER_2D_ARRAY, - ISampler2DMS = GL_INT_SAMPLER_2D_MULTISAMPLE, ISampler2DMSArray = GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, - ISamplerBuffer = GL_INT_SAMPLER_BUFFER, ISampler2DRect = GL_INT_SAMPLER_2D_RECT, + Bool = GL_BOOL, ///< `bool` + Bool2 = GL_BOOL_VEC2, ///< `bvec2` + Bool3 = GL_BOOL_VEC3, ///< `bvec3` + Bool4 = GL_BOOL_VEC4, ///< `bvec4` - USampler1D = GL_UNSIGNED_INT_SAMPLER_1D, USampler2D = GL_UNSIGNED_INT_SAMPLER_2D, - USampler3D = GL_UNSIGNED_INT_SAMPLER_3D, USamplerCube = GL_UNSIGNED_INT_SAMPLER_CUBE, - USampler1DArray = GL_UNSIGNED_INT_SAMPLER_1D_ARRAY, USampler2DArray = GL_UNSIGNED_INT_SAMPLER_2D_ARRAY, - USampler2DMS = GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE, USampler2DMSArray = GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, - USamplerBuffer = GL_UNSIGNED_INT_SAMPLER_BUFFER, USampler2DRect = GL_UNSIGNED_INT_SAMPLER_2D_RECT, + Mat2 = GL_FLOAT_MAT2, ///< `mat2` + Mat3 = GL_FLOAT_MAT3, ///< `mat3` + Mat4 = GL_FLOAT_MAT4, ///< `mat4` + Mat2x3 = GL_FLOAT_MAT2x3, ///< `mat2x3` + Mat2x4 = GL_FLOAT_MAT2x4, ///< `mat2x4` + Mat3x2 = GL_FLOAT_MAT3x2, ///< `mat3x2` + Mat3x4 = GL_FLOAT_MAT3x4, ///< `mat3x4` + Mat4x2 = GL_FLOAT_MAT4x2, ///< `mat4x2` + Mat4x3 = GL_FLOAT_MAT4x3, ///< `mat4x3` - Image1D = GL_IMAGE_1D, Image2D = GL_IMAGE_2D, - Image3D = GL_IMAGE_3D, Image2DRect = GL_IMAGE_2D_RECT, - ImageCube = GL_IMAGE_CUBE, ImageBuffer = GL_IMAGE_BUFFER, - Image1DArray = GL_IMAGE_1D_ARRAY, Image2DArray = GL_IMAGE_2D_ARRAY, - Image2DMS = GL_IMAGE_2D_MULTISAMPLE, Image2DMSArray = GL_IMAGE_2D_MULTISAMPLE_ARRAY, + DMat2 = GL_DOUBLE_MAT2, ///< `dmat2` + DMat3 = GL_DOUBLE_MAT3, ///< `dmat3` + DMat4 = GL_DOUBLE_MAT4, ///< `dmat4` + DMat2x3 = GL_DOUBLE_MAT2x3, ///< `dmat2x3` + DMat2x4 = GL_DOUBLE_MAT2x4, ///< `dmat2x4` + DMat3x2 = GL_DOUBLE_MAT3x2, ///< `dmat3x2` + DMat3x4 = GL_DOUBLE_MAT3x4, ///< `dmat3x4` + DMat4x2 = GL_DOUBLE_MAT4x2, ///< `dmat4x2` + DMat4x3 = GL_DOUBLE_MAT4x3, ///< `dmat4x3` - IImage1D = GL_INT_IMAGE_1D, IImage2D = GL_INT_IMAGE_2D, - IImage3D = GL_INT_IMAGE_3D, IImage2DRect = GL_INT_IMAGE_2D_RECT, - IImageCube = GL_INT_IMAGE_CUBE, IImageBuffer = GL_INT_IMAGE_BUFFER, - IImage1DArray = GL_INT_IMAGE_1D_ARRAY, IImage2DArray = GL_INT_IMAGE_2D_ARRAY, - IImage2DMS = GL_INT_IMAGE_2D_MULTISAMPLE, IImage2DMSArray = GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY, + Sampler1D = GL_SAMPLER_1D, ///< `sampler1D` + Sampler2D = GL_SAMPLER_2D, ///< `sampler2D` + Sampler3D = GL_SAMPLER_3D, ///< `sampler3D` + SamplerCube = GL_SAMPLER_CUBE, ///< `samplerCube` + Sampler1DArray = GL_SAMPLER_1D_ARRAY, ///< `sampler1DArray` + Sampler2DArray = GL_SAMPLER_2D_ARRAY, ///< `sampler2DArray` + Sampler2DMS = GL_SAMPLER_2D_MULTISAMPLE, ///< `sampler2DMS` + Sampler2DMSArray = GL_SAMPLER_2D_MULTISAMPLE_ARRAY, ///< `sampler2DMSArray` + SamplerBuffer = GL_SAMPLER_BUFFER, ///< `samplerBuffer` + Sampler2DRect = GL_SAMPLER_2D_RECT, ///< `sampler2DRect` + Sampler1DShadow = GL_SAMPLER_1D_SHADOW, ///< `sampler1DShadow` + Sampler2DShadow = GL_SAMPLER_2D_SHADOW, ///< `sampler2DShadow` + Sampler1DArrayShadow = GL_SAMPLER_1D_ARRAY_SHADOW, ///< `sampler1DArrayShadow` + Sampler2DArrayShadow = GL_SAMPLER_2D_ARRAY_SHADOW, ///< `sampler2DArrayShadow` + SamplerCubeShadow = GL_SAMPLER_CUBE_SHADOW, ///< `samplerCubeShadow` + Sampler2DRectShadow = GL_SAMPLER_2D_RECT_SHADOW, ///< `sampler2DRectShadow` - UImage1D = GL_UNSIGNED_INT_IMAGE_1D, UImage2D = GL_UNSIGNED_INT_IMAGE_2D, - UImage3D = GL_UNSIGNED_INT_IMAGE_3D, UImage2DRect = GL_UNSIGNED_INT_IMAGE_2D_RECT, - UImageCube = GL_UNSIGNED_INT_IMAGE_CUBE, UImageBuffer = GL_UNSIGNED_INT_IMAGE_BUFFER, - UImage1DArray = GL_UNSIGNED_INT_IMAGE_1D_ARRAY, UImage2DArray = GL_UNSIGNED_INT_IMAGE_2D_ARRAY, - UImage2DMS = GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE, UImage2DMSArray = GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY, + ISampler1D = GL_INT_SAMPLER_1D, ///< `isampler1D` + ISampler2D = GL_INT_SAMPLER_2D, ///< `isampler2D` + ISampler3D = GL_INT_SAMPLER_3D, ///< `isampler3D` + ISamplerCube = GL_INT_SAMPLER_CUBE, ///< `isamplerCube` + ISampler1DArray = GL_INT_SAMPLER_1D_ARRAY, ///< `isampler1DArray` + ISampler2DArray = GL_INT_SAMPLER_2D_ARRAY, ///< `isampler2DArray` + ISampler2DMS = GL_INT_SAMPLER_2D_MULTISAMPLE, ///< `isampler2DMS` + ISampler2DMSArray = GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, ///< `isampler2DMSArray` + ISamplerBuffer = GL_INT_SAMPLER_BUFFER, ///< `isamplerBuffer` + ISampler2DRect = GL_INT_SAMPLER_2D_RECT, ///< `isampler2DRect` + + USampler1D = GL_UNSIGNED_INT_SAMPLER_1D, ///< `usampler1D` + USampler2D = GL_UNSIGNED_INT_SAMPLER_2D, ///< `usampler2D` + USampler3D = GL_UNSIGNED_INT_SAMPLER_3D, ///< `usampler3D` + USamplerCube = GL_UNSIGNED_INT_SAMPLER_CUBE, ///< `usamplerCube` + USampler1DArray = GL_UNSIGNED_INT_SAMPLER_1D_ARRAY, ///< `usampler1DArray` + USampler2DArray = GL_UNSIGNED_INT_SAMPLER_2D_ARRAY, ///< `usampler2DArray` + USampler2DMS = GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE, ///< `usampler2DMS` + USampler2DMSArray = GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, ///< `usampler2DMSArray` + USamplerBuffer = GL_UNSIGNED_INT_SAMPLER_BUFFER, ///< `usamplerBuffer` + USampler2DRect = GL_UNSIGNED_INT_SAMPLER_2D_RECT, ///< `usampler2DRect` + + Image1D = GL_IMAGE_1D, ///< `image1D` + Image2D = GL_IMAGE_2D, ///< `image2D` + Image3D = GL_IMAGE_3D, ///< `image3D` + ImageCube = GL_IMAGE_CUBE, ///< `imageCube` + ImageBuffer = GL_IMAGE_BUFFER, ///< `imageBuffer` + Image1DArray = GL_IMAGE_1D_ARRAY, ///< `image1DArray` + Image2DArray = GL_IMAGE_2D_ARRAY, ///< `image2DArray` + Image2DMS = GL_IMAGE_2D_MULTISAMPLE, ///< `image2DMS` + Image2DMSArray = GL_IMAGE_2D_MULTISAMPLE_ARRAY, ///< `image2DMSArray` + Image2DRect = GL_IMAGE_2D_RECT, ///< `image2DRect` - AtomicUnit = GL_UNSIGNED_INT_ATOMIC_COUNTER + IImage1D = GL_INT_IMAGE_1D, ///< `iimage1D` + IImage2D = GL_INT_IMAGE_2D, ///< `iimage2D` + IImage3D = GL_INT_IMAGE_3D, ///< `iimage3D` + IImage2DRect = GL_INT_IMAGE_2D_RECT, ///< `iimageCube` + IImageCube = GL_INT_IMAGE_CUBE, ///< `iimageBuffer` + IImageBuffer = GL_INT_IMAGE_BUFFER, ///< `iimage1DArray` + IImage1DArray = GL_INT_IMAGE_1D_ARRAY, ///< `iimage2DArray` + IImage2DArray = GL_INT_IMAGE_2D_ARRAY, ///< `iimage2DMS` + IImage2DMS = GL_INT_IMAGE_2D_MULTISAMPLE, ///< `iimage2DMSArray` + IImage2DMSArray = GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY, ///< `iimage2DRect` + + UImage1D = GL_UNSIGNED_INT_IMAGE_1D, ///< `uimage1D` + UImage2D = GL_UNSIGNED_INT_IMAGE_2D, ///< `uimage2D` + UImage3D = GL_UNSIGNED_INT_IMAGE_3D, ///< `uimage3D` + UImage2DRect = GL_UNSIGNED_INT_IMAGE_2D_RECT, ///< `uimageCube` + UImageCube = GL_UNSIGNED_INT_IMAGE_CUBE, ///< `uimageBuffer` + UImageBuffer = GL_UNSIGNED_INT_IMAGE_BUFFER, ///< `uimage1DArray` + UImage1DArray = GL_UNSIGNED_INT_IMAGE_1D_ARRAY, ///< `uimage2DArray` + UImage2DArray = GL_UNSIGNED_INT_IMAGE_2D_ARRAY, ///< `uimage2DMS` + UImage2DMS = GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE, ///< `uimage2DMSArray` + UImage2DMSArray = GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY, ///< `uimage2DRect` + + AtomicUnit = GL_UNSIGNED_INT_ATOMIC_COUNTER ///< `atomic_uint` }; /** @@ -113,20 +178,20 @@ namespace lol */ enum class BufferType : GLenum { - Array = GL_ARRAY_BUFFER, - AtomicCounter = GL_ATOMIC_COUNTER_BUFFER, - CopyRead = GL_COPY_READ_BUFFER, - CopyWrite = GL_COPY_WRITE_BUFFER, - DispatchIndirect = GL_DISPATCH_INDIRECT_BUFFER, - DrawIndirect = GL_DRAW_INDIRECT_BUFFER, - ElementArray = GL_ELEMENT_ARRAY_BUFFER, - PixelPack = GL_PIXEL_PACK_BUFFER, - PixelUnpack = GL_PIXEL_UNPACK_BUFFER, - Query = GL_QUERY_BUFFER, - ShaderStorage = GL_SHADER_STORAGE_BUFFER, - Texture = GL_TEXTURE_BUFFER, - TransformFeedback = GL_TRANSFORM_FEEDBACK_BUFFER, - Uniform = GL_UNIFORM_BUFFER + Array = GL_ARRAY_BUFFER, ///< Vertex attributes + AtomicCounter = GL_ATOMIC_COUNTER_BUFFER, ///< Atomic counter storage + CopyRead = GL_COPY_READ_BUFFER, ///< Buffer copy source + CopyWrite = GL_COPY_WRITE_BUFFER, ///< Buffer copy destination + DispatchIndirect = GL_DISPATCH_INDIRECT_BUFFER, ///< Indirect compute dispatch commands + DrawIndirect = GL_DRAW_INDIRECT_BUFFER, ///< Indirect command arguments + ElementArray = GL_ELEMENT_ARRAY_BUFFER, ///< Vertex array indices + PixelPack = GL_PIXEL_PACK_BUFFER, ///< Pixel read target + PixelUnpack = GL_PIXEL_UNPACK_BUFFER, ///< Texture data source + Query = GL_QUERY_BUFFER, ///< Query result buffer + ShaderStorage = GL_SHADER_STORAGE_BUFFER, ///< Read-write storage for shaders + Texture = GL_TEXTURE_BUFFER, ///< Texture data buffer + TransformFeedback = GL_TRANSFORM_FEEDBACK_BUFFER, ///< Transform feedback buffer + Uniform = GL_UNIFORM_BUFFER ///< Uniform block storage }; /** diff --git a/src/Image.cpp b/src/Image.cpp index 17bc9f6..1cf96e1 100644 --- a/src/Image.cpp +++ b/src/Image.cpp @@ -6,7 +6,7 @@ namespace lol { Image::Image() : - size(0), pixels(nullptr), format(PixelFormat::RGBA), type(PixelType::UByte) + size(0), pixels(nullptr), format(PixelFormat::RGB), type(PixelType::UByte) { }