add usd-21-05-win64_py37
This commit is contained in:
1 parent
41d23e71ba
commit
66bc054336
15675 files changed
+3061008
No files matched your search
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// Copyright 2019 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 PXR_USD_IMAGING_USD_APP_UTILS_API_H
|
||||
#define PXR_USD_IMAGING_USD_APP_UTILS_API_H
|
||||
|
||||
#include "pxr/base/arch/export.h"
|
||||
|
||||
#if defined(PXR_STATIC)
|
||||
# define USDAPPUTILS_API
|
||||
# define USDAPPUTILS_API_TEMPLATE_CLASS(...)
|
||||
# define USDAPPUTILS_API_TEMPLATE_STRUCT(...)
|
||||
# define USDAPPUTILS_LOCAL
|
||||
#else
|
||||
# if defined(USDAPPUTILS_EXPORTS)
|
||||
# define USDAPPUTILS_API ARCH_EXPORT
|
||||
# define USDAPPUTILS_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
# define USDAPPUTILS_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
# else
|
||||
# define USDAPPUTILS_API ARCH_IMPORT
|
||||
# define USDAPPUTILS_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
# define USDAPPUTILS_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
# endif
|
||||
# define USDAPPUTILS_LOCAL ARCH_HIDDEN
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// Copyright 2019 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 PXR_USD_IMAGING_USD_APP_UTILS_CAMERA_H
|
||||
#define PXR_USD_IMAGING_USD_APP_UTILS_CAMERA_H
|
||||
|
||||
/// \file usdAppUtils/camera.h
|
||||
///
|
||||
/// Collection of module-scoped utilities for applications that operate using
|
||||
/// USD cameras.
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdAppUtils/api.h"
|
||||
|
||||
#include "pxr/usd/sdf/path.h"
|
||||
#include "pxr/usd/usd/stage.h"
|
||||
#include "pxr/usd/usdGeom/camera.h"
|
||||
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
/// Gets the UsdGeomCamera matching \p cameraPath from the USD stage \p stage.
|
||||
///
|
||||
/// If \p cameraPath is an absolute path, this is equivalent to
|
||||
/// UsdGeomCamera::Get(). Otherwise, if \p cameraPath is a single-element path
|
||||
/// representing just the name of a camera prim, then \p stage will be searched
|
||||
/// looking for a UsdGeomCamera matching that name. The UsdGeomCamera schema
|
||||
/// for that prim will be returned if found, or an invalid UsdGeomCamera will
|
||||
/// be returned if not.
|
||||
///
|
||||
/// Note that if \p cameraPath is a multi-element path, a warning is issued and
|
||||
/// it is just made absolute using the absolute root path before searching. In
|
||||
/// the future, this could potentially be changed to use a suffix-based match.
|
||||
USDAPPUTILS_API
|
||||
UsdGeomCamera UsdAppUtilsGetCameraAtPath(
|
||||
const UsdStagePtr& stage,
|
||||
const SdfPath& cameraPath);
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,138 @@
|
||||
//
|
||||
// Copyright 2019 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 PXR_USD_IMAGING_USD_APP_UTILS_FRAME_RECORDER_H
|
||||
#define PXR_USD_IMAGING_USD_APP_UTILS_FRAME_RECORDER_H
|
||||
|
||||
/// \file usdAppUtils/frameRecorder.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdAppUtils/api.h"
|
||||
|
||||
#include "pxr/base/tf/diagnostic.h"
|
||||
#include "pxr/base/tf/token.h"
|
||||
#include "pxr/usd/usd/stage.h"
|
||||
#include "pxr/usd/usd/timeCode.h"
|
||||
#include "pxr/usd/usdGeom/camera.h"
|
||||
#include "pxr/usdImaging/usdImagingGL/engine.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
/// \class UsdAppUtilsFrameRecorder
|
||||
///
|
||||
/// A utility class for recording images of USD stages.
|
||||
///
|
||||
/// UsdAppUtilsFrameRecorder uses Hydra to produce recorded images of a USD
|
||||
/// stage looking through a particular UsdGeomCamera on that stage at a
|
||||
/// particular UsdTimeCode. The images generated will be effectively the same
|
||||
/// as what you would see in the viewer in usdview.
|
||||
///
|
||||
/// Note that it is assumed that an OpenGL context has already been setup.
|
||||
class UsdAppUtilsFrameRecorder
|
||||
{
|
||||
public:
|
||||
USDAPPUTILS_API
|
||||
UsdAppUtilsFrameRecorder();
|
||||
|
||||
/// Gets the ID of the Hydra renderer plugin that will be used for
|
||||
/// recording.
|
||||
TfToken GetCurrentRendererId() const {
|
||||
return _imagingEngine.GetCurrentRendererId();
|
||||
}
|
||||
|
||||
/// Sets the Hydra renderer plugin to be used for recording.
|
||||
bool SetRendererPlugin(const TfToken& id) {
|
||||
return _imagingEngine.SetRendererPlugin(id);
|
||||
}
|
||||
|
||||
/// Sets the width of the recorded image.
|
||||
///
|
||||
/// The height of the recorded image will be computed using this value and
|
||||
/// the aspect ratio of the camera used for recording.
|
||||
///
|
||||
/// The default image width is 960 pixels.
|
||||
void SetImageWidth(const size_t imageWidth) {
|
||||
if (imageWidth == 0u) {
|
||||
TF_CODING_ERROR("Image width cannot be zero");
|
||||
return;
|
||||
}
|
||||
_imageWidth = imageWidth;
|
||||
}
|
||||
|
||||
/// Sets the level of refinement complexity.
|
||||
///
|
||||
/// The default complexity is "low" (1.0).
|
||||
void SetComplexity(const float complexity) {
|
||||
_complexity = complexity;
|
||||
}
|
||||
|
||||
/// Sets the color correction mode to be used for recording.
|
||||
///
|
||||
/// By default, color correction is disabled.
|
||||
void SetColorCorrectionMode(const TfToken& colorCorrectionMode) {
|
||||
_colorCorrectionMode = colorCorrectionMode;
|
||||
}
|
||||
|
||||
/// Sets the UsdGeomImageable purposes to be used for rendering
|
||||
///
|
||||
/// We will __always__ include "default" purpose, and by default,
|
||||
/// we will also include UsdGeomTokens->proxy. Use this method
|
||||
/// to explicitly enumerate an alternate set of purposes to be
|
||||
/// included along with "default".
|
||||
USDAPPUTILS_API
|
||||
void SetIncludedPurposes(const TfTokenVector& purposes);
|
||||
|
||||
/// Records an image and writes the result to \p outputImagePath.
|
||||
///
|
||||
/// The recorded image will represent the view from \p usdCamera looking at
|
||||
/// the imageable prims on USD stage \p stage at time \p timeCode.
|
||||
///
|
||||
/// If \p usdCamera is not a valid camera, a camera will be computed
|
||||
/// to automatically frame the stage geometry.
|
||||
///
|
||||
/// Returns true if the image was generated and written successfully, or
|
||||
/// false otherwise.
|
||||
USDAPPUTILS_API
|
||||
bool Record(
|
||||
const UsdStagePtr& stage,
|
||||
const UsdGeomCamera& usdCamera,
|
||||
const UsdTimeCode timeCode,
|
||||
const std::string& outputImagePath);
|
||||
|
||||
private:
|
||||
UsdImagingGLEngine _imagingEngine;
|
||||
size_t _imageWidth;
|
||||
float _complexity;
|
||||
TfToken _colorCorrectionMode;
|
||||
TfTokenVector _purposes;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,98 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_ADAPTER_REGISTRY_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_ADAPTER_REGISTRY_H
|
||||
|
||||
/// \file usdImaging/adapterRegistry.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/base/tf/singleton.h"
|
||||
#include "pxr/base/tf/staticTokens.h"
|
||||
#include "pxr/base/tf/token.h"
|
||||
#include "pxr/base/tf/type.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdImagingPrimAdapter;
|
||||
using UsdImagingPrimAdapterSharedPtr = std::shared_ptr<UsdImagingPrimAdapter>;
|
||||
|
||||
#define USD_IMAGING_ADAPTER_KEY_TOKENS \
|
||||
((instanceAdapterKey, "__instanceAdapter")) \
|
||||
((drawModeAdapterKey, "__drawModeAdapter")) \
|
||||
|
||||
TF_DECLARE_PUBLIC_TOKENS(UsdImagingAdapterKeyTokens,
|
||||
USDIMAGING_API,
|
||||
USD_IMAGING_ADAPTER_KEY_TOKENS);
|
||||
|
||||
/// \class UsdImagingAdapterRegistry
|
||||
///
|
||||
/// Registry of PrimAdapter plug-ins.
|
||||
///
|
||||
class UsdImagingAdapterRegistry : public TfSingleton<UsdImagingAdapterRegistry>
|
||||
{
|
||||
friend class TfSingleton<UsdImagingAdapterRegistry>;
|
||||
UsdImagingAdapterRegistry();
|
||||
|
||||
typedef std::unordered_map<TfToken,TfType,TfToken::HashFunctor> _TypeMap;
|
||||
_TypeMap _typeMap;
|
||||
|
||||
public:
|
||||
|
||||
/// Returns true if external plugins are enabled.
|
||||
/// Internal plugins have isInternal=1 set in their metadata. This flag is
|
||||
/// only intended to be set for critical imaging plugins (mesh, cube,
|
||||
/// sphere, curve, etc). This allows users to disable plugins that are
|
||||
/// crashing or executing slowly.
|
||||
///
|
||||
/// Driven by by the USDIMAGING_ENABLE_PLUGINS environment variable.
|
||||
USDIMAGING_API
|
||||
static bool AreExternalPluginsEnabled();
|
||||
|
||||
USDIMAGING_API
|
||||
static UsdImagingAdapterRegistry& GetInstance() {
|
||||
return TfSingleton<UsdImagingAdapterRegistry>::GetInstance();
|
||||
}
|
||||
|
||||
/// Returns true if an adapter has been registered to handle the given
|
||||
/// \p adapterKey.
|
||||
USDIMAGING_API
|
||||
bool HasAdapter(TfToken const& adapterKey);
|
||||
|
||||
/// Returns a new instance of the UsdImagingPrimAdapter that has been
|
||||
/// registered to handle the given \p adapterKey. This key is either
|
||||
/// a prim typename or a key specified in UsdImagingAdapterKeyTokens.
|
||||
/// Returns NULL if no adapter was registered for this key.
|
||||
USDIMAGING_API
|
||||
UsdImagingPrimAdapterSharedPtr ConstructAdapter(TfToken const& adapterKey);
|
||||
};
|
||||
|
||||
USDIMAGING_API_TEMPLATE_CLASS(TfSingleton<UsdImagingAdapterRegistry>);
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif //PXR_USD_IMAGING_USD_IMAGING_ADAPTER_REGISTRY_H
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USD_IMAGING_API_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_API_H
|
||||
|
||||
#include "pxr/base/arch/export.h"
|
||||
|
||||
#if defined(PXR_STATIC)
|
||||
# define USDIMAGING_API
|
||||
# define USDIMAGING_API_TEMPLATE_CLASS(...)
|
||||
# define USDIMAGING_API_TEMPLATE_STRUCT(...)
|
||||
# define USDIMAGING_LOCAL
|
||||
#else
|
||||
# if defined(USDIMAGING_EXPORTS)
|
||||
# define USDIMAGING_API ARCH_EXPORT
|
||||
# define USDIMAGING_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
# define USDIMAGING_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
# else
|
||||
# define USDIMAGING_API ARCH_IMPORT
|
||||
# define USDIMAGING_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
# define USDIMAGING_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
# endif
|
||||
# define USDIMAGING_LOCAL ARCH_HIDDEN
|
||||
#endif
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_API_H
|
||||
@@ -0,0 +1,118 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_BASIS_CURVES_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_BASIS_CURVES_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/basisCurvesAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
#include "pxr/usdImaging/usdImaging/gprimAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
/// \class UsdImagingBasisCurvesAdapter
|
||||
///
|
||||
/// Delegate support for UsdGeomBasisCurves.
|
||||
///
|
||||
class UsdImagingBasisCurvesAdapter : public UsdImagingGprimAdapter
|
||||
{
|
||||
public:
|
||||
using BaseAdapter = UsdImagingGprimAdapter;
|
||||
|
||||
UsdImagingBasisCurvesAdapter()
|
||||
: UsdImagingGprimAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
~UsdImagingBasisCurvesAdapter() override;
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath Populate(
|
||||
UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr) override;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr)
|
||||
const override;
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void UpdateForTime(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr)
|
||||
const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Data access
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue GetTopology(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue Get(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
VtIntArray *outIndices) const override;
|
||||
|
||||
protected:
|
||||
USDIMAGING_API
|
||||
bool _IsBuiltinPrimvar(TfToken const& primvarName) const override;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_BASIS_CURVES_ADAPTER_H
|
||||
@@ -0,0 +1,130 @@
|
||||
//
|
||||
// Copyright 2019 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 PXR_USD_IMAGING_USD_IMAGING_CAMERA_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_CAMERA_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/cameraAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingCameraAdapter
|
||||
///
|
||||
/// Delegate support for UsdGeomCamera.
|
||||
///
|
||||
class UsdImagingCameraAdapter : public UsdImagingPrimAdapter
|
||||
{
|
||||
public:
|
||||
typedef UsdImagingPrimAdapter BaseAdapter;
|
||||
|
||||
UsdImagingCameraAdapter()
|
||||
: UsdImagingPrimAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
~UsdImagingCameraAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) override;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const override;
|
||||
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void UpdateForTime(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName) override;
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits dirty,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkTransformDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkWindowPolicyDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Data access
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue Get(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
VtIntArray *outIndices) const override;
|
||||
|
||||
protected:
|
||||
void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_CAMERA_ADAPTER_H
|
||||
@@ -0,0 +1,106 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_CAPSULE_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_CAPSULE_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/capsuleAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/gprimAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdGeomCapsule;
|
||||
|
||||
/// \class UsdImagingCapsuleAdapter
|
||||
///
|
||||
/// Delegate support for UsdGeomCapsule.
|
||||
///
|
||||
class UsdImagingCapsuleAdapter : public UsdImagingGprimAdapter {
|
||||
public:
|
||||
typedef UsdImagingGprimAdapter BaseAdapter;
|
||||
|
||||
UsdImagingCapsuleAdapter()
|
||||
: UsdImagingGprimAdapter()
|
||||
{}
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingCapsuleAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath Populate(
|
||||
UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr) override;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
USDIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName);
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr)
|
||||
const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Data access
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue GetTopology(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
// Override the implemetation in GprimAdapter since we don't fetch the
|
||||
// points attribute for implicit primitives.
|
||||
USDIMAGING_API
|
||||
VtValue GetPoints(
|
||||
UsdPrim const& prim,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
USDIMAGING_API
|
||||
static VtValue GetMeshPoints(UsdPrim const& prim,
|
||||
UsdTimeCode time);
|
||||
|
||||
USDIMAGING_API
|
||||
static VtValue GetMeshTopology();
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_CAPSULE_ADAPTER_H
|
||||
@@ -0,0 +1,104 @@
|
||||
//
|
||||
// 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 PXR_USD_IMAGING_USD_IMAGING_COLLECTION_CACHE_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_COLLECTION_CACHE_H
|
||||
|
||||
/// \file usdImaging/collectionCache.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usd/usd/collectionAPI.h"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <tbb/concurrent_unordered_map.h>
|
||||
#include <tbb/concurrent_queue.h>
|
||||
#include <unordered_map>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
/// \class UsdImaging_CollectionCache
|
||||
///
|
||||
/// UsdImaging_CollectionCache provides a cache of Usd collections
|
||||
/// discovered in the scene. It associates the collection paths
|
||||
/// (UsdCollectionAPI::GetCollectionPath) with the computed
|
||||
/// membership query (UsdCollectionAPI::ComputeMembershipQuery).
|
||||
///
|
||||
/// For efficiency, it groups collections into equivalence
|
||||
/// classes based on the computed query. Collections that yield
|
||||
/// equivalent queries are merged. Each unique query is assigned
|
||||
/// an identifier token.
|
||||
///
|
||||
/// This cache is used to track the collections used for linking
|
||||
/// UsdLux lights/shadows/filters to geometry.
|
||||
///
|
||||
/// As an optimization, the query that includes everything is
|
||||
/// treated as a special case and given the empty id, TfToken().
|
||||
///
|
||||
class UsdImaging_CollectionCache : boost::noncopyable {
|
||||
public:
|
||||
/// Query is the MembershipQuery computed from a collection's state.
|
||||
typedef UsdCollectionAPI::MembershipQuery Query;
|
||||
|
||||
/// Computes the membership query from the current state of the
|
||||
/// given collection, and establishes a cache entry. If a
|
||||
/// prior entry existed for the collection at this path,
|
||||
/// it is removed first.
|
||||
TfToken UpdateCollection(UsdCollectionAPI const& collection);
|
||||
|
||||
/// Remove any cached entry for the given collection.
|
||||
/// Does nothing if no cache entry exists.
|
||||
void RemoveCollection(UsdCollectionAPI const& collection);
|
||||
|
||||
/// Return the cached entry for the given collection.
|
||||
TfToken
|
||||
GetIdForCollection(UsdCollectionAPI const& collection);
|
||||
|
||||
/// Return a list of identifiers of all collections that contain
|
||||
// the given path.
|
||||
VtArray<TfToken>
|
||||
ComputeCollectionsContainingPath(SdfPath const& path) const;
|
||||
|
||||
private:
|
||||
// The cache boils down to tracking the correspondence of
|
||||
// collection paths, their computed queries, and the id
|
||||
// assigned to each unique query:
|
||||
//
|
||||
// CollectionPath <=> MembershipQuery <=> AssignedId
|
||||
//
|
||||
// In this scheme, the assigned id provides a compact but
|
||||
// potentially human-meaningful reference to the query,
|
||||
// which we can pass to the renderer.
|
||||
//
|
||||
std::unordered_map<Query, TfToken, Query::Hash> _idForQuery;
|
||||
std::unordered_map<TfToken, Query, TfToken::HashFunctor> _queryForId;
|
||||
std::unordered_map<SdfPath, TfToken, SdfPath::Hash> _idForPath;
|
||||
std::unordered_map<Query, SdfPathSet, Query::Hash> _pathsForQuery;
|
||||
|
||||
std::mutex _mutex;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_COLLECTION_CACHE_H
|
||||
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_CONE_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_CONE_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/coneAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/gprimAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdGeomCone;
|
||||
|
||||
/// \class UsdImagingConeAdapter
|
||||
///
|
||||
/// Delegate support for UsdGeomCone.
|
||||
///
|
||||
class UsdImagingConeAdapter : public UsdImagingGprimAdapter {
|
||||
public:
|
||||
typedef UsdImagingGprimAdapter BaseAdapter;
|
||||
|
||||
UsdImagingConeAdapter()
|
||||
: UsdImagingGprimAdapter()
|
||||
{}
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingConeAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath Populate(
|
||||
UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr) override;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
USDIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName);
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr)
|
||||
const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Data access
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue GetTopology(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
// Override the implemetation in GprimAdapter since we don't fetch the
|
||||
// points attribute for implicit primitives.
|
||||
USDIMAGING_API
|
||||
VtValue GetPoints(
|
||||
UsdPrim const& prim,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
// Used by the legacyEngine.
|
||||
USDIMAGING_API
|
||||
static VtValue GetMeshPoints(UsdPrim const& prim,
|
||||
UsdTimeCode time);
|
||||
|
||||
// Used by the legacyEngine.
|
||||
USDIMAGING_API
|
||||
static VtValue GetMeshTopology();
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_CONE_ADAPTER_H
|
||||
@@ -0,0 +1,115 @@
|
||||
//
|
||||
// Copyright 2019 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 PXR_USD_IMAGING_USD_IMAGING_COORD_SYS_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_COORD_SYS_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/coordSysAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingCoordSysAdapter
|
||||
///
|
||||
class UsdImagingCoordSysAdapter : public UsdImagingPrimAdapter {
|
||||
public:
|
||||
typedef UsdImagingPrimAdapter BaseAdapter;
|
||||
|
||||
UsdImagingCoordSysAdapter()
|
||||
: UsdImagingPrimAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingCoordSysAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
virtual SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual bool IsSupported(UsdImagingIndexProxy const* index) const;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
virtual void TrackVariability(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void ProcessPrimResync(SdfPath const& primPath,
|
||||
UsdImagingIndexProxy* index);
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
virtual void UpdateForTime(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Returns a bit mask of attributes to be udpated, or
|
||||
/// HdChangeTracker::AllDirty if the entire prim must be resynchronized.
|
||||
USDIMAGING_API
|
||||
virtual HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits dirty,
|
||||
UsdImagingIndexProxy* index);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkTransformDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index);
|
||||
|
||||
protected:
|
||||
USDIMAGING_API
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index);
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_COORD_SYS_ADAPTER_H
|
||||
@@ -0,0 +1,107 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_CUBE_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_CUBE_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/cubeAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
#include "pxr/usdImaging/usdImaging/gprimAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdGeomCube;
|
||||
|
||||
/// \class UsdImagingCubeAdapter
|
||||
///
|
||||
/// Delegate support for UsdGeomCube.
|
||||
///
|
||||
class UsdImagingCubeAdapter : public UsdImagingGprimAdapter {
|
||||
public:
|
||||
typedef UsdImagingGprimAdapter BaseAdapter;
|
||||
|
||||
UsdImagingCubeAdapter()
|
||||
: UsdImagingGprimAdapter()
|
||||
{}
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingCubeAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath Populate(
|
||||
UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr) override;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
USDIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName);
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr)
|
||||
const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Data access
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue GetTopology(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
// Override the implemetation in GprimAdapter since we don't fetch the
|
||||
// points attribute for implicit primitives.
|
||||
USDIMAGING_API
|
||||
VtValue GetPoints(
|
||||
UsdPrim const& prim,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
USDIMAGING_API
|
||||
static VtValue GetMeshPoints(UsdPrim const& prim,
|
||||
UsdTimeCode time);
|
||||
|
||||
USDIMAGING_API
|
||||
static VtValue GetMeshTopology();
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_CUBE_ADAPTER_H
|
||||
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_CYLINDER_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_CYLINDER_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/cylinderAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/gprimAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdGeomCylinder;
|
||||
|
||||
/// \class UsdImagingCylinderAdapter
|
||||
///
|
||||
/// Delegate support for UsdGeomCylinder.
|
||||
///
|
||||
class UsdImagingCylinderAdapter : public UsdImagingGprimAdapter {
|
||||
public:
|
||||
typedef UsdImagingGprimAdapter BaseAdapter;
|
||||
|
||||
UsdImagingCylinderAdapter()
|
||||
: UsdImagingGprimAdapter()
|
||||
{}
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingCylinderAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath Populate(
|
||||
UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr) override;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
USDIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName);
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr)
|
||||
const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Data access
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue GetTopology(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
// Override the implemetation in GprimAdapter since we don't fetch the
|
||||
// points attribute for implicit primitives.
|
||||
USDIMAGING_API
|
||||
VtValue GetPoints(
|
||||
UsdPrim const& prim,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
// Used by the legacyEngine.
|
||||
USDIMAGING_API
|
||||
static VtValue GetMeshPoints(UsdPrim const& prim,
|
||||
UsdTimeCode time);
|
||||
|
||||
// Used by the legacyEngine.
|
||||
USDIMAGING_API
|
||||
static VtValue GetMeshTopology();
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_CYLINDER_ADAPTER_H
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USD_IMAGING_CYLINDER_LIGHT_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_CYLINDER_LIGHT_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/cylinderLightAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/lightAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingCylinderLightAdapter
|
||||
///
|
||||
/// Adapter class for lights of type CylinderLight
|
||||
///
|
||||
class UsdImagingCylinderLightAdapter : public UsdImagingLightAdapter {
|
||||
public:
|
||||
typedef UsdImagingLightAdapter BaseAdapter;
|
||||
|
||||
UsdImagingCylinderLightAdapter()
|
||||
: UsdImagingLightAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingCylinderLightAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
virtual SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual bool IsSupported(UsdImagingIndexProxy const* index) const;
|
||||
|
||||
protected:
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) final;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_CYLINDER_LIGHT_ADAPTER_H
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_DEBUG_CODES_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_DEBUG_CODES_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/base/tf/debug.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
TF_DEBUG_CODES(
|
||||
|
||||
USDIMAGING_COLLECTIONS,
|
||||
USDIMAGING_COORDSYS,
|
||||
USDIMAGING_CHANGES,
|
||||
USDIMAGING_COMPUTATIONS,
|
||||
USDIMAGING_INSTANCER,
|
||||
USDIMAGING_PLUGINS,
|
||||
USDIMAGING_POINT_INSTANCER_PROTO_CREATED,
|
||||
USDIMAGING_POINT_INSTANCER_PROTO_CULLING,
|
||||
USDIMAGING_SELECTION,
|
||||
USDIMAGING_SHADERS,
|
||||
USDIMAGING_TEXTURES,
|
||||
USDIMAGING_UPDATES
|
||||
|
||||
);
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_DEBUG_CODES_H
|
||||
@@ -0,0 +1,789 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_DELEGATE_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_DELEGATE_H
|
||||
|
||||
/// \file usdImaging/delegate.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/version.h"
|
||||
#include "pxr/usdImaging/usdImaging/collectionCache.h"
|
||||
#include "pxr/usdImaging/usdImaging/primvarDescCache.h"
|
||||
#include "pxr/usdImaging/usdImaging/resolvedAttributeCache.h"
|
||||
#include "pxr/usdImaging/usdImaging/instancerContext.h"
|
||||
|
||||
#include "pxr/imaging/cameraUtil/conformWindow.h"
|
||||
|
||||
#include "pxr/imaging/hd/coordSys.h"
|
||||
#include "pxr/imaging/hd/sceneDelegate.h"
|
||||
#include "pxr/imaging/hd/selection.h"
|
||||
#include "pxr/imaging/hd/version.h"
|
||||
|
||||
#include "pxr/imaging/pxOsd/subdivTags.h"
|
||||
#include "pxr/usd/sdf/path.h"
|
||||
#include "pxr/usd/sdf/pathTable.h"
|
||||
#include "pxr/usd/usd/attribute.h"
|
||||
#include "pxr/usd/usd/notice.h"
|
||||
#include "pxr/usd/usd/prim.h"
|
||||
#include "pxr/usd/usd/stage.h"
|
||||
#include "pxr/usd/usdGeom/cube.h"
|
||||
#include "pxr/usd/usdGeom/sphere.h"
|
||||
#include "pxr/usd/usdGeom/xformCache.h"
|
||||
#include "pxr/base/vt/value.h"
|
||||
|
||||
#include "pxr/base/gf/range3d.h"
|
||||
#include "pxr/base/gf/interval.h"
|
||||
#include "pxr/base/tf/declarePtrs.h"
|
||||
#include "pxr/base/tf/hashmap.h"
|
||||
#include "pxr/base/tf/hashset.h"
|
||||
#include "pxr/base/tf/denseHashSet.h"
|
||||
|
||||
#include <boost/container/flat_map.hpp>
|
||||
#include <tbb/spin_rw_mutex.h>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
TF_DECLARE_WEAK_PTRS(UsdImagingDelegate);
|
||||
typedef std::vector<UsdPrim> UsdPrimVector;
|
||||
|
||||
class UsdImagingPrimAdapter;
|
||||
class UsdImagingIndexProxy;
|
||||
class UsdImagingInstancerContext;
|
||||
|
||||
typedef boost::container::flat_map<SdfPath, bool> PickabilityMap;
|
||||
|
||||
using UsdImagingPrimAdapterSharedPtr = std::shared_ptr<UsdImagingPrimAdapter>;
|
||||
|
||||
/// \class UsdImagingDelegate
|
||||
///
|
||||
/// The primary translation layer between the Hydra (Hd) core and the Usd
|
||||
/// scene graph.
|
||||
///
|
||||
class UsdImagingDelegate : public HdSceneDelegate, public TfWeakBase {
|
||||
typedef UsdImagingDelegate This;
|
||||
public:
|
||||
|
||||
typedef TfHashMap<SdfPath, GfMatrix4d, SdfPath::Hash> RigidXformOverridesMap;
|
||||
|
||||
USDIMAGING_API
|
||||
UsdImagingDelegate(HdRenderIndex *parentIndex,
|
||||
SdfPath const& delegateID);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingDelegate();
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void Sync(HdSyncRequestVector* request) override;
|
||||
|
||||
// Helper for clients who don't want to drive the sync behavior (unit
|
||||
// tests). Note this method is not virtual.
|
||||
USDIMAGING_API
|
||||
void SyncAll(bool includeUnvarying);
|
||||
|
||||
/// Opportunity for the delegate to clean itself up after
|
||||
/// performing parrellel work during sync phase
|
||||
USDIMAGING_API
|
||||
virtual void PostSyncCleanup() override;
|
||||
|
||||
/// Populates the rootPrim in the HdRenderIndex.
|
||||
USDIMAGING_API
|
||||
void Populate(UsdPrim const& rootPrim);
|
||||
|
||||
/// Populates the rootPrim in the HdRenderIndex, excluding all paths in the
|
||||
/// \p excludedPrimPaths, as well as their prim children.
|
||||
USDIMAGING_API
|
||||
void Populate(UsdPrim const& rootPrim,
|
||||
SdfPathVector const& excludedPrimPaths,
|
||||
SdfPathVector const &invisedPrimPaths=SdfPathVector());
|
||||
|
||||
/// For each delegate in \p delegates, sets the current time from
|
||||
/// which data wil be read to the corresponding time in \p times.
|
||||
///
|
||||
/// This is equivalent to calling SetTime on each delegate individually.
|
||||
/// However, this method will try to parallelize certain operations,
|
||||
/// making it potentially more efficient.
|
||||
USDIMAGING_API
|
||||
static void SetTimes(const std::vector<UsdImagingDelegate*>& delegates,
|
||||
const std::vector<UsdTimeCode>& times);
|
||||
|
||||
/// Sets the current time from which data will be read by the delegate.
|
||||
///
|
||||
/// Changing the current time immediately triggers invalidation in the
|
||||
/// HdChangeTracker. Redundantly setting the time to its existing value is a
|
||||
/// no-op and will not trigger invalidation.
|
||||
USDIMAGING_API
|
||||
void SetTime(UsdTimeCode time);
|
||||
|
||||
/// Returns the current time.
|
||||
UsdTimeCode GetTime() const { return _time; }
|
||||
|
||||
/// Apply a relative offset to the current time.
|
||||
/// This has no effect in the case of the default USD timecode.
|
||||
UsdTimeCode GetTimeWithOffset(float offset) const;
|
||||
|
||||
/// Applies any scene edits which have been queued up by notices from USD.
|
||||
USDIMAGING_API
|
||||
void ApplyPendingUpdates();
|
||||
|
||||
/// Returns the refinement level that is used when prims have no explicit
|
||||
/// level set.
|
||||
///
|
||||
/// The refinement level indicates how many iterations to apply when
|
||||
/// subdividing subdivision surfaces or other refinable primitives.
|
||||
///
|
||||
/// Refinement level is always in the range [0,8].
|
||||
int GetRefineLevelFallback() const { return _refineLevelFallback; }
|
||||
|
||||
/// Sets the fallback refinement level to \p level, triggers dirty
|
||||
/// refine level bit to be set on all Rprims that don't have explicit refine
|
||||
/// levels set.
|
||||
///
|
||||
/// Level is expected to be in the range [0,8], where 0 indicates no
|
||||
/// refinement.
|
||||
USDIMAGING_API
|
||||
void SetRefineLevelFallback(int level);
|
||||
|
||||
/// Removes any explicit refine level set for the given USD prim.
|
||||
/// Marks dirty if a change in level occurs.
|
||||
USDIMAGING_API
|
||||
void ClearRefineLevel(SdfPath const& usdPath);
|
||||
|
||||
/// Sets an explicit refinement level for the given USD prim.
|
||||
/// If no level is explicitly set, the fallback is used;
|
||||
/// see GetRefineLevelFallback().
|
||||
/// If setting an explicit level does not change the effective level, no
|
||||
/// dirty bit is set.
|
||||
USDIMAGING_API
|
||||
void SetRefineLevel(SdfPath const& usdPath, int level);
|
||||
|
||||
/// Returns the fallback repr name.
|
||||
HdReprSelector GetReprFallback() const { return _reprFallback; }
|
||||
|
||||
/// Sets the fallback repr name. Note that currently UsdImagingDelegate
|
||||
/// doesn't support per-prim repr.
|
||||
USDIMAGING_API
|
||||
void SetReprFallback(HdReprSelector const &repr);
|
||||
|
||||
/// Returns the fallback cull style.
|
||||
HdCullStyle GetCullStyleFallback() const { return _cullStyleFallback; }
|
||||
|
||||
/// Sets the fallback cull style.
|
||||
USDIMAGING_API
|
||||
void SetCullStyleFallback(HdCullStyle cullStyle);
|
||||
|
||||
/// Sets the root transform for the entire delegate, which is applied to all
|
||||
/// render prims generated. Settting this value will immediately invalidate
|
||||
/// existing rprim transforms.
|
||||
USDIMAGING_API
|
||||
void SetRootTransform(GfMatrix4d const& xf);
|
||||
|
||||
/// Returns the root transform for the entire delegate.
|
||||
const GfMatrix4d &GetRootTransform() const { return _rootXf; }
|
||||
|
||||
/// Sets the root visibility for the entire delegate, which is applied to
|
||||
/// all render prims generated. Settting this value will immediately
|
||||
/// invalidate existing rprim visibility.
|
||||
USDIMAGING_API
|
||||
void SetRootVisibility(bool isVisible);
|
||||
|
||||
/// Returns the root visibility for the entire delegate.
|
||||
bool GetRootVisibility() const { return _rootIsVisible; }
|
||||
|
||||
/// Set the list of paths that must be invised.
|
||||
USDIMAGING_API
|
||||
void SetInvisedPrimPaths(SdfPathVector const &invisedPaths);
|
||||
|
||||
/// Set transform value overrides on a set of paths.
|
||||
USDIMAGING_API
|
||||
void SetRigidXformOverrides(RigidXformOverridesMap const &overrides);
|
||||
|
||||
/// Returns the root paths of pickable objects.
|
||||
USDIMAGING_API
|
||||
PickabilityMap GetPickabilityMap() const;
|
||||
|
||||
/// Sets pickability for a specific path.
|
||||
USDIMAGING_API
|
||||
void SetPickability(SdfPath const& path, bool pickable);
|
||||
|
||||
/// Clears any pickability opinions that this delegates might have.
|
||||
USDIMAGING_API
|
||||
void ClearPickabilityMap();
|
||||
|
||||
/// Sets display of prims with purpose "render"
|
||||
USDIMAGING_API
|
||||
void SetDisplayRender(const bool displayRender);
|
||||
bool GetDisplayRender() const { return _displayRender; }
|
||||
|
||||
/// Sets display of prims with purpose "proxy"
|
||||
USDIMAGING_API
|
||||
void SetDisplayProxy(const bool displayProxy);
|
||||
bool GetDisplayProxy() const { return _displayProxy; }
|
||||
|
||||
/// Sets display of prims with purpose "guide"
|
||||
USDIMAGING_API
|
||||
void SetDisplayGuides(const bool displayGuides);
|
||||
bool GetDisplayGuides() const { return _displayGuides; }
|
||||
|
||||
/// Returns whether draw modes are enabled.
|
||||
USDIMAGING_API
|
||||
void SetUsdDrawModesEnabled(bool enableUsdDrawModes);
|
||||
bool GetUsdDrawModesEnabled() const { return _enableUsdDrawModes; }
|
||||
|
||||
/// Enables custom shading on prims.
|
||||
USDIMAGING_API
|
||||
void SetSceneMaterialsEnabled(bool enable);
|
||||
|
||||
/// Enables lights found in the usdscene.
|
||||
USDIMAGING_API
|
||||
void SetSceneLightsEnabled(bool enable);
|
||||
|
||||
/// Set the window policy on all scene cameras. This comes from
|
||||
/// the application.
|
||||
USDIMAGING_API
|
||||
void SetWindowPolicy(CameraUtilConformWindowPolicy policy);
|
||||
|
||||
/// Sets display of unloaded prims as bounding boxes.
|
||||
/// Unloaded prims will need to satisfy one of the following set of
|
||||
/// conditions in order to see them:
|
||||
/// 1. The prim is a UsdGeomBoundable with an authored 'extent' attribute.
|
||||
/// 2. The prim is a UsdPrim.IsModel() and has an authored 'extentsHint'
|
||||
/// attribute (see UsdGeomModelAPI::GetExtentsHint).
|
||||
/// Effective only for delegates that support draw modes (see
|
||||
/// GetUsdDrawModesEnabled()).
|
||||
USDIMAGING_API
|
||||
void SetDisplayUnloadedPrimsWithBounds(bool displayUnloaded);
|
||||
bool GetDisplayUnloadedPrimsWithBounds() const {
|
||||
return _displayUnloadedPrimsWithBounds;
|
||||
}
|
||||
|
||||
/// Setup for the shutter open and close to be used for motion sampling.
|
||||
USDIMAGING_API
|
||||
void SetCameraForSampling(SdfPath const& id);
|
||||
|
||||
/// Returns the current interval that will be used when using the
|
||||
/// sample* API in the scene delegate.
|
||||
USDIMAGING_API
|
||||
GfInterval GetCurrentTimeSamplingInterval();
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
// See HdSceneDelegate for documentation of the following virtual methods.
|
||||
// ---------------------------------------------------------------------- //
|
||||
USDIMAGING_API
|
||||
virtual TfToken GetRenderTag(SdfPath const& id) override;
|
||||
USDIMAGING_API
|
||||
virtual HdMeshTopology GetMeshTopology(SdfPath const& id) override;
|
||||
USDIMAGING_API
|
||||
virtual HdBasisCurvesTopology GetBasisCurvesTopology(SdfPath const& id)
|
||||
override;
|
||||
typedef PxOsdSubdivTags SubdivTags;
|
||||
|
||||
// XXX: animated subdiv tags are not currently supported
|
||||
// XXX: subdiv tags currently fetched on-demand
|
||||
USDIMAGING_API
|
||||
virtual SubdivTags GetSubdivTags(SdfPath const& id) override;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual GfRange3d GetExtent(SdfPath const & id) override;
|
||||
USDIMAGING_API
|
||||
virtual GfMatrix4d GetTransform(SdfPath const & id) override;
|
||||
USDIMAGING_API
|
||||
virtual bool GetVisible(SdfPath const & id) override;
|
||||
USDIMAGING_API
|
||||
virtual bool GetDoubleSided(SdfPath const & id) override;
|
||||
USDIMAGING_API
|
||||
virtual HdCullStyle GetCullStyle(SdfPath const &id) override;
|
||||
|
||||
/// Gets the explicit display style for the given prim, if no refine level
|
||||
/// is explicitly set, the fallback is returned; also see
|
||||
/// GetRefineLevelFallback().
|
||||
USDIMAGING_API
|
||||
virtual HdDisplayStyle GetDisplayStyle(SdfPath const& id) override;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual VtValue Get(SdfPath const& id, TfToken const& key) override;
|
||||
USDIMAGING_API
|
||||
virtual VtValue GetIndexedPrimvar(SdfPath const& id,
|
||||
TfToken const& key,
|
||||
VtIntArray *outIndices) override;
|
||||
USDIMAGING_API
|
||||
HdIdVectorSharedPtr
|
||||
virtual GetCoordSysBindings(SdfPath const& id) override;
|
||||
USDIMAGING_API
|
||||
virtual HdReprSelector GetReprSelector(SdfPath const &id) override;
|
||||
USDIMAGING_API
|
||||
virtual VtArray<TfToken> GetCategories(SdfPath const &id) override;
|
||||
USDIMAGING_API
|
||||
virtual std::vector<VtArray<TfToken>>
|
||||
GetInstanceCategories(SdfPath const &instancerId) override;
|
||||
USDIMAGING_API
|
||||
virtual HdPrimvarDescriptorVector
|
||||
GetPrimvarDescriptors(SdfPath const& id,
|
||||
HdInterpolation interpolation) override;
|
||||
USDIMAGING_API
|
||||
virtual VtIntArray GetInstanceIndices(SdfPath const &instancerId,
|
||||
SdfPath const &prototypeId) override;
|
||||
USDIMAGING_API
|
||||
virtual GfMatrix4d GetInstancerTransform(SdfPath const &instancerId)
|
||||
override;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual SdfPath GetInstancerId(SdfPath const &primId) override;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual SdfPathVector GetInstancerPrototypes(SdfPath const &instancerId) override;
|
||||
|
||||
// Motion samples
|
||||
USDIMAGING_API
|
||||
virtual size_t
|
||||
SampleTransform(SdfPath const & id, size_t maxNumSamples,
|
||||
float *times, GfMatrix4d *samples) override;
|
||||
USDIMAGING_API
|
||||
virtual size_t
|
||||
SampleInstancerTransform(SdfPath const &instancerId,
|
||||
size_t maxSampleCount, float *times,
|
||||
GfMatrix4d *samples) override;
|
||||
USDIMAGING_API
|
||||
virtual size_t
|
||||
SamplePrimvar(SdfPath const& id, TfToken const& key,
|
||||
size_t maxNumSamples, float *times,
|
||||
VtValue *samples) override;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual size_t
|
||||
SampleIndexedPrimvar(SdfPath const& id, TfToken const& key,
|
||||
size_t maxNumSamples, float *times,
|
||||
VtValue *samples, VtIntArray *indices) override;
|
||||
|
||||
// Material Support
|
||||
USDIMAGING_API
|
||||
virtual SdfPath GetMaterialId(SdfPath const &rprimId) override;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual VtValue GetMaterialResource(SdfPath const &materialId) override;
|
||||
|
||||
// Light Support
|
||||
USDIMAGING_API
|
||||
virtual VtValue GetLightParamValue(SdfPath const &id,
|
||||
TfToken const ¶mName) override;
|
||||
// Camera Support
|
||||
USDIMAGING_API
|
||||
virtual VtValue GetCameraParamValue(SdfPath const &id,
|
||||
TfToken const ¶mName) override;
|
||||
|
||||
// Volume Support
|
||||
USDIMAGING_API
|
||||
virtual HdVolumeFieldDescriptorVector
|
||||
GetVolumeFieldDescriptors(SdfPath const &volumeId) override;
|
||||
|
||||
// Picking path resolution
|
||||
// Resolves a \p rprimId and \p instanceIndex back to the original USD
|
||||
// gprim and instance index. For point-instanced prims, \p instanceContext
|
||||
// returns extra information about which instance this is of which level of
|
||||
// point-instancer. For example:
|
||||
// /World/PI instances /World/PI/proto/PI
|
||||
// /World/PI/proto/PI instances /World/PI/proto/PI/proto/Gprim
|
||||
// instancerContext = [/World/PI, 0], [/World/PI/proto/PI, 1] means that
|
||||
// this instance represents "protoIndex = 0" of /World/PI, etc.
|
||||
|
||||
USDIMAGING_API
|
||||
virtual SdfPath
|
||||
GetScenePrimPath(SdfPath const& rprimId,
|
||||
int instanceIndex,
|
||||
HdInstancerContext *instancerContext = nullptr) override;
|
||||
|
||||
// ExtComputation support
|
||||
USDIMAGING_API
|
||||
TfTokenVector
|
||||
GetExtComputationSceneInputNames(SdfPath const& computationId) override;
|
||||
|
||||
USDIMAGING_API
|
||||
HdExtComputationInputDescriptorVector
|
||||
GetExtComputationInputDescriptors(SdfPath const& computationId) override;
|
||||
|
||||
USDIMAGING_API
|
||||
HdExtComputationOutputDescriptorVector
|
||||
GetExtComputationOutputDescriptors(SdfPath const& computationId) override;
|
||||
|
||||
USDIMAGING_API
|
||||
HdExtComputationPrimvarDescriptorVector
|
||||
GetExtComputationPrimvarDescriptors(SdfPath const& computationId,
|
||||
HdInterpolation interpolation) override;
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue GetExtComputationInput(SdfPath const& computationId,
|
||||
TfToken const& input) override;
|
||||
|
||||
USDIMAGING_API
|
||||
size_t SampleExtComputationInput(SdfPath const& computationId,
|
||||
TfToken const& input,
|
||||
size_t maxSampleCount,
|
||||
float *sampleTimes,
|
||||
VtValue *sampleValues) override;
|
||||
|
||||
USDIMAGING_API
|
||||
std::string GetExtComputationKernel(SdfPath const& computationId) override;
|
||||
|
||||
USDIMAGING_API
|
||||
void InvokeExtComputation(SdfPath const& computationId,
|
||||
HdExtComputationContext *context) override;
|
||||
|
||||
public:
|
||||
// Converts a cache path to a path in the render index.
|
||||
USDIMAGING_API
|
||||
SdfPath ConvertCachePathToIndexPath(SdfPath const& cachePath) {
|
||||
SdfPathMap::const_iterator it = _cache2indexPath.find(cachePath);
|
||||
if (it != _cache2indexPath.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
// For pure/plain usdImaging, there is no prefix to replace
|
||||
SdfPath const &delegateID = GetDelegateID();
|
||||
if (delegateID == SdfPath::AbsoluteRootPath()) {
|
||||
return cachePath;
|
||||
}
|
||||
if (cachePath.IsEmpty()) {
|
||||
return cachePath;
|
||||
}
|
||||
|
||||
return cachePath.ReplacePrefix(SdfPath::AbsoluteRootPath(), delegateID);
|
||||
}
|
||||
|
||||
/// Convert the given Hydra ID to a UsdImaging cache path,
|
||||
/// by stripping the scene delegate prefix.
|
||||
///
|
||||
/// The UsdImaging cache path is the same as a USD prim path,
|
||||
/// except for instanced prims, which get a name-mangled encoding.
|
||||
USDIMAGING_API
|
||||
SdfPath ConvertIndexPathToCachePath(SdfPath const& indexPath) {
|
||||
SdfPathMap::const_iterator it = _index2cachePath.find(indexPath);
|
||||
if (it != _index2cachePath.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
// For pure/plain usdImaging, there is no prefix to replace
|
||||
SdfPath const &delegateID = GetDelegateID();
|
||||
if (delegateID == SdfPath::AbsoluteRootPath()) {
|
||||
return indexPath;
|
||||
}
|
||||
|
||||
return indexPath.ReplacePrefix(delegateID, SdfPath::AbsoluteRootPath());
|
||||
}
|
||||
|
||||
/// Populate HdxSelection for given \p path (root) and \p instanceIndex.
|
||||
/// If indexPath is an instancer and instanceIndex is ALL_INSTANCES (-1),
|
||||
/// all instances will be selected.
|
||||
///
|
||||
/// Note: if usdPath points to a gprim, "instanceIndex" (if provided)
|
||||
/// is assumed to be the hydra-computed instance index returned from
|
||||
/// picking code.
|
||||
///
|
||||
/// If usdPath points to a point instancer, "instanceIndex" is assumed to
|
||||
/// be the instance of the point instancer to selection highlight (e.g.
|
||||
/// instance N of the protoIndices array). This would correspond to
|
||||
/// returning one of the tuples from GetScenePrimPath's "instancerContext".
|
||||
///
|
||||
/// In any other case, the interpretation of instanceIndex is undefined.
|
||||
static constexpr int ALL_INSTANCES = -1;
|
||||
USDIMAGING_API
|
||||
bool PopulateSelection(HdSelection::HighlightMode const& highlightMode,
|
||||
const SdfPath &usdPath,
|
||||
int instanceIndex,
|
||||
HdSelectionSharedPtr const &result);
|
||||
|
||||
/// Returns true if \p usdPath is included in invised path list.
|
||||
USDIMAGING_API
|
||||
bool IsInInvisedPaths(const SdfPath &usdPath) const;
|
||||
|
||||
private:
|
||||
// Internal Get and SamplePrimvar
|
||||
VtValue _Get(SdfPath const& id, TfToken const& key, VtIntArray *outIndices);
|
||||
|
||||
size_t _SamplePrimvar(SdfPath const& id, TfToken const& key,
|
||||
size_t maxNumSamples, float *times, VtValue *samples,
|
||||
VtIntArray *indices);
|
||||
|
||||
// Internal friend class.
|
||||
class _Worker;
|
||||
friend class UsdImagingIndexProxy;
|
||||
friend class UsdImagingPrimAdapter;
|
||||
|
||||
bool _ValidateRefineLevel(int level) {
|
||||
if (!(0 <= level && level <= 8)) {
|
||||
TF_CODING_ERROR("Invalid refinement level(%d), "
|
||||
"expected range is [0,8]",
|
||||
level);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void _AddTask(UsdImagingDelegate::_Worker *worker, SdfPath const& usdPath);
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
// Draw mode support
|
||||
// ---------------------------------------------------------------------- //
|
||||
// Determine whether to assign a draw mode adapter to the given prim.
|
||||
bool _IsDrawModeApplied(UsdPrim const& prim);
|
||||
// Get the inherited model:drawMode attribute of the given prim.
|
||||
TfToken _GetModelDrawMode(UsdPrim const& prim);
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
// Usd Change Processing / Notice Handlers
|
||||
// ---------------------------------------------------------------------- //
|
||||
void _OnUsdObjectsChanged(UsdNotice::ObjectsChanged const&,
|
||||
UsdStageWeakPtr const& sender);
|
||||
|
||||
// The lightest-weight update, it does fine-grained invalidation of
|
||||
// individual properties at the given path (prim or property).
|
||||
//
|
||||
// If \p path is a prim path, changedPrimInfoFields will be populated
|
||||
// with the list of scene description fields that caused this prim to
|
||||
// be refreshed.
|
||||
void _RefreshUsdObject(SdfPath const& usdPath,
|
||||
TfTokenVector const& changedPrimInfoFields,
|
||||
UsdImagingIndexProxy* proxy);
|
||||
|
||||
// Heavy-weight invalidation of an entire prim subtree. All cached data is
|
||||
// reconstructed for all prims below \p rootPath.
|
||||
//
|
||||
// By default, _ResyncPrim will remove each affected prim and call
|
||||
// Repopulate() on those prims individually. If repopulateFromRoot is
|
||||
// true, Repopulate() will be called on \p rootPath instead. This is slower,
|
||||
// but handles changes in tree topology.
|
||||
void _ResyncUsdPrim(SdfPath const& usdRootPath, UsdImagingIndexProxy* proxy,
|
||||
bool repopulateFromRoot = false);
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
// Usd Data-Access Helper Methods
|
||||
// ---------------------------------------------------------------------- //
|
||||
UsdPrim _GetUsdPrim(SdfPath const& usdPath) {
|
||||
UsdPrim const& p =
|
||||
_stage->GetPrimAtPath(usdPath.GetAbsoluteRootOrPrimPath());
|
||||
TF_VERIFY(p, "No prim found for id: %s",
|
||||
usdPath.GetAbsoluteRootOrPrimPath().GetText());
|
||||
return p;
|
||||
}
|
||||
|
||||
VtValue _GetUsdPrimAttribute(SdfPath const& cachePath,
|
||||
TfToken const &attrName);
|
||||
|
||||
void _UpdateSingleValue(SdfPath const& cachePath, int dirtyFlags);
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
// Cache structures and related methods for population.
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
// Returns true if this delegate can be populated, false otherwise.
|
||||
bool _CanPopulate(UsdPrim const& rootPrim) const;
|
||||
|
||||
// Set the delegate's state to reflect that it will be populated from
|
||||
// the given root prim with the given excluded paths.
|
||||
void _SetStateForPopulation(UsdPrim const& rootPrim,
|
||||
SdfPathVector const& excludedPaths,
|
||||
SdfPathVector const& invisedPaths);
|
||||
|
||||
// Populates this delegate's render index from the paths specified
|
||||
// in the given index proxy.
|
||||
void _Populate(class UsdImagingIndexProxy* proxy);
|
||||
|
||||
// Execute all variability update tasks that have been added to the given
|
||||
// worker.
|
||||
static void _ExecuteWorkForVariabilityUpdate(_Worker* worker);
|
||||
|
||||
/// Returns true if the given prim is visible, taking into account inherited
|
||||
/// visibility values. Inherited values are strongest, Usd has no notion of
|
||||
/// "super vis/invis".
|
||||
bool _GetVisible(UsdPrim const& prim);
|
||||
|
||||
/// Helper method for filtering discovered primvar names.
|
||||
TfTokenVector _GetPrimvarNames(SdfPath const& usdPath,
|
||||
TfToken const& interpolation);
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
// Helper methods for updating the delegate on time changes
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
// Execute all time update tasks that have been added to the given worker.
|
||||
static void _ExecuteWorkForTimeUpdate(_Worker* worker);
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
// Core Delegate state
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
// Usd Prim Type to Adapter lookup table.
|
||||
typedef TfHashMap<TfToken, UsdImagingPrimAdapterSharedPtr,
|
||||
TfToken::HashFunctor> _AdapterMap;
|
||||
_AdapterMap _adapterMap;
|
||||
|
||||
// Per-Hydra-Primitive tracking data
|
||||
struct _HdPrimInfo {
|
||||
UsdImagingPrimAdapterSharedPtr adapter; // The adapter to use for the
|
||||
// prim
|
||||
UsdPrim usdPrim; // Reference to the Usd prim
|
||||
HdDirtyBits timeVaryingBits; // Dirty Bits to set when
|
||||
// time changes
|
||||
HdDirtyBits dirtyBits; // Current dirty state of the prim.
|
||||
TfDenseHashSet<SdfPath, SdfPath::Hash>
|
||||
extraDependencies;// Dependencies that aren't usdPrim.
|
||||
};
|
||||
|
||||
typedef TfHashMap<SdfPath, _HdPrimInfo, SdfPath::Hash> _HdPrimInfoMap;
|
||||
|
||||
// Map from cache path to Hydra prim info
|
||||
_HdPrimInfoMap _hdPrimInfoMap;
|
||||
|
||||
typedef std::multimap<SdfPath, SdfPath> _DependencyMap;
|
||||
|
||||
// Map from USD path to Hydra path, for tracking USD->hydra dependencies.
|
||||
_DependencyMap _dependencyInfo;
|
||||
|
||||
void _GatherDependencies(SdfPath const& subtree,
|
||||
SdfPathVector *affectedCachePaths);
|
||||
|
||||
// SdfPath::ReplacePrefix() is used frequently to convert between
|
||||
// cache path and Hydra render index path and is a performance bottleneck.
|
||||
// These maps pre-computes these conversion.
|
||||
typedef TfHashMap<SdfPath, SdfPath, SdfPath::Hash> SdfPathMap;
|
||||
SdfPathMap _cache2indexPath;
|
||||
SdfPathMap _index2cachePath;
|
||||
|
||||
// Only use this method when we think no existing adapter has been
|
||||
// established. For example, during initial Population.
|
||||
UsdImagingPrimAdapterSharedPtr const& _AdapterLookup(
|
||||
UsdPrim const& prim,
|
||||
bool ignoreInstancing = false);
|
||||
UsdImagingPrimAdapterSharedPtr const& _AdapterLookup(
|
||||
TfToken const& adapterKey);
|
||||
|
||||
// Obtain the prim tracking data for the given cache path.
|
||||
_HdPrimInfo *_GetHdPrimInfo(const SdfPath &cachePath);
|
||||
|
||||
Usd_PrimFlagsConjunction _GetDisplayPredicate() const;
|
||||
|
||||
// Mark render tags dirty for all prims.
|
||||
// This is done in response to toggling the purpose-based display settings.
|
||||
void _MarkRenderTagsDirty();
|
||||
|
||||
|
||||
typedef TfHashSet<SdfPath, SdfPath::Hash> _InstancerSet;
|
||||
|
||||
// Set of cache paths representing instancers
|
||||
_InstancerSet _instancerPrimCachePaths;
|
||||
|
||||
/// Refinement level per-USD-prim and fallback.
|
||||
typedef TfHashMap<SdfPath, int, SdfPath::Hash> _RefineLevelMap;
|
||||
/// Map from USD prim path to refine level.
|
||||
_RefineLevelMap _refineLevelMap;
|
||||
|
||||
/// Cached/pre-fetched primvar descriptors.
|
||||
UsdImagingPrimvarDescCache _primvarDescCache;
|
||||
|
||||
/// Usd binding.
|
||||
UsdStageRefPtr _stage;
|
||||
SdfPath _rootPrimPath;
|
||||
SdfPathVector _excludedPrimPaths;
|
||||
SdfPathVector _invisedPrimPaths;
|
||||
|
||||
RigidXformOverridesMap _rigidXformOverrides;
|
||||
|
||||
// Aspects of the delegate root that apply to all items in the index.
|
||||
SdfPath _compensationPath;
|
||||
|
||||
GfMatrix4d _rootXf;
|
||||
bool _rootIsVisible;
|
||||
|
||||
/// The current time from which the delegate will read data.
|
||||
UsdTimeCode _time;
|
||||
|
||||
/// Path to the camera that its shutter will be used for time samples.
|
||||
SdfPath _cameraPathForSampling;
|
||||
|
||||
int _refineLevelFallback;
|
||||
HdReprSelector _reprFallback;
|
||||
HdCullStyle _cullStyleFallback;
|
||||
|
||||
// Cache of which prims are time-varying.
|
||||
SdfPathVector _timeVaryingPrimCache;
|
||||
bool _timeVaryingPrimCacheValid;
|
||||
|
||||
// Change processing
|
||||
TfNotice::Key _objectsChangedNoticeKey;
|
||||
SdfPathVector _usdPathsToResync;
|
||||
|
||||
// Map from path of Usd object to update to list of changed scene
|
||||
// description fields for that object. This list of fields is only
|
||||
// populated for prim paths.
|
||||
typedef std::unordered_map<SdfPath, TfTokenVector, SdfPath::Hash>
|
||||
_PathsToUpdateMap;
|
||||
_PathsToUpdateMap _usdPathsToUpdate;
|
||||
|
||||
UsdImaging_XformCache _xformCache;
|
||||
UsdImaging_MaterialBindingImplData _materialBindingImplData;
|
||||
UsdImaging_MaterialBindingCache _materialBindingCache;
|
||||
UsdImaging_CoordSysBindingImplData _coordSysBindingImplData;
|
||||
UsdImaging_CoordSysBindingCache _coordSysBindingCache;
|
||||
UsdImaging_VisCache _visCache;
|
||||
UsdImaging_PurposeCache _purposeCache;
|
||||
UsdImaging_DrawModeCache _drawModeCache;
|
||||
UsdImaging_CollectionCache _collectionCache;
|
||||
UsdImaging_InheritedPrimvarCache _inheritedPrimvarCache;
|
||||
UsdImaging_PointInstancerIndicesCache _pointInstancerIndicesCache;
|
||||
|
||||
// Pickability
|
||||
PickabilityMap _pickablesMap;
|
||||
|
||||
// Purpose-based rendering toggles
|
||||
bool _displayRender;
|
||||
bool _displayProxy;
|
||||
bool _displayGuides;
|
||||
bool _enableUsdDrawModes;
|
||||
|
||||
const bool _hasDrawModeAdapter;
|
||||
|
||||
/// Enable custom shading of prims
|
||||
bool _sceneMaterialsEnabled;
|
||||
|
||||
/// Enable lights found in the usdscene
|
||||
bool _sceneLightsEnabled;
|
||||
|
||||
CameraUtilConformWindowPolicy _appWindowPolicy;
|
||||
|
||||
// Enable HdCoordSys tracking
|
||||
const bool _coordSysEnabled;
|
||||
|
||||
// Display unloaded prims with Bounds adapter
|
||||
bool _displayUnloadedPrimsWithBounds;
|
||||
|
||||
UsdImagingDelegate() = delete;
|
||||
UsdImagingDelegate(UsdImagingDelegate const &) = delete;
|
||||
UsdImagingDelegate &operator =(UsdImagingDelegate const &) = delete;
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif //PXR_USD_IMAGING_USD_IMAGING_DELEGATE_H
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USD_IMAGING_DISK_LIGHT_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_DISK_LIGHT_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/diskLightAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/lightAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingDiskLightAdapter
|
||||
///
|
||||
/// Adapter class for lights of type DiskLight
|
||||
///
|
||||
class UsdImagingDiskLightAdapter : public UsdImagingLightAdapter {
|
||||
public:
|
||||
typedef UsdImagingLightAdapter BaseAdapter;
|
||||
|
||||
UsdImagingDiskLightAdapter()
|
||||
: UsdImagingLightAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingDiskLightAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
virtual SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual bool IsSupported(UsdImagingIndexProxy const* index) const;
|
||||
|
||||
protected:
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) final;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_DISK_LIGHT_ADAPTER_H
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USD_IMAGING_DISTANT_LIGHT_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_DISTANT_LIGHT_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/distantLightAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/lightAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingDistantLightAdapter
|
||||
///
|
||||
/// Adapter class for lights of type DistantLight
|
||||
///
|
||||
class UsdImagingDistantLightAdapter : public UsdImagingLightAdapter {
|
||||
public:
|
||||
typedef UsdImagingLightAdapter BaseAdapter;
|
||||
|
||||
UsdImagingDistantLightAdapter()
|
||||
: UsdImagingLightAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingDistantLightAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
virtual SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual bool IsSupported(UsdImagingIndexProxy const* index) const;
|
||||
|
||||
protected:
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) final;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_DISTANT_LIGHT_ADAPTER_H
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USD_IMAGING_DOME_LIGHT_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_DOME_LIGHT_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/domeLightAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/lightAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingDomeLightAdapter
|
||||
///
|
||||
/// Adapter class for lights of type DomeLight
|
||||
///
|
||||
class UsdImagingDomeLightAdapter : public UsdImagingLightAdapter {
|
||||
public:
|
||||
typedef UsdImagingLightAdapter BaseAdapter;
|
||||
|
||||
UsdImagingDomeLightAdapter()
|
||||
: UsdImagingLightAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingDomeLightAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
virtual SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual bool IsSupported(UsdImagingIndexProxy const* index) const;
|
||||
|
||||
protected:
|
||||
USDIMAGING_API
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) final;
|
||||
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_DOME_LIGHT_ADAPTER_H
|
||||
@@ -0,0 +1,140 @@
|
||||
//
|
||||
// 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 PXR_USD_IMAGING_USD_IMAGING_FIELD_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_FIELD_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/fieldAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingFieldAdapter
|
||||
///
|
||||
/// Base class for all USD fields.
|
||||
///
|
||||
class UsdImagingFieldAdapter : public UsdImagingPrimAdapter {
|
||||
public:
|
||||
using BaseAdapter = UsdImagingPrimAdapter;
|
||||
|
||||
|
||||
UsdImagingFieldAdapter()
|
||||
: UsdImagingPrimAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
~UsdImagingFieldAdapter() override;
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = nullptr) override;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = nullptr) const override;
|
||||
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void UpdateForTime(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = nullptr) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Returns a bit mask of attributes to be udpated, or
|
||||
/// HdChangeTracker::AllDirty if the entire prim must be resynchronized.
|
||||
USDIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName) override;
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits dirty,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkTransformDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkVisibilityDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Data access
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue Get(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
VtIntArray *outIndices) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Field adapter requirements
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// Returns the token specifying the Hydra primitive type that is created
|
||||
/// by this adapter.
|
||||
USDIMAGING_API
|
||||
virtual TfToken GetPrimTypeToken() const = 0;
|
||||
|
||||
protected:
|
||||
USDIMAGING_API
|
||||
void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_FIELD_ADAPTER_H
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Copyright 2021 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 PXR_USD_IMAGING_USD_IMAGING_GEOMETRY_LIGHT_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_GEOMETRY_LIGHT_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/geometryLightAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/lightAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingGeometryLightAdapter
|
||||
///
|
||||
/// Adapter class for lights of type GeometryLight
|
||||
///
|
||||
class UsdImagingGeometryLightAdapter : public UsdImagingLightAdapter {
|
||||
public:
|
||||
typedef UsdImagingLightAdapter BaseAdapter;
|
||||
|
||||
UsdImagingGeometryLightAdapter()
|
||||
: UsdImagingLightAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingGeometryLightAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
virtual SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual bool IsSupported(UsdImagingIndexProxy const* index) const;
|
||||
|
||||
protected:
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) final;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_GEOMETRY_LIGHT_ADAPTER_H
|
||||
@@ -0,0 +1,228 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_GPRIM_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_GPRIM_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/gprimAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
|
||||
#include "pxr/usd/usdGeom/xformCache.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdGeomGprim;
|
||||
|
||||
/// \class UsdImagingGprimAdapter
|
||||
///
|
||||
/// Delegate support for UsdGeomGrims.
|
||||
///
|
||||
/// This adapter is provided as a base class for all adapters that want basic
|
||||
/// Gprim data support, such as visibility, doubleSided, extent, displayColor,
|
||||
/// displayOpacity, purpose, and transform.
|
||||
///
|
||||
class UsdImagingGprimAdapter : public UsdImagingPrimAdapter
|
||||
{
|
||||
public:
|
||||
using BaseAdapter = UsdImagingPrimAdapter;
|
||||
|
||||
UsdImagingGprimAdapter()
|
||||
: UsdImagingPrimAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
~UsdImagingGprimAdapter() override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = nullptr) const override;
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void UpdateForTime(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = nullptr) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
virtual HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& property) override;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits dirty,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkRefineLevelDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkReprDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkCullStyleDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkRenderTagDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkTransformDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkVisibilityDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkMaterialDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Utility methods
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// Give derived classes an opportunity to override how we get points for
|
||||
/// a prim. This is useful for implicit primitives.
|
||||
USDIMAGING_API
|
||||
virtual VtValue GetPoints(UsdPrim const& prim,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
/// Returns color, Usd interpolation token, and optionally color indices for
|
||||
/// a given prim, taking into account surface shader colors and explicitly
|
||||
/// authored color on the prim. If indices is not nullptr and the color
|
||||
/// value has indices, color will be set to the unflattened color value and
|
||||
/// indices set to the color value's indices.
|
||||
USDIMAGING_API
|
||||
static bool GetColor(UsdPrim const& prim,
|
||||
UsdTimeCode time,
|
||||
TfToken *interpolation,
|
||||
VtValue *color,
|
||||
VtIntArray *indices);
|
||||
|
||||
/// Returns opacity, Usd interpolation token, and optionally opacity indices
|
||||
/// for a given prim, taking into account surface shader opacity and
|
||||
/// explicitly authored opacity on the prim. If indices is not nullptr and
|
||||
/// the opacity value has indices, opacity will be set to the unflattened
|
||||
/// opacity value and indices set to the opacity value's indices.
|
||||
USDIMAGING_API
|
||||
static bool GetOpacity(UsdPrim const& prim,
|
||||
UsdTimeCode time,
|
||||
TfToken *interpolation,
|
||||
VtValue *opacity,
|
||||
VtIntArray *indices);
|
||||
|
||||
// Helper function: add a given type of rprim, potentially with instancer
|
||||
// name mangling, and add any bound shader.
|
||||
USDIMAGING_API
|
||||
SdfPath _AddRprim(TfToken const& primType,
|
||||
UsdPrim const& usdPrim,
|
||||
UsdImagingIndexProxy* index,
|
||||
SdfPath const& materialUsdPath,
|
||||
UsdImagingInstancerContext const* instancerContext);
|
||||
|
||||
// Helper function: map USD path to UsdImaging cache path,
|
||||
// applying any name-encoding required by the instancerContext.
|
||||
USDIMAGING_API
|
||||
static SdfPath _ResolveCachePath(SdfPath const& usdPath,
|
||||
UsdImagingInstancerContext const* instancerContext);
|
||||
|
||||
/// Reads the extent from the given prim. If the extent is not authored,
|
||||
/// an empty GfRange3d is returned, the extent will not be computed.
|
||||
USDIMAGING_API
|
||||
GfRange3d GetExtent(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
/// Reads double-sided from the given prim. If not authored, returns false
|
||||
USDIMAGING_API
|
||||
bool GetDoubleSided(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath GetMaterialId(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
/// Gets the value of the parameter named key for the given prim (which
|
||||
/// has the given cache path) and given time. If outIndices is not nullptr
|
||||
/// and the value has indices, it will return the unflattened value and set
|
||||
/// outIndices to the value's associated indices.
|
||||
USDIMAGING_API
|
||||
VtValue Get(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
VtIntArray *outIndices) const override;
|
||||
|
||||
protected:
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
// Give derived classes an opportunity to block GprimAdapter processing
|
||||
// of certain primvars.
|
||||
USDIMAGING_API
|
||||
virtual bool _IsBuiltinPrimvar(TfToken const& primvarName) const;
|
||||
|
||||
// Utility for derived classes to try to find an inherited primvar.
|
||||
USDIMAGING_API
|
||||
UsdGeomPrimvar _GetInheritedPrimvar(UsdPrim const& prim,
|
||||
TfToken const& primvarName) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif //PXR_USD_IMAGING_USD_IMAGING_GPRIM_ADAPTER_H
|
||||
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// Copyright 2020 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 PXR_USD_IMAGING_USD_IMAGING_HERMITE_CURVES_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_HERMITE_CURVES_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/hermiteCurvesAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
#include "pxr/usdImaging/usdImaging/gprimAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
/// \class UsdImagingHermiteCurvesAdapter
|
||||
///
|
||||
/// Delegate support for UsdGeomHermiteCurves.
|
||||
///
|
||||
/// As Hydra doesn't support imaging of Hermite curves, we render
|
||||
/// the points as linearly interpolated BasisCurves, ignoring tangents,
|
||||
/// widths, and normals.
|
||||
///
|
||||
class UsdImagingHermiteCurvesAdapter : public UsdImagingGprimAdapter {
|
||||
public:
|
||||
typedef UsdImagingGprimAdapter BaseAdapter;
|
||||
|
||||
UsdImagingHermiteCurvesAdapter()
|
||||
: UsdImagingGprimAdapter()
|
||||
{}
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingHermiteCurvesAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath Populate(
|
||||
UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr) override;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr)
|
||||
const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Data access
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue GetTopology(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
protected:
|
||||
USDIMAGING_API
|
||||
bool _IsBuiltinPrimvar(TfToken const& primvarName) const override;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_HERMITE_CURVES_ADAPTER_H
|
||||
@@ -0,0 +1,179 @@
|
||||
//
|
||||
// Copyright 2019 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 PXR_USD_IMAGING_USD_IMAGING_IMPLICIT_SURFACE_MESH_UTILS_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_IMPLICIT_SURFACE_MESH_UTILS_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/base/vt/types.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class PxOsdMeshTopology;
|
||||
class TfToken;
|
||||
|
||||
// Sphere
|
||||
|
||||
/// Return a topology object for the canonical "unit sphere" mesh. This is
|
||||
/// constructed once and is identical for all spheres. The indices refer to the
|
||||
/// points array returned by UsdImagingGetUnitSphereMeshPoints().
|
||||
USDIMAGING_API
|
||||
const PxOsdMeshTopology&
|
||||
UsdImagingGetUnitSphereMeshTopology();
|
||||
|
||||
/// Return an array of points for the canonical "unit sphere" mesh. This is a
|
||||
/// mesh describing a sphere that fits in a unit-sized bounding box, centered on
|
||||
/// the origin. Note that this means the diameter, not radius, is one unit!
|
||||
///
|
||||
/// These points are constructed once and are identical for all spheres, with
|
||||
/// topology provided by UsdImagingGetUnitSphereMeshTopology(). To represent
|
||||
/// spheres of a different size, use with the transform produced by the
|
||||
/// companion function UsdImagingGenerateSphereOrCubeTransform().
|
||||
USDIMAGING_API
|
||||
const VtVec3fArray&
|
||||
UsdImagingGetUnitSphereMeshPoints();
|
||||
|
||||
// Cube
|
||||
|
||||
/// Return a topology object for the canonical "unit cube" mesh. This is
|
||||
/// constructed once and is identical for all cubes. The indices refer to the
|
||||
/// points array returned by UsdImagingGetUnitCubeMeshPoints().
|
||||
USDIMAGING_API
|
||||
const PxOsdMeshTopology&
|
||||
UsdImagingGetUnitCubeMeshTopology();
|
||||
|
||||
/// Return an array of points for the canonical "unit cube" mesh. This is a
|
||||
/// mesh describing a cube with unit-length edges, centered on the origin.
|
||||
///
|
||||
/// These points are constructed once and are identical for all cubes, with
|
||||
/// topology provided by UsdImagingGetUnitCubeMeshTopology(). To represent
|
||||
/// cubes of a different size, use with the transform produced by the
|
||||
/// companion function UsdImagingGenerateSphereOrCubeTransform().
|
||||
USDIMAGING_API
|
||||
const VtVec3fArray&
|
||||
UsdImagingGetUnitCubeMeshPoints();
|
||||
|
||||
// Cone
|
||||
|
||||
/// Return a topology object for the canonical "unit cone" mesh. This is
|
||||
/// constructed once and is identical for all cones. The indices refer to the
|
||||
/// points array returned by UsdImagingGetUnitConeMeshPoints().
|
||||
USDIMAGING_API
|
||||
const PxOsdMeshTopology&
|
||||
UsdImagingGetUnitConeMeshTopology();
|
||||
|
||||
/// Return an array of points for the canonical "unit cone" mesh. This is a
|
||||
/// mesh describing a cone that fits in a unit-sized bounding box, centered on
|
||||
/// the origin. Note that this means the diameter, not radius, is one unit!
|
||||
/// The circular-disk face of the cone lies in the XY plane, with the large end
|
||||
/// on the negative-Z side and the cone point on the positive-Z side.
|
||||
///
|
||||
/// These points are constructed once and are identical for all cones, with
|
||||
/// topology provided by UsdImagingGetUnitConeMeshTopology(). To represent
|
||||
/// cones of a different radius, height, or axis orientation, use with the
|
||||
/// transform produced by the companion function
|
||||
/// UsdImagingGenerateConeOrCylinderTransform().
|
||||
USDIMAGING_API
|
||||
const VtVec3fArray&
|
||||
UsdImagingGetUnitConeMeshPoints();
|
||||
|
||||
// Cylinder
|
||||
|
||||
/// Return a topology object for the canonical "unit cylinder" mesh. This is
|
||||
/// constructed once and is identical for all cylinders. The indices refer to
|
||||
/// the points array returned by UsdImagingGetUnitCylinderMeshPoints().
|
||||
USDIMAGING_API
|
||||
const PxOsdMeshTopology&
|
||||
UsdImagingGetUnitCylinderMeshTopology();
|
||||
|
||||
/// Return an array of points for the canonical "unit cylinder" mesh. This is a
|
||||
/// mesh describing a cylinder that fits in a unit-sized bounding box, centered
|
||||
/// on the origin. Note that this means the diameter, not radius, is one unit!
|
||||
/// The circular-disk face of the cone lies in the XY plane, with the height of
|
||||
/// the cylinder aligned along the Z axis.
|
||||
///
|
||||
/// These points are constructed once and are identical for all cylinders, with
|
||||
/// topology provided by UsdImagingGetUnitCylinderMeshTopology(). To represent
|
||||
/// cylinders of a different radius, height, or axis orientation, use with the
|
||||
/// transform produced by the companion function
|
||||
/// UsdImagingGenerateConeOrCylinderTransform().
|
||||
USDIMAGING_API
|
||||
const VtVec3fArray&
|
||||
UsdImagingGetUnitCylinderMeshPoints();
|
||||
|
||||
// Capsule
|
||||
|
||||
/// Return a topology object for use with all generated "capsule" meshes. This
|
||||
/// is constructed once and is identical for all capsules. The indices refer to
|
||||
/// the points array returned by UsdImagingGenerateCapsuleMeshPoints().
|
||||
USDIMAGING_API
|
||||
const PxOsdMeshTopology&
|
||||
UsdImagingGetCapsuleMeshTopology();
|
||||
|
||||
/// Generate an array of points describing a "capsule": a cylinder with
|
||||
/// hemispherical caps on each end. The given height is the length of the
|
||||
/// cylinder portion exclusively, and the given radius applies to both cylinder
|
||||
/// and hemisphere components. The cylinder will be oriented along the given
|
||||
/// axis.
|
||||
///
|
||||
/// Unlike the other primitives in this library, it's not possible to use a
|
||||
/// constant set of points and effect radius and height adjustments by varying
|
||||
/// the transform matrix. This function will generate the points with the
|
||||
/// requested parameters, and no additional transform is required. The returned
|
||||
/// points are for use with the topology provided by
|
||||
/// UsdImagingGetCapsuleMeshTopology().
|
||||
USDIMAGING_API
|
||||
VtVec3fArray
|
||||
UsdImagingGenerateCapsuleMeshPoints(
|
||||
const double height,
|
||||
const double radius,
|
||||
const TfToken& axis);
|
||||
|
||||
// Transforms
|
||||
|
||||
/// Generate a transform to inflate the "unit sphere" or "unit cube" mesh to the
|
||||
/// specified size. This is a uniform scale matrix. Note that the parameter is
|
||||
/// the net scale, so when using with the "unit sphere" mesh be sure to pass the
|
||||
/// desired diameter (not radius)!
|
||||
USDIMAGING_API
|
||||
GfMatrix4d
|
||||
UsdImagingGenerateSphereOrCubeTransform(
|
||||
const double size);
|
||||
|
||||
/// Generate a transform for use with the "unit cone" or "unit cylinder" meshes,
|
||||
/// which transforms the mesh to have the specified height and radius, while
|
||||
/// aligned along the specified axis. This is a combination of rotation and
|
||||
/// nonuniform scales. This function is for use only with the cone and cylinder
|
||||
/// primitives, hence its parameterization by radius; the net scale for the
|
||||
/// radial axes will be twice the given value.
|
||||
USDIMAGING_API
|
||||
GfMatrix4d
|
||||
UsdImagingGenerateConeOrCylinderTransform(
|
||||
const double height,
|
||||
const double radius,
|
||||
const TfToken& axis);
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_IMPLICIT_SURFACE_MESH_UTILS_H
|
||||
@@ -0,0 +1,251 @@
|
||||
//
|
||||
// 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 PXR_USD_IMAGING_USD_IMAGING_INDEX_PROXY_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_INDEX_PROXY_H
|
||||
|
||||
/// \file usdImaging/indexProxy.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/delegate.h"
|
||||
|
||||
#include "pxr/usd/sdf/path.h"
|
||||
#include "pxr/usd/usd/prim.h"
|
||||
|
||||
#include "pxr/base/tf/token.h"
|
||||
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
/// \class UsdImagingIndexProxy
|
||||
///
|
||||
/// This proxy class exposes a subset of the private Delegate API to
|
||||
/// PrimAdapters.
|
||||
///
|
||||
class UsdImagingIndexProxy {
|
||||
public:
|
||||
/// A note on paths/prims: the core function of UsdImagingIndexProxy and
|
||||
/// UsdImagingDelegate is to maintain a set of mappings between USD prims
|
||||
/// and hydra prims (and a set of adapters that know how to translate
|
||||
/// USD properties to hydra buffers). A USD prim can represent multiple
|
||||
/// hydra prims (e.g. point instancer prototypes that are referenced twice),
|
||||
/// and a hydra prim can represent multiple USD prims (e.g. a single hydra
|
||||
/// instancer prim representing multiple native instances).
|
||||
///
|
||||
/// There are three different prim "namespaces" that the delegate works
|
||||
/// with: "USD paths", which represent paths to USD prims; "index paths",
|
||||
/// which represent paths to hydra prims in the render index; and
|
||||
/// "cache paths", which represent paths to buffers in the value cache
|
||||
/// backing hydra prims. Cache paths and index paths are the same,
|
||||
/// except that index paths have the "delegateID" prefixed onto their path.
|
||||
///
|
||||
/// Index paths are only used in the interface to hydra. In IndexProxy
|
||||
/// and the adapters, the pattern is to use "cachePath" as a key to look
|
||||
/// up state for a hydra prim; and pass "usdPrim" when we additionally
|
||||
/// need to specify the related USD prim. The naming helps clarify them,
|
||||
/// and the fact that we pass a UsdPrim and not an SdfPath further ensures
|
||||
/// that we pass valid USD paths instead of passing cache paths by mistake.
|
||||
|
||||
|
||||
/// Adds a dependency from the given usdPrim to the given cache path.
|
||||
/// Insert* will automatically add a dependency, so this is for hydra prims
|
||||
/// that may depend on more than one usd prim (e.g. subsets, instancers)
|
||||
USDIMAGING_API
|
||||
void AddDependency(SdfPath const& cachePath,
|
||||
UsdPrim const& usdPrim);
|
||||
|
||||
/// Insert a hydra prim with the specified cache path. As mentioned above,
|
||||
/// the delegateID will be prepended before adding the prim in hydra, but
|
||||
/// cachePath will be the key into all internal usdImaging datastructures.
|
||||
/// usdPrim is the USD prim this hydra prim is representing (e.g. the
|
||||
/// UsdGeomMesh for which we are inserting a hydra mesh). If no
|
||||
/// adapter is specified, UsdImagingDelegate will choose based on Usd
|
||||
/// prim type; some clients (e.g. instancing) want to override the adapter
|
||||
/// choice but this should be used sparingly.
|
||||
///
|
||||
/// For Rprims and Instancers, "parentPath" is the parent instancer.
|
||||
USDIMAGING_API
|
||||
void InsertRprim(TfToken const& primType,
|
||||
SdfPath const& cachePath,
|
||||
UsdPrim const& usdPrim,
|
||||
UsdImagingPrimAdapterSharedPtr adapter =
|
||||
UsdImagingPrimAdapterSharedPtr());
|
||||
|
||||
USDIMAGING_API
|
||||
void InsertSprim(TfToken const& primType,
|
||||
SdfPath const& cachePath,
|
||||
UsdPrim const& usdPrim,
|
||||
UsdImagingPrimAdapterSharedPtr adapter =
|
||||
UsdImagingPrimAdapterSharedPtr());
|
||||
|
||||
USDIMAGING_API
|
||||
void InsertBprim(TfToken const& primType,
|
||||
SdfPath const& cachePath,
|
||||
UsdPrim const& usdPrim,
|
||||
UsdImagingPrimAdapterSharedPtr adapter =
|
||||
UsdImagingPrimAdapterSharedPtr());
|
||||
|
||||
USDIMAGING_API
|
||||
void InsertInstancer(SdfPath const& cachePath,
|
||||
UsdPrim const& usdPrim,
|
||||
UsdImagingPrimAdapterSharedPtr adapter =
|
||||
UsdImagingPrimAdapterSharedPtr());
|
||||
|
||||
// Mark a prim as needing follow-up work by the delegate
|
||||
// (e.g. TrackVariability); this is automatically called on Insert*, but
|
||||
// needs to manually be called in some special cases like native
|
||||
// instancer population.
|
||||
USDIMAGING_API
|
||||
void Refresh(SdfPath const& cachePath);
|
||||
|
||||
//
|
||||
// All removals are deferred to avoid surprises during change processing.
|
||||
//
|
||||
|
||||
// Removes the Rprim at the specified cache path.
|
||||
void RemoveRprim(SdfPath const& cachePath) {
|
||||
_rprimsToRemove.push_back(cachePath);
|
||||
_hdPrimInfoToRemove.push_back(cachePath);
|
||||
_RemoveDependencies(cachePath);
|
||||
}
|
||||
|
||||
// Removes the Sprim at the specified cache path.
|
||||
void RemoveSprim(TfToken const& primType, SdfPath const& cachePath) {
|
||||
_TypeAndPath primToRemove = {primType, cachePath};
|
||||
_sprimsToRemove.push_back(primToRemove);
|
||||
_hdPrimInfoToRemove.push_back(cachePath);
|
||||
_RemoveDependencies(cachePath);
|
||||
}
|
||||
|
||||
// Removes the Bprim at the specified cache path.
|
||||
void RemoveBprim(TfToken const& primType, SdfPath const& cachePath) {
|
||||
_TypeAndPath primToRemove = {primType, cachePath};
|
||||
_bprimsToRemove.push_back(primToRemove);
|
||||
_hdPrimInfoToRemove.push_back(cachePath);
|
||||
_RemoveDependencies(cachePath);
|
||||
}
|
||||
|
||||
// Removes the HdInstancer at the specified cache path.
|
||||
void RemoveInstancer(SdfPath const& cachePath) {
|
||||
_instancersToRemove.push_back(cachePath);
|
||||
_hdPrimInfoToRemove.push_back(cachePath);
|
||||
_RemoveDependencies(cachePath);
|
||||
}
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkRprimDirty(SdfPath const& cachePath, HdDirtyBits dirtyBits);
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkSprimDirty(SdfPath const& cachePath, HdDirtyBits dirtyBits);
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkBprimDirty(SdfPath const& cachePath, HdDirtyBits dirtyBits);
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkInstancerDirty(SdfPath const& cachePath, HdDirtyBits dirtyBits);
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsRprimTypeSupported(TfToken const& typeId) const;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSprimTypeSupported(TfToken const& typeId) const;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsBprimTypeSupported(TfToken const& typeId) const;
|
||||
|
||||
// Check if the given path has been populated yet.
|
||||
USDIMAGING_API
|
||||
bool IsPopulated(SdfPath const& cachePath) const;
|
||||
|
||||
// Recursively repopulate the specified usdPath into the render index.
|
||||
USDIMAGING_API
|
||||
void Repopulate(SdfPath const& usdPath);
|
||||
|
||||
USDIMAGING_API
|
||||
UsdImagingPrimAdapterSharedPtr GetMaterialAdapter(
|
||||
UsdPrim const& materialPrim);
|
||||
|
||||
// XXX: This is a workaround for some bugs in USD edit processing, and
|
||||
// the weird use of HdPrimInfo by instanced prims. It removes the dependency
|
||||
// between a hydra prim and whatever USD prim is in its primInfo, since this
|
||||
// dependency is automatically inserted and for instanced prims will
|
||||
// erroneously add a dependency between a hydra prototype and
|
||||
// a USD instancer.
|
||||
//
|
||||
// Pending some refactoring, hopefully this API will disappear.
|
||||
USDIMAGING_API
|
||||
void RemovePrimInfoDependency(SdfPath const& cachePath);
|
||||
|
||||
private:
|
||||
friend class UsdImagingDelegate;
|
||||
UsdImagingIndexProxy(UsdImagingDelegate* delegate,
|
||||
UsdImagingDelegate::_Worker* worker)
|
||||
: _delegate(delegate)
|
||||
, _worker(worker)
|
||||
{}
|
||||
|
||||
// Sort and de-duplicate "repopulate" paths to prevent double-inserts.
|
||||
// Called by UsdImagingDelegate::ApplyPendingUpdates.
|
||||
void _UniqueifyPathsToRepopulate();
|
||||
|
||||
bool _AddHdPrimInfo(SdfPath const& cachePath,
|
||||
UsdPrim const& usdPrim,
|
||||
UsdImagingPrimAdapterSharedPtr const& adapter);
|
||||
|
||||
USDIMAGING_API
|
||||
void _RemoveDependencies(SdfPath const& cachePath);
|
||||
|
||||
SdfPathVector const& _GetUsdPathsToRepopulate() {
|
||||
return _usdPathsToRepopulate;
|
||||
}
|
||||
void _ProcessRemovals();
|
||||
|
||||
void _AddTask(SdfPath const& usdPath);
|
||||
|
||||
struct _TypeAndPath {
|
||||
TfToken primType;
|
||||
SdfPath cachePath;
|
||||
};
|
||||
|
||||
typedef std::vector<_TypeAndPath> _TypeAndPathVector;
|
||||
|
||||
typedef std::vector<UsdImagingDelegate::_DependencyMap::value_type>
|
||||
_DependencyVector;
|
||||
|
||||
UsdImagingDelegate* _delegate;
|
||||
UsdImagingDelegate::_Worker* _worker;
|
||||
SdfPathVector _usdPathsToRepopulate;
|
||||
SdfPathVector _rprimsToRemove;
|
||||
_TypeAndPathVector _sprimsToRemove;
|
||||
_TypeAndPathVector _bprimsToRemove;
|
||||
SdfPathVector _instancersToRemove;
|
||||
SdfPathVector _hdPrimInfoToRemove;
|
||||
_DependencyVector _dependenciesToRemove;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif //PXR_USD_IMAGING_USD_IMAGING_INDEX_PROXY_H
|
||||
@@ -0,0 +1,629 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_INSTANCE_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_INSTANCE_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/instanceAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
|
||||
#include "pxr/base/tf/hashmap.h"
|
||||
|
||||
#include <mutex>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
/// \class UsdImagingInstanceAdapter
|
||||
///
|
||||
/// Delegate support for instanced prims.
|
||||
///
|
||||
/// In addition to prim schemas that support instancing, like the point
|
||||
/// instancer, USD has a built in instancing feature that will allow prims
|
||||
/// composed from the same assets, with compatible attributes, to be
|
||||
/// de-duplicated inside of USD.
|
||||
///
|
||||
/// When these prims are found during scene load, the prim location is
|
||||
/// marked as an instance (meaning prim.IsInstance() == true), and its
|
||||
/// descendants are added to a new hidden scene root. There can be
|
||||
/// multiple prototype scene roots, and each one can be pointed to by
|
||||
/// many instance prims, and these prototype sub-scenes can themselves
|
||||
/// contain instances.
|
||||
///
|
||||
/// We handle this by sending all instance prims to the instance adapter. In
|
||||
/// order to preserve USD's native instancing work during rendering, for each
|
||||
/// prototype scene root, we insert one hydra gprim per prototype USD gprim,
|
||||
/// and we insert a hydra instancer that computes all of the places these gprims
|
||||
/// (and any child instancers) are referenced in the scene, adjusting the
|
||||
/// instancing count accordingly.
|
||||
///
|
||||
/// The instance adapter is responsible for computing and passing down a
|
||||
/// small amount of inheritable data that we allow to vary per-instance:
|
||||
/// for example, transform and visibility state, and inherited constant
|
||||
/// primvars. Otherwise, prototypes have no knowledge of the instance prims
|
||||
/// that refer to them.
|
||||
///
|
||||
/// Just like the scene root, the root of the prototype tree isn't allowed to
|
||||
/// have attributes or a prim type; those are set on the instance prim instead.
|
||||
/// This means if a gprim is directly instanced, USD won't actually de-duplicate
|
||||
/// it. The instance adapter could theoretically bucket such gprims together,
|
||||
/// but the difficulty of doing so is the same as the difficulty of
|
||||
/// deduplicating arbitrary prims in the scene. Instead, the instance adapter
|
||||
/// refuses to image directly-instanced gprims, and the recommended authoring
|
||||
/// guidelines is to only enable USD instancing on enclosing scopes or xforms.
|
||||
///
|
||||
/// There's a small set of extremely-special-case prims that are allowed to be
|
||||
/// directly instanced, including cards and support prims that designate e.g.
|
||||
/// skinning buffers. These prim adapters opt-in via CanPopulateUsdInstance,
|
||||
/// and generally require very careful coding and support in the instance
|
||||
/// adapter; but they are useful for restricted schemas where we know how to
|
||||
/// vary the data per-instance or know how to efficiently aggregate instances.
|
||||
///
|
||||
/// Finally, there's a small (hopefully shrinking) set of inherited attributes
|
||||
/// that we need to respect, but don't know how to vary per-instance; for
|
||||
/// example, material bindings. If two instances point to the same USD proto
|
||||
/// root, but have different material bindings, we currently populate two
|
||||
/// hydra instancers with two sets of hydra prototypes. This cuts into the
|
||||
/// efficiency of instancing, so we try to minimize it.
|
||||
///
|
||||
class UsdImagingInstanceAdapter : public UsdImagingPrimAdapter
|
||||
{
|
||||
public:
|
||||
using BaseAdapter = UsdImagingPrimAdapter;
|
||||
|
||||
UsdImagingInstanceAdapter();
|
||||
virtual ~UsdImagingInstanceAdapter();
|
||||
|
||||
virtual SdfPath Populate(
|
||||
UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr) override;
|
||||
|
||||
virtual bool ShouldCullChildren() const override;
|
||||
|
||||
virtual bool IsInstancerAdapter() const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
virtual void TrackVariability(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const override;
|
||||
|
||||
virtual void UpdateForTime(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
virtual HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName)
|
||||
override;
|
||||
|
||||
virtual void ProcessPrimResync(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
virtual void ProcessPrimRemoval(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
|
||||
virtual void MarkDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits dirty,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
// As this adapter hijacks the adapter for the child prim
|
||||
// We need to forward these messages on, in case the child
|
||||
// adapter needs them
|
||||
virtual void MarkRefineLevelDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
virtual void MarkReprDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
virtual void MarkCullStyleDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
virtual void MarkRenderTagDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
virtual void MarkTransformDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
virtual void MarkVisibilityDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Instancing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
std::vector<VtArray<TfToken>> GetInstanceCategories(
|
||||
UsdPrim const& prim) override;
|
||||
|
||||
GfMatrix4d GetInstancerTransform(UsdPrim const& instancerPrim,
|
||||
SdfPath const& instancerPath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
SdfPath GetInstancerId(
|
||||
UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath) const override;
|
||||
|
||||
SdfPathVector GetInstancerPrototypes(
|
||||
UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath) const override;
|
||||
|
||||
size_t SampleInstancerTransform(UsdPrim const& instancerPrim,
|
||||
SdfPath const& instancerPath,
|
||||
UsdTimeCode time,
|
||||
size_t maxSampleCount,
|
||||
float *sampleTimes,
|
||||
GfMatrix4d *sampleValues) override;
|
||||
|
||||
size_t SampleTransform(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
size_t maxNumSamples,
|
||||
float *sampleTimes,
|
||||
GfMatrix4d *sampleValues) override;
|
||||
|
||||
size_t SamplePrimvar(UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
size_t maxNumSamples,
|
||||
float *sampleTimes,
|
||||
VtValue *sampleValues,
|
||||
VtIntArray *sampleIndices) override;
|
||||
|
||||
TfToken GetPurpose(
|
||||
UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& instanceInheritablePurpose) const override;
|
||||
|
||||
PxOsdSubdivTags GetSubdivTags(UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
VtValue GetTopology(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
HdCullStyle GetCullStyle(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
GfRange3d GetExtent(UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
bool GetVisible(UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
bool GetDoubleSided(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
GfMatrix4d GetTransform(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
bool ignoreRootTransform = false) const override;
|
||||
|
||||
SdfPath GetMaterialId(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
HdExtComputationInputDescriptorVector
|
||||
GetExtComputationInputs(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
const UsdImagingInstancerContext* instancerContext)
|
||||
const override;
|
||||
|
||||
|
||||
HdExtComputationOutputDescriptorVector
|
||||
GetExtComputationOutputs(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
const UsdImagingInstancerContext* instancerContext)
|
||||
const override;
|
||||
|
||||
HdExtComputationPrimvarDescriptorVector
|
||||
GetExtComputationPrimvars(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdInterpolation interpolation,
|
||||
const UsdImagingInstancerContext* instancerContext) const override;
|
||||
|
||||
VtValue
|
||||
GetExtComputationInput(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& name,
|
||||
UsdTimeCode time,
|
||||
const UsdImagingInstancerContext* instancerContext) const override;
|
||||
|
||||
std::string
|
||||
GetExtComputationKernel(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
const UsdImagingInstancerContext* instancerContext) const override;
|
||||
|
||||
VtValue
|
||||
GetInstanceIndices(UsdPrim const& instancerPrim,
|
||||
SdfPath const& instancerCachePath,
|
||||
SdfPath const& prototypeCachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
VtValue Get(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
VtIntArray *outIndices) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Nested instancing support
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
virtual GfMatrix4d GetRelativeInstancerTransform(
|
||||
SdfPath const &parentInstancerPath,
|
||||
SdfPath const &instancerPath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Picking & selection
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
virtual SdfPath GetScenePrimPath(
|
||||
SdfPath const& cachePath,
|
||||
int instanceIndex,
|
||||
HdInstancerContext *instancerContext) const override;
|
||||
|
||||
virtual bool PopulateSelection(
|
||||
HdSelection::HighlightMode const& highlightMode,
|
||||
SdfPath const &cachePath,
|
||||
UsdPrim const &usdPrim,
|
||||
int const hydraInstanceIndex,
|
||||
VtIntArray const &parentInstanceIndices,
|
||||
HdSelectionSharedPtr const &result) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Volume field information
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
virtual HdVolumeFieldDescriptorVector
|
||||
GetVolumeFieldDescriptors(UsdPrim const& usdPrim, SdfPath const &id,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
protected:
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override final;
|
||||
|
||||
private:
|
||||
|
||||
SdfPath _Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext,
|
||||
SdfPath const& parentProxyPath);
|
||||
|
||||
struct _ProtoPrim;
|
||||
struct _ProtoGroup;
|
||||
struct _InstancerData;
|
||||
|
||||
bool _IsChildPrim(UsdPrim const& prim,
|
||||
SdfPath const& cachePath) const;
|
||||
|
||||
// Returns true if the given prim serves as an instancer.
|
||||
bool _PrimIsInstancer(UsdPrim const& prim) const;
|
||||
|
||||
// Inserts prototype prims for the given \p usdPrim into the \p index.
|
||||
// Any inserted gprims will be inserted under a special path combining
|
||||
// \p instancerPath and \p protoName.
|
||||
SdfPath
|
||||
_InsertProtoPrim(UsdPrimRange::iterator *iter,
|
||||
const TfToken& protoName,
|
||||
SdfPath materialId,
|
||||
TfToken drawMode,
|
||||
TfToken inheritablePurpose,
|
||||
SdfPath instancerPath,
|
||||
UsdImagingPrimAdapterSharedPtr const& primAdapter,
|
||||
UsdImagingPrimAdapterSharedPtr const& instancerAdapter,
|
||||
UsdImagingIndexProxy* index,
|
||||
bool *isLeafInstancer);
|
||||
|
||||
// For a usd path, collects the instancers to resync.
|
||||
void _ResyncPath(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index,
|
||||
bool reload);
|
||||
// Removes and optionally reloads all instancer data, both locally and
|
||||
// from the render index.
|
||||
void _ResyncInstancer(SdfPath const& instancerPath,
|
||||
UsdImagingIndexProxy* index, bool reload);
|
||||
|
||||
// Computes per-frame data in the instancer map. This is primarily used
|
||||
// during update to send new instance indices out to Hydra.
|
||||
struct _ComputeInstanceMapFn;
|
||||
VtIntArray _ComputeInstanceMap(UsdPrim const& instancerPrim,
|
||||
_InstancerData const& instrData,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
// Precomputes the instancer visibility data (as visible, invis, varying
|
||||
// per-node), and returns whether the instance map is variable.
|
||||
// Note: this function assumes the instancer data is already locked by
|
||||
// the caller...
|
||||
struct _ComputeInstanceMapVariabilityFn;
|
||||
bool _ComputeInstanceMapVariability(UsdPrim const& instancerPrim,
|
||||
_InstancerData const& instrData) const;
|
||||
|
||||
// Gets the associated _ProtoPrim and instancer context for the given
|
||||
// instancer and cache path.
|
||||
_ProtoPrim const& _GetProtoPrim(SdfPath const& instancerPath,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingInstancerContext* ctx) const;
|
||||
|
||||
// Gets the associated _ProtoPrim and instancerContext if cachePath is a
|
||||
// child path and returns \c true, otherwise returns \c false.
|
||||
bool _GetProtoPrimForChild(
|
||||
UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath,
|
||||
_ProtoPrim const** proto,
|
||||
UsdImagingInstancerContext* ctx) const;
|
||||
|
||||
// Computes the transforms for all instances corresponding to the given
|
||||
// instancer.
|
||||
struct _ComputeInstanceTransformFn;
|
||||
bool _ComputeInstanceTransforms(UsdPrim const& instancer,
|
||||
VtMatrix4dArray* transforms,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
// Gathers the authored transforms time samples given an instancer.
|
||||
struct _GatherInstanceTransformTimeSamplesFn;
|
||||
bool _GatherInstanceTransformsTimeSamples(UsdPrim const& instancer,
|
||||
GfInterval interval,
|
||||
std::vector<double>* outTimes)
|
||||
const;
|
||||
|
||||
// Gathers the specified primvar time samples given an instancer.
|
||||
struct _GatherInstancePrimvarTimeSamplesFn;
|
||||
bool _GatherInstancePrimvarTimeSamples(UsdPrim const& instancer,
|
||||
TfToken const& key,
|
||||
GfInterval interval,
|
||||
std::vector<double>* outTimes)
|
||||
const;
|
||||
|
||||
// Returns true if any of the instances corresponding to the given
|
||||
// instancer has a varying transform.
|
||||
struct _IsInstanceTransformVaryingFn;
|
||||
bool _IsInstanceTransformVarying(UsdPrim const& instancer) const;
|
||||
|
||||
// Computes the value of a primvar for all instances corresponding to the
|
||||
// given instancer. The templated version runs the templated functor,
|
||||
// and the un-templated version does type dispatch.
|
||||
template<typename T> struct _ComputeInheritedPrimvarFn;
|
||||
|
||||
template<typename T>
|
||||
bool _ComputeInheritedPrimvar(UsdPrim const& instancer,
|
||||
TfToken const& primvarName,
|
||||
VtValue *result,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
bool _ComputeInheritedPrimvar(UsdPrim const& instancer,
|
||||
TfToken const& primvarName,
|
||||
SdfValueTypeName const& type,
|
||||
VtValue *result,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
// Returns true if any of the instances corresponding to the given
|
||||
// instancer has varying inherited primvars.
|
||||
struct _IsInstanceInheritedPrimvarVaryingFn;
|
||||
bool _IsInstanceInheritedPrimvarVarying(UsdPrim const& instancer) const;
|
||||
|
||||
struct _PopulateInstanceSelectionFn;
|
||||
struct _GetScenePrimPathFn;
|
||||
|
||||
// Helper functions for dealing with "actual" instances to be drawn.
|
||||
//
|
||||
// Suppose we have:
|
||||
// /Root
|
||||
// Instance_A (prototype: /__Prototype_1)
|
||||
// Instance_B (prototype: /__Prototype_1)
|
||||
// /__Prototype_1
|
||||
// AnotherInstance_A (prototype: /__Prototype_2)
|
||||
// /__Prototype_2
|
||||
//
|
||||
// /__Prototype_2 has only one associated instance in the Usd scenegraph:
|
||||
// /__Prototype_1/AnotherInstance_A. However, imaging actually needs to draw
|
||||
// two instances of /__Prototype_2, because AnotherInstance_A is a nested
|
||||
// instance beneath /__Prototype_1, and there are two instances of
|
||||
// /__Prototype_1.
|
||||
//
|
||||
// Each instance to be drawn is addressed by the chain of instances
|
||||
// that caused it to be drawn. In the above example, the two instances
|
||||
// of /__Prototype_2 to be drawn are:
|
||||
//
|
||||
// [ /Root/Instance_A, /__Prototype_1/AnotherInstance_A ],
|
||||
// [ /Root/Instance_B, /__Prototype_1/AnotherInstance_A ]
|
||||
//
|
||||
// This "instance context" describes the chain of opinions that
|
||||
// ultimately affect the final drawn instance. For example, the
|
||||
// transform of each instance to draw is the combined transforms
|
||||
// of the prims in each context.
|
||||
template <typename Functor>
|
||||
void _RunForAllInstancesToDraw(UsdPrim const& instancer, Functor* fn) const;
|
||||
template <typename Functor>
|
||||
bool _RunForAllInstancesToDrawImpl(UsdPrim const& instancer,
|
||||
std::vector<UsdPrim>* instanceContext,
|
||||
size_t* instanceIdx,
|
||||
Functor* fn) const;
|
||||
|
||||
typedef TfHashMap<SdfPath, size_t, SdfPath::Hash> _InstancerDrawCounts;
|
||||
size_t _CountAllInstancesToDraw(UsdPrim const& instancer) const;
|
||||
size_t _CountAllInstancesToDrawImpl(UsdPrim const& instancer,
|
||||
_InstancerDrawCounts* drawCounts) const;
|
||||
|
||||
// A proto prim represents a single adapter under a prototype root declared
|
||||
// on the instancer.
|
||||
struct _ProtoPrim {
|
||||
_ProtoPrim() {}
|
||||
// Each prim will become a prototype "child" under the instancer. This
|
||||
// path is the path to the prim on the Usd Stage (the path to a single
|
||||
// mesh, for example).
|
||||
SdfPath path;
|
||||
// The prim adapter for the actual prototype prim.
|
||||
UsdImagingPrimAdapterSharedPtr adapter;
|
||||
};
|
||||
|
||||
// Indexed by prototype cachePath (each prim has one entry)
|
||||
typedef TfHashMap<SdfPath, _ProtoPrim, SdfPath::Hash> _PrimMap;
|
||||
|
||||
// All data associated with a given instancer prim. PrimMap could
|
||||
// technically be split out to avoid two lookups, however it seems cleaner
|
||||
// to keep everything bundled up under the instancer path.
|
||||
struct _InstancerData {
|
||||
_InstancerData() : numInstancesToDraw(0), refreshVariability(false) { }
|
||||
|
||||
// The prototype prim path associated with this instancer.
|
||||
SdfPath prototypePath;
|
||||
|
||||
// The USD material path associated with this instancer.
|
||||
SdfPath materialUsdPath;
|
||||
|
||||
// The drawmode associated with this instancer.
|
||||
TfToken drawMode;
|
||||
|
||||
// The purpose value associated with this instance that can be inherited
|
||||
// by proto prims that need to inherit ancestor purpose.
|
||||
TfToken inheritablePurpose;
|
||||
|
||||
// Inherited primvar
|
||||
struct PrimvarInfo {
|
||||
TfToken name;
|
||||
SdfValueTypeName type;
|
||||
bool operator==(const PrimvarInfo& rhs) const;
|
||||
bool operator<(const PrimvarInfo& rhs) const;
|
||||
};
|
||||
std::vector<PrimvarInfo> inheritedPrimvars;
|
||||
|
||||
// Paths to Usd instance prims. Note that this is not necessarily
|
||||
// equivalent to all the instances that will be drawn. See below.
|
||||
std::vector<SdfPath> instancePaths;
|
||||
|
||||
// Number of actual instances of this instancer that will be
|
||||
// drawn. See comment on _RunForAllInstancesToDraw.
|
||||
// XXX: This is mutable so that we can precache it in TrackVariability;
|
||||
// it's inappropriate to track it in _Populate since not all instances
|
||||
// will have been populated.
|
||||
mutable size_t numInstancesToDraw;
|
||||
|
||||
// Cached visibility. This vector contains an entry for each instance
|
||||
// that will be drawn (i.e., visibility.size() == numInstancesToDraw).
|
||||
enum Visibility {
|
||||
Invisible, //< Invisible over all time
|
||||
Visible, //< Visible over all time
|
||||
Varying, //< Visibility varies over time
|
||||
Unknown //< Visibility has not yet been checked
|
||||
};
|
||||
// XXX: This is mutable so that we can precache visibility per-instance
|
||||
// in TrackVariability(). Can we replace this with some kind of usage
|
||||
// of an inherited cache?
|
||||
mutable std::vector<Visibility> visibility;
|
||||
|
||||
// Map of all rprims for this instancer prim.
|
||||
_PrimMap primMap;
|
||||
|
||||
// This is a set of reference paths, where this instancer needs
|
||||
// to deferer to another instancer. While refered to here as a child
|
||||
// instancer, the actual relationship is more like a directed graph.
|
||||
SdfPathSet childPointInstancers;
|
||||
|
||||
// Nested (child) native instances.
|
||||
SdfPathVector nestedInstances;
|
||||
|
||||
// Parent native instances.
|
||||
SdfPathVector parentInstances;
|
||||
|
||||
// Flag indicating we've queued up the delegate to call TrackVariability
|
||||
// on this instancer. We record this so we don't do it multiple times.
|
||||
mutable bool refreshVariability;
|
||||
};
|
||||
|
||||
// Map from hydra instancer cache path to the various instancer state we
|
||||
// need to answer adapter queries.
|
||||
// Note: this map is modified in multithreaded code paths and must be
|
||||
// locked.
|
||||
typedef std::unordered_map<SdfPath, _InstancerData, SdfPath::Hash>
|
||||
_InstancerDataMap;
|
||||
_InstancerDataMap _instancerData;
|
||||
|
||||
// Map from USD instance prim paths to the cache path of the hydra instancer
|
||||
// they are assigned to (which will typically be the path to the first
|
||||
// instance of this instance group we run across).
|
||||
// XXX: consider to move this forwarding map into HdRenderIndex.
|
||||
typedef TfHashMap<SdfPath, SdfPath, SdfPath::Hash>
|
||||
_InstanceToInstancerMap;
|
||||
_InstanceToInstancerMap _instanceToInstancerMap;
|
||||
|
||||
// Hd and UsdImaging think of instancing in terms of an 'instancer' that
|
||||
// specifies a list of 'prototype' prims that are shared per instance.
|
||||
//
|
||||
// For Usd scenegraph instancing, a prototype prim and its descendents
|
||||
// roughly correspond to the instancer and prototype prims. However,
|
||||
// Hd requires a different instancer and rprims for different combinations
|
||||
// of inherited attributes (material binding, draw mode, etc).
|
||||
// This means we cannot use the Usd prototype prim as the instancer, because
|
||||
// we can't represent this in the case where multiple Usd instances share
|
||||
// the same prototype but have different bindings.
|
||||
//
|
||||
// Instead, we use the first instance of a prototype with a given set of
|
||||
// inherited attributes as our instancer. For example, if /A and /B are
|
||||
// both instances of /__Prototype_1 but /A and /B have different material
|
||||
// bindings authored on them, both /A and /B will be instancers,
|
||||
// with their own set of rprims and instance indices.
|
||||
//
|
||||
// The below is a multimap from prototype path to the cache path of the
|
||||
// hydra instancer. The data for the instancer is located in the
|
||||
// _InstancerDataMap.
|
||||
typedef TfHashMultiMap<SdfPath, SdfPath, SdfPath::Hash>
|
||||
_PrototypeToInstancerMap;
|
||||
_PrototypeToInstancerMap _prototypeToInstancerMap;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_INSTANCE_ADAPTER_H
|
||||
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_INSTANCER_CONTEXT_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_INSTANCER_CONTEXT_H
|
||||
|
||||
/// \file usdImaging/instancerContext.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usd/sdf/path.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
using UsdImagingPrimAdapterSharedPtr =
|
||||
std::shared_ptr<class UsdImagingPrimAdapter>;
|
||||
|
||||
/// \class UsdImagingInstancerContext
|
||||
///
|
||||
/// Object used by instancer prim adapters to pass along context
|
||||
/// about the instancer and instance prim to prototype prim adapters.
|
||||
///
|
||||
class UsdImagingInstancerContext
|
||||
{
|
||||
public:
|
||||
/// The cachePath of the instancer.
|
||||
SdfPath instancerCachePath;
|
||||
|
||||
/// The name of the child prim, typically used for prototypes.
|
||||
TfToken childName;
|
||||
|
||||
/// The USD path to the material bound to the instance prim
|
||||
/// being processed.
|
||||
SdfPath instancerMaterialUsdPath;
|
||||
|
||||
/// The draw mode bound to the instance prim being processed.
|
||||
TfToken instanceDrawMode;
|
||||
|
||||
// The inheritable purpose bound to the instance prim being processed. If
|
||||
// the instance prim can provide this, prototypes without an explicit or
|
||||
// inherited purpose will inherit this purpose from the instance.
|
||||
TfToken instanceInheritablePurpose;
|
||||
|
||||
/// The instancer's prim Adapter. Useful when an adapter is needed, but the
|
||||
/// default adapter may be overridden for the sake of instancing.
|
||||
UsdImagingPrimAdapterSharedPtr instancerAdapter;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_INSTANCER_CONTEXT_H
|
||||
@@ -0,0 +1,136 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USD_IMAGING_LIGHT_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_LIGHT_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/lightAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingLightAdapter
|
||||
///
|
||||
/// Base class for all lights.
|
||||
///
|
||||
class UsdImagingLightAdapter : public UsdImagingPrimAdapter {
|
||||
public:
|
||||
typedef UsdImagingPrimAdapter BaseAdapter;
|
||||
|
||||
USDIMAGING_API
|
||||
static bool IsEnabledSceneLights();
|
||||
|
||||
UsdImagingLightAdapter()
|
||||
: UsdImagingPrimAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
~UsdImagingLightAdapter() override;
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL) override;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const override;
|
||||
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void UpdateForTime(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Returns a bit mask of attributes to be udpated, or
|
||||
/// HdChangeTracker::AllDirty if the entire prim must be resynchronized.
|
||||
USDIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName) override;
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits dirty,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkTransformDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkVisibilityDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkLightParamsDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Utilities
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue GetMaterialResource(UsdPrim const &prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
protected:
|
||||
void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_LIGHT_ADAPTER_H
|
||||
@@ -0,0 +1,130 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USD_IMAGING_LIGHT_FILTER_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_LIGHT_FILTER_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/lightFilterAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingLightFilterAdapter
|
||||
///
|
||||
/// Base class for all light filters.
|
||||
///
|
||||
class UsdImagingLightFilterAdapter : public UsdImagingPrimAdapter {
|
||||
public:
|
||||
typedef UsdImagingPrimAdapter BaseAdapter;
|
||||
|
||||
|
||||
UsdImagingLightFilterAdapter()
|
||||
: UsdImagingPrimAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
~UsdImagingLightFilterAdapter() override;
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL) override;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const override;
|
||||
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void UpdateForTime(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Returns a bit mask of attributes to be udpated, or
|
||||
/// HdChangeTracker::AllDirty if the entire prim must be resynchronized.
|
||||
USDIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName) override;
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits dirty,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkTransformDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkVisibilityDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Utilities
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue GetMaterialResource(UsdPrim const &prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
protected:
|
||||
USDIMAGING_API
|
||||
void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_LIGHT_FILTER_ADAPTER_H
|
||||
@@ -0,0 +1,120 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_MATERIAL_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_MATERIAL_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/materialAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
struct HdMaterialNetworkMap;
|
||||
|
||||
|
||||
/// \class UsdImagingMaterialAdapter
|
||||
/// \brief Provides information that can be used to generate a material.
|
||||
class UsdImagingMaterialAdapter : public UsdImagingPrimAdapter
|
||||
{
|
||||
public:
|
||||
using BaseAdapter = UsdImagingPrimAdapter;
|
||||
|
||||
UsdImagingMaterialAdapter()
|
||||
: UsdImagingPrimAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
~UsdImagingMaterialAdapter() override;
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL) override;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const override;
|
||||
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void UpdateForTime(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Returns a bit mask of attributes to be updated, or
|
||||
/// HdChangeTracker::AllDirty if the entire prim must be resynchronized.
|
||||
USDIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName) override;
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits dirty,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGING_API
|
||||
void MarkMaterialDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Utilities
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue GetMaterialResource(UsdPrim const &prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
protected:
|
||||
USDIMAGING_API
|
||||
void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) final;
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_MATERIAL_ADAPTER_H
|
||||
@@ -0,0 +1,124 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_MESH_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_MESH_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/meshAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
#include "pxr/usdImaging/usdImaging/gprimAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class HdSubdivTags;
|
||||
class PxOsdSubdivTags;
|
||||
|
||||
/// \class UsdImagingMeshAdapter
|
||||
///
|
||||
/// Delegate support for UsdGeomMesh.
|
||||
///
|
||||
class UsdImagingMeshAdapter : public UsdImagingGprimAdapter
|
||||
{
|
||||
public:
|
||||
using BaseAdapter = UsdImagingGprimAdapter;
|
||||
|
||||
UsdImagingMeshAdapter()
|
||||
: UsdImagingGprimAdapter()
|
||||
{}
|
||||
USDIMAGING_API
|
||||
~UsdImagingMeshAdapter() override;
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath Populate(
|
||||
UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr) override;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = nullptr) const override;
|
||||
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void UpdateForTime(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = nullptr) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Data access
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
PxOsdSubdivTags GetSubdivTags(UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue GetTopology(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue Get(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
VtIntArray *outIndices) const override;
|
||||
|
||||
protected:
|
||||
USDIMAGING_API
|
||||
bool _IsBuiltinPrimvar(TfToken const& primvarName) const override;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_MESH_ADAPTER_H
|
||||
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// Copyright 2019 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 PXR_USD_IMAGING_USD_IMAGING_NURBS_CURVES_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_NURBS_CURVES_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/nurbsCurvesAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
#include "pxr/usdImaging/usdImaging/gprimAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
/// \class UsdImagingNurbsCurvesAdapter
|
||||
///
|
||||
/// Delegate support for UsdGeomNurbsCurves.
|
||||
///
|
||||
class UsdImagingNurbsCurvesAdapter : public UsdImagingGprimAdapter
|
||||
{
|
||||
public:
|
||||
using BaseAdapter = UsdImagingGprimAdapter;
|
||||
|
||||
UsdImagingNurbsCurvesAdapter()
|
||||
: UsdImagingGprimAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
~UsdImagingNurbsCurvesAdapter() override;
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath Populate(
|
||||
UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr) override;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr)
|
||||
const override;
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void UpdateForTime(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = nullptr) const override;
|
||||
|
||||
USDIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName);
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Data access
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue GetTopology(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue Get(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
VtIntArray *outIndices) const override;
|
||||
|
||||
protected:
|
||||
USDIMAGING_API
|
||||
bool _IsBuiltinPrimvar(TfToken const& primvarName) const override;
|
||||
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_NURBS_CURVES_ADAPTER_H
|
||||
@@ -0,0 +1,109 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_NURBS_PATCH_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_NURBS_PATCH_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/nurbsPatchAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
#include "pxr/usdImaging/usdImaging/gprimAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
/// \class UsdImagingNurbsPatchAdapter
|
||||
///
|
||||
/// Delegate support for UsdGeomNurbsPatch.
|
||||
///
|
||||
class UsdImagingNurbsPatchAdapter : public UsdImagingGprimAdapter
|
||||
{
|
||||
public:
|
||||
using BaseAdapter = UsdImagingGprimAdapter;
|
||||
|
||||
UsdImagingNurbsPatchAdapter()
|
||||
: UsdImagingGprimAdapter()
|
||||
{}
|
||||
USDIMAGING_API
|
||||
~UsdImagingNurbsPatchAdapter() override;
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath Populate(
|
||||
UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr) override;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr)
|
||||
const override;
|
||||
|
||||
USDIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Data access
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue GetTopology(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
// Override the implemetation in GprimAdapter since we don't fetch the
|
||||
// points attribute for implicit primitives.
|
||||
USDIMAGING_API
|
||||
VtValue GetPoints(
|
||||
UsdPrim const& prim,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
// Used by the legacyEngine.
|
||||
USDIMAGING_API
|
||||
static VtValue GetMeshPoints(UsdPrim const& prim,
|
||||
UsdTimeCode time);
|
||||
|
||||
// Used by the legacyEngine.
|
||||
USDIMAGING_API
|
||||
static VtValue GetMeshTopology(UsdPrim const& prim,
|
||||
UsdTimeCode time);
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_NURBS_PATCH_ADAPTER_H
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// Copyright 2021 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 PXR_USD_IMAGING_USD_IMAGING_PLUGIN_LIGHT_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_PLUGIN_LIGHT_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/pluginLightAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/lightAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingPluginLightAdapter
|
||||
///
|
||||
/// Adapter class for lights of type PluginLight
|
||||
///
|
||||
class UsdImagingPluginLightAdapter : public UsdImagingLightAdapter {
|
||||
public:
|
||||
typedef UsdImagingLightAdapter BaseAdapter;
|
||||
|
||||
UsdImagingPluginLightAdapter()
|
||||
: UsdImagingLightAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingPluginLightAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
virtual SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual bool IsSupported(UsdImagingIndexProxy const* index) const;
|
||||
|
||||
protected:
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) final;
|
||||
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_PLUGIN_LIGHT_ADAPTER_H
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// Copyright 2021 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 PXR_USD_IMAGING_USD_IMAGING_PLUGIN_LIGHT_FILTER_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_PLUGIN_LIGHT_FILTER_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/pluginLightFilterAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/lightFilterAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingPluginLightFilterAdapter
|
||||
///
|
||||
/// Adapter class for lights of type PluginLightFilter
|
||||
///
|
||||
class UsdImagingPluginLightFilterAdapter : public UsdImagingLightFilterAdapter {
|
||||
public:
|
||||
typedef UsdImagingLightFilterAdapter BaseAdapter;
|
||||
|
||||
UsdImagingPluginLightFilterAdapter()
|
||||
: UsdImagingLightFilterAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingPluginLightFilterAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
virtual SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual bool IsSupported(UsdImagingIndexProxy const* index) const;
|
||||
|
||||
protected:
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) final;
|
||||
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_PLUGIN_LIGHT_FILTER_ADAPTER_H
|
||||
@@ -0,0 +1,431 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_POINT_INSTANCER_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_POINT_INSTANCER_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/pointInstancerAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/base/tf/denseHashMap.h"
|
||||
#include "pxr/usdImaging/usdImaging/version.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
#include "pxr/usdImaging/usdImaging/gprimAdapter.h"
|
||||
|
||||
#include <mutex>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
/// Delegate support for UsdGeomPointInstancer
|
||||
///
|
||||
class UsdImagingPointInstancerAdapter : public UsdImagingPrimAdapter
|
||||
{
|
||||
public:
|
||||
using BaseAdapter = UsdImagingPrimAdapter;
|
||||
|
||||
UsdImagingPointInstancerAdapter()
|
||||
: BaseAdapter()
|
||||
{ }
|
||||
virtual ~UsdImagingPointInstancerAdapter();
|
||||
|
||||
virtual SdfPath Populate(
|
||||
UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr) override;
|
||||
|
||||
virtual bool ShouldCullChildren() const override;
|
||||
|
||||
virtual bool IsInstancerAdapter() const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
virtual void TrackVariability(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const override;
|
||||
|
||||
virtual void UpdateForTime(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
virtual HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName)
|
||||
override;
|
||||
|
||||
virtual void ProcessPrimResync(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
virtual void ProcessPrimRemoval(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
virtual void MarkDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits dirty,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
virtual void MarkRefineLevelDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
virtual void MarkReprDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
virtual void MarkCullStyleDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
virtual void MarkRenderTagDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
virtual void MarkTransformDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
virtual void MarkVisibilityDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Instancing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
GfMatrix4d GetInstancerTransform(UsdPrim const& instancerPrim,
|
||||
SdfPath const& instancerPath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
size_t SampleInstancerTransform(UsdPrim const& instancerPrim,
|
||||
SdfPath const& instancerPath,
|
||||
UsdTimeCode time,
|
||||
size_t maxNumSamples,
|
||||
float *sampleTimes,
|
||||
GfMatrix4d *sampleValues) override;
|
||||
|
||||
SdfPath GetInstancerId(
|
||||
UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath) const override;
|
||||
|
||||
SdfPathVector GetInstancerPrototypes(
|
||||
UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath) const override;
|
||||
|
||||
GfMatrix4d GetTransform(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
bool ignoreRootTransform = false) const override;
|
||||
|
||||
size_t SampleTransform(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
size_t maxNumSamples,
|
||||
float *sampleTimes,
|
||||
GfMatrix4d *sampleValues) override;
|
||||
|
||||
size_t SamplePrimvar(UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
size_t maxNumSamples,
|
||||
float *sampleTimes,
|
||||
VtValue *sampleValues,
|
||||
VtIntArray *sampleIndices) override;
|
||||
|
||||
PxOsdSubdivTags GetSubdivTags(UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
bool GetVisible(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
TfToken GetPurpose(
|
||||
UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& instanceInheritablePurpose) const override;
|
||||
|
||||
VtValue GetTopology(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
HdCullStyle GetCullStyle(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
GfRange3d GetExtent(UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
bool GetDoubleSided(UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
|
||||
SdfPath GetMaterialId(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
HdExtComputationInputDescriptorVector
|
||||
GetExtComputationInputs(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
const UsdImagingInstancerContext* instancerContext)
|
||||
const override;
|
||||
|
||||
HdExtComputationOutputDescriptorVector
|
||||
GetExtComputationOutputs(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
const UsdImagingInstancerContext* instancerContext)
|
||||
const override;
|
||||
|
||||
HdExtComputationPrimvarDescriptorVector
|
||||
GetExtComputationPrimvars(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdInterpolation interpolation,
|
||||
const UsdImagingInstancerContext* instancerContext) const override;
|
||||
|
||||
VtValue
|
||||
GetExtComputationInput(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& name,
|
||||
UsdTimeCode time,
|
||||
const UsdImagingInstancerContext* instancerContext) const override;
|
||||
|
||||
std::string
|
||||
GetExtComputationKernel(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
const UsdImagingInstancerContext* instancerContext) const override;
|
||||
|
||||
VtValue
|
||||
GetInstanceIndices(UsdPrim const& instancerPrim,
|
||||
SdfPath const& instancerCachePath,
|
||||
SdfPath const& prototypeCachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
VtValue Get(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
VtIntArray *outIndices) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Nested instancing support
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
virtual GfMatrix4d GetRelativeInstancerTransform(
|
||||
SdfPath const &instancerPath,
|
||||
SdfPath const &protoInstancerPath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Picking & selection
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
virtual SdfPath GetScenePrimPath(
|
||||
SdfPath const& cachePath,
|
||||
int instanceIndex,
|
||||
HdInstancerContext *instancerContext) const override;
|
||||
|
||||
virtual bool PopulateSelection(
|
||||
HdSelection::HighlightMode const& highlightMode,
|
||||
SdfPath const &cachePath,
|
||||
UsdPrim const &usdPrim,
|
||||
int const hydraInstanceIndex,
|
||||
VtIntArray const &parentInstanceIndices,
|
||||
HdSelectionSharedPtr const &result) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Volume field information
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
virtual HdVolumeFieldDescriptorVector
|
||||
GetVolumeFieldDescriptors(UsdPrim const& usdPrim, SdfPath const &id,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
protected:
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override final;
|
||||
|
||||
private:
|
||||
struct _ProtoPrim;
|
||||
struct _InstancerData;
|
||||
|
||||
SdfPath _Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext);
|
||||
|
||||
void _PopulatePrototype(int protoIndex,
|
||||
_InstancerData& instrData,
|
||||
UsdPrim const& protoRootPrim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const *instancerContext);
|
||||
|
||||
// Process prim removal and output a set of affected instancer paths is
|
||||
// provided.
|
||||
void _ProcessPrimRemoval(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index,
|
||||
SdfPathVector* instancersToReload);
|
||||
|
||||
// Removes all instancer data, both locally and from the render index.
|
||||
void _UnloadInstancer(SdfPath const& instancerPath,
|
||||
UsdImagingIndexProxy* index);
|
||||
|
||||
// Updates per-frame instancer visibility.
|
||||
void _UpdateInstancerVisibility(SdfPath const& instancerPath,
|
||||
_InstancerData const& instrData,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
// Returns true if the instancer is visible, taking into account all
|
||||
// parent instancers visibilities.
|
||||
bool _GetInstancerVisible(SdfPath const &instancerPath, UsdTimeCode time)
|
||||
const;
|
||||
|
||||
// Gets the associated _ProtoPrim for the given instancer and cache path.
|
||||
_ProtoPrim const& _GetProtoPrim(SdfPath const& instancerPath,
|
||||
SdfPath const& cachePath) const;
|
||||
|
||||
// Gets the associated _ProtoPrim and instancerContext if cachePath is a
|
||||
// child path and returns \c true, otherwise returns \c false.
|
||||
//
|
||||
// Note that the returned instancer context may not be as fully featured as
|
||||
// your needs may be.
|
||||
bool _GetProtoPrimForChild(
|
||||
UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath,
|
||||
_ProtoPrim const** proto,
|
||||
UsdImagingInstancerContext* ctx) const;
|
||||
|
||||
// Gets the UsdPrim to use from the given _ProtoPrim.
|
||||
const UsdPrim _GetProtoUsdPrim(_ProtoPrim const& proto) const;
|
||||
|
||||
// Takes the transform applies a corrective transform to 1) remove any
|
||||
// transforms above the model root (root proto path) and 2) apply the
|
||||
// instancer transform.
|
||||
GfMatrix4d _CorrectTransform(UsdPrim const& instancer,
|
||||
UsdPrim const& proto,
|
||||
SdfPath const& cachePath,
|
||||
SdfPathVector const& protoPathChain,
|
||||
GfMatrix4d const& inTransform,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
// Similar to CorrectTransform, requires a visibility value exist in the
|
||||
// ValueCache, removes any visibility opinions above the model root (proto
|
||||
// root path) and applies the instancer visibility.
|
||||
void _ComputeProtoVisibility(UsdPrim const& protoRoot,
|
||||
UsdPrim const& protoGprim,
|
||||
UsdTimeCode time,
|
||||
bool* vis) const;
|
||||
|
||||
/*
|
||||
PointInstancer (InstancerData)
|
||||
|
|
||||
+-- Prototype[0]------+-- ProtoRprim (mesh, curve, ...)
|
||||
| +-- ProtoRprim
|
||||
| +-- ProtoRprim
|
||||
|
|
||||
+-- Prototype[1]------+-- ProtoRprim
|
||||
| +-- ProtoRprim
|
||||
.
|
||||
.
|
||||
*/
|
||||
|
||||
// A proto prim represents a single populated prim under a prototype root
|
||||
// declared on the instancer. For example, a character may be targeted
|
||||
// by the prototypes relationship; it will have many meshes, and each
|
||||
// mesh is represented as a separate proto prim.
|
||||
struct _ProtoPrim {
|
||||
_ProtoPrim() : variabilityBits(0), visible(true) {}
|
||||
// Each prim will become a prototype "child" under the instancer.
|
||||
// paths is a list of paths we had to hop across when resolving native
|
||||
// USD instances.
|
||||
SdfPathVector paths;
|
||||
// The prim adapter for the actual prototype prim.
|
||||
UsdImagingPrimAdapterSharedPtr adapter;
|
||||
// The root prototype path, typically the model root, which is a subtree
|
||||
// and might contain several imageable prims.
|
||||
SdfPath protoRootPath;
|
||||
// Tracks the variability of the underlying adapter to avoid
|
||||
// redundantly reading data. This value is stored as
|
||||
// HdDirtyBits bit flags.
|
||||
// XXX: This is mutable so we can set it in TrackVariability.
|
||||
mutable HdDirtyBits variabilityBits;
|
||||
// When variabilityBits does not include HdChangeTracker::DirtyVisibility
|
||||
// the visible field is the unvarying value for visibility.
|
||||
// XXX: This is mutable so we can set it in TrackVariability.
|
||||
mutable bool visible;
|
||||
};
|
||||
|
||||
// Indexed by cachePath (each prim has one entry)
|
||||
typedef std::unordered_map<SdfPath, _ProtoPrim, SdfPath::Hash> _ProtoPrimMap;
|
||||
|
||||
// All data asscoiated with a given Instancer prim. PrimMap could
|
||||
// technically be split out to avoid two lookups, however it seems cleaner
|
||||
// to keep everything bundled up under the instancer path.
|
||||
struct _InstancerData {
|
||||
_InstancerData() {}
|
||||
SdfPath parentInstancerCachePath;
|
||||
_ProtoPrimMap protoPrimMap;
|
||||
SdfPathVector prototypePaths;
|
||||
|
||||
using PathToIndexMap = TfDenseHashMap<SdfPath, size_t, SdfPath::Hash>;
|
||||
PathToIndexMap prototypePathIndices;
|
||||
|
||||
|
||||
// XXX: We keep a bunch of state around visibility that's set in
|
||||
// TrackVariability and UpdateForTime. "visible", and "visibleTime"
|
||||
// (the cache key for visible) are set in UpdateForTime and guarded
|
||||
// by "mutex".
|
||||
mutable std::mutex mutex;
|
||||
mutable bool variableVisibility;
|
||||
mutable bool visible;
|
||||
mutable UsdTimeCode visibleTime;
|
||||
};
|
||||
|
||||
// A map of instancer data, one entry per instancer prim that has been
|
||||
// populated.
|
||||
// Note: this is accessed in multithreaded code paths and must be protected
|
||||
typedef std::unordered_map<SdfPath /*instancerPath*/,
|
||||
_InstancerData,
|
||||
SdfPath::Hash> _InstancerDataMap;
|
||||
_InstancerDataMap _instancerData;
|
||||
};
|
||||
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_POINT_INSTANCER_ADAPTER_H
|
||||
@@ -0,0 +1,113 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_POINTS_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_POINTS_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/pointsAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
#include "pxr/usdImaging/usdImaging/gprimAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
/// \class UsdImagingPointsAdapter
|
||||
///
|
||||
/// Delegate support for UsdGeomPoints.
|
||||
///
|
||||
class UsdImagingPointsAdapter : public UsdImagingGprimAdapter
|
||||
{
|
||||
public:
|
||||
using BaseAdapter = UsdImagingGprimAdapter;
|
||||
|
||||
UsdImagingPointsAdapter()
|
||||
: UsdImagingGprimAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
~UsdImagingPointsAdapter() override;
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath Populate(
|
||||
UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr) override;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr)
|
||||
const override;
|
||||
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void UpdateForTime(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr)
|
||||
const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Data access
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue Get(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
VtIntArray *outIndices) const override;
|
||||
|
||||
protected:
|
||||
USDIMAGING_API
|
||||
bool _IsBuiltinPrimvar(TfToken const& primvarName) const override;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_POINTS_ADAPTER_H
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Copyright 2021 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 PXR_USD_IMAGING_USD_IMAGING_PORTAL_LIGHT_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_PORTAL_LIGHT_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/portalLightAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/lightAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingPortalLightAdapter
|
||||
///
|
||||
/// Adapter class for lights of type PortalLight
|
||||
///
|
||||
class UsdImagingPortalLightAdapter : public UsdImagingLightAdapter {
|
||||
public:
|
||||
typedef UsdImagingLightAdapter BaseAdapter;
|
||||
|
||||
UsdImagingPortalLightAdapter()
|
||||
: UsdImagingLightAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingPortalLightAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
virtual SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual bool IsSupported(UsdImagingIndexProxy const* index) const;
|
||||
|
||||
protected:
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) final;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_PORTAL_LIGHT_ADAPTER_H
|
||||
@@ -0,0 +1,808 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_PRIM_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_PRIM_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/primAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/version.h"
|
||||
#include "pxr/usdImaging/usdImaging/collectionCache.h"
|
||||
#include "pxr/usdImaging/usdImaging/primvarDescCache.h"
|
||||
#include "pxr/usdImaging/usdImaging/resolvedAttributeCache.h"
|
||||
|
||||
#include "pxr/imaging/hd/changeTracker.h"
|
||||
#include "pxr/imaging/hd/selection.h"
|
||||
#include "pxr/usd/usd/attribute.h"
|
||||
#include "pxr/usd/usd/prim.h"
|
||||
#include "pxr/usd/usd/timeCode.h"
|
||||
|
||||
#include "pxr/usd/usdShade/shader.h"
|
||||
|
||||
#include "pxr/base/tf/type.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
// Forward declaration for nested class.
|
||||
class UsdImagingDelegate;
|
||||
class UsdImagingIndexProxy;
|
||||
class UsdImagingInstancerContext;
|
||||
class HdExtComputationContext;
|
||||
|
||||
using UsdImagingPrimAdapterSharedPtr =
|
||||
std::shared_ptr<class UsdImagingPrimAdapter>;
|
||||
|
||||
/// \class UsdImagingPrimAdapter
|
||||
///
|
||||
/// Base class for all PrimAdapters.
|
||||
///
|
||||
class UsdImagingPrimAdapter
|
||||
: public std::enable_shared_from_this<UsdImagingPrimAdapter>
|
||||
{
|
||||
public:
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Initialization
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
UsdImagingPrimAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingPrimAdapter();
|
||||
|
||||
/// Called to populate the RenderIndex for this UsdPrim. The adapter is
|
||||
/// expected to create one or more prims in the render index using the
|
||||
/// given proxy.
|
||||
virtual SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = nullptr) = 0;
|
||||
|
||||
// Indicates whether population traversal should be pruned based on
|
||||
// prim-specific features (like whether it's imageable).
|
||||
USDIMAGING_API
|
||||
static bool ShouldCullSubtree(UsdPrim const& prim);
|
||||
|
||||
// Indicates whether population traversal should be pruned based on
|
||||
// adapter-specific features (like whether the adapter is an instance
|
||||
// adapter, and wants to do its own population).
|
||||
USDIMAGING_API
|
||||
virtual bool ShouldCullChildren() const;
|
||||
|
||||
// Indicates whether or not native USD prim instancing should be ignored
|
||||
// for prims using this delegate, along with their descendants.
|
||||
USDIMAGING_API
|
||||
virtual bool ShouldIgnoreNativeInstanceSubtrees() const;
|
||||
|
||||
// Indicates the adapter is a multiplexing adapter (e.g. PointInstancer),
|
||||
// potentially managing its children. This flag is used in nested
|
||||
// instancer cases to determine which adapter is assigned to which prim.
|
||||
USDIMAGING_API
|
||||
virtual bool IsInstancerAdapter() const;
|
||||
|
||||
// Indicates whether this adapter can directly populate USD instance prims.
|
||||
//
|
||||
// Normally, with USD instances, we make a firewall between the instance
|
||||
// prim and the USD prototype tree. The instance adapter creates one
|
||||
// hydra prototype per prim in the USD prototype tree, shared by all USD
|
||||
// instances; this lets us recognize the benefits of instancing,
|
||||
// by hopefully having a high instance count per prototype. The instance
|
||||
// adapter additionally configures a hydra instancer for the prototype tree;
|
||||
// and a small set of specially-handled data is allowed through: things like
|
||||
// inherited constant primvars, transforms, visibility, and other things
|
||||
// we know how to vary per-instance.
|
||||
//
|
||||
// We enforce the above policy by refusing to populate gprims which are
|
||||
// USD instances, since we'd need one prototype per instance and would lose
|
||||
// any instancing benefit.
|
||||
//
|
||||
// There are a handful of times when it really is useful to directly
|
||||
// populate instance prims: for example, instances with cards applied,
|
||||
// or instances of type UsdSkelRoot. In those cases, the adapters can
|
||||
// opt into this scheme with "CanPopulateUsdInstance".
|
||||
//
|
||||
// Note that any adapters taking advantage of this feature will need
|
||||
// extensive code support in instanceAdapter: the instance adapter will
|
||||
// need to potentially create and track multiple hydra prototypes per
|
||||
// USD prototype, and the adapter will need special handling to pass down
|
||||
// any relevant instance-varying data.
|
||||
//
|
||||
// In summary: use with caution.
|
||||
USDIMAGING_API
|
||||
virtual bool CanPopulateUsdInstance() const;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// For the given \p prim, variability is detected and
|
||||
/// stored in \p timeVaryingBits. Initial values are cached into the value
|
||||
/// cache.
|
||||
///
|
||||
/// This method is expected to be called from multiple threads.
|
||||
virtual void TrackVariability(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = nullptr) const = 0;
|
||||
|
||||
/// Populates the \p cache for the given \p prim, \p time and \p
|
||||
/// requestedBits.
|
||||
///
|
||||
/// This method is expected to be called from multiple threads.
|
||||
virtual void UpdateForTime(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = nullptr) const = 0;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Returns a bit mask of attributes to be updated, or
|
||||
/// HdChangeTracker::AllDirty if the entire prim must be resynchronized.
|
||||
///
|
||||
/// \p changedFields contains a list of changed scene description fields
|
||||
/// for this prim. This may be empty in certain cases, like the addition
|
||||
/// of an inert prim spec for the given \p prim.
|
||||
///
|
||||
/// The default implementation returns HdChangeTracker::AllDirty if any of
|
||||
/// the changed fields are plugin metadata fields, HdChangeTracker::Clean
|
||||
/// otherwise.
|
||||
USDIMAGING_API
|
||||
virtual HdDirtyBits ProcessPrimChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfTokenVector const& changedFields);
|
||||
|
||||
/// Returns a bit mask of attributes to be updated, or
|
||||
/// HdChangeTracker::AllDirty if the entire prim must be resynchronized.
|
||||
virtual HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName) = 0;
|
||||
|
||||
/// When a PrimResync event occurs, the prim may have been deleted entirely,
|
||||
/// adapter plug-ins should override this method to free any per-prim state
|
||||
/// that was accumulated in the adapter.
|
||||
USDIMAGING_API
|
||||
virtual void ProcessPrimResync(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index);
|
||||
|
||||
/// Removes all associated Rprims and dependencies from the render index
|
||||
/// without scheduling them for repopulation.
|
||||
USDIMAGING_API
|
||||
virtual void ProcessPrimRemoval(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index);
|
||||
|
||||
|
||||
virtual void MarkDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits dirty,
|
||||
UsdImagingIndexProxy* index) = 0;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkRefineLevelDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkReprDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkCullStyleDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkRenderTagDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkTransformDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkVisibilityDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkMaterialDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkLightParamsDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual void MarkWindowPolicyDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index);
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Computations
|
||||
// ---------------------------------------------------------------------- //
|
||||
USDIMAGING_API
|
||||
virtual void InvokeComputation(SdfPath const& cachePath,
|
||||
HdExtComputationContext* context);
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Instancing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Return an array of the categories used by each instance.
|
||||
USDIMAGING_API
|
||||
virtual std::vector<VtArray<TfToken>>
|
||||
GetInstanceCategories(UsdPrim const& prim);
|
||||
|
||||
/// Get the instancer transform for the given prim.
|
||||
/// \see HdSceneDelegate::GetInstancerTransform()
|
||||
USDIMAGING_API
|
||||
virtual GfMatrix4d GetInstancerTransform(
|
||||
UsdPrim const& instancerPrim,
|
||||
SdfPath const& instancerPath,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
/// Sample the instancer transform for the given prim.
|
||||
/// \see HdSceneDelegate::SampleInstancerTransform()
|
||||
USDIMAGING_API
|
||||
virtual size_t SampleInstancerTransform(
|
||||
UsdPrim const& instancerPrim,
|
||||
SdfPath const& instancerPath,
|
||||
UsdTimeCode time,
|
||||
size_t maxNumSamples,
|
||||
float *sampleTimes,
|
||||
GfMatrix4d *sampleValues);
|
||||
|
||||
/// Return the instancerId for this prim.
|
||||
USDIMAGING_API
|
||||
virtual SdfPath GetInstancerId(
|
||||
UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath) const;
|
||||
|
||||
/// Return the list of known prototypes of this prim.
|
||||
USDIMAGING_API
|
||||
virtual SdfPathVector GetInstancerPrototypes(
|
||||
UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath) const;
|
||||
|
||||
/// Sample the primvar for the given prim. If *sampleIndices is not nullptr
|
||||
/// and the primvar has indices, it will sample the unflattened primvar and
|
||||
/// set *sampleIndices to the primvar's sampled indices.
|
||||
/// \see HdSceneDelegate::SamplePrimvar() and
|
||||
/// HdSceneDelegate::SampleIndexedPrimvar()
|
||||
USDIMAGING_API
|
||||
virtual size_t
|
||||
SamplePrimvar(UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
size_t maxNumSamples,
|
||||
float *sampleTimes,
|
||||
VtValue *sampleValues,
|
||||
VtIntArray *sampleIndices);
|
||||
|
||||
/// Get the subdiv tags for this prim.
|
||||
USDIMAGING_API
|
||||
virtual PxOsdSubdivTags GetSubdivTags(UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Nested instancing support
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
// NOTE: This method is currently only used by PointInstancer
|
||||
// style instances, and not instanceable-references.
|
||||
|
||||
/// Returns the transform of \p protoInstancerPath relative to
|
||||
/// \p instancerPath. \p instancerPath must be managed by this
|
||||
/// adapter.
|
||||
USDIMAGING_API
|
||||
virtual GfMatrix4d GetRelativeInstancerTransform(
|
||||
SdfPath const &instancerPath,
|
||||
SdfPath const &protoInstancerPath,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Selection
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
virtual SdfPath GetScenePrimPath(SdfPath const& cachePath,
|
||||
int instanceIndex,
|
||||
HdInstancerContext *instancerCtx) const;
|
||||
|
||||
// Add the given usdPrim to the HdSelection object, to mark it for
|
||||
// selection highlighting. cachePath is the path of the object referencing
|
||||
// this adapter.
|
||||
//
|
||||
// If an instance index is provided to Delegate::PopulateSelection, it's
|
||||
// interpreted as a hydra instance index and left unchanged (to make
|
||||
// picking/selection round-tripping work). Otherwise, instance adapters
|
||||
// will build up a composite instance index range at each level.
|
||||
//
|
||||
// Consider:
|
||||
// /World/A (2 instances)
|
||||
// /B (2 instances)
|
||||
// /C (gprim)
|
||||
// ... to select /World/A, instance 0, you want to select cartesian
|
||||
// coordinates (0, *) -> (0, 0) and (0, 1). The flattened representation
|
||||
// of this is:
|
||||
// index = coordinate[0] * instance_count[1] + coordinate[1]
|
||||
// Likewise, for one more nesting level you get:
|
||||
// index = c[0] * count[1] * count[2] + c[1] * count[2] + c[2]
|
||||
// ... since the adapter for /World/A has no idea what count[1+] are,
|
||||
// this needs to be built up. The delegate initially sets
|
||||
// parentInstanceIndices to []. /World/A sets this to [0]. /World/A/B,
|
||||
// since it is selecting *, adds all possible instance indices:
|
||||
// 0 * 2 + 0 = 0, 0 * 2 + 1 = 1. /World/A/B/C is a gprim, and adds
|
||||
// instances [0,1] to its selection.
|
||||
USDIMAGING_API
|
||||
virtual bool PopulateSelection(
|
||||
HdSelection::HighlightMode const& highlightMode,
|
||||
SdfPath const &cachePath,
|
||||
UsdPrim const &usdPrim,
|
||||
int const hydraInstanceIndex,
|
||||
VtIntArray const &parentInstanceIndices,
|
||||
HdSelectionSharedPtr const &result) const;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Volume field information
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
virtual HdVolumeFieldDescriptorVector
|
||||
GetVolumeFieldDescriptors(UsdPrim const& usdPrim, SdfPath const &id,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Utilities
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// The root transform provided by the delegate.
|
||||
USDIMAGING_API
|
||||
GfMatrix4d GetRootTransform() const;
|
||||
|
||||
/// A thread-local XformCache provided by the delegate.
|
||||
USDIMAGING_API
|
||||
void SetDelegate(UsdImagingDelegate* delegate);
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsChildPath(SdfPath const& path) const;
|
||||
|
||||
/// Returns true if the given prim is visible, taking into account inherited
|
||||
/// visibility values. Inherited values are strongest, Usd has no notion of
|
||||
/// "super vis/invis".
|
||||
USDIMAGING_API
|
||||
virtual bool GetVisible(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
/// Returns the purpose token for \p prim. If a non-empty \p
|
||||
/// instanceInheritablePurpose is specified and the prim doesn't have an
|
||||
/// explicitly authored or inherited purpose, it may inherit the
|
||||
/// instancer's purpose if the instance has an explicit purpose.
|
||||
USDIMAGING_API
|
||||
virtual TfToken GetPurpose(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& instanceInheritablePurpose) const;
|
||||
|
||||
/// Returns the purpose token for \p prim, but only if it is inheritable
|
||||
/// by child prims (i.e. it is an explicitly authored purpose on the prim
|
||||
/// itself or one of the prim's ancestors), otherwise it returns the empty
|
||||
/// token.
|
||||
USDIMAGING_API
|
||||
TfToken GetInheritablePurpose(UsdPrim const& prim) const;
|
||||
|
||||
/// Fetches the transform for the given prim at the given time from a
|
||||
/// pre-computed cache of prim transforms. Requesting transforms at
|
||||
/// incoherent times is currently inefficient.
|
||||
USDIMAGING_API
|
||||
virtual GfMatrix4d GetTransform(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
bool ignoreRootTransform = false) const;
|
||||
|
||||
/// Samples the transform for the given prim.
|
||||
USDIMAGING_API
|
||||
virtual size_t SampleTransform(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
size_t maxNumSamples,
|
||||
float *sampleTimes,
|
||||
GfMatrix4d *sampleValues);
|
||||
|
||||
/// Gets the value of the parameter named key for the given prim (which
|
||||
/// has the given cache path) and given time. If outIndices is not nullptr
|
||||
/// and the value has indices, it will return the unflattened value and set
|
||||
/// outIndices to the value's associated indices.
|
||||
USDIMAGING_API
|
||||
virtual VtValue Get(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
VtIntArray *outIndices) const;
|
||||
|
||||
/// Gets the cullstyle of a specific path in the scene graph.
|
||||
USDIMAGING_API
|
||||
virtual HdCullStyle GetCullStyle(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
/// Gets the material path for the given prim, walking up namespace if
|
||||
/// necessary.
|
||||
USDIMAGING_API
|
||||
SdfPath GetMaterialUsdPath(UsdPrim const& prim) const;
|
||||
|
||||
/// Gets the model:drawMode attribute for the given prim, walking up
|
||||
/// the namespace if necessary.
|
||||
USDIMAGING_API
|
||||
TfToken GetModelDrawMode(UsdPrim const& prim);
|
||||
|
||||
/// Computes the per-prototype instance indices for a UsdGeomPointInstancer.
|
||||
/// XXX: This needs to be defined on the base class, to have access to the
|
||||
/// delegate, but it's a clear violation of abstraction. This call is only
|
||||
/// legal for prims of type UsdGeomPointInstancer; in other cases, the
|
||||
/// returned array will be empty and the computation will issue errors.
|
||||
USDIMAGING_API
|
||||
VtArray<VtIntArray> GetPerPrototypeIndices(UsdPrim const& prim,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
/// Gets the topology object of a specific Usd prim. If the
|
||||
/// adapter is a mesh it will return an HdMeshTopology,
|
||||
/// if it is of type basis curves, it will return an HdBasisCurvesTopology.
|
||||
/// If the adapter does not have a topology, it returns an empty VtValue.
|
||||
USDIMAGING_API
|
||||
virtual VtValue GetTopology(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
/// Reads the extent from the given prim. If the extent is not authored,
|
||||
/// an empty GfRange3d is returned, the extent will not be computed.
|
||||
USDIMAGING_API
|
||||
virtual GfRange3d GetExtent(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
/// Reads double-sided from the given prim. If not authored, returns false
|
||||
USDIMAGING_API
|
||||
virtual bool GetDoubleSided(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual SdfPath GetMaterialId(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual VtValue GetMaterialResource(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name ExtComputations
|
||||
// ---------------------------------------------------------------------- //
|
||||
USDIMAGING_API
|
||||
virtual const TfTokenVector &GetExtComputationSceneInputNames(
|
||||
SdfPath const& cachePath) const;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual HdExtComputationInputDescriptorVector
|
||||
GetExtComputationInputs(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
const UsdImagingInstancerContext* instancerContext)
|
||||
const;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual HdExtComputationOutputDescriptorVector
|
||||
GetExtComputationOutputs(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
const UsdImagingInstancerContext* instancerContext)
|
||||
const;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual HdExtComputationPrimvarDescriptorVector
|
||||
GetExtComputationPrimvars(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdInterpolation interpolation,
|
||||
const UsdImagingInstancerContext* instancerContext) const;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual VtValue
|
||||
GetExtComputationInput(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& name,
|
||||
UsdTimeCode time,
|
||||
const UsdImagingInstancerContext* instancerContext) const;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual size_t
|
||||
SampleExtComputationInput(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& name,
|
||||
UsdTimeCode time,
|
||||
const UsdImagingInstancerContext* instancerContext,
|
||||
size_t maxSampleCount,
|
||||
float *sampleTimes,
|
||||
VtValue *sampleValues);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual std::string
|
||||
GetExtComputationKernel(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
const UsdImagingInstancerContext* instancerContext) const;
|
||||
|
||||
USDIMAGING_API
|
||||
virtual VtValue
|
||||
GetInstanceIndices(UsdPrim const& instancerPrim,
|
||||
SdfPath const& instancerCachePath,
|
||||
SdfPath const& prototypeCachePath,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Render Index Compatibility
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Returns true if the adapter can be populated into the target index.
|
||||
virtual bool IsSupported(UsdImagingIndexProxy const* index) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
using Keys = UsdImagingPrimvarDescCache::Key;
|
||||
|
||||
template <typename T>
|
||||
T _Get(UsdPrim const& prim, TfToken const& attrToken,
|
||||
UsdTimeCode time) const {
|
||||
T value;
|
||||
prim.GetAttribute(attrToken).Get<T>(&value, time);
|
||||
return value;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void _GetPtr(UsdPrim const& prim, TfToken const& key, UsdTimeCode time,
|
||||
T* out) const {
|
||||
prim.GetAttribute(key).Get<T>(out, time);
|
||||
}
|
||||
|
||||
USDIMAGING_API
|
||||
UsdImagingPrimvarDescCache* _GetPrimvarDescCache() const;
|
||||
|
||||
USDIMAGING_API
|
||||
UsdPrim _GetPrim(SdfPath const& usdPath) const;
|
||||
|
||||
// Returns the prim adapter for the given \p prim, or an invalid pointer if
|
||||
// no adapter exists. If \p prim is an instance and \p ignoreInstancing
|
||||
// is \c true, the instancing adapter will be ignored and an adapter will
|
||||
// be looked up based on \p prim's type.
|
||||
USDIMAGING_API
|
||||
const UsdImagingPrimAdapterSharedPtr&
|
||||
_GetPrimAdapter(UsdPrim const& prim, bool ignoreInstancing = false) const;
|
||||
|
||||
USDIMAGING_API
|
||||
const UsdImagingPrimAdapterSharedPtr&
|
||||
_GetAdapter(TfToken const& adapterKey) const;
|
||||
|
||||
// XXX: Transitional API
|
||||
// Returns the instance proxy prim path for a USD-instanced prim, given the
|
||||
// instance chain leading to that prim. The paths are sorted from more to
|
||||
// less local; the first path is the prim path (possibly in prototype), then
|
||||
// instance paths (possibly in prototype); the last path is the prim or
|
||||
// instance path in the scene.
|
||||
USDIMAGING_API
|
||||
SdfPath _GetPrimPathFromInstancerChain(
|
||||
SdfPathVector const& instancerChain) const;
|
||||
|
||||
USDIMAGING_API
|
||||
UsdTimeCode _GetTimeWithOffset(float offset) const;
|
||||
|
||||
// Converts \p cachePath to the path in the render index.
|
||||
USDIMAGING_API
|
||||
SdfPath _ConvertCachePathToIndexPath(SdfPath const& cachePath) const;
|
||||
|
||||
// Converts \p indexPath to the path in the USD stage
|
||||
USDIMAGING_API
|
||||
SdfPath _ConvertIndexPathToCachePath(SdfPath const& indexPath) const;
|
||||
|
||||
// Returns the material binding purpose from the renderer delegate.
|
||||
USDIMAGING_API
|
||||
TfToken _GetMaterialBindingPurpose() const;
|
||||
|
||||
// Returns the material contexts from the renderer delegate.
|
||||
USDIMAGING_API
|
||||
TfTokenVector _GetMaterialRenderContexts() const;
|
||||
|
||||
// Returns true if render delegate wants primvars to be filtered based.
|
||||
// This will filter the primvars based on the bound material primvar needs.
|
||||
USDIMAGING_API
|
||||
bool _IsPrimvarFilteringNeeded() const;
|
||||
|
||||
// Returns the shader source type from the render delegate.
|
||||
USDIMAGING_API
|
||||
TfTokenVector _GetShaderSourceTypes() const;
|
||||
|
||||
// Returns \c true if \p usdPath is included in the scene delegate's
|
||||
// invised path list.
|
||||
USDIMAGING_API
|
||||
bool _IsInInvisedPaths(SdfPath const& usdPath) const;
|
||||
|
||||
// Determines if an attribute is varying and if so, sets the given
|
||||
// \p dirtyFlag in the \p dirtyFlags and increments a perf counter. Returns
|
||||
// true if the attribute is varying.
|
||||
//
|
||||
// If \p exists is non-null, _IsVarying will store whether the attribute
|
||||
// was found. If the attribute is not found, it counts as non-varying.
|
||||
//
|
||||
// This only sets the dirty bit, never un-sets. The caller is responsible
|
||||
// for setting the initial state correctly.
|
||||
USDIMAGING_API
|
||||
bool _IsVarying(UsdPrim prim, TfToken const& attrName,
|
||||
HdDirtyBits dirtyFlag, TfToken const& perfToken,
|
||||
HdDirtyBits* dirtyFlags, bool isInherited,
|
||||
bool* exists = nullptr) const;
|
||||
|
||||
// Determines if the prim's transform (CTM) is varying and if so, sets the
|
||||
// given \p dirtyFlag in the \p dirtyFlags and increments a perf counter.
|
||||
// Returns true if the prim's transform is varying.
|
||||
//
|
||||
// This only sets the dirty bit, never un-sets. The caller is responsible
|
||||
// for setting the initial state correctly.
|
||||
USDIMAGING_API
|
||||
bool _IsTransformVarying(UsdPrim prim,
|
||||
HdDirtyBits dirtyFlag,
|
||||
TfToken const& perfToken,
|
||||
HdDirtyBits* dirtyFlags) const;
|
||||
|
||||
// Convenience method for adding or updating a primvar descriptor.
|
||||
// Role defaults to empty token (none). Indexed defaults to false.
|
||||
USDIMAGING_API
|
||||
void _MergePrimvar(
|
||||
HdPrimvarDescriptorVector* vec,
|
||||
TfToken const& name,
|
||||
HdInterpolation interp,
|
||||
TfToken const& role = TfToken(),
|
||||
bool indexed = false) const;
|
||||
|
||||
// Convenience method for removing a primvar descriptor.
|
||||
USDIMAGING_API
|
||||
void _RemovePrimvar(
|
||||
HdPrimvarDescriptorVector* vec,
|
||||
TfToken const& name) const;
|
||||
|
||||
// Convenience method for computing a primvar. The primvar will only be
|
||||
// added to the list of prim desc if there is no primvar of the same
|
||||
// name already present. Thus, "local" primvars should be merged before
|
||||
// inherited primvars.
|
||||
USDIMAGING_API
|
||||
void _ComputeAndMergePrimvar(
|
||||
UsdPrim const& prim,
|
||||
UsdGeomPrimvar const& primvar,
|
||||
UsdTimeCode time,
|
||||
HdPrimvarDescriptorVector* primvarDescs,
|
||||
HdInterpolation *interpOverride = nullptr) const;
|
||||
|
||||
// Returns true if the property name has the "primvars:" prefix.
|
||||
USDIMAGING_API
|
||||
static bool _HasPrimvarsPrefix(TfToken const& propertyName);
|
||||
|
||||
// Convenience methods to figure out what changed about the primvar and
|
||||
// return the appropriate dirty bit.
|
||||
// Caller can optionally pass in a dirty bit to set for primvar value
|
||||
// changes. This is useful for attributes that have a special dirty bit
|
||||
// such as normals and widths.
|
||||
//
|
||||
// Handle USD attributes that are treated as primvars by Hydra. This
|
||||
// requires the interpolation to be passed in, as well as the primvar
|
||||
// name passed to Hydra.
|
||||
USDIMAGING_API
|
||||
HdDirtyBits _ProcessNonPrefixedPrimvarPropertyChange(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName,
|
||||
TfToken const& primvarName,
|
||||
HdInterpolation const& primvarInterp,
|
||||
HdDirtyBits valueChangeDirtyBit = HdChangeTracker::DirtyPrimvar) const;
|
||||
|
||||
// Handle UsdGeomPrimvars that use the "primvars:" prefix, while also
|
||||
// accommodating inheritance.
|
||||
USDIMAGING_API
|
||||
HdDirtyBits _ProcessPrefixedPrimvarPropertyChange(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName,
|
||||
HdDirtyBits valueChangeDirtyBit = HdChangeTracker::DirtyPrimvar,
|
||||
bool inherited = true) const;
|
||||
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) = 0;
|
||||
|
||||
USDIMAGING_API
|
||||
UsdImaging_CollectionCache& _GetCollectionCache() const;
|
||||
|
||||
USDIMAGING_API
|
||||
UsdImaging_CoordSysBindingStrategy::value_type
|
||||
_GetCoordSysBindings(UsdPrim const& prim) const;
|
||||
|
||||
USDIMAGING_API
|
||||
UsdImaging_InheritedPrimvarStrategy::value_type
|
||||
_GetInheritedPrimvars(UsdPrim const& prim) const;
|
||||
|
||||
USDIMAGING_API
|
||||
GfInterval _GetCurrentTimeSamplingInterval();
|
||||
|
||||
USDIMAGING_API
|
||||
Usd_PrimFlagsConjunction _GetDisplayPredicate() const;
|
||||
|
||||
USDIMAGING_API
|
||||
bool _DoesDelegateSupportCoordSys() const;
|
||||
|
||||
// Conversion functions between usd and hydra enums.
|
||||
USDIMAGING_API
|
||||
static HdInterpolation _UsdToHdInterpolation(TfToken const& usdInterp);
|
||||
USDIMAGING_API
|
||||
static TfToken _UsdToHdRole(TfToken const& usdRole);
|
||||
|
||||
private:
|
||||
UsdImagingDelegate* _delegate;
|
||||
};
|
||||
|
||||
class UsdImagingPrimAdapterFactoryBase : public TfType::FactoryBase {
|
||||
public:
|
||||
virtual UsdImagingPrimAdapterSharedPtr New() const = 0;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class UsdImagingPrimAdapterFactory : public UsdImagingPrimAdapterFactoryBase {
|
||||
public:
|
||||
virtual UsdImagingPrimAdapterSharedPtr New() const
|
||||
{
|
||||
return std::make_shared<T>();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_PRIM_ADAPTER_H
|
||||
@@ -0,0 +1,239 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_PRIMVARDESC_CACHE_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_PRIMVARDESC_CACHE_H
|
||||
|
||||
/// \file usdImaging/primvarDescCache.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/imaging/hd/sceneDelegate.h"
|
||||
|
||||
#include "pxr/usd/sdf/path.h"
|
||||
|
||||
#include "pxr/base/tf/token.h"
|
||||
|
||||
#include <tbb/concurrent_unordered_map.h>
|
||||
#include <tbb/concurrent_queue.h>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
/// \class UsdImagingPrimvarDescCache
|
||||
///
|
||||
/// A cache for primvar descriptors.
|
||||
///
|
||||
class UsdImagingPrimvarDescCache
|
||||
{
|
||||
public:
|
||||
UsdImagingPrimvarDescCache(const UsdImagingPrimvarDescCache&) = delete;
|
||||
UsdImagingPrimvarDescCache& operator=(const UsdImagingPrimvarDescCache&)
|
||||
= delete;
|
||||
|
||||
class Key
|
||||
{
|
||||
friend class UsdImagingPrimvarDescCache;
|
||||
SdfPath _path;
|
||||
TfToken _attribute;
|
||||
|
||||
public:
|
||||
Key(SdfPath const& path, TfToken const& attr)
|
||||
: _path(path)
|
||||
, _attribute(attr)
|
||||
{}
|
||||
|
||||
inline bool operator==(Key const& rhs) const {
|
||||
return _path == rhs._path && _attribute == rhs._attribute;
|
||||
}
|
||||
inline bool operator!=(Key const& rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
struct Hash {
|
||||
inline size_t operator()(Key const& key) const {
|
||||
size_t hash = key._path.GetHash();
|
||||
boost::hash_combine(hash, key._attribute.Hash());
|
||||
return hash;
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
static Key Primvars(SdfPath const& path) {
|
||||
static TfToken attr("primvars");
|
||||
return Key(path, attr);
|
||||
}
|
||||
};
|
||||
|
||||
UsdImagingPrimvarDescCache()
|
||||
: _locked(false)
|
||||
{ }
|
||||
|
||||
private:
|
||||
template <typename Element>
|
||||
struct _TypedCache
|
||||
{
|
||||
typedef tbb::concurrent_unordered_map<Key, Element, Key::Hash> _MapType;
|
||||
typedef typename _MapType::iterator _MapIt;
|
||||
typedef typename _MapType::const_iterator _MapConstIt;
|
||||
typedef tbb::concurrent_queue<_MapIt> _QueueType;
|
||||
|
||||
_MapType _map;
|
||||
_QueueType _deferredDeleteQueue;
|
||||
};
|
||||
|
||||
|
||||
/// Locates the requested \p key then populates \p value and returns true if
|
||||
/// found.
|
||||
template <typename T>
|
||||
bool _Find(Key const& key, T* value) const {
|
||||
typedef _TypedCache<T> Cache_t;
|
||||
|
||||
Cache_t *cache = nullptr;
|
||||
|
||||
_GetCache(&cache);
|
||||
typename Cache_t::_MapConstIt it = cache->_map.find(key);
|
||||
if (it == cache->_map.end()) {
|
||||
return false;
|
||||
}
|
||||
*value = it->second;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Locates the requested \p key then populates \p value, swap the value
|
||||
/// from the entry and queues the entry up for deletion.
|
||||
/// Returns true if found.
|
||||
/// This function is thread-safe, but Garbage collection must be called
|
||||
/// to perform the actual deletion.
|
||||
/// Note: second hit on same key will be sucessful, but return whatever
|
||||
/// value was passed into the first _Extract.
|
||||
template <typename T>
|
||||
bool _Extract(Key const& key, T* value) {
|
||||
if (!TF_VERIFY(!_locked)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef _TypedCache<T> Cache_t;
|
||||
Cache_t *cache = nullptr;
|
||||
|
||||
_GetCache(&cache);
|
||||
typename Cache_t::_MapIt it = cache->_map.find(key);
|
||||
|
||||
if (it == cache->_map.end()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we're going to erase the old value, swap to avoid a copy.
|
||||
std::swap(it->second, *value);
|
||||
cache->_deferredDeleteQueue.push(it);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Erases the given key from the value cache.
|
||||
/// Not thread safe
|
||||
template <typename T>
|
||||
void _Erase(Key const& key) {
|
||||
if (!TF_VERIFY(!_locked)) {
|
||||
return;
|
||||
}
|
||||
|
||||
typedef _TypedCache<T> Cache_t;
|
||||
|
||||
Cache_t *cache = nullptr;
|
||||
_GetCache(&cache);
|
||||
cache->_map.unsafe_erase(key);
|
||||
}
|
||||
|
||||
/// Returns a reference to the held value for \p key. Note that the entry
|
||||
/// for \p key will created with a default-constructed instance of T if
|
||||
/// there was no pre-existing entry.
|
||||
template <typename T>
|
||||
T& _Get(Key const& key) const {
|
||||
typedef _TypedCache<T> Cache_t;
|
||||
|
||||
Cache_t *cache = nullptr;
|
||||
_GetCache(&cache);
|
||||
|
||||
// With concurrent_unordered_map, multi-threaded insertion is safe.
|
||||
std::pair<typename Cache_t::_MapIt, bool> res =
|
||||
cache->_map.insert(std::make_pair(key, T()));
|
||||
|
||||
return res.first->second;
|
||||
}
|
||||
|
||||
/// Removes items from the cache that are marked for deletion.
|
||||
/// This is not thread-safe and designed to be called after
|
||||
/// all the worker threads have been joined.
|
||||
template <typename T>
|
||||
void _GarbageCollect(_TypedCache<T> &cache) {
|
||||
typedef _TypedCache<T> Cache_t;
|
||||
|
||||
typename Cache_t::_MapIt it;
|
||||
|
||||
while (cache._deferredDeleteQueue.try_pop(it)) {
|
||||
cache._map.unsafe_erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
void EnableMutation() { _locked = false; }
|
||||
void DisableMutation() { _locked = true; }
|
||||
|
||||
/// Clear all data associated with a specific path.
|
||||
void Clear(SdfPath const& path) {
|
||||
_Erase<HdPrimvarDescriptorVector>(Key::Primvars(path));
|
||||
}
|
||||
|
||||
HdPrimvarDescriptorVector& GetPrimvars(SdfPath const& path) const {
|
||||
return _Get<HdPrimvarDescriptorVector>(Key::Primvars(path));
|
||||
}
|
||||
|
||||
bool FindPrimvars(SdfPath const& path, HdPrimvarDescriptorVector* value) const {
|
||||
return _Find(Key::Primvars(path), value);
|
||||
}
|
||||
|
||||
bool ExtractPrimvars(SdfPath const& path, HdPrimvarDescriptorVector* value) {
|
||||
return _Extract(Key::Primvars(path), value);
|
||||
}
|
||||
|
||||
/// Remove any items from the cache that are marked for defered deletion.
|
||||
void GarbageCollect()
|
||||
{
|
||||
_GarbageCollect(_pviCache);
|
||||
}
|
||||
|
||||
private:
|
||||
bool _locked;
|
||||
|
||||
typedef _TypedCache<HdPrimvarDescriptorVector> _PviCache;
|
||||
mutable _PviCache _pviCache;
|
||||
|
||||
void _GetCache(_PviCache **cache) const {
|
||||
*cache = &_pviCache;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_PRIMVARDESC_CACHE_H
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USD_IMAGING_RECT_LIGHT_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_RECT_LIGHT_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/rectLightAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/lightAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingRectLightAdapter
|
||||
///
|
||||
/// Adapter class for lights of type RectLight
|
||||
///
|
||||
class UsdImagingRectLightAdapter : public UsdImagingLightAdapter {
|
||||
public:
|
||||
typedef UsdImagingLightAdapter BaseAdapter;
|
||||
|
||||
UsdImagingRectLightAdapter()
|
||||
: UsdImagingLightAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingRectLightAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
virtual SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual bool IsSupported(UsdImagingIndexProxy const* index) const;
|
||||
|
||||
protected:
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) final;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_RECT_LIGHT_ADAPTER_H
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,110 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_SPHERE_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_SPHERE_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/sphereAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
#include "pxr/usdImaging/usdImaging/gprimAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdGeomSphere;
|
||||
|
||||
/// \class UsdImagingSphereAdapter
|
||||
///
|
||||
/// Delegate support for UsdGeomSphere.
|
||||
///
|
||||
class UsdImagingSphereAdapter : public UsdImagingGprimAdapter
|
||||
{
|
||||
public:
|
||||
using BaseAdapter = UsdImagingGprimAdapter;
|
||||
|
||||
UsdImagingSphereAdapter()
|
||||
: UsdImagingGprimAdapter()
|
||||
{}
|
||||
USDIMAGING_API
|
||||
~UsdImagingSphereAdapter() override;
|
||||
|
||||
USDIMAGING_API
|
||||
SdfPath Populate(
|
||||
UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr)
|
||||
override;
|
||||
|
||||
USDIMAGING_API
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
USDIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& propertyName) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// Thread Safe.
|
||||
USDIMAGING_API
|
||||
void TrackVariability(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const* instancerContext = nullptr)
|
||||
const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Data access
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue GetTopology(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
// Override the implemetation in GprimAdapter since we don't fetch the
|
||||
// points attribute for implicit primitives.
|
||||
USDIMAGING_API
|
||||
VtValue GetPoints(
|
||||
UsdPrim const& prim,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
// Used by the legacyEngine.
|
||||
USDIMAGING_API
|
||||
static VtValue GetMeshPoints(UsdPrim const& prim,
|
||||
UsdTimeCode time);
|
||||
|
||||
// Used by the legacyEngine.
|
||||
USDIMAGING_API
|
||||
static VtValue GetMeshTopology();
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_SPHERE_ADAPTER_H
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USD_IMAGING_SPHERE_LIGHT_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_SPHERE_LIGHT_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/sphereLightAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/lightAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingSphereLightAdapter
|
||||
///
|
||||
/// Adapter class for lights of type SphereLight
|
||||
///
|
||||
class UsdImagingSphereLightAdapter : public UsdImagingLightAdapter {
|
||||
public:
|
||||
typedef UsdImagingLightAdapter BaseAdapter;
|
||||
|
||||
UsdImagingSphereLightAdapter()
|
||||
: UsdImagingLightAdapter()
|
||||
{}
|
||||
|
||||
USDIMAGING_API
|
||||
virtual ~UsdImagingSphereLightAdapter();
|
||||
|
||||
USDIMAGING_API
|
||||
virtual SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL);
|
||||
|
||||
USDIMAGING_API
|
||||
virtual bool IsSupported(UsdImagingIndexProxy const* index) const;
|
||||
|
||||
protected:
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) final;
|
||||
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_SPHERE_LIGHT_ADAPTER_H
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// 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 PXR_USD_IMAGING_USD_IMAGING_TEXTURE_UTILS_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_TEXTURE_UTILS_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
|
||||
#include "pxr/base/tf/token.h"
|
||||
|
||||
#include "pxr/usd/sdf/layer.h"
|
||||
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
/// The functions below are used by the old texture system where the
|
||||
/// scene delegates creates the texture resource in
|
||||
/// GetTextureResource.
|
||||
///
|
||||
/// Note: these functions are also not binding the Usd stage's
|
||||
/// resolver context and thus don't handle some cases (e.g., model
|
||||
/// search paths) correctly.
|
||||
///
|
||||
/// The corresponding functions for the new texture system are in
|
||||
/// usdImaging/materialParamUtils.cpp and HdStUdimTextureObject.
|
||||
///
|
||||
USDIMAGING_API
|
||||
std::vector<std::tuple<int, TfToken>>
|
||||
UsdImaging_GetUdimTiles(
|
||||
std::string const& basePath,
|
||||
int tileLimit,
|
||||
SdfLayerHandle const& layerHandle = SdfLayerHandle());
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_TEXTURE_UTILS_H
|
||||
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_TOKENS_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_TOKENS_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/base/tf/staticTokens.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
#define USDIMAGING_TOKENS \
|
||||
((infoSource, "info:source")) \
|
||||
(faceIndexPrimvar) \
|
||||
(faceOffsetPrimvar) \
|
||||
((primvarsNormals, "primvars:normals")) \
|
||||
((primvarsWidths, "primvars:widths")) \
|
||||
(ptexFaceIndex) \
|
||||
(ptexFaceOffset) \
|
||||
(usdPopulatedPrimCount) \
|
||||
(usdVaryingExtent) \
|
||||
(usdVaryingPrimvar) \
|
||||
(usdVaryingTopology) \
|
||||
(usdVaryingVisibility) \
|
||||
(usdVaryingWidths) \
|
||||
(usdVaryingNormals) \
|
||||
(usdVaryingXform) \
|
||||
(usdVaryingTexture) \
|
||||
(uvPrimvar) \
|
||||
(UsdPreviewSurface) \
|
||||
(UsdUVTexture) \
|
||||
(UsdPrimvarReader_float)\
|
||||
(UsdPrimvarReader_float2)\
|
||||
(UsdPrimvarReader_float3)\
|
||||
(UsdPrimvarReader_float4)\
|
||||
(UsdPrimvarReader_int) \
|
||||
(UsdTransform2d)
|
||||
|
||||
TF_DECLARE_PUBLIC_TOKENS(UsdImagingTokens, USDIMAGING_API, USDIMAGING_TOKENS);
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif //PXR_USD_IMAGING_USD_IMAGING_TOKENS_H
|
||||
@@ -0,0 +1,248 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_UNIT_TEST_HELPER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_UNIT_TEST_HELPER_H
|
||||
|
||||
/// \file usdImaging/unitTestHelper.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/delegate.h"
|
||||
|
||||
#include "pxr/imaging/hd/changeTracker.h"
|
||||
#include "pxr/imaging/hd/engine.h"
|
||||
#include "pxr/imaging/hd/renderIndex.h"
|
||||
#include "pxr/imaging/hd/renderPass.h"
|
||||
#include "pxr/imaging/hd/rprim.h"
|
||||
#include "pxr/imaging/hd/rprimCollection.h"
|
||||
#include "pxr/imaging/hd/tokens.h"
|
||||
#include "pxr/imaging/hd/unitTestNullRenderDelegate.h"
|
||||
#include "pxr/imaging/hd/unitTestNullRenderPass.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
using HdRenderPassSharedPtr = std::shared_ptr<HdRenderPass>;
|
||||
|
||||
/// A simple test task that just causes sync processing
|
||||
class UsdImaging_TestTask final : public HdTask
|
||||
{
|
||||
public:
|
||||
UsdImaging_TestTask(HdRenderPassSharedPtr const &renderPass,
|
||||
TfTokenVector const &renderTags)
|
||||
: HdTask(SdfPath::EmptyPath())
|
||||
, _renderPass(renderPass)
|
||||
, _renderTags(renderTags)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void Sync(HdSceneDelegate* delegate,
|
||||
HdTaskContext* ctx,
|
||||
HdDirtyBits* dirtyBits) override {
|
||||
_renderPass->Sync();
|
||||
|
||||
*dirtyBits = HdChangeTracker::Clean;
|
||||
}
|
||||
|
||||
virtual void Prepare(HdTaskContext* ctx,
|
||||
HdRenderIndex* renderIndex) override {
|
||||
}
|
||||
|
||||
virtual void Execute(HdTaskContext* ctx) override {
|
||||
}
|
||||
|
||||
virtual const TfTokenVector &GetRenderTags() const override {
|
||||
return _renderTags;
|
||||
}
|
||||
|
||||
private:
|
||||
HdRenderPassSharedPtr _renderPass;
|
||||
TfTokenVector _renderTags;
|
||||
};
|
||||
|
||||
/// \class UsdImaging_TestDriver
|
||||
///
|
||||
/// A unit test driver that exercises the core engine.
|
||||
///
|
||||
/// \note This test driver uses a Null render delegate, so
|
||||
/// no images are produced. It just tests interaction between Hydra and
|
||||
/// UsdImaging during Hydra's Sync phase. of Hydra
|
||||
///
|
||||
class UsdImaging_TestDriver final {
|
||||
public:
|
||||
UsdImaging_TestDriver(std::string const& usdFilePath)
|
||||
: _engine()
|
||||
, _renderDelegate()
|
||||
, _renderIndex(nullptr)
|
||||
, _delegate(nullptr)
|
||||
, _geometryPass()
|
||||
, _stage()
|
||||
{
|
||||
HdRprimCollection collection = HdRprimCollection(
|
||||
HdTokens->geometry,
|
||||
HdReprSelector(HdReprTokens->hull));
|
||||
|
||||
TfTokenVector renderTags;
|
||||
renderTags.push_back(HdRenderTagTokens->geometry);
|
||||
|
||||
_Init(UsdStage::Open(usdFilePath),
|
||||
collection,
|
||||
SdfPath::AbsoluteRootPath(),
|
||||
renderTags);
|
||||
}
|
||||
|
||||
UsdImaging_TestDriver(std::string const& usdFilePath,
|
||||
TfToken const &collectionName,
|
||||
TfToken const &reprName,
|
||||
TfTokenVector const &renderTags)
|
||||
: _engine()
|
||||
, _renderDelegate()
|
||||
, _renderIndex(nullptr)
|
||||
, _delegate(nullptr)
|
||||
, _geometryPass()
|
||||
, _stage()
|
||||
{
|
||||
HdRprimCollection collection = HdRprimCollection(
|
||||
collectionName,
|
||||
HdReprSelector(reprName));
|
||||
|
||||
_Init(UsdStage::Open(usdFilePath),
|
||||
collection,
|
||||
SdfPath::AbsoluteRootPath(),
|
||||
renderTags);
|
||||
}
|
||||
|
||||
UsdImaging_TestDriver(UsdStageRefPtr const& usdStage)
|
||||
: _engine()
|
||||
, _renderDelegate()
|
||||
, _renderIndex(nullptr)
|
||||
, _delegate(nullptr)
|
||||
, _geometryPass()
|
||||
, _stage()
|
||||
{
|
||||
HdRprimCollection collection = HdRprimCollection(
|
||||
HdTokens->geometry,
|
||||
HdReprSelector(HdReprTokens->hull));
|
||||
|
||||
TfTokenVector renderTags;
|
||||
renderTags.push_back(HdRenderTagTokens->geometry);
|
||||
|
||||
_Init(usdStage, collection, SdfPath::AbsoluteRootPath(), renderTags);
|
||||
}
|
||||
|
||||
UsdImaging_TestDriver(UsdStageRefPtr const& usdStage,
|
||||
TfToken const &collectionName,
|
||||
TfToken const &reprName,
|
||||
TfTokenVector const &renderTags)
|
||||
: _engine()
|
||||
, _renderDelegate()
|
||||
, _renderIndex(nullptr)
|
||||
, _delegate(nullptr)
|
||||
, _geometryPass()
|
||||
, _stage()
|
||||
{
|
||||
HdRprimCollection collection = HdRprimCollection(
|
||||
collectionName,
|
||||
HdReprSelector(reprName));
|
||||
|
||||
_Init(usdStage, collection, SdfPath::AbsoluteRootPath(), renderTags);
|
||||
}
|
||||
|
||||
UsdImaging_TestDriver(UsdStageRefPtr const& usdStage,
|
||||
HdRprimCollection const &collection,
|
||||
SdfPath const &delegateId,
|
||||
TfTokenVector const &renderTags)
|
||||
: _engine()
|
||||
, _renderDelegate()
|
||||
, _renderIndex(nullptr)
|
||||
, _delegate(nullptr)
|
||||
, _geometryPass()
|
||||
, _stage()
|
||||
{
|
||||
_Init(usdStage, collection, delegateId, renderTags);
|
||||
}
|
||||
|
||||
~UsdImaging_TestDriver()
|
||||
{
|
||||
delete _delegate;
|
||||
delete _renderIndex;
|
||||
}
|
||||
|
||||
void Draw() {
|
||||
HdTaskSharedPtrVector tasks = {
|
||||
std::make_shared<UsdImaging_TestTask>(_geometryPass, _renderTags)
|
||||
};
|
||||
_engine.Execute(&_delegate->GetRenderIndex(), &tasks);
|
||||
}
|
||||
void SetTime(double time) {
|
||||
_delegate->SetTime(time);
|
||||
}
|
||||
|
||||
/// Marks an rprim in the RenderIndex as dirty with the given dirty flags.
|
||||
void MarkRprimDirty(SdfPath path, HdDirtyBits flag) {
|
||||
_delegate->GetRenderIndex().GetChangeTracker()
|
||||
.MarkRprimDirty(path, flag);
|
||||
}
|
||||
|
||||
/// Returns the underlying delegate for this driver.
|
||||
UsdImagingDelegate& GetDelegate() {
|
||||
return *_delegate;
|
||||
}
|
||||
|
||||
/// Returns the populated UsdStage for this driver.
|
||||
UsdStageRefPtr const& GetStage() {
|
||||
return _stage;
|
||||
}
|
||||
|
||||
private:
|
||||
HdEngine _engine;
|
||||
Hd_UnitTestNullRenderDelegate _renderDelegate;
|
||||
HdRenderIndex *_renderIndex;
|
||||
UsdImagingDelegate *_delegate;
|
||||
HdRenderPassSharedPtr _geometryPass;
|
||||
UsdStageRefPtr _stage;
|
||||
TfTokenVector _renderTags;
|
||||
|
||||
void _Init(UsdStageRefPtr const& usdStage,
|
||||
HdRprimCollection const &collection,
|
||||
SdfPath const &delegateId,
|
||||
TfTokenVector const &renderTags) {
|
||||
_renderIndex = HdRenderIndex::New(&_renderDelegate, HdDriverVector());
|
||||
TF_VERIFY(_renderIndex != nullptr);
|
||||
_delegate = new UsdImagingDelegate(_renderIndex, delegateId);
|
||||
|
||||
_stage = usdStage;
|
||||
_delegate->Populate(_stage->GetPseudoRoot());
|
||||
|
||||
_geometryPass = HdRenderPassSharedPtr(
|
||||
new Hd_UnitTestNullRenderPass(_renderIndex, collection));
|
||||
|
||||
_renderTags = renderTags;
|
||||
}
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif //PXR_USD_IMAGING_USD_IMAGING_UNIT_TEST_HELPER_H
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_VERSION_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_VERSION_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
|
||||
// Version 3 -- add support for nested instancers in InsertInstancer.
|
||||
// Version 4 -- Populate returns SdfPath, HdxSelectionInstanceMap.
|
||||
// Version 5 -- GetPathForInstanceIndex returns absoluteInstanceIndex.
|
||||
// Version 6 -- PrimAdater::GetDependPaths.
|
||||
// Version 7 -- GetPathForInstanceIndex returns instanceContext.
|
||||
// Version 8 -- GetPathForInstanceIndex returns instanceContext (as
|
||||
// SdfPathVector) and rprimPath separately.
|
||||
// Version 9 -- Rework UsdImagingEngineGL::RenderParams API to conform to
|
||||
// updated purpose tokens and make proxy imaging optional.
|
||||
// Version 10 - Add "UsdPrim" parameter to adapter PopulateSelection.
|
||||
// Version 11 - PopulateSelection takes "usdPath" (relative to USD stage),
|
||||
// rather than a path with the delegate root.
|
||||
// Version 12 - Adapter PopulateSelection signature change to adapt to
|
||||
// flat instance indices in hydra selection.
|
||||
// Version 13 - Deleted GetPathForInstanceIndex; added GetScenePrimPath.
|
||||
// Version 14 - Added HdInstancerContext to GetScenePrimPath.
|
||||
// Version 15 - CanPopulateMaster renamed to CanPopulateUsdInstance.
|
||||
// Version 16 - InsertRprim/InsertInstancer no longer take an instancer path.
|
||||
|
||||
#define USD_IMAGING_API_VERSION 16
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_VERSION_H
|
||||
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// 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 PXR_USD_IMAGING_USD_IMAGING_VOLUME_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_VOLUME_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/volumeAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usd/usdVol/volume.h"
|
||||
#include "pxr/usdImaging/usdImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
#include "pxr/usdImaging/usdImaging/gprimAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
/// \class UsdImagingVolumeAdapter
|
||||
///
|
||||
/// Delegate support for UsdVolVolume.
|
||||
///
|
||||
class UsdImagingVolumeAdapter : public UsdImagingGprimAdapter {
|
||||
public:
|
||||
typedef UsdImagingGprimAdapter BaseAdapter;
|
||||
|
||||
UsdImagingVolumeAdapter()
|
||||
: UsdImagingGprimAdapter()
|
||||
{}
|
||||
virtual ~UsdImagingVolumeAdapter();
|
||||
|
||||
virtual SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) override;
|
||||
|
||||
virtual bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// Thread Safe.
|
||||
virtual void TrackVariability(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const override;
|
||||
|
||||
/// Thread Safe.
|
||||
virtual void UpdateForTime(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const override;
|
||||
|
||||
virtual HdVolumeFieldDescriptorVector
|
||||
GetVolumeFieldDescriptors(UsdPrim const& usdPrim, SdfPath const &id,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
private:
|
||||
bool _GatherVolumeData(UsdPrim const& prim,
|
||||
UsdVolVolume::FieldMap *fieldMap) const;
|
||||
};
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_VOLUME_ADAPTER_H
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USD_IMAGING_GL_API_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_GL_API_H
|
||||
|
||||
#include "pxr/base/arch/export.h"
|
||||
|
||||
#if defined(PXR_STATIC)
|
||||
# define USDIMAGINGGL_API
|
||||
# define USDIMAGINGGL_API_TEMPLATE_CLASS(...)
|
||||
# define USDIMAGINGGL_API_TEMPLATE_STRUCT(...)
|
||||
# define USDIMAGINGGL_LOCAL
|
||||
#else
|
||||
# if defined(USDIMAGINGGL_EXPORTS)
|
||||
# define USDIMAGINGGL_API ARCH_EXPORT
|
||||
# define USDIMAGINGGL_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
# define USDIMAGINGGL_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
# else
|
||||
# define USDIMAGINGGL_API ARCH_IMPORT
|
||||
# define USDIMAGINGGL_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
# define USDIMAGINGGL_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
# endif
|
||||
# define USDIMAGINGGL_LOCAL ARCH_HIDDEN
|
||||
#endif
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_GL_API_H
|
||||
@@ -0,0 +1,248 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_IMAGING_GL_DRAW_MODE_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_GL_DRAW_MODE_ADAPTER_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImagingGL/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
/// \class UsdImagingGLDrawModeAdapter
|
||||
///
|
||||
/// Delegate support for the drawMode attribute on UsdGeomModelAPI.
|
||||
///
|
||||
class UsdImagingGLDrawModeAdapter : public UsdImagingPrimAdapter
|
||||
{
|
||||
public:
|
||||
using BaseAdapter = UsdImagingPrimAdapter;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
UsdImagingGLDrawModeAdapter();
|
||||
|
||||
USDIMAGINGGL_API
|
||||
~UsdImagingGLDrawModeAdapter() override;
|
||||
|
||||
/// Called to populate the RenderIndex for this UsdPrim. The adapter is
|
||||
/// expected to create one or more Rprims in the render index using the
|
||||
/// given proxy.
|
||||
SdfPath Populate(
|
||||
UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL) override;
|
||||
|
||||
// If the draw mode adapter is applied to a prim, it cuts off traversal of
|
||||
// that prim's subtree.
|
||||
bool ShouldCullChildren() const override;
|
||||
|
||||
// Because draw mode can change usdImaging topology, we need to handle
|
||||
// render index compatibility at a later point than adapter lookup.
|
||||
bool IsSupported(UsdImagingIndexProxy const* index) const override;
|
||||
|
||||
// Cards mode can be applied to instance prims, so we need to let the
|
||||
// UsdImagingInstanceAdapter know we want special handling.
|
||||
bool CanPopulateUsdInstance() const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGINGGL_API
|
||||
void TrackVariability(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const override;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
void UpdateForTime(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
UsdImagingInstancerContext const*
|
||||
instancerContext = NULL) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGINGGL_API
|
||||
HdDirtyBits ProcessPropertyChange(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& property) override;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
void MarkDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdDirtyBits dirty,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
void MarkTransformDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
void MarkVisibilityDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
void MarkMaterialDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Data access
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDIMAGINGGL_API
|
||||
VtValue Get(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
VtIntArray *outIndices) const override;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
HdCullStyle GetCullStyle(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
VtValue GetTopology(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
GfRange3d GetExtent(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
bool GetDoubleSided(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
GfMatrix4d GetTransform(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
bool ignoreRootTransform = false) const override;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
SdfPath GetMaterialId(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue GetMaterialResource(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
protected:
|
||||
USDIMAGINGGL_API
|
||||
void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
private:
|
||||
// For cards rendering, check if we're rendering any faces with 0 area;
|
||||
// if so, issue a warning.
|
||||
void _SanityCheckFaceSizes(SdfPath const& cachePath,
|
||||
GfRange3d const& extents, uint8_t axes_mask)
|
||||
const;
|
||||
|
||||
void _ComputeGeometryData(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time,
|
||||
TfToken const& drawMode,
|
||||
VtValue* topology,
|
||||
VtValue* points,
|
||||
GfRange3d* extent,
|
||||
VtValue* uv,
|
||||
VtValue* assign) const;
|
||||
|
||||
// Check whether the given cachePath is a path to the draw mode material.
|
||||
bool _IsMaterialPath(SdfPath const& path) const;
|
||||
|
||||
// Check whether the given cachePath is a path to a draw mode texture.
|
||||
bool _IsTexturePath(SdfPath const& path) const;
|
||||
|
||||
// Return true if prim has a time varying extent or extentsHint attribute.
|
||||
bool _HasVaryingExtent(UsdPrim const& prim) const;
|
||||
|
||||
// Check if any of the cards texture attributes are marked as time-varying.
|
||||
void _CheckForTextureVariability(UsdPrim const& prim,
|
||||
HdDirtyBits dirtyBits,
|
||||
HdDirtyBits *timeVaryingBits) const;
|
||||
|
||||
// Computes the extents of the given prim, using UsdGeomBBoxCache.
|
||||
// The extents are computed for purposes default/proxy/render.
|
||||
GfRange3d _ComputeExtent(UsdPrim const& prim,
|
||||
const UsdTimeCode& timecode) const;
|
||||
|
||||
// Generate geometry for "origin" draw mode.
|
||||
void _GenerateOriginGeometry(VtValue* topo, VtValue* points,
|
||||
GfRange3d const& extents) const;
|
||||
|
||||
// Generate geometry for "bounds" draw mode.
|
||||
void _GenerateBoundsGeometry(VtValue* topo, VtValue* points,
|
||||
GfRange3d const& extents) const;
|
||||
|
||||
// Generate geometry for "cards" draw mode, with cardGeometry "cross".
|
||||
void _GenerateCardsCrossGeometry(VtValue* topo, VtValue* points,
|
||||
GfRange3d const& extents, uint8_t axes_mask) const;
|
||||
|
||||
// Generate geometry for "cards" draw mode, with cardGeometry "box".
|
||||
void _GenerateCardsBoxGeometry(VtValue* topo, VtValue* points,
|
||||
GfRange3d const& extents, uint8_t axes_mask) const;
|
||||
|
||||
// Generate geometry for "cards" draw mode, with cardGeometry "fromTexture".
|
||||
void _GenerateCardsFromTextureGeometry(VtValue* topo, VtValue* points,
|
||||
VtValue* uv, VtValue* assign, GfRange3d* extents,
|
||||
UsdPrim const& prim) const;
|
||||
|
||||
// Given an asset attribute pointing to a texture, pull the "worldtoscreen"
|
||||
// matrix out of image metadata.
|
||||
bool _GetMatrixFromImageMetadata(UsdAttribute const& attr, GfMatrix4d* mat)
|
||||
const;
|
||||
|
||||
// Generate texture coordinates for cards "cross"/"box" mode.
|
||||
void _GenerateTextureCoordinates(VtValue* uv, VtValue* assign,
|
||||
uint8_t axes_mask) const;
|
||||
|
||||
// Map from cachePath to what drawMode it was populated as.
|
||||
using _DrawModeMap = TfHashMap<SdfPath, TfToken, SdfPath::Hash>;
|
||||
_DrawModeMap _drawModeMap;
|
||||
|
||||
// The default value of model:drawModeColor, fetched from the schema
|
||||
// registry and stored for quick access...
|
||||
GfVec3f _schemaColor;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_GL_DRAW_MODE_ADAPTER_H
|
||||
@@ -0,0 +1,602 @@
|
||||
//
|
||||
// Copyright 2016 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.
|
||||
//
|
||||
|
||||
/// \file usdImagingGL/engine.h
|
||||
|
||||
#ifndef PXR_USD_IMAGING_USD_IMAGING_GL_ENGINE_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_GL_ENGINE_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImagingGL/api.h"
|
||||
#include "pxr/usdImaging/usdImagingGL/version.h"
|
||||
#include "pxr/usdImaging/usdImaging/version.h"
|
||||
|
||||
#include "pxr/usdImaging/usdImagingGL/renderParams.h"
|
||||
#include "pxr/usdImaging/usdImagingGL/rendererSettings.h"
|
||||
|
||||
#include "pxr/imaging/cameraUtil/conformWindow.h"
|
||||
|
||||
#include "pxr/imaging/hd/driver.h"
|
||||
#include "pxr/imaging/hd/engine.h"
|
||||
#include "pxr/imaging/hd/rprimCollection.h"
|
||||
#include "pxr/imaging/hd/pluginRenderDelegateUniqueHandle.h"
|
||||
|
||||
#include "pxr/imaging/hdx/selectionTracker.h"
|
||||
#include "pxr/imaging/hdx/renderSetupTask.h"
|
||||
|
||||
#include "pxr/imaging/hgi/hgi.h"
|
||||
|
||||
#include "pxr/imaging/glf/simpleLight.h"
|
||||
#include "pxr/imaging/glf/simpleMaterial.h"
|
||||
|
||||
#include "pxr/imaging/hgi/hgi.h"
|
||||
|
||||
#include "pxr/usd/sdf/path.h"
|
||||
#include "pxr/usd/usd/timeCode.h"
|
||||
|
||||
#include "pxr/base/gf/frustum.h"
|
||||
#include "pxr/base/gf/matrix4d.h"
|
||||
#include "pxr/base/gf/vec4d.h"
|
||||
#include "pxr/base/gf/vec4f.h"
|
||||
#include "pxr/base/gf/vec4i.h"
|
||||
|
||||
#include "pxr/base/vt/dictionary.h"
|
||||
|
||||
#include "pxr/base/tf/declarePtrs.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class UsdPrim;
|
||||
class HdRenderIndex;
|
||||
class HdxTaskController;
|
||||
class UsdImagingDelegate;
|
||||
class UsdImagingGLLegacyEngine;
|
||||
|
||||
TF_DECLARE_WEAK_AND_REF_PTRS(GlfSimpleLightingContext);
|
||||
|
||||
/// \class UsdImagingGLEngine
|
||||
///
|
||||
/// The UsdImagingGLEngine is the main entry point API for rendering USD scenes.
|
||||
///
|
||||
class UsdImagingGLEngine
|
||||
{
|
||||
public:
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/// \name Global State
|
||||
/// @{
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// Returns true if Hydra is enabled for GL drawing.
|
||||
USDIMAGINGGL_API
|
||||
static bool IsHydraEnabled();
|
||||
|
||||
/// @}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/// \name Construction
|
||||
/// @{
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// A HdDriver, containing the Hgi of your choice, can be optionally passed
|
||||
/// in during construction. This can be helpful if you application creates
|
||||
/// multiple UsdImagingGLEngine that wish to use the same HdDriver / Hgi.
|
||||
USDIMAGINGGL_API
|
||||
UsdImagingGLEngine(const HdDriver& driver = HdDriver());
|
||||
|
||||
USDIMAGINGGL_API
|
||||
UsdImagingGLEngine(const SdfPath& rootPath,
|
||||
const SdfPathVector& excludedPaths,
|
||||
const SdfPathVector& invisedPaths=SdfPathVector(),
|
||||
const SdfPath& sceneDelegateID =
|
||||
SdfPath::AbsoluteRootPath(),
|
||||
const HdDriver& driver = HdDriver());
|
||||
|
||||
// Disallow copies
|
||||
UsdImagingGLEngine(const UsdImagingGLEngine&) = delete;
|
||||
UsdImagingGLEngine& operator=(const UsdImagingGLEngine&) = delete;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
~UsdImagingGLEngine();
|
||||
|
||||
/// @}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/// \name Rendering
|
||||
/// @{
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// Support for batched drawing
|
||||
USDIMAGINGGL_API
|
||||
void PrepareBatch(const UsdPrim& root,
|
||||
const UsdImagingGLRenderParams& params);
|
||||
USDIMAGINGGL_API
|
||||
void RenderBatch(const SdfPathVector& paths,
|
||||
const UsdImagingGLRenderParams& params);
|
||||
|
||||
/// Entry point for kicking off a render
|
||||
USDIMAGINGGL_API
|
||||
void Render(const UsdPrim& root,
|
||||
const UsdImagingGLRenderParams ¶ms);
|
||||
|
||||
/// Returns true if the resulting image is fully converged.
|
||||
/// (otherwise, caller may need to call Render() again to refine the result)
|
||||
USDIMAGINGGL_API
|
||||
bool IsConverged() const;
|
||||
|
||||
/// @}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/// \name Root Transform and Visibility
|
||||
/// @{
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// Sets the root transform.
|
||||
USDIMAGINGGL_API
|
||||
void SetRootTransform(GfMatrix4d const& xf);
|
||||
|
||||
/// Sets the root visibility.
|
||||
USDIMAGINGGL_API
|
||||
void SetRootVisibility(bool isVisible);
|
||||
|
||||
/// @}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/// \name Camera State
|
||||
/// @{
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// Scene camera API
|
||||
/// Set the scene camera path to use for rendering.
|
||||
USDIMAGINGGL_API
|
||||
void SetCameraPath(SdfPath const& id);
|
||||
|
||||
/// Determines how the filmback of the camera is mapped into
|
||||
/// the pixels of the render buffer and what pixels of the render
|
||||
/// buffer will be rendered into.
|
||||
USDIMAGINGGL_API
|
||||
void SetFraming(CameraUtilFraming const& framing);
|
||||
|
||||
/// Specifies whether to force a window policy when conforming
|
||||
/// the frustum of the camera to match the display window of
|
||||
/// the camera framing.
|
||||
///
|
||||
/// If set to {false, ...}, the window policy of the specified camera
|
||||
/// will be used.
|
||||
///
|
||||
/// Note: std::pair<bool, ...> is used instead of std::optional<...>
|
||||
/// because the latter is only available in C++17 or later.
|
||||
USDIMAGINGGL_API
|
||||
void SetOverrideWindowPolicy(
|
||||
const std::pair<bool, CameraUtilConformWindowPolicy> &policy);
|
||||
|
||||
/// Set the size of the render buffers baking the AOVs.
|
||||
/// GUI applications should set this to the size of the window.
|
||||
///
|
||||
USDIMAGINGGL_API
|
||||
void SetRenderBufferSize(GfVec2i const& size);
|
||||
|
||||
/// Set the viewport to use for rendering as (x,y,w,h), where (x,y)
|
||||
/// represents the lower left corner of the viewport rectangle, and (w,h)
|
||||
/// is the width and height of the viewport in pixels.
|
||||
///
|
||||
/// \deprecated Use SetFraming and SetRenderBufferSize instead.
|
||||
USDIMAGINGGL_API
|
||||
void SetRenderViewport(GfVec4d const& viewport);
|
||||
|
||||
/// Set the window policy to use.
|
||||
/// XXX: This is currently used for scene cameras set via SetCameraPath.
|
||||
/// See comment in SetCameraState for the free cam.
|
||||
USDIMAGINGGL_API
|
||||
void SetWindowPolicy(CameraUtilConformWindowPolicy policy);
|
||||
|
||||
/// Free camera API
|
||||
/// Set camera framing state directly (without pointing to a camera on the
|
||||
/// USD stage). The projection matrix is expected to be pre-adjusted for the
|
||||
/// window policy.
|
||||
USDIMAGINGGL_API
|
||||
void SetCameraState(const GfMatrix4d& viewMatrix,
|
||||
const GfMatrix4d& projectionMatrix);
|
||||
|
||||
/// Helper function to extract camera and viewport state from opengl and
|
||||
/// then call SetCameraState and SetRenderViewport
|
||||
USDIMAGINGGL_API
|
||||
void SetCameraStateFromOpenGL();
|
||||
|
||||
/// @}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/// \name Light State
|
||||
/// @{
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// Helper function to extract lighting state from opengl and then
|
||||
/// call SetLights.
|
||||
USDIMAGINGGL_API
|
||||
void SetLightingStateFromOpenGL();
|
||||
|
||||
/// Copy lighting state from another lighting context.
|
||||
USDIMAGINGGL_API
|
||||
void SetLightingState(GlfSimpleLightingContextPtr const &src);
|
||||
|
||||
/// Set lighting state
|
||||
/// Derived classes should ensure that passing an empty lights
|
||||
/// vector disables lighting.
|
||||
/// \param lights is the set of lights to use, or empty to disable lighting.
|
||||
USDIMAGINGGL_API
|
||||
void SetLightingState(GlfSimpleLightVector const &lights,
|
||||
GlfSimpleMaterial const &material,
|
||||
GfVec4f const &sceneAmbient);
|
||||
|
||||
/// @}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/// \name Selection Highlighting
|
||||
/// @{
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// Sets (replaces) the list of prim paths that should be included in
|
||||
/// selection highlighting. These paths may include root paths which will
|
||||
/// be expanded internally.
|
||||
USDIMAGINGGL_API
|
||||
void SetSelected(SdfPathVector const& paths);
|
||||
|
||||
/// Clear the list of prim paths that should be included in selection
|
||||
/// highlighting.
|
||||
USDIMAGINGGL_API
|
||||
void ClearSelected();
|
||||
|
||||
/// Add a path with instanceIndex to the list of prim paths that should be
|
||||
/// included in selection highlighting. UsdImagingDelegate::ALL_INSTANCES
|
||||
/// can be used for highlighting all instances if path is an instancer.
|
||||
USDIMAGINGGL_API
|
||||
void AddSelected(SdfPath const &path, int instanceIndex);
|
||||
|
||||
/// Sets the selection highlighting color.
|
||||
USDIMAGINGGL_API
|
||||
void SetSelectionColor(GfVec4f const& color);
|
||||
|
||||
/// @}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/// \name Picking
|
||||
/// @{
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// Finds closest point of intersection with a frustum by rendering.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// Returns whether a hit occurred and if so, \p outHitPoint will contain
|
||||
/// the intersection point in world space (i.e. \p projectionMatrix and
|
||||
/// \p viewMatrix factored back out of the result), and \p outHitNormal
|
||||
/// will contain the world space normal at that point.
|
||||
///
|
||||
/// \p outHitPrimPath will point to the gprim selected by the pick.
|
||||
/// \p outHitInstancerPath will point to the point instancer (if applicable)
|
||||
/// of that gprim. For nested instancing, outHitInstancerPath points to
|
||||
/// the closest instancer.
|
||||
///
|
||||
USDIMAGINGGL_API
|
||||
bool TestIntersection(
|
||||
const GfMatrix4d &viewMatrix,
|
||||
const GfMatrix4d &projectionMatrix,
|
||||
const UsdPrim& root,
|
||||
const UsdImagingGLRenderParams ¶ms,
|
||||
GfVec3d *outHitPoint,
|
||||
GfVec3d *outHitNormal,
|
||||
SdfPath *outHitPrimPath = NULL,
|
||||
SdfPath *outHitInstancerPath = NULL,
|
||||
int *outHitInstanceIndex = NULL,
|
||||
HdInstancerContext *outInstancerContext = NULL);
|
||||
|
||||
/// Decodes a pick result given hydra prim ID/instance ID (like you'd get
|
||||
/// from an ID render).
|
||||
USDIMAGINGGL_API
|
||||
bool DecodeIntersection(
|
||||
unsigned char const primIdColor[4],
|
||||
unsigned char const instanceIdColor[4],
|
||||
SdfPath *outHitPrimPath = NULL,
|
||||
SdfPath *outHitInstancerPath = NULL,
|
||||
int *outHitInstanceIndex = NULL,
|
||||
HdInstancerContext *outInstancerContext = NULL);
|
||||
|
||||
/// @}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/// \name Renderer Plugin Management
|
||||
/// @{
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// Return the vector of available render-graph delegate plugins.
|
||||
USDIMAGINGGL_API
|
||||
static TfTokenVector GetRendererPlugins();
|
||||
|
||||
/// Return the user-friendly description of a renderer plugin.
|
||||
USDIMAGINGGL_API
|
||||
static std::string GetRendererDisplayName(TfToken const &id);
|
||||
|
||||
/// Return the id of the currently used renderer plugin.
|
||||
USDIMAGINGGL_API
|
||||
TfToken GetCurrentRendererId() const;
|
||||
|
||||
/// Set the current render-graph delegate to \p id.
|
||||
/// the plugin will be loaded if it's not yet.
|
||||
USDIMAGINGGL_API
|
||||
bool SetRendererPlugin(TfToken const &id);
|
||||
|
||||
/// @}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/// \name AOVs and Renderer Settings
|
||||
/// @{
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// Return the vector of available renderer AOV settings.
|
||||
USDIMAGINGGL_API
|
||||
TfTokenVector GetRendererAovs() const;
|
||||
|
||||
/// Set the current renderer AOV to \p id.
|
||||
USDIMAGINGGL_API
|
||||
bool SetRendererAov(TfToken const& id);
|
||||
|
||||
/// Returns an AOV texture handle for the given token.
|
||||
USDIMAGINGGL_API
|
||||
HgiTextureHandle GetAovTexture(TfToken const& name) const;
|
||||
|
||||
/// Returns the list of renderer settings.
|
||||
USDIMAGINGGL_API
|
||||
UsdImagingGLRendererSettingsList GetRendererSettingsList() const;
|
||||
|
||||
/// Gets a renderer setting's current value.
|
||||
USDIMAGINGGL_API
|
||||
VtValue GetRendererSetting(TfToken const& id) const;
|
||||
|
||||
/// Sets a renderer setting's value.
|
||||
USDIMAGINGGL_API
|
||||
void SetRendererSetting(TfToken const& id,
|
||||
VtValue const& value);
|
||||
|
||||
/// Enable / disable presenting the render to bound framebuffer.
|
||||
/// An application may choose to manage the AOVs that are rendered into
|
||||
/// itself and skip the engine's presentation.
|
||||
USDIMAGINGGL_API
|
||||
void SetEnablePresentation(bool enabled);
|
||||
|
||||
/// The destination API (e.g., OpenGL, see hgiInterop for details) and
|
||||
/// framebuffer that the AOVs are presented into. The framebuffer
|
||||
/// is a VtValue that encoding a framebuffer in a destination API
|
||||
/// specific way.
|
||||
/// E.g., a uint32_t (aka GLuint) for framebuffer object for OpenGL.
|
||||
USDIMAGINGGL_API
|
||||
void SetPresentationOutput(TfToken const &api, VtValue const &framebuffer);
|
||||
|
||||
/// @}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/// \name Control of background rendering threads.
|
||||
/// @{
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// Query the renderer as to whether it supports pausing and resuming.
|
||||
USDIMAGINGGL_API
|
||||
bool IsPauseRendererSupported() const;
|
||||
|
||||
/// Pause the renderer.
|
||||
///
|
||||
/// Returns \c true if successful.
|
||||
USDIMAGINGGL_API
|
||||
bool PauseRenderer();
|
||||
|
||||
/// Resume the renderer.
|
||||
///
|
||||
/// Returns \c true if successful.
|
||||
USDIMAGINGGL_API
|
||||
bool ResumeRenderer();
|
||||
|
||||
/// Query the renderer as to whether it supports stopping and restarting.
|
||||
USDIMAGINGGL_API
|
||||
bool IsStopRendererSupported() const;
|
||||
|
||||
/// Stop the renderer.
|
||||
///
|
||||
/// Returns \c true if successful.
|
||||
USDIMAGINGGL_API
|
||||
bool StopRenderer();
|
||||
|
||||
/// Restart the renderer.
|
||||
///
|
||||
/// Returns \c true if successful.
|
||||
USDIMAGINGGL_API
|
||||
bool RestartRenderer();
|
||||
|
||||
/// @}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/// \name Color Correction
|
||||
/// @{
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// Set \p id to one of the HdxColorCorrectionTokens.
|
||||
USDIMAGINGGL_API
|
||||
void SetColorCorrectionSettings(
|
||||
TfToken const& id);
|
||||
|
||||
/// @}
|
||||
|
||||
/// Returns true if the platform is color correction capable.
|
||||
USDIMAGINGGL_API
|
||||
static bool IsColorCorrectionCapable();
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/// \name Render Statistics
|
||||
/// @{
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// Returns render statistics.
|
||||
///
|
||||
/// The contents of the dictionary will depend on the current render
|
||||
/// delegate.
|
||||
///
|
||||
USDIMAGINGGL_API
|
||||
VtDictionary GetRenderStats() const;
|
||||
|
||||
/// @}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/// \name HGI
|
||||
/// @{
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
/// Returns the HGI interface.
|
||||
///
|
||||
USDIMAGINGGL_API
|
||||
Hgi* GetHgi();
|
||||
|
||||
/// @}
|
||||
|
||||
protected:
|
||||
|
||||
/// Open some protected methods for whitebox testing.
|
||||
friend class UsdImagingGL_UnitTestGLDrawing;
|
||||
|
||||
/// Returns the render index of the engine, if any. This is only used for
|
||||
/// whitebox testing.
|
||||
USDIMAGINGGL_API
|
||||
HdRenderIndex *_GetRenderIndex() const;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
void _Execute(const UsdImagingGLRenderParams ¶ms,
|
||||
HdTaskSharedPtrVector tasks);
|
||||
|
||||
USDIMAGINGGL_API
|
||||
bool _CanPrepare(const UsdPrim& root);
|
||||
USDIMAGINGGL_API
|
||||
void _PreSetTime(const UsdImagingGLRenderParams& params);
|
||||
USDIMAGINGGL_API
|
||||
void _PostSetTime(const UsdImagingGLRenderParams& params);
|
||||
|
||||
USDIMAGINGGL_API
|
||||
void _PrepareRender(const UsdImagingGLRenderParams& params);
|
||||
|
||||
// Create a hydra collection given root paths and render params.
|
||||
// Returns true if the collection was updated.
|
||||
USDIMAGINGGL_API
|
||||
static bool _UpdateHydraCollection(HdRprimCollection *collection,
|
||||
SdfPathVector const& roots,
|
||||
UsdImagingGLRenderParams const& params);
|
||||
USDIMAGINGGL_API
|
||||
static HdxRenderTaskParams _MakeHydraUsdImagingGLRenderParams(
|
||||
UsdImagingGLRenderParams const& params);
|
||||
USDIMAGINGGL_API
|
||||
static void _ComputeRenderTags(UsdImagingGLRenderParams const& params,
|
||||
TfTokenVector *renderTags);
|
||||
|
||||
USDIMAGINGGL_API
|
||||
void _InitializeHgiIfNecessary();
|
||||
|
||||
USDIMAGINGGL_API
|
||||
void _SetRenderDelegateAndRestoreState(
|
||||
HdPluginRenderDelegateUniqueHandle &&);
|
||||
|
||||
USDIMAGINGGL_API
|
||||
void _SetRenderDelegate(HdPluginRenderDelegateUniqueHandle &&);
|
||||
|
||||
USDIMAGINGGL_API
|
||||
SdfPath _ComputeControllerPath(const HdPluginRenderDelegateUniqueHandle &);
|
||||
|
||||
USDIMAGINGGL_API
|
||||
static TfToken _GetDefaultRendererPluginId();
|
||||
|
||||
USDIMAGINGGL_API
|
||||
UsdImagingDelegate *_GetSceneDelegate() const;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
HdEngine *_GetHdEngine();
|
||||
|
||||
USDIMAGINGGL_API
|
||||
HdxTaskController *_GetTaskController() const;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
bool _IsUsingLegacyImpl() const;
|
||||
|
||||
USDIMAGINGGL_API
|
||||
HdSelectionSharedPtr _GetSelection() const;
|
||||
|
||||
protected:
|
||||
|
||||
// private:
|
||||
// Note that any of the fields below might become private
|
||||
// in the future and subclasses should use the above getters
|
||||
// to access them instead.
|
||||
|
||||
HgiUniquePtr _hgi;
|
||||
// Similar for HdDriver.
|
||||
HdDriver _hgiDriver;
|
||||
|
||||
VtValue _userFramebuffer;
|
||||
|
||||
protected:
|
||||
HdPluginRenderDelegateUniqueHandle _renderDelegate;
|
||||
std::unique_ptr<HdRenderIndex> _renderIndex;
|
||||
|
||||
SdfPath const _sceneDelegateId;
|
||||
|
||||
std::unique_ptr<HdxTaskController> _taskController;
|
||||
|
||||
HdxSelectionTrackerSharedPtr _selTracker;
|
||||
HdRprimCollection _renderCollection;
|
||||
HdRprimCollection _intersectCollection;
|
||||
|
||||
GlfSimpleLightingContextRefPtr _lightingContextForOpenGLState;
|
||||
|
||||
// Data we want to live across render plugin switches:
|
||||
GfVec4f _selectionColor;
|
||||
|
||||
SdfPath _rootPath;
|
||||
SdfPathVector _excludedPrimPaths;
|
||||
SdfPathVector _invisedPrimPaths;
|
||||
bool _isPopulated;
|
||||
|
||||
// An implementation of much of the engine functionality that doesn't
|
||||
// invoke any of the advanced Hydra features. It is kept around for
|
||||
// backwards compatibility and may one day be deprecated. Most of the
|
||||
// time we expect this to be null. When it is not null, none of the other
|
||||
// member variables of this class are used.
|
||||
std::unique_ptr<UsdImagingGLLegacyEngine> _legacyImpl;
|
||||
|
||||
private:
|
||||
void _DestroyHydraObjects();
|
||||
|
||||
std::unique_ptr<UsdImagingDelegate> _sceneDelegate;
|
||||
std::unique_ptr<HdEngine> _engine;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_GL_ENGINE_H
|
||||
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USD_IMAGING_GL_PACKAGE_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_GL_PACKAGE_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImagingGL/api.h"
|
||||
#include "pxr/usdImaging/usdImagingGL/version.h"
|
||||
#include "pxr/base/tf/token.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
USDIMAGINGGL_API
|
||||
TfToken UsdImagingGLPackageDrawModeShader();
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_GL_PACKAGE_H
|
||||
@@ -0,0 +1,176 @@
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
/// \file usdImagingGL/renderParams.h
|
||||
|
||||
#ifndef PXR_USD_IMAGING_USD_IMAGING_GL_RENDER_PARAMS_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_GL_RENDER_PARAMS_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImagingGL/api.h"
|
||||
|
||||
#include "pxr/usd/usd/timeCode.h"
|
||||
|
||||
#include "pxr/base/gf/vec2i.h"
|
||||
#include "pxr/base/gf/vec4d.h"
|
||||
#include "pxr/base/gf/vec4f.h"
|
||||
#include "pxr/base/tf/token.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
enum class UsdImagingGLDrawMode
|
||||
{
|
||||
DRAW_POINTS,
|
||||
DRAW_WIREFRAME,
|
||||
DRAW_WIREFRAME_ON_SURFACE,
|
||||
DRAW_SHADED_FLAT,
|
||||
DRAW_SHADED_SMOOTH,
|
||||
DRAW_GEOM_ONLY,
|
||||
DRAW_GEOM_FLAT,
|
||||
DRAW_GEOM_SMOOTH
|
||||
};
|
||||
|
||||
// Note: some assumptions are made about the order of these enums, so please
|
||||
// be careful when updating them.
|
||||
enum class UsdImagingGLCullStyle
|
||||
{
|
||||
CULL_STYLE_NO_OPINION,
|
||||
CULL_STYLE_NOTHING,
|
||||
CULL_STYLE_BACK,
|
||||
CULL_STYLE_FRONT,
|
||||
CULL_STYLE_BACK_UNLESS_DOUBLE_SIDED,
|
||||
|
||||
CULL_STYLE_COUNT
|
||||
};
|
||||
|
||||
|
||||
/// \class UsdImagingGLRenderParams
|
||||
///
|
||||
/// Used as an arguments class for various methods in UsdImagingGLEngine.
|
||||
///
|
||||
class UsdImagingGLRenderParams
|
||||
{
|
||||
public:
|
||||
|
||||
typedef std::vector<GfVec4d> ClipPlanesVector;
|
||||
|
||||
UsdTimeCode frame;
|
||||
float complexity;
|
||||
UsdImagingGLDrawMode drawMode;
|
||||
bool showGuides;
|
||||
bool showProxy;
|
||||
bool showRender;
|
||||
bool forceRefresh;
|
||||
bool flipFrontFacing;
|
||||
UsdImagingGLCullStyle cullStyle;
|
||||
bool enableIdRender;
|
||||
bool enableLighting;
|
||||
bool enableSampleAlphaToCoverage;
|
||||
bool applyRenderState;
|
||||
bool gammaCorrectColors;
|
||||
bool highlight;
|
||||
GfVec4f overrideColor;
|
||||
GfVec4f wireframeColor;
|
||||
float alphaThreshold; // threshold < 0 implies automatic
|
||||
ClipPlanesVector clipPlanes;
|
||||
bool enableSceneMaterials;
|
||||
bool enableSceneLights;
|
||||
// Respect USD's model:drawMode attribute...
|
||||
bool enableUsdDrawModes;
|
||||
GfVec4f clearColor;
|
||||
TfToken colorCorrectionMode;
|
||||
int lut3dSizeOCIO;
|
||||
|
||||
inline UsdImagingGLRenderParams();
|
||||
|
||||
inline bool operator==(const UsdImagingGLRenderParams &other) const;
|
||||
|
||||
inline bool operator!=(const UsdImagingGLRenderParams &other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
UsdImagingGLRenderParams::UsdImagingGLRenderParams() :
|
||||
frame(UsdTimeCode::EarliestTime()),
|
||||
complexity(1.0),
|
||||
drawMode(UsdImagingGLDrawMode::DRAW_SHADED_SMOOTH),
|
||||
showGuides(false),
|
||||
showProxy(true),
|
||||
showRender(false),
|
||||
forceRefresh(false),
|
||||
flipFrontFacing(false),
|
||||
cullStyle(UsdImagingGLCullStyle::CULL_STYLE_NOTHING),
|
||||
enableIdRender(false),
|
||||
enableLighting(true),
|
||||
enableSampleAlphaToCoverage(false),
|
||||
applyRenderState(true),
|
||||
gammaCorrectColors(true),
|
||||
highlight(false),
|
||||
overrideColor(.0f, .0f, .0f, .0f),
|
||||
wireframeColor(.0f, .0f, .0f, .0f),
|
||||
alphaThreshold(-1),
|
||||
clipPlanes(),
|
||||
enableSceneMaterials(true),
|
||||
enableSceneLights(true),
|
||||
enableUsdDrawModes(true),
|
||||
clearColor(0,0,0,1),
|
||||
lut3dSizeOCIO(65)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
UsdImagingGLRenderParams::operator==(const UsdImagingGLRenderParams &other)
|
||||
const
|
||||
{
|
||||
return frame == other.frame
|
||||
&& complexity == other.complexity
|
||||
&& drawMode == other.drawMode
|
||||
&& showGuides == other.showGuides
|
||||
&& showProxy == other.showProxy
|
||||
&& showRender == other.showRender
|
||||
&& forceRefresh == other.forceRefresh
|
||||
&& flipFrontFacing == other.flipFrontFacing
|
||||
&& cullStyle == other.cullStyle
|
||||
&& enableIdRender == other.enableIdRender
|
||||
&& enableLighting == other.enableLighting
|
||||
&& enableSampleAlphaToCoverage == other.enableSampleAlphaToCoverage
|
||||
&& applyRenderState == other.applyRenderState
|
||||
&& gammaCorrectColors == other.gammaCorrectColors
|
||||
&& highlight == other.highlight
|
||||
&& overrideColor == other.overrideColor
|
||||
&& wireframeColor == other.wireframeColor
|
||||
&& alphaThreshold == other.alphaThreshold
|
||||
&& clipPlanes == other.clipPlanes
|
||||
&& enableSceneMaterials == other.enableSceneMaterials
|
||||
&& enableSceneLights == other.enableSceneLights
|
||||
&& enableUsdDrawModes == other.enableUsdDrawModes
|
||||
&& clearColor == other.clearColor
|
||||
&& colorCorrectionMode == other.colorCorrectionMode
|
||||
&& lut3dSizeOCIO == other.lut3dSizeOCIO;
|
||||
}
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_GL_RENDER_PARAMS_H
|
||||
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
/// \file usdImagingGL/renderSettings.h
|
||||
|
||||
#ifndef PXR_USD_IMAGING_USD_IMAGING_GL_RENDERER_SETTINGS_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_GL_RENDERER_SETTINGS_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/base/tf/token.h"
|
||||
#include "pxr/base/vt/value.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
struct UsdImagingGLRendererSetting {
|
||||
enum Type {
|
||||
TYPE_FLAG,
|
||||
TYPE_INT,
|
||||
TYPE_FLOAT,
|
||||
TYPE_STRING
|
||||
};
|
||||
std::string name;
|
||||
TfToken key;
|
||||
Type type;
|
||||
VtValue defValue;
|
||||
};
|
||||
|
||||
typedef std::vector<UsdImagingGLRendererSetting>
|
||||
UsdImagingGLRendererSettingsList;
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_GL_RENDERER_SETTINGS_H
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USD_IMAGING_GL_VERSION_H
|
||||
#define PXR_USD_IMAGING_USD_IMAGING_GL_VERSION_H
|
||||
|
||||
// 0 -> 1: added IDRenderColor decode and direct Rprim path fetching.
|
||||
// 1 -> 2: added RenderParams::enableUsdDrawModes
|
||||
// 2 -> 3: refactor picking API.
|
||||
// 3 -> 4: Add "instancerContext" to new picking API.
|
||||
// 4 -> 5: Use UsdImagingGLEngine::_GetSceneDelegate() instead of _delegate.
|
||||
// 5 -> 6: Use UsdImagingGLEngine::_GetHdEngine() instead of _engine.
|
||||
// 6 -> 7: Added UsdImagingGLEngine::_GetTaskController() and _IsUsingLegacyImpl()
|
||||
// 7 -> 8: Added outHitNormal parameter to UsdImagingGLEngine::TestIntersection()
|
||||
#define USDIMAGINGGL_API_VERSION 8
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_IMAGING_GL_VERSION_H
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USD_RI_IMAGING_API_H
|
||||
#define PXR_USD_IMAGING_USD_RI_IMAGING_API_H
|
||||
|
||||
#include "pxr/base/arch/export.h"
|
||||
|
||||
#if defined(PXR_STATIC)
|
||||
# define USDRIIMAGING_API
|
||||
# define USDRIIMAGING_API_TEMPLATE_CLASS(...)
|
||||
# define USDRIIMAGING_API_TEMPLATE_STRUCT(...)
|
||||
# define USDRIIMAGING_LOCAL
|
||||
#else
|
||||
# if defined(USDRIIMAGING_EXPORTS)
|
||||
# define USDRIIMAGING_API ARCH_EXPORT
|
||||
# define USDRIIMAGING_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
# define USDRIIMAGING_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
# else
|
||||
# define USDRIIMAGING_API ARCH_IMPORT
|
||||
# define USDRIIMAGING_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
# define USDRIIMAGING_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
# endif
|
||||
# define USDRIIMAGING_LOCAL ARCH_HIDDEN
|
||||
#endif
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_RI_IMAGING_API_H
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USD_RI_IMAGING_PXR_BARN_LIGHT_FILTER_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_RI_IMAGING_PXR_BARN_LIGHT_FILTER_ADAPTER_H
|
||||
|
||||
/// \file usdRiImaging/pxrBarnLightFilterAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdRiImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/lightFilterAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdRiImagingPxrBarnLightFilterAdapter
|
||||
///
|
||||
/// Adapter class for lights of type PxrBarnLightFilter
|
||||
///
|
||||
class UsdRiImagingPxrBarnLightFilterAdapter : public UsdImagingLightFilterAdapter {
|
||||
public:
|
||||
typedef UsdImagingLightFilterAdapter BaseAdapter;
|
||||
|
||||
UsdRiImagingPxrBarnLightFilterAdapter()
|
||||
: UsdImagingLightFilterAdapter()
|
||||
{}
|
||||
|
||||
USDRIIMAGING_API
|
||||
virtual ~UsdRiImagingPxrBarnLightFilterAdapter();
|
||||
|
||||
USDRIIMAGING_API
|
||||
virtual SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL);
|
||||
|
||||
USDRIIMAGING_API
|
||||
virtual bool IsSupported(UsdImagingIndexProxy const* index) const;
|
||||
|
||||
protected:
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) final;
|
||||
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_RI_IMAGING_PXR_BARN_LIGHT_FILTER_ADAPTER_H
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USD_RI_IMAGING_PXR_INTMULT_LIGHT_FILTER_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_RI_IMAGING_PXR_INTMULT_LIGHT_FILTER_ADAPTER_H
|
||||
|
||||
/// \file usdRiImaging/pxrIntMultLightFilterAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdRiImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/lightFilterAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdRiImagingPxrIntMultLightFilterAdapter
|
||||
///
|
||||
/// Adapter class for lights of type PxrIntMultLightFilter
|
||||
///
|
||||
class UsdRiImagingPxrIntMultLightFilterAdapter : public UsdImagingLightFilterAdapter {
|
||||
public:
|
||||
typedef UsdImagingLightFilterAdapter BaseAdapter;
|
||||
|
||||
UsdRiImagingPxrIntMultLightFilterAdapter()
|
||||
: UsdImagingLightFilterAdapter()
|
||||
{}
|
||||
|
||||
USDRIIMAGING_API
|
||||
virtual ~UsdRiImagingPxrIntMultLightFilterAdapter();
|
||||
|
||||
USDRIIMAGING_API
|
||||
virtual SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL);
|
||||
|
||||
USDRIIMAGING_API
|
||||
virtual bool IsSupported(UsdImagingIndexProxy const* index) const;
|
||||
|
||||
protected:
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) final;
|
||||
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_RI_IMAGING_PXR_INTMULT_LIGHT_FILTER_ADAPTER_H
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USD_RI_IMAGING_PXR_ROD_LIGHT_FILTER_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_RI_IMAGING_PXR_ROD_LIGHT_FILTER_ADAPTER_H
|
||||
|
||||
/// \file usdRiImaging/pxrRodLightFilterAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdRiImaging/api.h"
|
||||
#include "pxr/usdImaging/usdImaging/lightFilterAdapter.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdRiImagingPxrRodLightFilterAdapter
|
||||
///
|
||||
/// Adapter class for lights of type PxrRodLightFilter
|
||||
///
|
||||
class UsdRiImagingPxrRodLightFilterAdapter : public UsdImagingLightFilterAdapter {
|
||||
public:
|
||||
typedef UsdImagingLightFilterAdapter BaseAdapter;
|
||||
|
||||
UsdRiImagingPxrRodLightFilterAdapter()
|
||||
: UsdImagingLightFilterAdapter()
|
||||
{}
|
||||
|
||||
USDRIIMAGING_API
|
||||
virtual ~UsdRiImagingPxrRodLightFilterAdapter();
|
||||
|
||||
USDRIIMAGING_API
|
||||
virtual SdfPath Populate(UsdPrim const& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
UsdImagingInstancerContext const* instancerContext = NULL);
|
||||
|
||||
USDRIIMAGING_API
|
||||
virtual bool IsSupported(UsdImagingIndexProxy const* index) const;
|
||||
|
||||
protected:
|
||||
virtual void _RemovePrim(SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) final;
|
||||
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_RI_IMAGING_PXR_ROD_LIGHT_FILTER_ADAPTER_H
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_RI_IMAGING_TOKENS_H
|
||||
#define PXR_USD_IMAGING_USD_RI_IMAGING_TOKENS_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdRiImaging/api.h"
|
||||
#include "pxr/base/tf/staticTokens.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
#define USDRIIMAGING_TOKENS \
|
||||
((infoSource, "info:source")) \
|
||||
(faceIndexPrimvar) \
|
||||
(faceOffsetPrimvar) \
|
||||
((primvarsNormals, "primvars:normals")) \
|
||||
((primvarsWidths, "primvars:widths")) \
|
||||
(ptexFaceIndex) \
|
||||
(ptexFaceOffset) \
|
||||
(usdPopulatedPrimCount) \
|
||||
(usdVaryingExtent) \
|
||||
(usdVaryingPrimvar) \
|
||||
(usdVaryingTopology) \
|
||||
(usdVaryingVisibility) \
|
||||
(usdVaryingWidths) \
|
||||
(usdVaryingNormals) \
|
||||
(usdVaryingXform) \
|
||||
(usdVaryingTexture) \
|
||||
(uvPrimvar) \
|
||||
(UsdPreviewSurface) \
|
||||
(UsdUVTexture) \
|
||||
(UsdPrimvarReader_float)\
|
||||
(UsdPrimvarReader_float2)\
|
||||
(UsdPrimvarReader_float3)\
|
||||
(UsdPrimvarReader_float4)\
|
||||
(UsdPrimvarReader_int) \
|
||||
(UsdTransform2d) \
|
||||
(pxrBarnLightFilter) \
|
||||
(pxrIntMultLightFilter) \
|
||||
(pxrRodLightFilter)
|
||||
|
||||
TF_DECLARE_PUBLIC_TOKENS(UsdRiImagingTokens, USDRIIMAGING_API, USDRIIMAGING_TOKENS);
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif //PXR_USD_IMAGING_USD_RI_IMAGING_TOKENS_H
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USD_RI_IMAGING_VERSION_H
|
||||
#define PXR_USD_IMAGING_USD_RI_IMAGING_VERSION_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
// Version 1 -- clone off PXR_USD_IMAGING_USD_RI_IMAGING_VERSION_H and add light filter support
|
||||
|
||||
#define USD_RI_IMAGING_API_VERSION 1
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_RI_IMAGING_VERSION_H
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// 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 PXR_USD_IMAGING_USD_SKEL_IMAGING_API_H
|
||||
#define PXR_USD_IMAGING_USD_SKEL_IMAGING_API_H
|
||||
|
||||
#include "pxr/base/arch/export.h"
|
||||
|
||||
#if defined(PXR_STATIC)
|
||||
# define USDSKELIMAGING_API
|
||||
# define USDSKELIMAGING_API_TEMPLATE_CLASS(...)
|
||||
# define USDSKELIMAGING_API_TEMPLATE_STRUCT(...)
|
||||
# define USDSKELIMAGING_LOCAL
|
||||
#else
|
||||
# if defined(USDSKELIMAGING_EXPORTS)
|
||||
# define USDSKELIMAGING_API ARCH_EXPORT
|
||||
# define USDSKELIMAGING_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
# define USDSKELIMAGING_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
# else
|
||||
# define USDSKELIMAGING_API ARCH_IMPORT
|
||||
# define USDSKELIMAGING_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
# define USDSKELIMAGING_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
# endif
|
||||
# define USDSKELIMAGING_LOCAL ARCH_HIDDEN
|
||||
#endif
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_SKEL_IMAGING_API_H
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// Copyright 2019 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 PXR_USD_IMAGING_USD_SKEL_IMAGING_PACKAGE_H
|
||||
#define PXR_USD_IMAGING_USD_SKEL_IMAGING_PACKAGE_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdSkelImaging/api.h"
|
||||
#include "pxr/base/tf/token.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
USDSKELIMAGING_API
|
||||
TfToken UsdSkelImagingPackageSkinningShader();
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_SKEL_IMAGING_PACKAGE_H
|
||||
@@ -0,0 +1,115 @@
|
||||
//
|
||||
// Copyright 2019 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 PXR_USD_IMAGING_USD_SKEL_IMAGING_SKEL_ROOT_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_SKEL_IMAGING_SKEL_ROOT_ADAPTER_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
#include "pxr/usdImaging/usdSkelImaging/api.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
/// \class UsdImagingSkelRootAdapter
|
||||
///
|
||||
/// The SkelRoot adapter exists for two reasons:
|
||||
/// (a) Registering the SkeletonAdapter to handle processing of any skinned
|
||||
/// prim under a SkelRoot prim.
|
||||
/// The UsdSkel schema requires that ANY skinned prim lives under a
|
||||
/// SkelRoot.
|
||||
/// (b) Getting the skeleton that deforms each skinned prim, which is stored
|
||||
/// in the SkeletonAdapter (the latter is stateful).
|
||||
/// Both of these happen during Populate(..)
|
||||
///
|
||||
class UsdSkelImagingSkelRootAdapter : public UsdImagingPrimAdapter {
|
||||
public:
|
||||
using BaseAdapter = UsdImagingPrimAdapter;
|
||||
|
||||
UsdSkelImagingSkelRootAdapter()
|
||||
: BaseAdapter()
|
||||
{}
|
||||
|
||||
USDSKELIMAGING_API
|
||||
virtual ~UsdSkelImagingSkelRootAdapter();
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Initialization
|
||||
// ---------------------------------------------------------------------- //
|
||||
USDSKELIMAGING_API
|
||||
SdfPath
|
||||
Populate(const UsdPrim& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
const UsdImagingInstancerContext*
|
||||
instancerContext=nullptr) override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
bool CanPopulateUsdInstance() const override { return true; }
|
||||
|
||||
bool ShouldIgnoreNativeInstanceSubtrees() const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDSKELIMAGING_API
|
||||
void TrackVariability(const UsdPrim& prim,
|
||||
const SdfPath& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
const UsdImagingInstancerContext*
|
||||
instancerContext = nullptr) const override;
|
||||
|
||||
/// Thread Safe.
|
||||
USDSKELIMAGING_API
|
||||
void UpdateForTime(const UsdPrim& prim,
|
||||
const SdfPath& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
const UsdImagingInstancerContext*
|
||||
instancerContext=nullptr) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDSKELIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(const UsdPrim& prim,
|
||||
const SdfPath& cachePath,
|
||||
const TfToken& propertyName) override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
void MarkDirty(const UsdPrim& prim,
|
||||
const SdfPath& cachePath,
|
||||
HdDirtyBits dirty,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
protected:
|
||||
USDSKELIMAGING_API
|
||||
void _RemovePrim(const SdfPath& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_SKEL_IMAGING_SKEL_ROOT_ADAPTER_H
|
||||
@@ -0,0 +1,473 @@
|
||||
//
|
||||
// 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 PXR_USD_IMAGING_USD_SKEL_IMAGING_SKELETON_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_SKEL_IMAGING_SKELETON_ADAPTER_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/primAdapter.h"
|
||||
#include "pxr/usdImaging/usdSkelImaging/api.h"
|
||||
|
||||
#include "pxr/imaging/hd/meshTopology.h"
|
||||
|
||||
#include "pxr/usd/usdSkel/binding.h"
|
||||
#include "pxr/usd/usdSkel/blendShapeQuery.h"
|
||||
#include "pxr/usd/usdSkel/cache.h"
|
||||
#include "pxr/usd/usdSkel/skeleton.h"
|
||||
#include "pxr/usd/usdSkel/skeletonQuery.h"
|
||||
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
/// \class UsdImagingSkeletonAdapter
|
||||
///
|
||||
/// Support for drawing bones of a UsdSkelSkeleton.
|
||||
///
|
||||
class UsdSkelImagingSkeletonAdapter : public UsdImagingPrimAdapter
|
||||
{
|
||||
public:
|
||||
using BaseAdapter = UsdImagingPrimAdapter;
|
||||
|
||||
UsdSkelImagingSkeletonAdapter()
|
||||
: BaseAdapter()
|
||||
{}
|
||||
|
||||
USDSKELIMAGING_API
|
||||
virtual ~UsdSkelImagingSkeletonAdapter();
|
||||
|
||||
USDSKELIMAGING_API
|
||||
SdfPath
|
||||
Populate(const UsdPrim& prim,
|
||||
UsdImagingIndexProxy* index,
|
||||
const UsdImagingInstancerContext*
|
||||
instancerContext=nullptr) override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
bool IsSupported(const UsdImagingIndexProxy* index) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Parallel Setup and Resolve
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
/// Thread Safe.
|
||||
USDSKELIMAGING_API
|
||||
void TrackVariability(const UsdPrim& prim,
|
||||
const SdfPath& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
const UsdImagingInstancerContext*
|
||||
instancerContext = nullptr) const override;
|
||||
|
||||
/// Thread Safe.
|
||||
USDSKELIMAGING_API
|
||||
void UpdateForTime(const UsdPrim& prim,
|
||||
const SdfPath& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
const UsdImagingInstancerContext*
|
||||
instancerContext=nullptr) const override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing API (public)
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDSKELIMAGING_API
|
||||
HdDirtyBits ProcessPropertyChange(const UsdPrim& prim,
|
||||
const SdfPath& cachePath,
|
||||
const TfToken& propertyName) override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
void ProcessPrimResync(SdfPath const& primPath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
void ProcessPrimRemoval(SdfPath const& primPath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
void MarkDirty(const UsdPrim& prim,
|
||||
const SdfPath& cachePath,
|
||||
HdDirtyBits dirty,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
void MarkRefineLevelDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
void MarkReprDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
void MarkCullStyleDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
void MarkRenderTagDirty(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
void MarkTransformDirty(const UsdPrim& prim,
|
||||
const SdfPath& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
void MarkVisibilityDirty(const UsdPrim& prim,
|
||||
const SdfPath& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
void MarkMaterialDirty(const UsdPrim& prim,
|
||||
const SdfPath& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Computation API
|
||||
// ---------------------------------------------------------------------- //
|
||||
USDSKELIMAGING_API
|
||||
void InvokeComputation(SdfPath const& cachePath,
|
||||
HdExtComputationContext* context) override;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Non-virtual public API
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDSKELIMAGING_API
|
||||
void RegisterSkelBinding(UsdSkelBinding const& binding);
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Virtual public API
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
USDSKELIMAGING_API
|
||||
PxOsdSubdivTags GetSubdivTags(UsdPrim const& usdPrim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
VtValue GetTopology(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
GfRange3d GetExtent(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
TfToken GetPurpose(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& instanceInheritablePurpose)
|
||||
const override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
bool GetDoubleSided(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
|
||||
USDSKELIMAGING_API
|
||||
SdfPath GetMaterialId(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
UsdTimeCode time) const override;
|
||||
|
||||
|
||||
USDSKELIMAGING_API
|
||||
const TfTokenVector &GetExtComputationSceneInputNames(
|
||||
SdfPath const& cachePath) const override;
|
||||
|
||||
USDSKELIMAGING_API
|
||||
HdExtComputationInputDescriptorVector
|
||||
GetExtComputationInputs(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
const UsdImagingInstancerContext *instancerContext)
|
||||
const override;
|
||||
|
||||
HdExtComputationOutputDescriptorVector
|
||||
GetExtComputationOutputs(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
const UsdImagingInstancerContext* instancerContext)
|
||||
const override;
|
||||
|
||||
HdExtComputationPrimvarDescriptorVector
|
||||
GetExtComputationPrimvars(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
HdInterpolation interpolation,
|
||||
const UsdImagingInstancerContext* instancerContext) const override;
|
||||
|
||||
USDIMAGING_API
|
||||
VtValue
|
||||
GetExtComputationInput(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& name,
|
||||
UsdTimeCode time,
|
||||
const UsdImagingInstancerContext* instancerContext) const override;
|
||||
|
||||
USDIMAGING_API
|
||||
size_t
|
||||
SampleExtComputationInput(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& name,
|
||||
UsdTimeCode time,
|
||||
const UsdImagingInstancerContext* instancerContext,
|
||||
size_t maxSampleCount,
|
||||
float *sampleTimes,
|
||||
VtValue *sampleValues) override;
|
||||
|
||||
USDIMAGING_API
|
||||
std::string
|
||||
GetExtComputationKernel(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
const UsdImagingInstancerContext* instancerContext) const override;
|
||||
|
||||
|
||||
USDSKELIMAGING_API
|
||||
VtValue Get(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
VtIntArray *outIndices) const override;
|
||||
|
||||
protected:
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// \name Change Processing API (protected)
|
||||
// ---------------------------------------------------------------------- //
|
||||
void _RemovePrim(const SdfPath& cachePath,
|
||||
UsdImagingIndexProxy* index) override;
|
||||
|
||||
private:
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// Handlers for the Bone Mesh
|
||||
// ---------------------------------------------------------------------- //
|
||||
bool _IsCallbackForSkeleton(const UsdPrim& prim) const;
|
||||
|
||||
/// Returns a value holding color for \p prim,
|
||||
/// taking into account explicitly authored color on the prim.
|
||||
GfVec3f _GetSkeletonDisplayColor(const UsdPrim& prim,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
/// Returns a value holding opacity for \p prim,
|
||||
/// taking into account explicitly authored opacity on the prim.
|
||||
float _GetSkeletonDisplayOpacity(const UsdPrim& prim,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
void _TrackBoneMeshVariability(
|
||||
const UsdPrim& prim,
|
||||
const SdfPath& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
const UsdImagingInstancerContext*
|
||||
instancerContext = nullptr) const;
|
||||
|
||||
void _UpdateBoneMeshForTime(
|
||||
const UsdPrim& prim,
|
||||
const SdfPath& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
const UsdImagingInstancerContext* instancerContext=nullptr) const;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// Common utitily methods for skinning computations & skinned prims
|
||||
// ---------------------------------------------------------------------- //
|
||||
bool _IsAffectedByTimeVaryingSkelAnim(const SdfPath& skinnedPrimPath)
|
||||
const;
|
||||
|
||||
void _RemoveSkinnedPrimAndComputations(const SdfPath& cachePath,
|
||||
UsdImagingIndexProxy* index);
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// Handlers for the skinning computations
|
||||
// ---------------------------------------------------------------------- //
|
||||
bool _IsSkinningComputationPath(const SdfPath& cachePath) const;
|
||||
|
||||
bool
|
||||
_IsSkinningInputAggregatorComputationPath(const SdfPath& cachePath)const;
|
||||
|
||||
void _TrackSkinningComputationVariability(
|
||||
const UsdPrim& skinnedPrim,
|
||||
const SdfPath& computationPath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
const UsdImagingInstancerContext*
|
||||
instancerContext = nullptr) const;
|
||||
|
||||
VtVec3fArray _GetSkinnedPrimPoints(const UsdPrim& skinnedPrim,
|
||||
const SdfPath& skinnedPrimCachePath,
|
||||
UsdTimeCode time) const;
|
||||
|
||||
SdfPath _GetSkinningComputationPath(const SdfPath& skinnedPrimPath) const;
|
||||
|
||||
SdfPath _GetSkinningInputAggregatorComputationPath(
|
||||
const SdfPath& skinnedPrimPath) const;
|
||||
|
||||
// Static helper methods
|
||||
static
|
||||
std::string _LoadSkinningComputeKernel();
|
||||
|
||||
static
|
||||
const std::string& _GetSkinningComputeKernel();
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// Handlers for the skinned prim
|
||||
// ---------------------------------------------------------------------- //
|
||||
bool _IsSkinnedPrimPath(const SdfPath& cachePath) const;
|
||||
|
||||
void _TrackSkinnedPrimVariability(
|
||||
const UsdPrim& prim,
|
||||
const SdfPath& cachePath,
|
||||
HdDirtyBits* timeVaryingBits,
|
||||
const UsdImagingInstancerContext*
|
||||
instancerContext = nullptr) const;
|
||||
|
||||
void _UpdateSkinnedPrimForTime(
|
||||
const UsdPrim& prim,
|
||||
const SdfPath& cachePath,
|
||||
UsdTimeCode time,
|
||||
HdDirtyBits requestedBits,
|
||||
const UsdImagingInstancerContext* instancerContext=nullptr) const;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// GetExtComputationInput() helpers
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
VtValue
|
||||
_GetExtComputationInputForSkinningComputation(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& name,
|
||||
UsdTimeCode time,
|
||||
const UsdImagingInstancerContext* instancerContext) const;
|
||||
|
||||
VtValue
|
||||
_GetExtComputationInputForInputAggregator(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& name,
|
||||
UsdTimeCode time,
|
||||
const UsdImagingInstancerContext* instancerContext) const;
|
||||
|
||||
size_t
|
||||
_SampleExtComputationInputForSkinningComputation(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& name,
|
||||
UsdTimeCode time,
|
||||
const UsdImagingInstancerContext* instancerContext,
|
||||
size_t maxSampleCount,
|
||||
float *sampleTimes,
|
||||
VtValue *sampleValues);
|
||||
|
||||
size_t
|
||||
_SampleExtComputationInputForInputAggregator(
|
||||
UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& name,
|
||||
UsdTimeCode time,
|
||||
const UsdImagingInstancerContext* instancerContext,
|
||||
size_t maxSampleCount,
|
||||
float *sampleTimes,
|
||||
VtValue *sampleValues);
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// Populated skeleton state
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// Data for a skel instance.
|
||||
struct _SkelData {
|
||||
|
||||
UsdSkelSkeletonQuery skelQuery;
|
||||
SdfPathSet skelRootPaths;
|
||||
|
||||
/// Compute bone mesh topology, and intiailize
|
||||
/// other rest-state data for imaging bones.
|
||||
HdMeshTopology ComputeTopologyAndRestState();
|
||||
|
||||
/// Compute animated bone mesh points.
|
||||
VtVec3fArray ComputePoints(UsdTimeCode time) const;
|
||||
|
||||
TfToken ComputePurpose() const;
|
||||
|
||||
private:
|
||||
// Cache of a mesh for a skeleton (at rest)
|
||||
// TODO: Dedupe this infromation across UsdSkelSkeleton instances.
|
||||
VtVec3fArray _boneMeshPoints;
|
||||
VtIntArray _boneMeshJointIndices;
|
||||
size_t _numJoints;
|
||||
};
|
||||
|
||||
_SkelData* _GetSkelData(const SdfPath& cachePath) const;
|
||||
|
||||
UsdSkelCache _skelCache;
|
||||
using _SkelDataMap =
|
||||
std::unordered_map<SdfPath, std::shared_ptr<_SkelData>, SdfPath::Hash>;
|
||||
_SkelDataMap _skelDataCache;
|
||||
|
||||
// Data for each skinned prim.
|
||||
struct _SkinnedPrimData {
|
||||
_SkinnedPrimData() = default;
|
||||
|
||||
/// Construct skinned prim, referencing the skeleton at \p skelPath.
|
||||
/// XXX: We cannot extract the skel path from the skelQuery because
|
||||
/// the skelQuery might refer to a prim within an instance master.
|
||||
_SkinnedPrimData(const SdfPath& skelPath,
|
||||
const UsdSkelSkeletonQuery& skelQuery,
|
||||
const UsdSkelSkinningQuery& skinningQuery,
|
||||
const SdfPath& skelRootPath);
|
||||
|
||||
std::shared_ptr<UsdSkelBlendShapeQuery> blendShapeQuery;
|
||||
UsdSkelSkinningQuery skinningQuery;
|
||||
UsdSkelAnimQuery animQuery;
|
||||
SdfPath skelPath, skelRootPath;
|
||||
bool hasJointInfluences = false;
|
||||
};
|
||||
|
||||
const _SkinnedPrimData* _GetSkinnedPrimData(const SdfPath& cachePath) const;
|
||||
|
||||
using _SkinnedPrimDataMap =
|
||||
std::unordered_map<SdfPath, _SkinnedPrimData, SdfPath::Hash>;
|
||||
_SkinnedPrimDataMap _skinnedPrimDataCache;
|
||||
|
||||
// ---------------------------------------------------------------------- //
|
||||
/// Skeleton -> Skinned Prim(s) state
|
||||
/// (Populated via UsdSkelImagingSkelRootAdapter::Populate)
|
||||
// ---------------------------------------------------------------------- //
|
||||
|
||||
using _SkelBindingMap =
|
||||
std::unordered_map<SdfPath, UsdSkelBinding, SdfPath::Hash>;
|
||||
_SkelBindingMap _skelBindingMap;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // USDSKELIMAGING_SKELETONADAPTER
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// 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 PXR_USD_IMAGING_USD_SKEL_IMAGING_UTILS_H
|
||||
#define PXR_USD_IMAGING_USD_SKEL_IMAGING_UTILS_H
|
||||
|
||||
/// \file usdSkelImaging/utils.h
|
||||
///
|
||||
/// Collection of utility methods for imaging skels.
|
||||
///
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdSkelImaging/api.h"
|
||||
|
||||
#include "pxr/base/vt/array.h"
|
||||
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class HdMeshTopology;
|
||||
class UsdSkelTopology;
|
||||
|
||||
|
||||
/// \defgroup UsdSkelImaging_BoneUtils Bone Utilities
|
||||
/// Utilities for constructing bone meshes.
|
||||
/// @{
|
||||
|
||||
|
||||
/// Compute mesh topology for imaging \p skelTopology.
|
||||
/// The number of points that the mesh is expected to have are return in
|
||||
/// \p numPoints.
|
||||
USDSKELIMAGING_API
|
||||
bool
|
||||
UsdSkelImagingComputeBoneTopology(const UsdSkelTopology& skelTopology,
|
||||
HdMeshTopology* meshTopology,
|
||||
size_t* numPoints);
|
||||
|
||||
|
||||
/// Compute mesh points for imaging a skeleton, given the
|
||||
/// \p topology of the skeleton and \p skelXforms.
|
||||
/// The \p numPoints corresponds to the number of points computed by
|
||||
/// UsdSkelImagingComputeBoneTopology.
|
||||
USDSKELIMAGING_API
|
||||
bool
|
||||
UsdSkelImagingComputeBonePoints(const UsdSkelTopology& topology,
|
||||
const VtMatrix4dArray& jointSkelXforms,
|
||||
size_t numPoints,
|
||||
VtVec3fArray* points);
|
||||
|
||||
/// \overload
|
||||
USDSKELIMAGING_API
|
||||
bool
|
||||
UsdSkelImagingComputeBonePoints(const UsdSkelTopology& topology,
|
||||
const GfMatrix4d* jointSkelXforms,
|
||||
GfVec3f* points, size_t numPoints);
|
||||
|
||||
|
||||
/// Compute joint indices corresponding to each point in a bone mesh.
|
||||
/// This can be used to animate a bone mesh using normal skinning algos.
|
||||
/// This does not compute joint weights (they would all be 1s).
|
||||
/// The \p numPoints corresponds to the number of points computed by
|
||||
/// UsdSkelImagingComputeBoneTopology.
|
||||
USDSKELIMAGING_API
|
||||
bool
|
||||
UsdSkelImagingComputeBoneJointIndices(const UsdSkelTopology& topology,
|
||||
VtIntArray* jointIndices,
|
||||
size_t numPoints);
|
||||
|
||||
|
||||
/// \overload
|
||||
USDSKELIMAGING_API
|
||||
bool
|
||||
UsdSkelImagingComputeBoneJointIndices(const UsdSkelTopology& topology,
|
||||
int* jointIndices, size_t numPoints);
|
||||
|
||||
/// @}
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_SKEL_IMAGING_UTILS_H
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// 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 PXR_USD_IMAGING_USD_VOL_IMAGING_API_H
|
||||
#define PXR_USD_IMAGING_USD_VOL_IMAGING_API_H
|
||||
|
||||
#include "pxr/base/arch/export.h"
|
||||
|
||||
#if defined(PXR_STATIC)
|
||||
# define USDVOLIMAGING_API
|
||||
# define USDVOLIMAGING_API_TEMPLATE_CLASS(...)
|
||||
# define USDVOLIMAGING_API_TEMPLATE_STRUCT(...)
|
||||
# define USDVOLIMAGING_LOCAL
|
||||
#else
|
||||
# if defined(USDVOLIMAGING_EXPORTS)
|
||||
# define USDVOLIMAGING_API ARCH_EXPORT
|
||||
# define USDVOLIMAGING_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
# define USDVOLIMAGING_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
# else
|
||||
# define USDVOLIMAGING_API ARCH_IMPORT
|
||||
# define USDVOLIMAGING_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
# define USDVOLIMAGING_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
# endif
|
||||
# define USDVOLIMAGING_LOCAL ARCH_HIDDEN
|
||||
#endif
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_VOL_IMAGING_API_H
|
||||
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// 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 PXR_USD_IMAGING_USD_VOL_IMAGING_FIELD3D_ASSET_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_VOL_IMAGING_FIELD3D_ASSET_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/field3dAssetAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/fieldAdapter.h"
|
||||
#include "pxr/usdImaging/usdVolImaging/api.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingField3DAssetAdapter
|
||||
///
|
||||
/// Adapter class for fields of type Field3DAsset
|
||||
///
|
||||
class UsdImagingField3DAssetAdapter : public UsdImagingFieldAdapter {
|
||||
public:
|
||||
using BaseAdapter = UsdImagingFieldAdapter;
|
||||
|
||||
UsdImagingField3DAssetAdapter()
|
||||
: UsdImagingFieldAdapter()
|
||||
{}
|
||||
|
||||
USDVOLIMAGING_API
|
||||
~UsdImagingField3DAssetAdapter() override;
|
||||
|
||||
USDVOLIMAGING_API
|
||||
VtValue Get(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
VtIntArray *outIndices) const override;
|
||||
|
||||
USDVOLIMAGING_API
|
||||
TfToken GetPrimTypeToken() const override;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_VOL_IMAGING_FIELD3D_ASSET_ADAPTER_H
|
||||
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// 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 PXR_USD_IMAGING_USD_VOL_IMAGING_OPENVDB_ASSET_ADAPTER_H
|
||||
#define PXR_USD_IMAGING_USD_VOL_IMAGING_OPENVDB_ASSET_ADAPTER_H
|
||||
|
||||
/// \file usdImaging/openvdbAssetAdapter.h
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdImaging/fieldAdapter.h"
|
||||
#include "pxr/usdImaging/usdVolImaging/api.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdPrim;
|
||||
|
||||
/// \class UsdImagingOpenVDBAssetAdapter
|
||||
///
|
||||
/// Adapter class for fields of type OpenVDBAsset
|
||||
///
|
||||
class UsdImagingOpenVDBAssetAdapter : public UsdImagingFieldAdapter {
|
||||
public:
|
||||
using BaseAdapter = UsdImagingFieldAdapter;
|
||||
|
||||
UsdImagingOpenVDBAssetAdapter()
|
||||
: UsdImagingFieldAdapter()
|
||||
{}
|
||||
|
||||
USDVOLIMAGING_API
|
||||
~UsdImagingOpenVDBAssetAdapter() override;
|
||||
|
||||
USDVOLIMAGING_API
|
||||
VtValue Get(UsdPrim const& prim,
|
||||
SdfPath const& cachePath,
|
||||
TfToken const& key,
|
||||
UsdTimeCode time,
|
||||
VtIntArray *outIndices) const override;
|
||||
|
||||
USDVOLIMAGING_API
|
||||
TfToken GetPrimTypeToken() const override;
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_VOL_IMAGING_OPENVDB_ASSET_ADAPTER_H
|
||||
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// Copyright 2019 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 PXR_USD_IMAGING_USD_VOL_IMAGING_TOKENS_H
|
||||
#define PXR_USD_IMAGING_USD_VOL_IMAGING_TOKENS_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdVolImaging/api.h"
|
||||
#include "pxr/base/tf/staticTokens.h"
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
#define USDVOLIMAGING_TOKENS \
|
||||
(field3dAsset) \
|
||||
(openvdbAsset)
|
||||
|
||||
TF_DECLARE_PUBLIC_TOKENS(UsdVolImagingTokens, USDVOLIMAGING_API, USDVOLIMAGING_TOKENS);
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif // PXR_USD_IMAGING_USD_VOL_IMAGING_TOKENS_H
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// Copyright 2017 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 PXR_USD_IMAGING_USDVIEWQ_API_H
|
||||
#define PXR_USD_IMAGING_USDVIEWQ_API_H
|
||||
|
||||
#include "pxr/base/arch/export.h"
|
||||
|
||||
#if defined(PXR_STATIC)
|
||||
# define USDVIEWQ_API
|
||||
# define USDVIEWQ_API_TEMPLATE_CLASS(...)
|
||||
# define USDVIEWQ_API_TEMPLATE_STRUCT(...)
|
||||
# define USDVIEWQ_LOCAL
|
||||
#else
|
||||
# if defined(USDVIEWQ_EXPORTS)
|
||||
# define USDVIEWQ_API ARCH_EXPORT
|
||||
# define USDVIEWQ_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
# define USDVIEWQ_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
# else
|
||||
# define USDVIEWQ_API ARCH_IMPORT
|
||||
# define USDVIEWQ_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__)
|
||||
# define USDVIEWQ_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__)
|
||||
# endif
|
||||
# define USDVIEWQ_LOCAL ARCH_HIDDEN
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// Copyright 2016 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 PXR_USD_IMAGING_USDVIEWQ_UTILS_H
|
||||
#define PXR_USD_IMAGING_USDVIEWQ_UTILS_H
|
||||
|
||||
#include "pxr/pxr.h"
|
||||
#include "pxr/usdImaging/usdviewq/api.h"
|
||||
#include "pxr/usd/usd/prim.h"
|
||||
#include "pxr/usd/usd/timeCode.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
|
||||
class UsdStage;
|
||||
|
||||
/// \class UsdviewqUtils
|
||||
///
|
||||
/// Performance enhancing utilities for usdview.
|
||||
///
|
||||
class UsdviewqUtils {
|
||||
public:
|
||||
|
||||
struct PrimInfo {
|
||||
PrimInfo(const UsdPrim &prim, const UsdTimeCode time);
|
||||
|
||||
bool hasCompositionArcs;
|
||||
bool isActive;
|
||||
bool isImageable;
|
||||
bool isDefined;
|
||||
bool isAbstract;
|
||||
bool isInPrototype;
|
||||
bool isInstance;
|
||||
bool supportsDrawMode;
|
||||
bool isVisibilityInherited;
|
||||
bool visVaries;
|
||||
std::string name;
|
||||
std::string typeName;
|
||||
};
|
||||
|
||||
/// For the given \p stage and \p schemaType, return all active, defined
|
||||
/// prims that either match the schemaType exactly or are a descendant type.
|
||||
//
|
||||
// Furthermore, this method is not intended to be used publically,
|
||||
// ultimately Usd will have better core support for fast prim
|
||||
// filtering by typeName.
|
||||
USDVIEWQ_API
|
||||
static
|
||||
std::vector<UsdPrim> _GetAllPrimsOfType(UsdStagePtr const &stage,
|
||||
TfType const& schemaType);
|
||||
|
||||
/// Fetch prim-related data in batch to to speed up Qt treeview item
|
||||
/// population. Takes a time argument so that we can evaluate the prim's
|
||||
/// visibiity if it is imageable.
|
||||
USDVIEWQ_API
|
||||
static UsdviewqUtils::PrimInfo GetPrimInfo(const UsdPrim &prim,
|
||||
const UsdTimeCode time);
|
||||
};
|
||||
|
||||
|
||||
PXR_NAMESPACE_CLOSE_SCOPE
|
||||
|
||||
#endif //PXR_USD_IMAGING_USDVIEWQ_UTILS_H
|
||||
Reference in new issue
Block a user