HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
field.h
Go to the documentation of this file.
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_FIELD_H
8 #define PXR_IMAGING_HD_ST_FIELD_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hd/version.h"
12 #include "pxr/imaging/hd/field.h"
13 #include "pxr/imaging/hdSt/api.h"
14 
16 
18 
19 ///
20 /// Represents a Field Buffer Prim.
21 ///
22 class HdStField : public HdField {
23 public:
24  /// For now, only fieldType HdStTokens->openvdbAsset is supported.
25  HDST_API
26  HdStField(SdfPath const & id, TfToken const & fieldType);
27  HDST_API
28  ~HdStField() override;
29 
30  /// Loads field as 3d texture to generate GetFieldResource.
31  HDST_API
32  void Sync(HdSceneDelegate *sceneDelegate,
33  HdRenderParam *renderParam,
34  HdDirtyBits *dirtyBits) override;
35 
36  HDST_API
37  HdDirtyBits GetInitialDirtyBitsMask() const override;
38 
39  /// Initialized by Sync.
40  HDST_API
42  return _textureId;
43  }
44 
45  /// Get memory request for this field
46  size_t GetTextureMemory() const { return _textureMemory; }
47 
48  /// Bprim types handled by this class
49  HDST_API
50  static const TfTokenVector &GetSupportedBprimTypes();
51 
52  /// Can bprim type be handled by this class
53  HDST_API
54  static bool IsSupportedBprimType(const TfToken &bprimType);
55 
56 private:
57  const TfToken _fieldType;
58 
59  HdStTextureIdentifier _textureId;
60  size_t _textureMemory;
61 
62  bool _isInitialized : 1;
63 };
64 
66 
67 #endif //PXR_IMAGING_HD_ST_FIELD_H
HDST_API HdStField(SdfPath const &id, TfToken const &fieldType)
For now, only fieldType HdStTokens->openvdbAsset is supported.
uint32_t HdDirtyBits
Definition: types.h:143
HDST_API ~HdStField() override
static HDST_API const TfTokenVector & GetSupportedBprimTypes()
Bprim types handled by this class.
HDST_API HdDirtyBits GetInitialDirtyBitsMask() const override
size_t GetTextureMemory() const
Get memory request for this field.
Definition: field.h:46
Definition: token.h:70
Definition: field.h:33
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
Definition: path.h:273
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
static HDST_API bool IsSupportedBprimType(const TfToken &bprimType)
Can bprim type be handled by this class.
#define HDST_API
Definition: api.h:23
HDST_API HdStTextureIdentifier const & GetTextureIdentifier() const
Initialized by Sync.
Definition: field.h:41
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HDST_API void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits) override
Loads field as 3d texture to generate GetFieldResource.