Expose texture attributes in interface

This commit is contained in:
Dan Paulat 2022-10-05 23:10:23 -05:00
parent 71d873f4b4
commit e4629eb9ef
2 changed files with 80 additions and 16 deletions

View file

@ -5,6 +5,8 @@
#include <memory>
#include <string>
#include <boost/gil/point.hpp>
namespace scwx
{
namespace qt
@ -12,6 +14,44 @@ namespace qt
namespace util
{
struct TextureAttributes
{
TextureAttributes() :
valid_ {false},
position_ {},
size_ {},
sLeft_ {},
sRight_ {},
tTop_ {},
tBottom_ {}
{
}
TextureAttributes(boost::gil::point_t position,
boost::gil::point_t size,
float sLeft,
float sRight,
float tTop,
float tBottom) :
valid_ {true},
position_ {position},
size_ {size},
sLeft_ {sLeft},
sRight_ {sRight},
tTop_ {tTop},
tBottom_ {tBottom}
{
}
bool valid_;
boost::gil::point_t position_;
boost::gil::point_t size_;
float sLeft_;
float sRight_;
float tTop_;
float tBottom_;
};
class TextureAtlas
{
public:
@ -30,6 +70,8 @@ public:
void BuildAtlas(size_t width, size_t height);
GLuint BufferAtlas(gl::OpenGLFunctions& gl);
TextureAttributes GetTextureAttributes(const std::string& name);
private:
class Impl;