CMSC23700 Common Code Library
Support code for CS23700 programming projects
tqt.hxx
Go to the documentation of this file.
1 
10 /*
11  * COPYRIGHT (c) 2015 John Reppy (http://cs.uchicago.edu/~jhr)
12  * All rights reserved.
13  */
14 
15 #ifndef _TQT_HXX_
16 #define _TQT_HXX_
17 
18 #include "cs237.hxx"
19 #include <vector>
20 
21 namespace TQT {
22 
24  class TextureQTree {
25  public:
26 
27  TextureQTree (const char* filename);
28  ~TextureQTree();
29 
31  bool isValid () const { return this->_source != nullptr; }
33  int Depth() const { return this->_depth; }
35  int TileSize() const { return this->_tileSize; }
36 
45  cs237::image2d *LoadImage (int level, int row, int col, bool flip = true);
46 
48  static bool isTQTFile (const char* filename);
49 
50  private:
51  std::vector<std::streamoff> _toc;
52  int _depth;
53  int _tileSize;
54  std::ifstream *_source;
55 
56  }; // class TextureQTree
57 
58 };
59 
60 #endif // !_TQT_HXX_
Definition: tqt.hxx:21
int TileSize() const
the size of a texture tile measured in pixels (tiles are always square)
Definition: tqt.hxx:35
cs237::image2d * LoadImage(int level, int row, int col, bool flip=true)
TextureQTree(const char *filename)
int Depth() const
the depth of the TQT
Definition: tqt.hxx:33
static bool isTQTFile(const char *filename)
return true if the file looks like a TQT file of the right version
Manages a disk-based texture quadtree.
Definition: tqt.hxx:24
Definition: cs237-image.hxx:115
bool isValid() const
is this a valid TQT?
Definition: tqt.hxx:31