Skip to content

Commit

Permalink
fix sphere and cylinder picking. (#158)
Browse files Browse the repository at this point in the history
Encoded picking color pass by vertex attribute would be used by raster interpolation, make decoded picking id may not be the precise value passed in,
and this line of debug check may fail:
https://github.com/nmwsharp/polyscope/blob/master/include/polyscope/pick.ipp#L38
  • Loading branch information
baixiaohub authored Feb 6, 2022
1 parent fda65ff commit f46f08b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/render/opengl/shaders/cylinder_shaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,19 +384,19 @@ const ShaderReplacementRule CYLINDER_PROPAGATE_PICK (
in vec3 a_colorTailToGeom[];
in vec3 a_colorTipToGeom[];
in vec3 a_colorEdgeToGeom[];
out vec3 a_colorTailToFrag;
out vec3 a_colorTipToFrag;
out vec3 a_colorEdgeToFrag;
flat out vec3 a_colorTailToFrag;
flat out vec3 a_colorTipToFrag;
flat out vec3 a_colorEdgeToFrag;
)"},
{"GEOM_PER_EMIT", R"(
a_colorTailToFrag = a_colorTailToGeom[0];
a_colorTipToFrag = a_colorTipToGeom[0];
a_colorEdgeToFrag = a_colorEdgeToGeom[0];
)"},
{"FRAG_DECLARATIONS", R"(
in vec3 a_colorTailToFrag;
in vec3 a_colorTipToFrag;
in vec3 a_colorEdgeToFrag;
flat in vec3 a_colorTailToFrag;
flat in vec3 a_colorTipToFrag;
flat in vec3 a_colorEdgeToFrag;
float length2(vec3 x);
)"},
{"GENERATE_SHADE_VALUE", R"(
Expand Down
4 changes: 2 additions & 2 deletions src/render/opengl/shaders/sphere_shaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,13 @@ const ShaderReplacementRule SPHERE_PROPAGATE_COLOR (
)"},
{"GEOM_DECLARATIONS", R"(
in vec3 a_colorToGeom[];
out vec3 a_colorToFrag;
flat out vec3 a_colorToFrag;
)"},
{"GEOM_PER_EMIT", R"(
a_colorToFrag = a_colorToGeom[0];
)"},
{"FRAG_DECLARATIONS", R"(
in vec3 a_colorToFrag;
flat in vec3 a_colorToFrag;
)"},
{"GENERATE_SHADE_VALUE", R"(
vec3 shadeColor = a_colorToFrag;
Expand Down

0 comments on commit f46f08b

Please sign in to comment.