Skip to content

Commit

Permalink
Merge pull request #567 from marktucker/dev_usdvol_combined
Browse files Browse the repository at this point in the history
Combined UsdVol schema and Hydra changes

(Internal change: 1890691)
  • Loading branch information
pixar-oss committed Sep 7, 2018
2 parents 1ad18fc + 98233d9 commit 2fbc0ac
Show file tree
Hide file tree
Showing 56 changed files with 5,131 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pxr/imaging/lib/hd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pxr_library(hd
extCompPrimvarBufferSource
extComputation
extComputationContext
field
flatNormals
geomSubset
instancer
Expand Down Expand Up @@ -91,6 +92,7 @@ pxr_library(hd
unitTestNullRenderDelegate
unitTestNullRenderPass
vertexAdjacency
volume
vtBufferSource

PUBLIC_HEADERS
Expand Down
37 changes: 37 additions & 0 deletions pxr/imaging/lib/hd/field.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// Copyright 2018 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#include "pxr/imaging/hd/field.h"

PXR_NAMESPACE_OPEN_SCOPE

HdField::HdField(SdfPath const &id)
: HdBprim(id)
{
}

HdField::~HdField()
{
}

PXR_NAMESPACE_CLOSE_SCOPE
66 changes: 66 additions & 0 deletions pxr/imaging/lib/hd/field.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// Copyright 2018 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#ifndef HD_FIELD_H
#define HD_FIELD_H

#include "pxr/pxr.h"
#include "pxr/imaging/hd/api.h"
#include "pxr/imaging/hd/version.h"
#include "pxr/imaging/hd/bprim.h"

#include <boost/shared_ptr.hpp>

#include <vector>

PXR_NAMESPACE_OPEN_SCOPE

class HdSceneDelegate;
typedef boost::shared_ptr<class HdField> HdFieldSharedPtr;
typedef std::vector<class HdField const *> HdFieldPtrConstVector;

/// \class HdField
///
/// Hydra schema for a USD field primitive. Acts like a texture, combined
/// with other fields to make up a renderable volume.
///
class HdField : public HdBprim {
public:
HD_API
HdField(SdfPath const & id);
HD_API
virtual ~HdField();

// Change tracking for HdField
enum DirtyBits : HdDirtyBits {
Clean = 0,
DirtyTransform = 1 << 0,
DirtyParams = 1 << 1,
AllDirty = (DirtyTransform
|DirtyParams)
};
};

PXR_NAMESPACE_CLOSE_SCOPE

#endif // HD_FIELD_H
11 changes: 11 additions & 0 deletions pxr/imaging/lib/hd/sceneDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,17 @@ HdSceneDelegate::GetClipPlanes(SdfPath const& cameraId)
return std::vector<GfVec4d>();
}

// -----------------------------------------------------------------------//
/// \name Volume Aspects
// -----------------------------------------------------------------------//

/*virtual*/
HdVolumeFieldDescriptorVector
HdSceneDelegate::GetVolumeFieldDescriptors(SdfPath const &volumeId)
{
return HdVolumeFieldDescriptorVector();
}

// -----------------------------------------------------------------------//
/// \name ExtComputation Aspects
// -----------------------------------------------------------------------//
Expand Down
29 changes: 29 additions & 0 deletions pxr/imaging/lib/hd/sceneDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,27 @@ struct HdRenderBufferDescriptor {
bool multiSampled;
};

/// \struct HdVolumeFieldDescriptor
///
/// Description of a single field related to a volume primitive.
///
struct HdVolumeFieldDescriptor {
TfToken fieldName;
TfToken fieldPrimType;
SdfPath fieldId;

HdVolumeFieldDescriptor() {}
HdVolumeFieldDescriptor(
TfToken const & fieldName_,
TfToken const & fieldPrimType_,
SdfPath const & fieldId_)
: fieldName(fieldName_), fieldPrimType(fieldPrimType_), fieldId(fieldId_)
{ }
};

typedef std::vector<HdVolumeFieldDescriptor>
HdVolumeFieldDescriptorVector;

/// \class HdSceneDelegate
///
/// Adapter class providing data exchange with the client scene graph.
Expand Down Expand Up @@ -558,6 +579,14 @@ class HdSceneDelegate {
HD_API
virtual std::vector<GfVec4d> GetClipPlanes(SdfPath const& cameraId);

// -----------------------------------------------------------------------//
/// \name Volume Aspects
// -----------------------------------------------------------------------//

HD_API
virtual HdVolumeFieldDescriptorVector
GetVolumeFieldDescriptors(SdfPath const &volumeId);

// -----------------------------------------------------------------------//
/// \name ExtComputation Aspects
// -----------------------------------------------------------------------//
Expand Down
3 changes: 1 addition & 2 deletions pxr/imaging/lib/hd/tokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

PXR_NAMESPACE_OPEN_SCOPE


#define HD_TOKENS \
(adjacency) \
(bboxLocalMin) \
Expand Down Expand Up @@ -189,7 +188,6 @@ PXR_NAMESPACE_OPEN_SCOPE
(worldToViewMatrix) \
(worldToViewInverseMatrix)


#define HD_OPTION_TOKENS \
(parallelRprimSync)

Expand All @@ -198,6 +196,7 @@ PXR_NAMESPACE_OPEN_SCOPE
(mesh) \
(basisCurves) \
(points) \
(volume) \
\
/* Sprims */ \
(camera) \
Expand Down
37 changes: 37 additions & 0 deletions pxr/imaging/lib/hd/volume.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// Copyright 2018 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#include "pxr/imaging/hd/volume.h"

PXR_NAMESPACE_OPEN_SCOPE

HdVolume::HdVolume(SdfPath const& id, SdfPath const& instancerId)
: HdRprim(id, instancerId)
{
}

HdVolume::~HdVolume()
{
}

PXR_NAMESPACE_CLOSE_SCOPE
57 changes: 57 additions & 0 deletions pxr/imaging/lib/hd/volume.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//
// Copyright 2018 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#ifndef HD_VOLUME_H
#define HD_VOLUME_H

#include "pxr/pxr.h"
#include "pxr/imaging/hd/api.h"
#include "pxr/imaging/hd/version.h"
#include "pxr/imaging/hd/rprim.h"

#include <boost/shared_ptr.hpp>

#include <vector>

PXR_NAMESPACE_OPEN_SCOPE

class HdSceneDelegate;
typedef boost::shared_ptr<class HdVolume> HdVolumeSharedPtr;
typedef std::vector<class HdVolume const *> HdVolumePtrConstVector;

/// \class HdVolume
///
/// Hd schema for a renderable volume primitive.
///
class HdVolume : public HdRprim {
public:
HD_API
HdVolume(SdfPath const& id, SdfPath const& instancerId = SdfPath());

HD_API
virtual ~HdVolume();
};

PXR_NAMESPACE_CLOSE_SCOPE

#endif // HD_VOLUME_H
1 change: 1 addition & 0 deletions pxr/usd/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set(DIRS
pcp
usd
usdGeom
usdVol
usdLux
usdShade
usdHydra
Expand Down
53 changes: 53 additions & 0 deletions pxr/usd/lib/usdVol/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
set(PXR_PREFIX pxr/usd)
set(PXR_PACKAGE usdVol)

pxr_library(usdVol

LIBRARIES
tf
usd
usdGeom

PUBLIC_CLASSES
volume
fieldBase
fieldAsset
field3DAsset
openVDBAsset
tokens

PUBLIC_HEADERS
api.h

PYTHON_CPPFILES
moduleDeps.cpp

PYMODULE_CPPFILES
module.cpp
wrapVolume.cpp
wrapFieldBase.cpp
wrapFieldAsset.cpp
wrapField3DAsset.cpp
wrapOpenVDBAsset.cpp
wrapTokens.cpp

PYMODULE_FILES
__init__.py

RESOURCE_FILES
generatedSchema.usda
plugInfo.json
schema.usda:usdVol/schema.usda
)

pxr_test_scripts(
testenv/testUsdVolVolume.py
)

pxr_register_test(testUsdVolVolume
PYTHON
COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testUsdVolVolume"
EXPECTED_RETURN_CODE 0
)


0 comments on commit 2fbc0ac

Please sign in to comment.