Skip to content

Commit

Permalink
fix undefined values and conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
hotstreams committed Aug 30, 2024
1 parent d99b694 commit 5870490
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions include/limitless/instances/instance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace Limitless {
* Instance outline color
*/

glm::vec3 outline_color {};
glm::vec3 outline_color {1.0f};

/**
* Final bounding box
Expand Down Expand Up @@ -123,7 +123,7 @@ namespace Limitless {
/**
* Whether instance can be pickable from ColorPicker
*/
bool pickable {};
bool pickable {true};

/**
* Instance data structure to GPU map
Expand Down
6 changes: 3 additions & 3 deletions shaders/pipeline/color_picker.frag
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ out vec3 color;

vec3 getColorId() {
uint id = getId();
uint r = (id & 0x000000FF) >> 0;
uint g = (id & 0x0000FF00) >> 8;
uint b = (id & 0x00FF0000) >> 16;
uint r = (id & 0x000000FFu) >> 0;
uint g = (id & 0x0000FF00u) >> 8;
uint b = (id & 0x00FF0000u) >> 16;
return vec3(r, g, b) / 255.0;
}

Expand Down
1 change: 1 addition & 0 deletions shaders/pipeline/gbuffer.frag
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ void main() {

info.r = float(mctx.shading_model) / 255.0;
info.g = float(getDecalMask()) / 255.0;
info.b = 0.0;

outline.rgb = getOutlineColor();
outline.a = getIsOutlined() == 1u ? getId() / 65535.0 : 0.0;
Expand Down
5 changes: 5 additions & 0 deletions shaders/pipeline/skybox.frag
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ layout (location = 1) out vec3 normal;
layout (location = 2) out vec3 properties;
layout (location = 3) out vec3 emissive;
layout (location = 4) out vec3 info;
layout (location = 5) out vec4 outline;

void main() {
MaterialContext mctx = computeMaterialContext();
Expand All @@ -24,6 +25,10 @@ void main() {
properties.b = computeMaterialAO(mctx);

info.r = float(mctx.shading_model) / 255.0;
info.g = 0.0;
info.b = 0.0;

outline = vec4(0.0);

emissive = computeMaterialEmissiveColor(mctx);
}
6 changes: 3 additions & 3 deletions src/limitless/renderer/color_picker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ void ColorPicker::process(Context& ctx) {
}

void ColorPicker::render(InstanceRenderer& renderer, [[maybe_unused]] Scene &scene, Context &ctx, const Assets &assets, [[maybe_unused]] const Camera &camera, UniformSetter &setter) {
if (data.empty()) {
return;
}
// if (data.empty()) {
// return;
// }

framebuffer.bind();

Expand Down
3 changes: 2 additions & 1 deletion src/limitless/renderer/skybox_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ void SkyboxPass::render([[maybe_unused]] InstanceRenderer &instance_renderer, Sc
FramebufferAttachment::Color1,
FramebufferAttachment::Color2,
FramebufferAttachment::Color3,
FramebufferAttachment::Color4
FramebufferAttachment::Color4,
FramebufferAttachment::Color5
});

if (auto skybox = scene.getSkybox(); skybox) {
Expand Down

0 comments on commit 5870490

Please sign in to comment.