Texture.cpp
branchv_0
changeset 28 4cbd9c0beb4c
parent 22 12262f2420de
child 29 69903e30b00d
equal deleted inserted replaced
27:2a156cb51479 28:4cbd9c0beb4c
    25 public:
    25 public:
    26 	GLuint id;
    26 	GLuint id;
    27 	std::string fileName;
    27 	std::string fileName;
    28 	int width;
    28 	int width;
    29 	int height;
    29 	int height;
       
    30 	GLfloat scale = 1.;
    30 };
    31 };
    31 
    32 
    32 Texture::Texture(
    33 Texture::Texture(
    33 		int width,
    34 		int width,
    34 		int height,
    35 		int height,
    62 
    63 
    63 GLfloat Texture::getRatio() const {
    64 GLfloat Texture::getRatio() const {
    64 	return (GLfloat) impl->width / (GLfloat) impl->height;
    65 	return (GLfloat) impl->width / (GLfloat) impl->height;
    65 }
    66 }
    66 
    67 
       
    68 GLfloat Texture::getScale() const {
       
    69 	return impl->scale;
       
    70 }
       
    71 
       
    72 void Texture::setScale(GLfloat scale) {
       
    73 	impl->scale = scale;
       
    74 }
       
    75 
    67 void Texture::update(int width, int height, const Buffer& img) {
    76 void Texture::update(int width, int height, const Buffer& img) {
    68 	impl->width = width;
    77 	impl->width = width;
    69 	impl->height = height;
    78 	impl->height = height;
    70 
    79 
    71 	if (img.getSize() != impl->width * impl->height * 4)
    80 	if (img.getSize() != impl->width * impl->height * 4)