Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HYDRA-931 : implement basics of bounding box display style #103

Merged
merged 4 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ HdSceneIndexBaseRefPtr FilteringSceneIndicesChainManager::createFilteringSceneIn
return nullptr;//Not an empty filtering scene indices chain
}

//Append the filtering scene indices chain tp the merging scene index from renderIndexProxy
//Append the filtering scene indices chain to the merging scene index from renderIndexProxy
_AppendFilteringSceneIndicesChain(viewportInformationAndSceneIndicesPerViewportData, inputSceneIndex);

if (viewportInformationAndSceneIndicesPerViewportData.GetLastFilteringSceneIndex() == nullptr){
Expand Down
19 changes: 19 additions & 0 deletions lib/flowViewport/API/samples/fvpDataProducerSceneIndexExample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <pxr/imaging/hd/xformSchema.h>
#include <pxr/imaging/hd/instancerTopologySchema.h>
#include <pxr/imaging/hd/containerDataSourceEditor.h>
#include <pxr/imaging/hd/extentSchema.h>

//TBB headers to use multithreading
#include <tbb/parallel_for.h>
Expand Down Expand Up @@ -484,6 +485,9 @@ HdRetainedSceneIndex::AddedPrimEntry DataProducerSceneIndexExample::_CreateCubeP
.Build()
);

const GfRange3d cubeRange ({-halfSize, -halfSize, -halfSize},
{ halfSize, halfSize, halfSize});

//Add the cube primitive
HdRetainedSceneIndex::AddedPrimEntry addedPrim;
addedPrim.primPath = cubePath;
Expand All @@ -505,6 +509,14 @@ HdRetainedSceneIndex::AddedPrimEntry DataProducerSceneIndexExample::_CreateCubeP
.SetResetXformStack(HdRetainedTypedSampledDataSource<bool>::New(true)) //Mark the transform of prototype not inherit from parent
.Build(),

//Create an extent attribute to support the viewport bounding box display style,
//if no extent attribute is added, it will not be displayed at all in bounding box display style
HdExtentSchemaTokens->extent,
HdExtentSchema::Builder()
.SetMin(HdRetainedTypedSampledDataSource<GfVec3d>::New(cubeRange.GetMin()))
.SetMax(HdRetainedTypedSampledDataSource<GfVec3d>::New(cubeRange.GetMax()))
.Build(),

//create a mesh
HdMeshSchemaTokens->mesh,
meshDs,
Expand All @@ -524,6 +536,13 @@ HdRetainedSceneIndex::AddedPrimEntry DataProducerSceneIndexExample::_CreateCubeP
.SetMatrix(HdRetainedTypedSampledDataSource<GfMatrix4d>::New(
transform)).Build(),

//create an extent attribute to easily compute the bounding box from it
HdExtentSchemaTokens->extent,
HdExtentSchema::Builder()
.SetMin(HdRetainedTypedSampledDataSource<GfVec3d>::New(cubeRange.GetMin()))
.SetMax(HdRetainedTypedSampledDataSource<GfVec3d>::New(cubeRange.GetMax()))
.Build(),

//create a mesh
HdMeshSchemaTokens->mesh,
meshDs,
Expand Down
2 changes: 2 additions & 0 deletions lib/flowViewport/sceneIndex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ target_sources(${TARGET_NAME}
fvpSceneIndexUtils.cpp
fvpSelectionSceneIndex.cpp
fvpWireframeSelectionHighlightSceneIndex.cpp
fvpBBoxSceneIndex.cpp
)

set(HEADERS
Expand All @@ -21,6 +22,7 @@ set(HEADERS
fvpSceneIndexUtils.h
fvpSelectionSceneIndex.h
fvpWireframeSelectionHighlightSceneIndex.h
fvpBBoxSceneIndex.h
)

# -----------------------------------------------------------------------------
Expand Down
Loading