Compare commits

...

2 Commits

Author SHA1 Message Date
ohsqueezy a5f55be257 function to get sb::Color as glm::vec4 2023-12-04 21:53:49 -05:00
ohsqueezy ec6a720b24 set texture wrap to clamp 2023-11-30 00:34:54 -05:00
3 changed files with 14 additions and 0 deletions

View File

@ -91,6 +91,11 @@ bool sb::Color::operator<(const sb::Color& color) const
return r < color.r || g < color.g || b < color.b || a < color.a;
}
glm::vec4 sb::Color::normal() const
{
return glm::vec4{r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f};
}
std::ostream& std::operator<<(std::ostream& out, const sb::Color& color)
{
float h, s, v;

View File

@ -55,6 +55,11 @@ public:
bool operator!=(const Color&) const;
bool operator<(const Color&) const;
/*!
* Get the color's RGBA value represented as a 4D vector of values between 0.0 and 1.0.
*/
glm::vec4 normal() const;
template <typename Type>
Color(Type red, Type green, Type blue, Type alpha = 255)
{

View File

@ -47,6 +47,10 @@ void Texture::generate(glm::vec2 size, GLenum format, GLint filter)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
/* Set the texture wrap of this texture */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
sb::Log::gl_errors();
/* Store a copy of size */