Skip to content

Commit

Permalink
Retire unused API UsdImagingGLEngine::TestIntersectionBath().
Browse files Browse the repository at this point in the history
(Internal change: 1905143)
  • Loading branch information
c64kernal authored and pixar-oss committed Oct 26, 2018
1 parent 341c26e commit 5b226e0
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 433 deletions.
53 changes: 0 additions & 53 deletions pxr/usdImaging/lib/usdImagingGL/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,59 +225,6 @@ class UsdImagingGLEngine {
int *outHitInstanceIndex = NULL,
int *outHitElementIndex = NULL) = 0;

/// A callback function to control collating intersection test hits.
/// See the documentation for TestIntersectionBatch() below for more detail.
typedef std::function< SdfPath(const SdfPath&, const SdfPath&, const int) >
PathTranslatorCallback;

struct HitInfo {
GfVec3d worldSpaceHitPoint;
int hitInstanceIndex;
};
typedef TfHashMap<SdfPath, HitInfo, SdfPath::Hash> HitBatch;


/// Finds closest point of intersection with a frustum by rendering a batch.
///
/// This method uses a PickRender and a customized depth buffer to find an
/// approximate point of intersection by rendering. This is less accurate
/// than implicit methods or rendering with GL_SELECT, but leverages any
/// data already cached in the renderer. The resolution of the pick
/// renderer is controlled through \p pickResolution.
///
/// In batched selection scenarios, the path desired may not be as granular
/// as the leaf-level prim. For example, one might want to find the closest
/// hit for all prims underneath a certain path scope, or ignore others
/// altogether.
///
/// The \p pathTranslator receives an \c SdfPath pointing to the hit prim
/// as well as an \c SdfPath pointing to the instancer prim and an integer
/// instance index in the case where the hit is an instanced object. It may
/// return an empty path (signifying an ignored hit), or a different
/// simplified path altogether.
///
/// Returned hits are collated by the translated \c SdfPath above, and
/// placed in the structure pointed to by \p outHit. For each \c SdfPath in
/// the \c HitBatch, the closest found hit point and instance id is given.
/// The intersection point returned is in world space
/// (i.e. \p projectionMatrix and \p viewMatrix factored back out of the
/// result).
///
/// \c outHit is not cleared between consecutive runs -- this allows
/// hits to be accumulated across multiple calls to \cTestIntersection. Hits
/// to any single SdfPath will be overwritten on successive calls.
///
USDIMAGINGGL_API
virtual bool TestIntersectionBatch(
const GfMatrix4d &viewMatrix,
const GfMatrix4d &projectionMatrix,
const GfMatrix4d &worldToLocalSpace,
const SdfPathVector& paths,
const UsdImagingGLRenderParams& params,
unsigned int pickResolution,
PathTranslatorCallback pathTranslator,
HitBatch *outHit) = 0;

/// Using an Id extracted from an Id render, returns the associated
/// rprim path.
///
Expand Down
16 changes: 0 additions & 16 deletions pxr/usdImaging/lib/usdImagingGL/gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,22 +292,6 @@ UsdImagingGL::TestIntersection(
outHitElementIndex);
}

bool
UsdImagingGL::TestIntersectionBatch(
const GfMatrix4d &viewMatrix,
const GfMatrix4d &projectionMatrix,
const GfMatrix4d &worldToLocalSpace,
const SdfPathVector& paths,
const UsdImagingGLRenderParams& params,
unsigned int pickResolution,
PathTranslatorCallback pathTranslator,
HitBatch *outHit)
{
return _engine->TestIntersectionBatch(viewMatrix, projectionMatrix,
worldToLocalSpace, paths, params, pickResolution,
pathTranslator, outHit);
}

/* virtual */
VtDictionary
UsdImagingGL::GetResourceAllocation() const
Expand Down
11 changes: 0 additions & 11 deletions pxr/usdImaging/lib/usdImagingGL/gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,6 @@ class UsdImagingGL : public UsdImagingGLEngine {
int *outHitInstanceIndex = NULL,
int *outHitElementIndex = NULL) override;

