Slang actually worked.

This commit is contained in:
2024-12-09 20:00:09 -06:00
parent ccd5b36965
commit b3c2e0114f
20 changed files with 2422 additions and 3067 deletions

View File

@@ -23,7 +23,7 @@ void SimpleTexturedMaterial::load(std::shared_ptr<SceneLoadContext> ctx) {
}
struct Color SimpleTexturedMaterial::getColor() {
return this->data.color;
return this->data.data.color;
}
std::shared_ptr<Texture> SimpleTexturedMaterial::getTexture() {
@@ -37,25 +37,25 @@ void SimpleTexturedMaterial::setTexture(
}
void SimpleTexturedMaterial::setColor(const struct Color color) {
this->data.color = color;
this->data.data.color = color;
}
std::vector<std::shared_ptr<IRenderPass>> SimpleTexturedMaterial::getPasses(
struct RenderPassContext &ctx
) {
this->data.model = this->getItem()->getWorldTransform();
this->data.projection = ctx.camera->getProjection();
this->data.view = ctx.camera->getItem()->getWorldTransform();
this->data.data.model = this->getItem()->getWorldTransform();
this->data.data.projection = ctx.camera->getProjection();
this->data.data.view = ctx.camera->getItem()->getWorldTransform();
auto textures = std::unordered_map<
shadertexturebinding_t, std::shared_ptr<Texture>
>();
if(this->texture) {
this->data.hasTexture = true;
this->data.data.hasTexture = true;
this->data.texture = 0;
textures[this->data.texture] = this->texture;
} else {
this->data.hasTexture = false;
this->data.data.hasTexture = false;
}
return {

View File

@@ -9,7 +9,7 @@
namespace Dawn {
class ShaderManager {
private:
std::vector<std::weak_ptr<IShaderBase>> shaders;
std::vector<std::shared_ptr<IShaderBase>> shaders;
public:
/**
@@ -23,7 +23,8 @@ namespace Dawn {
std::shared_ptr<T> getShader() {
auto itShaders = shaders.begin();
while(itShaders != shaders.end()) {
auto shader = itShaders->lock();
// auto shader = itShaders->lock();
auto shader = *itShaders;
if(!shader) {
itShaders = shaders.erase(itShaders);
continue;