update Assets container - template-based now

This commit is contained in:
MihailRis
2024-06-22 22:30:14 +03:00
parent 848d121099
commit d54b6b2e58
20 changed files with 68 additions and 143 deletions
+3 -3
View File
@@ -59,7 +59,7 @@ Skybox::~Skybox() {
}
void Skybox::drawBackground(Camera* camera, Assets* assets, int width, int height) {
Shader* backShader = assets->getShader("background");
auto backShader = assets->get<Shader>("background");
backShader->use();
backShader->uniformMatrix("u_view", camera->getView(false));
backShader->uniform1f("u_zoom", camera->zoom*camera->getFov()/(M_PI*0.5f));
@@ -107,7 +107,7 @@ void Skybox::draw(
DrawContext ctx = pctx.sub();
ctx.setBlendMode(BlendMode::addition);
Shader* shader = assets->getShader("ui3d");
auto shader = assets->get<Shader>("ui3d");
shader->use();
shader->uniformMatrix("u_projview", camera->getProjView(false));
shader->uniformMatrix("u_apply", glm::mat4(1.0f));
@@ -117,7 +117,7 @@ void Skybox::draw(
float opacity = glm::pow(1.0f-fog, 7.0f);
for (auto& sprite : sprites) {
batch3d->texture(assets->getTexture(sprite.texture));
batch3d->texture(assets->get<Texture>(sprite.texture));
float sangle = daytime * M_PI*2 + sprite.phase;
float distance = sprite.distance;