HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fieldTextureData.h
Go to the documentation of this file.
1 //
2 // Copyright 2021 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_HIO_FIELD_TEXTURE_DATA_H
8 #define PXR_IMAGING_HIO_FIELD_TEXTURE_DATA_H
9 
10 /// \file hio/fieldTextureData.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/imaging/hio/api.h"
14 #include "pxr/imaging/hio/image.h"
15 
16 #include "pxr/base/gf/bbox3d.h"
17 
18 #include "pxr/base/tf/type.h"
19 
20 #include <memory>
21 #include <string>
22 
24 
25 using HioFieldTextureDataSharedPtr = std::shared_ptr<class HioFieldTextureData>;
26 
27 /// \class HioFieldTextureData
28 ///
29 /// An interface class for reading volume files having a
30 /// transformation.
31 ///
33 {
34 public:
35  HIO_API
37 
38  HIO_API
39  virtual ~HioFieldTextureData();
40 
41  /// Load Volume Field Data
42  ///
43  /// fieldName corresponds to the gridName in an OpenVDB file or
44  /// to the layer/attribute name in a Field3D file.
45  /// fieldIndex corresponds to the partition index
46  /// fieldPurpose corresponds to the partition name/grouping
47  ///
48  /// Returns nullptr and posts an error if the specified data cannot be
49  /// loaded.
50  ///
51  HIO_API
53  std::string const & filePath,
54  std::string const & fieldName,
55  int fieldIndex,
56  std::string const & fieldPurpose,
57  size_t targetMemory);
58 
59  /// Bounding box describing how 3d texture maps into
60  /// world space.
61  ///
62  virtual const GfBBox3d &GetBoundingBox() const = 0;
63 
64  virtual int ResizedWidth() const = 0;
65 
66  virtual int ResizedHeight() const = 0;
67 
68  virtual int ResizedDepth() const = 0;
69 
70  virtual HioFormat GetFormat() const = 0;
71 
72  virtual bool Read() = 0;
73 
74  virtual bool HasRawBuffer() const = 0;
75 
76  virtual unsigned char const * GetRawBuffer() const = 0;
77 
78 private:
79  // Disallow copies
80  HioFieldTextureData(const HioFieldTextureData&) = delete;
81  HioFieldTextureData& operator=(const HioFieldTextureData&) = delete;
82 
83 };
84 
85 /// \class HioFieldTextureDataFactoryBase
86 ///
87 /// A base class to make HioFieldTextureData objects, implemented by plugins.
88 ///
90 {
91 protected:
92  friend class HioFieldTextureData;
93 
94  virtual HioFieldTextureDataSharedPtr _New(
95  std::string const & filePath,
96  std::string const & fieldName,
97  int fieldIndex,
98  std::string const & fieldPurpose,
99  size_t targetMemory) const = 0;
100 };
101 
102 
104 
105 #endif
HIO_API HioFieldTextureData()
virtual int ResizedWidth() const =0
virtual int ResizedDepth() const =0
#define HIO_API
Definition: api.h:23
virtual unsigned char const * GetRawBuffer() const =0
virtual bool Read()=0
Base class of all factory types.
Definition: type.h:56
virtual bool HasRawBuffer() const =0
virtual HIO_API ~HioFieldTextureData()
static HIO_API HioFieldTextureDataSharedPtr New(std::string const &filePath, std::string const &fieldName, int fieldIndex, std::string const &fieldPurpose, size_t targetMemory)
virtual const GfBBox3d & GetBoundingBox() const =0
std::shared_ptr< class HioFieldTextureData > HioFieldTextureDataSharedPtr
HioFormat
Definition: types.h:25
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
virtual HioFormat GetFormat() const =0
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
virtual int ResizedHeight() const =0