Simulant  21.12-246
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
dds_texture_loader.h
1 #pragma once
2 
3 #include "texture_loader.h"
4 
5 namespace smlt {
6 namespace loaders {
7 
8 /*
9  * Ideally this wouldn't exist as SOIL does load DDS automatically, however, it doesn't
10  * seem like there is any way to read the S3TC format back once it's loaded :(
11  */
12 
14 public:
15  DDSTextureLoader(const Path& filename, std::shared_ptr<std::istream> data):
16  BaseTextureLoader(filename, data) {}
17 
18 private:
19  TextureLoadResult do_load(std::shared_ptr<FileIfstream> stream) override;
20 };
21 
23 public:
25  // Always add the texture hint
26  add_hint(LOADER_HINT_TEXTURE);
27  }
28 
29  virtual ~DDSTextureLoaderType() {}
30 
31  const char* name() override { return "dds_texture"; }
32  bool supports(const Path& filename) const override {
33  return filename.ext() == ".dds";
34  }
35 
36  Loader::ptr loader_for(const Path& filename, std::shared_ptr<std::istream> data) const override {
37  return Loader::ptr(new DDSTextureLoader(filename, data));
38  }
39 };
40 
41 }
42 }
smlt::TextureLoadResult
Definition: loader.h:133
smlt
Definition: animation.cpp:25
smlt::LoaderType
Definition: loader.h:111
smlt::loaders::DDSTextureLoaderType
Definition: dds_texture_loader.h:22
smlt::loaders::BaseTextureLoader
Definition: loader.h:143
smlt::Path
Definition: path.h:7
smlt::loaders::DDSTextureLoader
Definition: dds_texture_loader.h:13