MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / isMouseOnGroup

Method isMouseOnGroup

Source/RenderPasses/SDFEditor/SelectionWheel.cpp:145–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145bool Falcor::SelectionWheel::isMouseOnGroup(const float2& mousePos, uint32_t groupIndex, uint32_t& sectorIndex)
146{
147 FALCOR_CHECK(groupIndex < (uint32_t)mDescription.sectorGroups.size(), "'groupIndex' ({}) is out of bounds.", groupIndex);
148
149 float dirLength, mouseAngle;
150 computeMouseAngleAndDirLength(mousePos, mouseAngle, dirLength);
151
152 float minRotation = getRotationOfSector(groupIndex, 0);
153 float sectorAngle = getAngleOfSectorInGroup(groupIndex);
154 float maxRotation = minRotation + sectorAngle * mDescription.sectorGroups[groupIndex];
155
156 bool isInGroup = minRotation <= mouseAngle && mouseAngle <= maxRotation && dirLength >= mDescription.minRadius &&
157 dirLength <= mDescription.maxRadius;
158
159 if (isInGroup)
160 {
161 sectorIndex = (uint32_t)std::floor((mouseAngle - minRotation) / sectorAngle);
162 }
163 else
164 {
165 sectorIndex = kInvalidIndex;
166 }
167
168 return isInGroup;
169}
170
171float2 Falcor::SelectionWheel::getCenterPositionOfSector(uint32_t groupIndex, uint32_t sectorIndex)
172{

Callers 1

setup2DGUIMethod · 0.80

Calls 2

floorFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected