HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GT_GEOElementId.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  * NAME: GT_GEOElementId.h ( GEO Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_GEOElementId__
12 #define __GT_GEOElementId__
13 
14 #include "GT_API.h"
15 #include "GT_DataArray.h"
16 #include "GT_GEOSupport.h"
17 #include <GU/GU_DetailHandle.h>
18 #include <UT/UT_Assert.h>
19 
20 /// A representation of an offsets list as a GT data array. If we're given a
21 /// list of vertex offsets, we can also provide the primitive/point id's. This
22 /// is done for primitives like quadrics.
24 {
25 public:
28  GA_AttributeOwner index_type,
29  bool from_vertex);
30  ~GT_GEOElementId() override;
31 
32  const char *className() const override { return "GT_GEOElementId"; }
33 
34  /// @{
35  /// Query methods defined on GT_DataArray
36  GT_Storage getStorage() const override
37  {
38  return myOffsets.is32Bit() ? GT_STORE_INT32
40  }
41  GT_Size getTupleSize() const override { return 1; }
42  GT_Type getTypeInfo() const override { return GT_TYPE_HIDDEN; }
43  GT_Size entries() const override { return myOffsets.entries(); }
44  int64 getMemoryUsage() const override;
45  /// @}
46 
47  /// @{
48  /// Access methods
49  int64 getI64(GT_Offset offset, int =0) const override
50  { return getOffset(offset); }
51  uint8 getU8(GT_Offset offset, int idx) const override
52  { return getOffset(offset); }
53  int32 getI32(GT_Offset offset, int idx) const override
54  { return getOffset(offset); }
55  fpreal16 getF16(GT_Offset offset, int idx=0) const override
56  { return getOffset(offset); }
57  fpreal32 getF32(GT_Offset offset, int idx=0) const override
58  { return getOffset(offset); }
59  fpreal64 getF64(GT_Offset offset, int idx=0) const override
60  { return getOffset(offset); }
61 
62  GT_String getS(GT_Offset, int) const override
64  GT_Size getStringIndexCount() const override { return -1; }
65  GT_Offset getStringIndex(GT_Offset, int) const override { return -1; }
67  UT_IntArray &) const override { }
68  /// @}
69 
70 protected:
71  // specialization for filling int32/int64
73  int tuple_size, int stride) const override;
75  int tuple_size, int stride) const override;
77  int tuple_size, int stride) const override;
79  int tuple_size, int stride) const override;
80 
81  /// @{
82  /// Call base class to handle other data
84  int tuple_size, int stride) const override
85  {
86  GT_DataArray::doFillArray(data, start, length,
87  tuple_size, stride);
88  }
90  int tuple_size, int stride) const override
91  {
92  GT_DataArray::doFillArray(data, start, length,
93  tuple_size, stride);
94  }
96  int tuple_size, int stride) const override
97  {
98  GT_DataArray::doFillArray(data, start, length,
99  tuple_size, stride);
100  }
102  int tuple_size, int stride) const override
103  {
104  GT_DataArray::doFillArray(data, start, length,
105  tuple_size, stride);
106  }
107  /// @}
108 
109 private:
110  int64 getOffset(GT_Offset offset) const
111  {
112  GA_Offset gaoff = myOffsets(offset);
113  if (myVertexMap)
114  {
115  if (myOwner == GA_ATTRIB_POINT)
116  gaoff = myGdp->vertexPoint(gaoff);
117  else
118  gaoff = myGdp->vertexPrimitive(gaoff);
119  }
120  return gaoff;
121  }
122  GU_ConstDetailHandle myGdh;
123  const GU_Detail *myGdp;
124  GT_GEOOffsetList myOffsets;
125  GA_AttributeOwner myOwner;
126  bool myVertexMap;
127 };
128 
129 #endif
130 
GT_Storage
Definition: GT_Types.h:18
int64 getI64(GT_Offset offset, int=0) const override
int int32
Definition: SYS_Types.h:39
GT_Size getStringIndexCount() const override
fpreal16 getF16(GT_Offset offset, int idx=0) const override
GLuint start
Definition: glcorearb.h:475
void doFillArray(fpreal32 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const override
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2621
#define GT_API
Definition: GT_API.h:11
GT_Type
Definition: GT_Types.h:34
void doFillArray(fpreal16 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const override
GT_Size getTupleSize() const override
float fpreal32
Definition: SYS_Types.h:200
double fpreal64
Definition: SYS_Types.h:201
unsigned char uint8
Definition: SYS_Types.h:36
GA_Size GA_Offset
Definition: GA_Types.h:640
int32 getI32(GT_Offset offset, int idx) const override
GT_Offset getStringIndex(GT_Offset, int) const override
fpreal64 getF64(GT_Offset offset, int idx=0) const override
Abstract data class for an array of float, int or string data.
Definition: GT_DataArray.h:40
GT_Storage getStorage() const override
static const UT_StringHolder theEmptyString
void doFillArray(uint8 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const override
void doFillArray(fpreal64 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const override
int64 GT_Offset
Definition: GT_Types.h:124
long long int64
Definition: SYS_Types.h:116
virtual void doFillArray(uint8 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:662
signed char int8
Definition: SYS_Types.h:35
void getIndexedStrings(UT_StringArray &, UT_IntArray &) const override
uint8 getU8(GT_Offset offset, int idx) const override
GT_Type getTypeInfo() const override
GT_String getS(GT_Offset, int) const override
int64 GT_Size
Definition: GT_Types.h:123
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
GA_AttributeOwner
Definition: GA_Types.h:33
const char * className() const override
short int16
Definition: SYS_Types.h:37
virtual int64 getMemoryUsage() const =0
GLintptr offset
Definition: glcorearb.h:665
GLint GLenum GLboolean GLsizei stride
Definition: glcorearb.h:872
fpreal32 getF32(GT_Offset offset, int idx=0) const override
GT_Size entries() const override
Definition: format.h:895