USDIMAGINGGL_API
virtual bool TestIntersectionBatch(
const GfMatrix4d &viewMatrix,
const GfMatrix4d &projectionMatrix,
const GfMatrix4d &worldToLocalSpace,
const SdfPathVector& paths,
const UsdImagingGLRenderParams& params,
unsigned int pickResolution,
PathTranslatorCallback pathTranslator,
HitBatch *outHit) override;

USDIMAGINGGL_API
virtual VtDictionary GetResourceAllocation() const;

Expand Down
65 changes: 0 additions & 65 deletions pxr/usdImaging/lib/usdImagingGL/hdEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,71 +464,6 @@ UsdImagingGLHdEngine::TestIntersection(
return true;
}

bool
UsdImagingGLHdEngine::TestIntersectionBatch(
const GfMatrix4d &viewMatrix,
const GfMatrix4d &projectionMatrix,
const GfMatrix4d &worldToLocalSpace,
const SdfPathVector& paths,
const UsdImagingGLRenderParams& params,
unsigned int pickResolution,
PathTranslatorCallback pathTranslator,
HitBatch *outHit)
{
_UpdateHydraCollection(&_intersectCollection, paths, params, &_renderTags);

static const HdCullStyle USD_2_HD_CULL_STYLE[] =
{
HdCullStyleDontCare, // No opinion, unused
HdCullStyleNothing, // CULL_STYLE_NOTHING,
HdCullStyleBack, // CULL_STYLE_BACK,
HdCullStyleFront, // CULL_STYLE_FRONT,
HdCullStyleBackUnlessDoubleSided, // CULL_STYLE_BACK_UNLESS_DOUBLE_SIDED
};
static_assert(((sizeof(USD_2_HD_CULL_STYLE) /
sizeof(USD_2_HD_CULL_STYLE[0]))
== (size_t)UsdImagingGLCullStyle::CULL_STYLE_COUNT),
"enum size mismatch");

HdxIntersector::HitVector allHits;
HdxIntersector::Params qparams;
qparams.viewMatrix = worldToLocalSpace * viewMatrix;
qparams.projectionMatrix = projectionMatrix;
qparams.alphaThreshold = params.alphaThreshold;
qparams.cullStyle = USD_2_HD_CULL_STYLE[(size_t)params.cullStyle];
qparams.renderTags = _renderTags;
qparams.enableSceneMaterials = params.enableSceneMaterials;

_taskController->SetPickResolution(pickResolution);
if (!_taskController->TestIntersection(
&_engine,
_intersectCollection,
qparams,
HdxIntersectionModeTokens->unique,
&allHits)) {
return false;
}

if (!outHit) {
return true;
}

for (const HdxIntersector::Hit& hit : allHits) {
const SdfPath primPath = hit.objectId;
const SdfPath instancerPath = hit.instancerId;
const int instanceIndex = hit.instanceIndex;

HitInfo& info = (*outHit)[pathTranslator(primPath, instancerPath,
instanceIndex)];
info.worldSpaceHitPoint = GfVec3d(hit.worldSpaceHitPoint[0],
hit.worldSpaceHitPoint[1],
hit.worldSpaceHitPoint[2]);
info.hitInstanceIndex = instanceIndex;
}

return true;
}

class _DebugGroupTaskWrapper : public HdTask {
const HdTaskSharedPtr _task;
public:
Expand Down
11 changes: 0 additions & 11 deletions pxr/usdImaging/lib/usdImagingGL/hdEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,6 @@ class UsdImagingGLHdEngine : public UsdImagingGLEngine
int *outHitInstanceIndex = NULL,
int *outHitElementIndex = NULL);

USDIMAGINGGL_API
virtual bool TestIntersectionBatch(
const GfMatrix4d &viewMatrix,
const GfMatrix4d &projectionMatrix,
const GfMatrix4d &worldToLocalSpace,
const SdfPathVector& paths,
const UsdImagingGLRenderParams& params,
unsigned int pickResolution,
PathTranslatorCallback pathTranslator,
HitBatch *outHit);

USDIMAGINGGL_API
virtual VtDictionary GetResourceAllocation() const;

Expand Down
Loading

0 comments on commit 5b226e0

Please sign in to comment.