| 506 | } |
| 507 | |
| 508 | void SDFEditor::setup2DGUI() |
| 509 | { |
| 510 | const float2 center = float2(mFrameDim) * 0.5f; |
| 511 | const float minSide = float(std::min(mFrameDim.x, mFrameDim.y)); |
| 512 | const float radius = 0.5f * minSide; |
| 513 | const float markerSize = radius * 0.2f; |
| 514 | const float roundedRadius = markerSize * 0.1f; |
| 515 | |
| 516 | mUI2D.pMarker2DSet->clear(); |
| 517 | |
| 518 | // Draw editing menu wheel. |
| 519 | if (isMainGUIKeyDown() || mUI2D.fadeAwayGUI) |
| 520 | { |
| 521 | float alpha = 1.0f; |
| 522 | if (!isMainGUIKeyDown()) |
| 523 | { |
| 524 | CpuTimer::TimePoint t = mUI2D.timer.getCurrentTimePoint(); |
| 525 | float deltaTime = float(CpuTimer::calcDuration(mUI2D.timeOfReleaseMainGUIKey, t)) * 0.001f; // In seconds. |
| 526 | if (deltaTime >= kFadeAwayDuration) |
| 527 | { |
| 528 | mUI2D.fadeAwayGUI = false; |
| 529 | alpha = 0.0f; |
| 530 | } |
| 531 | else |
| 532 | { |
| 533 | alpha = 1.0f - deltaTime / kFadeAwayDuration; // In [0,1]. |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | float4 multColor = float4(1.0f, 1.0f, 1.0f, alpha); |
| 538 | float4 color = kMarkerColor * multColor; |
| 539 | |
| 540 | SelectionWheel::Desc swDesc; |
| 541 | swDesc.position = center; |
| 542 | swDesc.minRadius = 0.3f * radius; |
| 543 | swDesc.maxRadius = 0.7f * radius; |
| 544 | swDesc.baseColor = float4(0.13f, 0.13f, 0.1523f, 0.8f * alpha); |
| 545 | swDesc.highlightColor = float4(0.4648f, 0.7226f, 0.0f, 0.8f * alpha); |
| 546 | swDesc.sectorGroups = {2, 4}; |
| 547 | swDesc.lineColor = kLineColor * multColor; |
| 548 | swDesc.borderWidth = 10.0f; |
| 549 | mUI2D.pSelectionWheel->update(mUI2D.currentMousePosition, swDesc); |
| 550 | mUI2D.pMarker2DSet->addSimpleMarker( |
| 551 | SDF2DShapeType::Square, markerSize, mUI2D.pSelectionWheel->getCenterPositionOfSector(0, 0), 0.0f, color |
| 552 | ); |
| 553 | mUI2D.pMarker2DSet->addSimpleMarker( |
| 554 | SDF2DShapeType::Circle, markerSize * 0.5f, mUI2D.pSelectionWheel->getCenterPositionOfSector(0, 1), 0.0f, color |
| 555 | ); |
| 556 | setupPrimitiveAndOperation( |
| 557 | mUI2D.pSelectionWheel->getCenterPositionOfSector(1, 0), |
| 558 | markerSize * kMarkerSizeFactor, |
| 559 | mUI2D.currentEditingShape, |
| 560 | SDFOperationType::SmoothSubtraction, |
| 561 | kMarkerColor, |
| 562 | alpha |
| 563 | ); |
| 564 | setupPrimitiveAndOperation( |
| 565 | mUI2D.pSelectionWheel->getCenterPositionOfSector(1, 1), |
nothing calls this directly
no test coverage detected