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

Combined UsdVol schema and Hydra changes #567

Merged
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
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
geomSubset
instancer
instanceRegistry
Expand Down Expand Up @@ -90,6 +91,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 @@ -368,6 +368,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 @@ -250,6 +250,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 @@ -556,6 +577,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
5 changes: 4 additions & 1 deletion pxr/imaging/lib/hd/tokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ PXR_NAMESPACE_OPEN_SCOPE
(mesh) \
(basisCurves) \
(points) \
(volume) \
\
/* Sprims */ \
(camera) \
Expand All @@ -224,7 +225,9 @@ PXR_NAMESPACE_OPEN_SCOPE
\
/* Bprims */ \
(texture) \
(renderBuffer)
(renderBuffer) \
(openvdbAsset) \
(field3dAsset)

#define HD_PRIMVAR_ROLE_TOKENS \
((none, "")) \
Expand Down
38 changes: 38 additions & 0 deletions pxr/imaging/lib/hd/volume.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// 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
42 changes: 42 additions & 0 deletions pxr/usd/lib/usdVol/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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
)

40 changes: 40 additions & 0 deletions pxr/usd/lib/usdVol/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#
# 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.
#
import _usdVol
from pxr import Tf
Tf.PrepareModule(_usdVol, locals())
del Tf

try:
import __DOC
__DOC.Execute(locals())
del __DOC
except Exception:
try:
import __tmpDoc
__tmpDoc.Execute(locals())
del __tmpDoc
except:
pass

Loading