Skip to content

Commit c62b6d5

Browse files
committed
coord/bufferind renaming
1 parent 5589bc5 commit c62b6d5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

include/polyscope/pick.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct PickResult {
3939
// Query functions to evaluate a pick.
4040
// Internally, these do a render pass to populate relevant information, then query the resulting buffers.
4141
PickResult queryPickAtScreenCoords(glm::vec2 screenCoords); // takes screen coordinates
42-
PickResult queryPickAtBufferCoords(int xPos, int yPos); // takes indices into render buffer
42+
PickResult queryPickAtBufferInds(glm::ivec2 bufferInds); // takes indices into render buffer
4343

4444
namespace pick {
4545

src/pick.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ namespace polyscope {
1212

1313
PickResult queryPickAtScreenCoords(glm::vec2 screenCoords) {
1414
int xInd, yInd;
15-
std::tie(xInd, yInd) = view::screenCoordsToBufferInds(screenCoords);
16-
return queryPickAtBufferCoords(xInd, yInd);
15+
glm::ivec2 bufferInds = view::screenCoordsToBufferIndsVec(screenCoords);
16+
return queryPickAtBufferInds(bufferInds);
1717
}
18-
PickResult queryPickAtBufferCoords(int xPos, int yPos) {
18+
PickResult queryPickAtBufferInds(glm::ivec2 bufferInds) {
1919
PickResult result;
2020

2121
// Query the render buffer
22-
result.position = view::bufferCoordsToWorldPosition(xPos, yPos);
22+
result.position = view::bufferIndsToWorldPosition(bufferInds);
2323
result.depth = glm::length(result.position - view::getCameraWorldPosition());
2424

2525
// Query the pick buffer
26-
std::pair<Structure*, size_t> rawPickResult = pick::pickAtBufferCoords(xPos, yPos);
26+
std::pair<Structure*, size_t> rawPickResult = pick::pickAtBufferCoords(bufferInds.x, bufferInds.y);
2727

2828
// Transcribe result into return tuple
2929
result.structure = rawPickResult.first;
30-
result.bufferCoords = glm::ivec2(xPos, yPos);
31-
result.screenCoords = view::bufferIndsToScreenCoords(xPos, yPos);
30+
result.bufferCoords = bufferInds;
31+
result.screenCoords = view::bufferIndsToScreenCoords(bufferInds);
3232
if (rawPickResult.first == nullptr) {
3333
result.isHit = false;
3434
result.structureType = "";

0 commit comments

Comments
 (0)