diff --git a/samples/materials/scene.cpp b/samples/materials/scene.cpp index e7480cb8..829d0f0e 100644 --- a/samples/materials/scene.cpp +++ b/samples/materials/scene.cpp @@ -115,12 +115,15 @@ void LimitlessMaterials::Scene::setUpModels() { .build() ); - scene.add(Instance::builder() - .model(assets.models.at("sphere")) - .material(assets.materials.at("basic8")) - .position({24.0f, 1.0f, 19.0f }) - .build() - ); + + + auto sphere = Instance::builder() + .model(assets.models.at("sphere")) + .material(assets.materials.at("basic8")) + .position({24.0f, 1.0f, 19.0f }) + .build(); + sphere->makeOutlined(); + scene.add(sphere); auto floor = std::make_shared(); floor->makeOutlined(); diff --git a/shaders/pipeline/gbuffer.frag b/shaders/pipeline/gbuffer.frag index 7ca23957..d20aa26e 100644 --- a/shaders/pipeline/gbuffer.frag +++ b/shaders/pipeline/gbuffer.frag @@ -26,7 +26,7 @@ void main() { info.r = float(mctx.shading_model) / 255.0; // info.g = object type ?; - info.b = 1.0; + info.b = outline; emissive = computeMaterialEmissiveColor(mctx); } diff --git a/src/limitless/instances/model_instance.cpp b/src/limitless/instances/model_instance.cpp index 4a03a7b3..8e7c67e6 100644 --- a/src/limitless/instances/model_instance.cpp +++ b/src/limitless/instances/model_instance.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -44,6 +45,10 @@ void ModelInstance::draw(Context& ctx, const Assets& assets, ShaderType pass, ms return; } + const_cast(uniform_setter).add([&] (ShaderProgram& shader) { + shader.setUniform("outline", outlined ? 1.0f : 0.0f); + }); + for (auto& [name, mesh] : meshes) { mesh.draw(ctx, assets, pass, shader_type, final_matrix, blending, uniform_setter); }