CMSC23700 Common Code Library
Support code for CS23700 programming projects
Loading...
Searching...
No Matches
tqt.hpp
Go to the documentation of this file.
1
8/*
9 * COPYRIGHT (c) 2023 John Reppy (http://cs.uchicago.edu/~jhr)
10 * All rights reserved.
11 */
12
13#ifndef _TQT_HPP_
14#define _TQT_HPP_
15
16#include "cs237.hpp"
17#include <vector>
18
19namespace tqt {
20
24public:
25
30 TextureQTree (std::string const &filename, bool flip, bool sRGB);
32
34 bool isValid () const { return this->_source != nullptr; }
36 int depth() const { return this->_depth; }
38 int tileSize() const { return this->_tileSize; }
39
47 cs237::Image2D *loadImage (int level, int row, int col);
48
50 bool sRGB () const { return this->_sRGB; }
51
53 static bool isTQTFile (std::string const &filename);
54
55private:
56 std::vector<std::streamoff> _toc;
57 int _depth;
58 int _tileSize;
59 bool _flip;
61 bool _sRGB;
62 std::ifstream *_source;
63
64}; // class TextureQTree
65
66} // namespace tqt
67
68#endif // !_TQT_HPP_
Definition cs237-image.hpp:139
Definition tqt.hpp:23
bool isValid() const
is this a valid TQT?
Definition tqt.hpp:34
TextureQTree(std::string const &filename, bool flip, bool sRGB)
constructor for a texture quad tree
int tileSize() const
the size of a texture tile measured in pixels (tiles are always square)
Definition tqt.hpp:38
int depth() const
the depth of the TQT
Definition tqt.hpp:36
static bool isTQTFile(std::string const &filename)
return true if the file looks like a TQT file of the right version
cs237::Image2D * loadImage(int level, int row, int col)
return the image tile at the specified quadtree node.
bool sRGB() const
are the images sRGB?
Definition tqt.hpp:50
Definition tqt.hpp:19