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

Method rotateGridPlane

Source/RenderPasses/SDFEditor/SDFEditor.cpp:458–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456}
457
458void SDFEditor::rotateGridPlane(
459 const float mouseDiff,
460 const float3& rotationVector,
461 const float3& inNormal,
462 const float3& inRightVector,
463 float3& outNormal,
464 float3& outRightVector,
465 const bool fromPreviousMouse
466)
467{
468 const float diagonal = length(float2(mFrameDim));
469 const float maxAngle = float(M_PI) * 0.05f;
470 float angle;
471
472 if (fromPreviousMouse)
473 {
474 const float speedFactor = 2.0f * float(M_PI) * 0.075f / diagonal;
475 angle = mouseDiff * std::abs(mouseDiff) * speedFactor;
476 angle = std::clamp(angle, -maxAngle, maxAngle);
477 }
478 else // From the start position -- which is better when doing constrained rotation (around a single axis).
479 {
480 const float speedFactor = 2.0f * float(M_PI) * 0.5f / diagonal;
481 angle = mouseDiff * speedFactor;
482 }
483 float4x4 rotationMatrix = math::rotate(float4x4::identity(), angle, rotationVector);
484
485 outNormal = normalize(transformVector(rotationMatrix, inNormal));
486 outRightVector = normalize(transformVector(rotationMatrix, inRightVector));
487}
488
489void SDFEditor::translateGridPlane(const float mouseDiff, const float3& translationVector, const float3& inPosition, float3& outPosition)
490{

Callers

nothing calls this directly

Calls 6

rotateFunction · 0.85
lengthFunction · 0.50
absFunction · 0.50
clampFunction · 0.50
normalizeFunction · 0.50
transformVectorFunction · 0.50

Tested by

no test coverage detected