Loading...
Searching...
No Matches
smoothNormals.h
1//
2// Copyright 2016 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_ST_SMOOTH_NORMALS_H
8#define PXR_IMAGING_HD_ST_SMOOTH_NORMALS_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hdSt/api.h"
12#include "pxr/imaging/hdSt/computation.h"
13
14#include "pxr/imaging/hd/bufferSource.h"
15
16#include "pxr/base/tf/token.h"
17
18PXR_NAMESPACE_OPEN_SCOPE
19
20
21class Hd_VertexAdjacency;
22class HdSt_VertexAdjacencyBuilder;
23
28class HdSt_SmoothNormalsComputationCPU : public HdComputedBufferSource
29{
30public:
31 HDST_API
32 HdSt_SmoothNormalsComputationCPU(
33 Hd_VertexAdjacency const *adjacency,
34 HdBufferSourceSharedPtr const &points,
35 TfToken const &dstName,
36 HdBufferSourceSharedPtr const &adjacencyBuilder,
37 bool packed);
38
39 HDST_API
40 void GetBufferSpecs(HdBufferSpecVector *specs) const override;
41
42 HDST_API
43 bool Resolve() override;
44
45 HDST_API
46 TfToken const &GetName() const override;
47
48protected:
49 HDST_API
50 bool _CheckValid() const override;
51
52private:
53 Hd_VertexAdjacency const *_adjacency;
54 HdBufferSourceSharedPtr _points;
55 TfToken _dstName;
56 HdBufferSourceSharedPtr _adjacencyBuilder;
57 bool _packed;
58};
59
64class HdSt_SmoothNormalsComputationGPU : public HdStComputation
65{
66public:
67 HDST_API
68 HdSt_SmoothNormalsComputationGPU(
69 HdSt_VertexAdjacencyBuilder const *vertexAdjacencyBuilder,
70 TfToken const &srcName,
71 TfToken const &dstName,
72 HdType srcDataType,
73 bool packed);
74
75 HDST_API
76 void GetBufferSpecs(HdBufferSpecVector *specs) const override;
77
78 HDST_API
79 void Execute(HdBufferArrayRangeSharedPtr const &range,
80 HdResourceRegistry *resourceRegistry) override;
81
85 int GetNumOutputElements() const override { return 0; }
86
87private:
88 HdSt_VertexAdjacencyBuilder const *_vertexAdjacencyBuilder;
89 TfToken _srcName;
90 TfToken _dstName;
91 HdType _srcDataType;
92 HdType _dstDataType;
93};
94
95
96PXR_NAMESPACE_CLOSE_SCOPE
97
98#endif // PXR_IMAGING_HD_ST_SMOOTH_NORMALS_H
virtual bool _CheckValid() const =0
Checks the validity of the source buffer.
virtual bool Resolve()=0
Prepare the access of GetData().
virtual void GetBufferSpecs(HdBufferSpecVector *specs) const =0
Add the buffer spec for this buffer source into given bufferspec vector.
An abstract base class for cpu computation followed by buffer transfer to the GPU.
Definition: bufferSource.h:209
virtual HD_API TfToken const & GetName() const override
Return the name of this buffer source.
A central registry for resources.
An interface class for GPU computation.
Definition: computation.h:36
virtual void Execute(HdBufferArrayRangeSharedPtr const &range, HdResourceRegistry *resourceRegistry)=0
Execute computation.
virtual void GetBufferSpecs(HdBufferSpecVector *specs) const =0
Add the buffer spec for this computation into given bufferspec vector.
virtual int GetNumOutputElements() const =0
Returns the size of its destination buffer (located by range argument of Execute()).
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...