Texture.cpp
Go to the documentation of this file.
1 #include "Texture.hpp"
2 
5 
6 namespace iv
7 {
8 
10 {
11  { Texture::Filtering::Nearest, "Nearest" },
12  { Texture::Filtering::SmoothMsdf, "SmoothMsdf" },
13  { Texture::Filtering::Smooth2D, "Smooth2D" },
14  { Texture::Filtering::Smooth3D, "Smooth3D" }
15 };
16 
18  size( 0, 0 ),
19  density( 1.0 ),
20  filtering( Filtering::Nearest ),
21  format( PixelFormat::RGBA ),
22  color_space( ColorSpace::sRGB ),
23  msdf_pixelRange( 1.0f ),
24  hitmap( false ),
25  instant_loading( false )
26 {
27 }
28 
30  cm( inst, this, "Texture" ),
31  _metadata(),
32  _gl_texture(),
33  _hitmap(),
34  inst( inst )
35 {
36 }
37 
39 {
40  return this->inst;
41 }
42 
44 {
45  return this->_metadata;
46 }
47 
49 {
50  return &this->_gl_texture;
51 }
52 
53 bool Texture::hittest( int x, int y ) const
54 {
55  int id = y * this->_metadata.size.x + x;
56  if( id < 0 || id >= this->_hitmap.size() )
57  return false;
58  return this->_hitmap[ id ];
59 }
60 
61 }