Loading...
Searching...
No Matches
flatNormals.h
1//
2// Copyright 2018 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_FLAT_NORMALS_H
8#define PXR_IMAGING_HD_ST_FLAT_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#include "pxr/imaging/hd/flatNormals.h"
16
17#include "pxr/base/tf/token.h"
18
19PXR_NAMESPACE_OPEN_SCOPE
20
21
26class HdSt_FlatNormalsComputationCPU : public HdComputedBufferSource
27{
28public:
29 HDST_API
30 HdSt_FlatNormalsComputationCPU(
31 HdMeshTopology const *topology,
32 HdBufferSourceSharedPtr const &points,
33 TfToken const &dstName,
34 bool packed);
35
36 HDST_API
37 void GetBufferSpecs(HdBufferSpecVector *specs) const override;
38
39 HDST_API
40 bool Resolve() override;
41
42 HDST_API
43 TfToken const &GetName() const override;
44
45protected:
46 HDST_API
47 bool _CheckValid() const override;
48
49private:
50 HdMeshTopology const *_topology;
51 HdBufferSourceSharedPtr const _points;
52 TfToken _dstName;
53 bool _packed;
54};
55
60class HdSt_FlatNormalsComputationGPU : public HdStComputation
61{
62public:
63 HDST_API
64 HdSt_FlatNormalsComputationGPU(
65 HdBufferArrayRangeSharedPtr const &topologyRange,
66 HdBufferArrayRangeSharedPtr const &vertexRange,
67 int numFaces,
68 TfToken const &srcName,
69 TfToken const &dstName,
70 HdType srcDataType,
71 bool packed);
72
73 HDST_API
74 void GetBufferSpecs(HdBufferSpecVector *specs) const override;
75
76 HDST_API
77 void Execute(HdBufferArrayRangeSharedPtr const &range,
78 HdResourceRegistry *resourceRegistry) override;
79
80 int GetNumOutputElements() const override;
81
82private:
83 HdBufferArrayRangeSharedPtr const _topologyRange;
84 HdBufferArrayRangeSharedPtr const _vertexRange;
85 int _numFaces;
86 TfToken _srcName;
87 TfToken _dstName;
88 HdType _srcDataType;
89 HdType _dstDataType;
90};
91
92
93PXR_NAMESPACE_CLOSE_SCOPE
94
95#endif // PXR_IMAGING_HD_ST_FLAT_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.
A abstract base class for cpu computation followed by buffer transfer to the GPU.
Definition: bufferSource.h:196
virtual HD_API TfToken const & GetName() const override
Return the name of this buffer source.
Topology data for meshes.
Definition: meshTopology.h:38
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...