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  GT_Size getDictIndexCount() const override { return -1; }
69  GT_Offset getDictIndex(GT_Offset, int) const override { return -1; }
71  UT_IntArray &) const override { }
72  /// @}
73 
74 protected:
75  // specialization for filling int32/int64
77  int tuple_size, int stride) const override;
79  int tuple_size, int stride) const override;
81  int tuple_size, int stride) const override;
83  int tuple_size, int stride) const override;
84 
85  /// @{
86  /// Call base class to handle other data
88  int tuple_size, int stride) const override
89  {
90  GT_DataArray::doFillArray(data, start, length,
91  tuple_size, stride);
92  }
94  int tuple_size, int stride) const override
95  {
96  GT_DataArray::doFillArray(data, start, length,
97  tuple_size, stride);
98  }
100  int tuple_size, int stride) const override
101  {
102  GT_DataArray::doFillArray(data, start, length,
103  tuple_size, stride);
104  }
106  int tuple_size, int stride) const override
107  {
108  GT_DataArray::doFillArray(data, start, length,
109  tuple_size, stride);
110  }
111  /// @}
112 
113 private:
114  int64 getOffset(GT_Offset offset) const
115  {
116  GA_Offset gaoff = myOffsets(offset);
117  if (myVertexMap)
118  {
119  if (myOwner == GA_ATTRIB_POINT)
120  gaoff = myGdp->vertexPoint(gaoff);
121  else
122  gaoff = myGdp->vertexPrimitive(gaoff);
123  }
124  return gaoff;
125  }
126  GU_ConstDetailHandle myGdh;
127  const GU_Detail *myGdp;
128  GT_GEOOffsetList myOffsets;
129  GA_AttributeOwner myOwner;
130  bool myVertexMap;
131 };
132 
133 #endif
134 
GT_Storage
Definition: GT_Types.h:19
int64 getI64(GT_Offset offset, int=0) const override
int int32
Definition: SYS_Types.h:39
GT_Size getStringIndexCount() const override
GT_Size getDictIndexCount() 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
#define GT_API
Definition: GT_API.h:13
GT_Type
Definition: GT_Types.h:36
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
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
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2621
double fpreal64
Definition: SYS_Types.h:201
unsigned char uint8
Definition: SYS_Types.h:36
GA_Size GA_Offset
Definition: GA_Types.h:646
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
GLintptr offset
Definition: glcorearb.h:665
Abstract data class for an array of float, int or string data.
Definition: GT_DataArray.h:40
void getIndexedDicts(UT_Array< UT_OptionsHolder > &, UT_IntArray &) const override
GT_Offset getDictIndex(GT_Offset, int) const override
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
GLint GLenum GLboolean GLsizei stride
Definition: glcorearb.h:872
void doFillArray(fpreal64 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const override
int64 GT_Offset
Definition: GT_Types.h:129
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:700
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:128
GA_AttributeOwner
Definition: GA_Types.h:35
const char * className() const override
short int16
Definition: SYS_Types.h:37
virtual int64 getMemoryUsage() const =0
fpreal32 getF32(GT_Offset offset, int idx=0) const override
GT_Size entries() const override
Definition: format.h:895