Files
OpenSpace/modules/volume/textureslicevolumereader.h
2016-05-20 00:39:29 +02:00

35 lines
964 B
C++

#ifndef __TEXTURESLICEVOLUMEREADER_H__
#define __TEXTURESLICEVOLUMEREADER_H__
#include <vector>
#include <ghoul/opengl/texture.h>
#include <memory>
#include <modules/volume/linearlrucache.h>
#include <map>
#include <unordered_map>
namespace openspace {
template <typename Voxel>
class TextureSliceVolumeReader {
public:
typedef Voxel VoxelType;
TextureSliceVolumeReader(std::vector<std::string> paths, size_t sliceCacheMaxItems, size_t sliceCacheSize);
VoxelType get(const glm::ivec3& coordinates) const;
virtual glm::ivec3 dimensions() const;
void setPaths(const std::vector<std::string> paths);
void initialize();
private:
ghoul::opengl::Texture& getSlice(int sliceIndex) const;
std::vector<std::string> _paths;
mutable LinearLruCache<std::shared_ptr<ghoul::opengl::Texture>> _cache;
glm::ivec2 _sliceDimensions;
bool _initialized;
};
}
#include "textureslicevolumereader.inl"
#endif // __TEXTURESLICEVOLUME_H__