Textures are working now

This commit is contained in:
2023-11-19 11:39:48 -06:00
parent 0515c48815
commit 688658c8e9
9 changed files with 93 additions and 69 deletions

View File

@ -39,7 +39,8 @@ namespace Dawn {
/**
* Cleans up the render pass.
*/
virtual ~IRenderPass() { }
virtual ~IRenderPass() {
}
};
template<class S, typename D>
@ -48,7 +49,7 @@ namespace Dawn {
std::shared_ptr<S> shader;
const std::unordered_map<
shadertexturebinding_t, std::shared_ptr<Texture>
> &textures;
> textures;
std::shared_ptr<Mesh> mesh;
const enum MeshDrawMode drawMode;
const int32_t indiceStart;
@ -98,7 +99,6 @@ namespace Dawn {
}
void bind() override {
std::cout << "textures: " << textures.size() << "\n";
shader->bind();
}
@ -108,7 +108,6 @@ namespace Dawn {
void upload() override {
for(auto &pair : textures) {
assertNotNull(pair.second, "Texture cannot be null!");
pair.second->bind(pair.first);
}
shader->upload();
@ -119,6 +118,9 @@ namespace Dawn {
mesh->draw(drawMode, indiceStart, indiceCount);
}
}
~RenderPass() override {
}
};
struct RenderPassContext {

View File

@ -19,7 +19,6 @@ void SimpleTexturedMaterial::setTexture(std::shared_ptr<Texture> texture) {
this->texture = texture;
}
void SimpleTexturedMaterial::setColor(const struct Color color) {
this->data.color = color;
}
@ -30,7 +29,6 @@ std::vector<std::shared_ptr<IRenderPass>> SimpleTexturedMaterial::getPasses(
this->data.model = this->getItem()->getWorldTransform();
this->data.projection = ctx.camera->getProjection();
this->data.view = ctx.camera->getItem()->getWorldTransform();
this->data.color = COLOR_RED;
auto textures = std::unordered_map<
shadertexturebinding_t, std::shared_ptr<Texture>
>();