HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
smoothNormals.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_IMAGING_HD_ST_SMOOTH_NORMALS_H
25 #define PXR_IMAGING_HD_ST_SMOOTH_NORMALS_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hdSt/api.h"
30 
32 
33 #include "pxr/base/tf/token.h"
34 
36 
37 
38 class Hd_VertexAdjacency;
39 class HdSt_VertexAdjacencyBuilder;
40 
41 /// \class HdSt_SmoothNormalsComputationCPU
42 ///
43 /// Smooth normal computation CPU.
44 ///
46 {
47 public:
48  HDST_API
50  Hd_VertexAdjacency const *adjacency,
52  TfToken const &dstName,
53  HdBufferSourceSharedPtr const &adjacencyBuilder,
54  bool packed);
55 
56  HDST_API
57  void GetBufferSpecs(HdBufferSpecVector *specs) const override;
58 
59  HDST_API
60  bool Resolve() override;
61 
62  HDST_API
63  TfToken const &GetName() const override;
64 
65 protected:
66  HDST_API
67  bool _CheckValid() const override;
68 
69 private:
70  Hd_VertexAdjacency const *_adjacency;
72  TfToken _dstName;
73  HdBufferSourceSharedPtr _adjacencyBuilder;
74  bool _packed;
75 };
76 
77 /// \class HdSt_SmoothNormalsComputationGPU
78 ///
79 /// Smooth normal computation GPU.
80 ///
82 {
83 public:
84  HDST_API
86  HdSt_VertexAdjacencyBuilder const *vertexAdjacencyBuilder,
87  TfToken const &srcName,
88  TfToken const &dstName,
89  HdType srcDataType,
90  bool packed);
91 
92  HDST_API
93  void GetBufferSpecs(HdBufferSpecVector *specs) const override;
94 
95  HDST_API
97  HdResourceRegistry *resourceRegistry) override;
98 
99  /// This computation doesn't generate buffer source (i.e. 2nd phase)
100  /// This is a gpu computation, but no need to resize the destination
101  /// since it belongs the same range as src buffer.
102  int GetNumOutputElements() const override { return 0; }
103 
104 private:
105  HdSt_VertexAdjacencyBuilder const *_vertexAdjacencyBuilder;
106  TfToken _srcName;
107  TfToken _dstName;
108  HdType _srcDataType;
109  HdType _dstDataType;
110 };
111 
112 
114 
115 #endif // PXR_IMAGING_HD_ST_SMOOTH_NORMALS_H
GLenum GLint * range
Definition: glcorearb.h:1925
GLdouble GLdouble GLint GLint const GLdouble * points
Definition: glad.h:2676
HDST_API bool Resolve() override
HDST_API void GetBufferSpecs(HdBufferSpecVector *specs) const override
int GetNumOutputElements() const override
HDST_API bool _CheckValid() const override
GLenum GLint GLint GLint GLint GLuint dstName
Definition: glcorearb.h:2510
Definition: token.h:87
HDST_API TfToken const & GetName() const override
Return the name of this buffer source.
HDST_API HdSt_SmoothNormalsComputationGPU(HdSt_VertexAdjacencyBuilder const *vertexAdjacencyBuilder, TfToken const &srcName, TfToken const &dstName, HdType srcDataType, bool packed)
VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR_14 uint8_t packed(VULKAN_HPP_NAMESPACE::Format format)
std::vector< struct HdBufferSpec > HdBufferSpecVector
HDST_API HdSt_SmoothNormalsComputationCPU(Hd_VertexAdjacency const *adjacency, HdBufferSourceSharedPtr const &points, TfToken const &dstName, HdBufferSourceSharedPtr const &adjacencyBuilder, bool packed)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1432
HDST_API void Execute(HdBufferArrayRangeSharedPtr const &range, HdResourceRegistry *resourceRegistry) override
Execute computation.
#define HDST_API
Definition: api.h:40
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
std::shared_ptr< HdBufferArrayRange > HdBufferArrayRangeSharedPtr
Definition: bufferArray.h:44
std::shared_ptr< class HdBufferSource > HdBufferSourceSharedPtr
HdType
Definition: types.h:287
HDST_API void GetBufferSpecs(HdBufferSpecVector *specs) const override