Loading...
Searching...
No Matches
implicitSurface.h
1//
2// Copyright 2026 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HD_IMPLICITSURFACE_H
8#define PXR_IMAGING_HD_IMPLICITSURFACE_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hd/api.h"
12#include "pxr/imaging/hd/version.h"
13#include "pxr/imaging/hd/rprim.h"
14
15PXR_NAMESPACE_OPEN_SCOPE
16
17#define HD_IMPLICITSURFACE_REPR_DESC_TOKENS \
18 (surfaceShader) \
19 (surfaceShaderUnlit) \
20 (surfaceShaderSheer) \
21 (surfaceShaderOutline) \
22 (constantColor) \
23 (hullColor) \
24 (pointColor)
25
26TF_DECLARE_PUBLIC_TOKENS(HdImplicitSurfaceReprDescTokens, HD_API,
27 HD_IMPLICITSURFACE_REPR_DESC_TOKENS);
28
34{
36 HdImplicitSurfaceGeomStyle geomStyle = HdImplicitSurfaceGeomStyleInvalid,
37 HdCullStyle cullStyle = HdCullStyleDontCare,
38 TfToken shadingTerminal = HdImplicitSurfaceReprDescTokens->surfaceShader,
39 bool blendWireframeColor = true,
40 bool forceOpaqueRings = true,
41 bool doubleSided = false)
48 {}
49
50 bool IsEmpty() const {
51 return geomStyle == HdImplicitSurfaceGeomStyleInvalid;
52 }
53
55 HdImplicitSurfaceGeomStyle geomStyle;
57 HdCullStyle cullStyle;
69};
70
76{
77public:
78 HD_API
79 ~HdImplicitSurface() override;
80
84 bool IsDoubleSided(HdSceneDelegate* delegate) const {
85 return delegate->GetDoubleSided(GetId());
86 }
87
88 HdCullStyle GetCullStyle(HdSceneDelegate* delegate) const {
89 return delegate->GetCullStyle(GetId());
90 }
91
92 HdDisplayStyle GetDisplayStyle(HdSceneDelegate* delegate) const {
93 return delegate->GetDisplayStyle(GetId());
94 }
95
96 HD_API
97 TfTokenVector const & GetBuiltinPrimvarNames() const override;
98
100 HD_API
101 static void ConfigureRepr(TfToken const &reprName,
103
104protected:
105 HD_API
106 explicit HdImplicitSurface(SdfPath const& id);
107
108 using _ImplicitSurfaceReprConfig = _ReprDescConfigs<HdImplicitSurfaceReprDesc>;
109
110 HD_API
111 static _ImplicitSurfaceReprConfig::DescArray
112 _GetReprDesc(TfToken const &reprName);
113
114private:
115
116 // Class can not be default constructed, copied, or moved.
117 HdImplicitSurface() = delete;
118 HdImplicitSurface(const HdImplicitSurface &) = delete;
119 HdImplicitSurface &operator=(const HdImplicitSurface &) = delete;
121 HdImplicitSurface &operator=(HdImplicitSurface &&) = delete;
122
123 static _ImplicitSurfaceReprConfig _reprDescConfig;
124};
125
126PXR_NAMESPACE_CLOSE_SCOPE
127
128#endif // PXR_IMAGING_HD_IMPLICITSURFACE_H
Hydra Schema for a natively supported implicit surface (e.g., spheres).
HD_API TfTokenVector const & GetBuiltinPrimvarNames() const override
Returns the names of built-in primvars, i.e.
static HD_API void ConfigureRepr(TfToken const &reprName, HdImplicitSurfaceReprDesc desc)
Configure geometric style of drawItems for reprName.
bool IsDoubleSided(HdSceneDelegate *delegate) const
Render State.
The render engine state for a given rprim from the scene graph.
Definition rprim.h:38
SdfPath const & GetId() const
Returns the identifier of this Rprim.
Definition rprim.h:146
Adapter class providing data exchange with the client scene graph.
virtual HD_API HdDisplayStyle GetDisplayStyle(SdfPath const &id)
Returns the display style for the given prim.
virtual HD_API bool GetDoubleSided(SdfPath const &id)
Returns the doubleSided state for the given prim.
virtual HD_API HdCullStyle GetCullStyle(SdfPath const &id)
Returns the cullstyle for the given prim.
A path value used to locate objects in layers or scenegraphs.
Definition path.h:281
Token for efficient comparison, assignment, and hashing of known strings.
Definition token.h:81
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Describes how the geometry of a prim should be displayed.
Descriptor to configure the drawItem for a repr.
HdCullStyle cullStyle
The culling style: draw front faces, back faces, etc.
HdImplicitSurfaceGeomStyle geomStyle
The rendering style: surface, wireframe-only, wireframe-on-surface etc.
bool forceOpaqueRings
If the geom style includes wireframe lines, should those lines be forced to be fully opaque,...
bool doubleSided
Should this surface be treated as double-sided? The resolved value is (prim.doubleSided || repr....
TfToken shadingTerminal
Specifies how the fragment color should be computed from surfaceShader; this can be used to render th...
bool blendWireframeColor
Should the wireframe color be blended into the color primvar?
std::vector< TfToken > TfTokenVector
Convenience types.
Definition token.h:489