Skip to content

Commit

Permalink
Merge pull request #64 from hotstreams/fix/color-picker
Browse files Browse the repository at this point in the history
fix color picker
  • Loading branch information
hotstreams authored Jun 17, 2024
2 parents 92fda41 + 772043c commit 9482ce5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/limitless/util/color_picker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ void ColorPicker::onPick(Context& ctx, Assets& assets, Scene& scene, glm::uvec2
}

void ColorPicker::onPick(Context& ctx, Assets& assets, const Instances& instances, glm::uvec2 coords, std::function<void(uint32_t)> callback) {
coords.y = ctx.getSize().y - coords.y;
auto& pick = data.emplace_back(PickData{std::move(callback), coords});

framebuffer.bind();
//TODO: fixme
ctx.clearColor(glm::vec4{0.0f});
ctx.clear(Clear::ColorDepth);

ctx.enable(Capabilities::DepthTest);
ctx.setDepthFunc(DepthFunc::Less);
ctx.setDepthMask(DepthMask::True);

ctx.clearColor(glm::vec4{0.0f, 0.0f, 0.f, 1.f});

framebuffer.clear();

for (auto& wrapper : instances) {
auto& instance = wrapper.get();
const auto id = instance.getId();
Expand Down Expand Up @@ -48,9 +51,9 @@ void ColorPicker::process(Context& ctx) {

framebuffer.unbind();

data.pop_front();

info.callback(convert(color));

data.pop_front();
}
}

Expand Down

0 comments on commit 9482ce5

Please sign in to comment.