Skip to content

Commit

Permalink
fixup! SceneGadget : Add normalAt` method
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmehl committed Mar 5, 2024
1 parent 616ac28 commit 2f459dd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/GafferSceneUI/SceneGadget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,9 @@ bool SceneGadget::objectAt( const IECore::LineSegment3f &lineInGadgetSpace, Gaff

auto viewportGadget = ancestor<ViewportGadget>();
const V2f rasterPosition = viewportGadget->gadgetToRasterSpace( lineInGadgetSpace.p1, this );
const LineSegment3f offsetLineInGadgetSpace = viewportGadget->rasterToGadgetSpace( rasterPosition, this );

float depth = std::numeric_limits<float>::max();
bool hit = openGLObjectAt( offsetLineInGadgetSpace, path, depth );
bool hit = openGLObjectAt( lineInGadgetSpace, path, depth );

if( m_outputBuffer )
{
Expand Down Expand Up @@ -546,7 +545,7 @@ bool SceneGadget::objectAt( const IECore::LineSegment3f &lineInGadgetSpace, Gaff
const M44f cameraTransform = cameraWorldTransform * fullTransform().inverse();
cameraTransform.multDirMatrix( V3f( 0.0f, 0.0f, -1.0f ), viewDir );

const V3f traceDir = offsetLineInGadgetSpace.normalizedDirection();
const V3f traceDir = lineInGadgetSpace.normalizedDirection();

depth /= max( 0.00001f, viewDir.dot( traceDir ) );

Expand Down

0 comments on commit 2f459dd

Please sign in to comment.