HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_Volume.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  */
8 
9 #ifndef __HOM_Volume_h__
10 #define __HOM_Volume_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_BinaryString.h"
14 #include "HOM_Prim.h"
15 #include <vector>
16 #include <hboost/any.hpp>
17 
18 SWIGOUT(%rename(Volume) HOM_Volume;)
19 
20 class HOM_API HOM_Volume : virtual public HOM_Prim
21 {
22 public:
24  { HOM_CONSTRUCT_OBJECT(this) }
25 
26  // Because the lowermost base classes initialize the virtual bases
27  // before any non-virtual bases, the correct thing to do here is
28  // explicitly call the constructor for HOM_Prim.
29  HOM_Volume(const HOM_Volume &volume)
30  : HOM_Prim(volume)
31  { HOM_CONSTRUCT_OBJECT(this) }
32 
33  ~HOM_Volume() override
34  { HOM_DESTRUCT_OBJECT(this) }
35 
36  // Let swig know we're overriding __repr__ for this class so it doesn't
37  // provide its own __repr__.
38  SWIGOUT(virtual std::string __repr__() = 0;)
39 
40  virtual HOM_EnumValue &storageType() = 0;
41  virtual int channelCount() = 0;
42 
43  virtual HOM_EnumValue &visualization() = 0;
44 
45  virtual double sample(const std::vector<double> &position) = 0;
46 
47  SWIGOUT(%newobject gradient;)
48  virtual HOM_Vector3 *gradient(const std::vector<double> &position) = 0;
49 
50  virtual double voxel(const std::vector<int> &index) = 0;
51 
52  virtual void setVoxel(const std::vector<int> &index, double value) = 0;
53 
54  virtual std::vector<float> allVoxels() = 0;
55 
56  virtual HOM_BinaryString allVoxelsAsString() = 0;
57 
58  virtual void setAllVoxels(const std::vector<float> &values) = 0;
59 
60  SWIGOUT(%ignore opaqueSetAllVoxelsFromString);
61  virtual void opaqueSetAllVoxelsFromString(const char *values, int64 length) = 0;
62 
63 #ifdef SWIG
64 %extend
65 {
66  void setAllVoxelsFromString(InterpreterObject values)
67  {
68  HOM_PyBuffer buffer(values);
69  self->opaqueSetAllVoxelsFromString(
70  (const char *)buffer.myData, buffer.myLength);
71  }
72 }
73 #endif
74 
75  virtual std::vector<float> voxelSlice(const char *plane, int index) = 0;
76 
77  virtual HOM_BinaryString voxelSliceAsString(const char *plane, int index) = 0;
78 
79  virtual void setVoxelSlice(
80  const std::vector<float> &values, const char *plane, int index) = 0;
81 
82  SWIGOUT(%ignore opaqueSetVoxelSliceFromString);
83  virtual void opaqueSetVoxelSliceFromString(
84  const char *values, int64 length, const char *plane, int index) = 0;
85 
86 #ifdef SWIG
87 %extend
88 {
89  void setVoxelSliceFromString(
90  InterpreterObject values, const char *plane, int index)
91  {
92  HOM_PyBuffer buffer(values);
93  self->opaqueSetVoxelSliceFromString(
94  (const char *)buffer.myData, buffer.myLength, plane, index);
95  }
96 }
97 #endif
98 
99  virtual std::vector<int> resolution() = 0;
100 
101  virtual bool hasWindow() = 0;
102  virtual void clearWindow() = 0;
103  virtual HOM_Vector3 dataWindowOffset() = 0;
104  virtual HOM_Vector3 dataWindowSize() = 0;
105  virtual HOM_Vector3 displayWindowOffset() = 0;
106  virtual HOM_Vector3 displayWindowSize() = 0;
107  virtual HOM_Vector3 windowVoxelScale() = 0;
108  virtual void setDataWindowOffset(const std::vector<double> &offset) = 0;
109  virtual void setDisplayWindowOffset(const std::vector<double> &offset) = 0;
110  virtual void setDisplayWindowSize(const std::vector<double> &size) = 0;
111  virtual void setWindowVoxelScale(const std::vector<double> &scale) = 0;
112 
113  SWIGOUT(%newobject indexToPos;)
114  virtual HOM_Vector3 *indexToPos(const std::vector<int> &index) = 0;
115 
116  virtual std::vector<int> posToIndex(const std::vector<double> &position) = 0;
117 
118  virtual bool isValidIndex(const std::vector<int> &index) = 0;
119 
120  virtual bool isSDF() = 0;
121 
122  virtual bool isHeightField() = 0;
123 
124  virtual hboost::any computeMax(int channel = 0) = 0;
125  virtual hboost::any computeMin(int channel = 0) = 0;
126  virtual double computeAverage(int channel = 0) = 0;
127 
128  virtual hboost::any volumeMax(int channel = 0) = 0;
129  virtual hboost::any volumeMin(int channel = 0) = 0;
130  virtual double volumeAverage(int channel = 0) = 0;
131 
132  SWIGOUT(%newobject transform;)
133  virtual HOM_Matrix3 *transform() = 0;
134 
135  virtual void setTransform(HOM_Matrix4 &transform) = 0;
136 
137  virtual double taperX() = 0;
138  virtual double taperY() = 0;
139 
140  SWIGOUT(%newobject vertex;)
141  virtual HOM_Vertex *vertex(int index) = 0;
142 
143  virtual HOM_Vector3 voxelSize() = 0;
144 };
145 
146 #endif
SIM_API const UT_StringHolder vertex
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1398
GLsizei const GLfloat * value
Definition: glcorearb.h:824
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:312
GLuint buffer
Definition: glcorearb.h:660
GA_API const UT_StringHolder scale
~HOM_Volume() override
Definition: HOM_Volume.h:33
GLintptr offset
Definition: glcorearb.h:665
bool any(const vbool4 &v)
Definition: simd.h:3600
#define HOM_API
Definition: HOM_API.h:13
void ignore(T const &) VULKAN_HPP_NOEXCEPT
Definition: vulkan.hpp:6508
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:1397
long long int64
Definition: SYS_Types.h:116
HOM_Volume(const HOM_Volume &volume)
Definition: HOM_Volume.h:29
HUSD_API const char * resolution()
GA_API const UT_StringHolder transform
GLsizeiptr size
Definition: glcorearb.h:664
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1602
OIIO_UTIL_API bool rename(string_view from, string_view to, std::string &err)
GLuint index
Definition: glcorearb.h:786
ScalarToVectorConverter< GridType >::Type::Ptr gradient(const GridType &grid, bool threaded, InterruptT *interrupt)
Compute the gradient of the given scalar grid.
SIM_API const UT_StringHolder position