WIP: SDL/OpenGL renderer. Make mvedecode use renderer for playback.

This commit is contained in:
2015-04-30 16:16:48 +02:00
parent b9d4048695
commit 7fb5f66091
27 changed files with 1399 additions and 103 deletions

41
render/ProgramProvider.hh Normal file
View File

@@ -0,0 +1,41 @@
#ifndef WC3RE_RENDER_PROGRAMPROVIDER_HH__
#define WC3RE_RENDER_PROGRAMPROVIDER_HH__
#include <unordered_map>
#include "Singleton.hh"
#include "GlResource.hh"
namespace render {
using ProgramProviderKeyType = std::tuple<std::string, std::string>;
}
namespace std
{
template<>
struct hash<render::ProgramProviderKeyType> {
typedef render::ProgramProviderKeyType argument_type;
typedef std::size_t result_type;
result_type operator()(argument_type const& s) const {
const result_type h1{std::hash<std::string>()(std::get<0>(s))};
const result_type h2{std::hash<std::string>()(std::get<1>(s))};
return h1 ^ h2;
}
};
}
namespace render {
class ProgramProvider : public Singleton<ProgramProvider> {
private:
ProgramProvider();
friend class Singleton<ProgramProvider>;
public:
gl::GLuint getProgram(std::string const& vertexShader, std::string const& fragShader);
private:
std::unordered_map<ProgramProviderKeyType, ProgramResource> programCache_;
};
}
#endif