Added more texture types
This commit is contained in:
parent
e60328cf04
commit
7c16ca7913
6 changed files with 129 additions and 16 deletions
|
@ -12,7 +12,7 @@ namespace lol
|
|||
{
|
||||
public:
|
||||
Image();
|
||||
Image(unsigned int width, unsigned int height, PixelFormat pixelFormat = PixelFormat::RGBA, PixelType pixelType = PixelType::UByte);
|
||||
Image(unsigned int width, unsigned int height, PixelFormat pixelFormat = PixelFormat::RGB, PixelType pixelType = PixelType::UByte);
|
||||
Image(const std::string& filepath);
|
||||
~Image();
|
||||
|
||||
|
|
|
@ -39,6 +39,14 @@ namespace lol
|
|||
void Bind();
|
||||
void Unbind();
|
||||
|
||||
/**
|
||||
* Set a int uniform
|
||||
*
|
||||
* @param name Name of the uniform
|
||||
* @param value Value of the uniform
|
||||
*/
|
||||
void SetUniform(const std::string& name, int value);
|
||||
|
||||
/**
|
||||
* Set a float uniform
|
||||
*
|
||||
|
@ -55,6 +63,14 @@ namespace lol
|
|||
*/
|
||||
void SetUniform(const std::string& name, const glm::mat4& value);
|
||||
|
||||
/**
|
||||
* Set a 2 component vector uniform
|
||||
*
|
||||
* @param name Name of the uniform
|
||||
* @param value Value of the uniform
|
||||
*/
|
||||
void SetUniform(const std::string& name, const glm::vec2& value);
|
||||
|
||||
/**
|
||||
* Set a 4 component vector uniform
|
||||
*
|
||||
|
|
|
@ -11,18 +11,36 @@ namespace lol
|
|||
class Texture : public NonCopyable
|
||||
{
|
||||
public:
|
||||
Texture(const Image& image, TextureFormat texFormat = TextureFormat::RGB);
|
||||
Texture(TargetTexture target);
|
||||
~Texture();
|
||||
|
||||
void Bind();
|
||||
void Unbind();
|
||||
|
||||
void SetWrap(TextureWrap s, TextureWrap t, TextureWrap r = TextureWrap::Repeat);
|
||||
void SetBorderColor(float r, float g, float b, float a);
|
||||
|
||||
// TODO: Remove again later
|
||||
inline unsigned int GetID() const { return id; }
|
||||
|
||||
private:
|
||||
protected:
|
||||
TargetTexture target;
|
||||
unsigned int id;
|
||||
};
|
||||
|
||||
typedef ObjectManager<Texture> TextureManager;
|
||||
|
||||
|
||||
class Texture2D : public Texture
|
||||
{
|
||||
public:
|
||||
Texture2D(const Image& image, TextureFormat texFormat = TextureFormat::RGB);
|
||||
};
|
||||
|
||||
class Texture1D : public Texture
|
||||
{
|
||||
public:
|
||||
Texture1D(unsigned int width, const void* data, PixelFormat pixFormat = PixelFormat::RGB, PixelType pixType = PixelType::UByte, TextureFormat texFormat = TextureFormat::RGB);
|
||||
Texture1D(const Image& image, TextureFormat texFormat = TextureFormat::RGB);
|
||||
};
|
||||
}
|
|
@ -179,6 +179,24 @@ namespace lol
|
|||
ReadWrite = GL_READ_WRITE
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief OpenGL target texture
|
||||
*/
|
||||
enum class TargetTexture : GLenum
|
||||
{
|
||||
Texture1D = GL_TEXTURE_1D,
|
||||
Texture2D = GL_TEXTURE_2D,
|
||||
Texture3D = GL_TEXTURE_3D,
|
||||
Array1D = GL_TEXTURE_1D_ARRAY,
|
||||
Array2D = GL_TEXTURE_2D_ARRAY,
|
||||
Rectangle = GL_TEXTURE_RECTANGLE,
|
||||
Cubemap = GL_TEXTURE_CUBE_MAP,
|
||||
CubemapArray = GL_TEXTURE_CUBE_MAP_ARRAY,
|
||||
Buffer = GL_TEXTURE_BUFFER,
|
||||
Multisample = GL_TEXTURE_2D_MULTISAMPLE,
|
||||
MultisampleArra = GL_TEXTURE_2D_MULTISAMPLE_ARRAY
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief OpenGL internal texture formats
|
||||
*/
|
||||
|
@ -309,4 +327,13 @@ namespace lol
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
enum class TextureWrap : GLenum
|
||||
{
|
||||
ClampToEdge = GL_CLAMP_TO_EDGE,
|
||||
ClampToBorder = GL_CLAMP_TO_BORDER,
|
||||
MirroredRepeat = GL_MIRRORED_REPEAT,
|
||||
Repeat = GL_REPEAT,
|
||||
MirrorClampToEdge = GL_MIRROR_CLAMP_TO_EDGE
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue