|
|
@@ -66,7 +66,7 @@ identity<material> manager::get(identity<shader_program> program,
|
|
|
std::vector<struct uniform> uniforms;
|
|
|
uniforms.push_back({texture_or_uniform(texture, uniform),
|
|
|
shaders::uniform_location(program, uniform)});
|
|
|
- math::vec2i size = make_vector(1, 1);
|
|
|
+ math::vec2i size = get(uniforms[0].texture).size;
|
|
|
// if (!uniforms.empty()) { size = ...; }
|
|
|
return cache.emplace(key, material(program, size, uniforms));
|
|
|
}
|
|
|
@@ -76,6 +76,13 @@ material const & manager::get(identity<material> identity) const {
|
|
|
return cache.values.find(cache.keys.find(identity)->second)->second;
|
|
|
}
|
|
|
|
|
|
+texture const & manager::get(identity<texture> identity) const {
|
|
|
+ auto & cache = pimpl_->textures;
|
|
|
+ auto it = cache.keys.find(identity);
|
|
|
+ if (it == cache.keys.end()) { return texture::WHITE(); }
|
|
|
+ return cache.values.find(it->second)->second;
|
|
|
+}
|
|
|
+
|
|
|
identity<shader> manager::get(shaders::type type,
|
|
|
std::string const & path) const {
|
|
|
auto key = std::make_pair(type, path);
|