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  virtual ~GT_GEOElementId();
31 
32  virtual const char *className() const { return "GT_GEOElementId"; }
33 
34  /// @{
35  /// Query methods defined on GT_DataArray
36  virtual GT_Storage getStorage() const
37  {
38  return myOffsets.is32Bit() ? GT_STORE_INT32
40  }
41  virtual GT_Size getTupleSize() const { return 1; }
42  virtual GT_Type getTypeInfo() const { return GT_TYPE_HIDDEN; }
43  virtual GT_Size entries() const { return myOffsets.entries(); }
44  virtual int64 getMemoryUsage() const;
45  /// @}
46 
47  /// @{
48  /// Access methods
49  virtual int64 getI64(GT_Offset offset, int =0) const
50  { return getOffset(offset); }
51  virtual uint8 getU8(GT_Offset offset, int idx) const
52  { return getOffset(offset); }
53  virtual int32 getI32(GT_Offset offset, int idx) const
54  { return getOffset(offset); }
55  virtual fpreal16 getF16(GT_Offset offset, int idx=0) const
56  { return getOffset(offset); }
57  virtual fpreal32 getF32(GT_Offset offset, int idx=0) const
58  { return getOffset(offset); }
59  virtual fpreal64 getF64(GT_Offset offset, int idx=0) const
60  { return getOffset(offset); }
61 
62  virtual GT_String getS(GT_Offset, int) const
64  virtual GT_Size getStringIndexCount() const { return -1; }
65  virtual GT_Offset getStringIndex(GT_Offset, int) const { return -1; }
67  UT_IntArray &) const { }
68  /// @}
69 
70 protected:
71  // specialization for filling int32/int64
73  int tuple_size, int stride) const;
75  int tuple_size, int stride) const;
77  int tuple_size, int stride) const;
79  int tuple_size, int stride) const;
80 
81  /// @{
82  /// Call base class to handle other data
84  int tuple_size, int stride) const
85  {
86  GT_DataArray::doFillArray(data, start, length,
87  tuple_size, stride);
88  }
90  int tuple_size, int stride) const
91  {
92  GT_DataArray::doFillArray(data, start, length,
93  tuple_size, stride);
94  }
96  int tuple_size, int stride) const
97  {
98  GT_DataArray::doFillArray(data, start, length,
99  tuple_size, stride);
100  }
102  int tuple_size, int stride) const
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 
virtual uint8 getU8(GT_Offset offset, int idx) const
GT_Storage
Definition: GT_Types.h:18
virtual GT_Storage getStorage() const
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glew.h:4117
virtual fpreal16 getF16(GT_Offset offset, int idx=0) const
#define GT_API
Definition: GT_API.h:11
GT_Type
Definition: GT_Types.h:34
virtual void doFillArray(fpreal16 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
virtual void doFillArray(fpreal32 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
signed char int8
Definition: SYS_Types.h:35
GA_Size GA_Offset
Definition: GA_Types.h:637
long long int64
Definition: SYS_Types.h:111
virtual int64 getI64(GT_Offset offset, int=0) const
Abstract data class for an array of float, int or string data.
Definition: GT_DataArray.h:39
virtual void doFillArray(fpreal64 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
virtual void doFillArray(uint8 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
static const UT_StringHolder theEmptyString
double fpreal64
Definition: SYS_Types.h:196
GLuint GLsizei GLsizei * length
Definition: glew.h:1825
int64 GT_Offset
Definition: GT_Types.h:114
virtual void doFillArray(uint8 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:607
virtual fpreal32 getF32(GT_Offset offset, int idx=0) const
int int32
Definition: SYS_Types.h:39
GLuint start
Definition: glew.h:1253
virtual GT_Type getTypeInfo() const
GLsizei stride
Definition: glew.h:1523
virtual int32 getI32(GT_Offset offset, int idx) const
int64 GT_Size
Definition: GT_Types.h:113
GA_AttributeOwner
Definition: GA_Types.h:33
virtual GT_Offset getStringIndex(GT_Offset, int) const
unsigned char uint8
Definition: SYS_Types.h:36
virtual int64 getMemoryUsage() const =0
virtual GT_String getS(GT_Offset, int) const
virtual GT_Size entries() const
virtual void getIndexedStrings(UT_StringArray &, UT_IntArray &) const
virtual fpreal64 getF64(GT_Offset offset, int idx=0) const
short int16
Definition: SYS_Types.h:37
virtual GT_Size getTupleSize() const
virtual GT_Size getStringIndexCount() const
float fpreal32
Definition: SYS_Types.h:195
virtual const char * className() const
GLintptr offset
Definition: glew.h:1682