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 { return NULL; }
63  virtual GT_Size getStringIndexCount() const { return -1; }
64  virtual GT_Offset getStringIndex(GT_Offset, int) const { return -1; }
66  UT_IntArray &) const { }
67  /// @}
68 
69 protected:
70  // specialization for filling int32/int64
72  int tuple_size, int stride) const;
74  int tuple_size, int stride) const;
76  int tuple_size, int stride) const;
78  int tuple_size, int stride) const;
79 
80  /// @{
81  /// Call base class to handle other data
83  int tuple_size, int stride) const
84  {
85  GT_DataArray::doFillArray(data, start, length,
86  tuple_size, stride);
87  }
89  int tuple_size, int stride) const
90  {
91  GT_DataArray::doFillArray(data, start, length,
92  tuple_size, stride);
93  }
95  int tuple_size, int stride) const
96  {
97  GT_DataArray::doFillArray(data, start, length,
98  tuple_size, stride);
99  }
101  int tuple_size, int stride) const
102  {
103  GT_DataArray::doFillArray(data, start, length,
104  tuple_size, stride);
105  }
106  /// @}
107 
108 private:
109  int64 getOffset(GT_Offset offset) const
110  {
111  GA_Offset gaoff = myOffsets(offset);
112  if (myVertexMap)
113  {
114  if (myOwner == GA_ATTRIB_POINT)
115  gaoff = myGdp->vertexPoint(gaoff);
116  else
117  gaoff = myGdp->vertexPrimitive(gaoff);
118  }
119  return gaoff;
120  }
121  GU_ConstDetailHandle myGdh;
122  const GU_Detail *myGdp;
123  GT_GEOOffsetList myOffsets;
124  GA_AttributeOwner myOwner;
125  bool myVertexMap;
126 };
127 
128 #endif
129 
virtual uint8 getU8(GT_Offset offset, int idx) const
GT_Storage
Definition: GT_Types.h:17
virtual GT_Storage getStorage() const
GLuint start
Definition: glcorearb.h:474
const char * GT_String
Definition: GT_Types.h:111
virtual fpreal16 getF16(GT_Offset offset, int idx=0) const
#define GT_API
Definition: GT_API.h:11
GT_Type
Definition: GT_Types.h:33
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
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2620
signed char int8
Definition: SYS_Types.h:31
GA_Size GA_Offset
Definition: GA_Types.h:617
long long int64
Definition: SYS_Types.h:107
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:38
virtual void doFillArray(fpreal64 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
virtual void doFillArray(uint8 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
double fpreal64
Definition: SYS_Types.h:192
GLint GLenum GLboolean GLsizei stride
Definition: glcorearb.h:871
GLintptr offset
Definition: glcorearb.h:664
virtual void doFillArray(uint8 *data, GT_Offset start, GT_Size length, int tuple_size, int stride) const
Definition: GT_DataArray.h:429
virtual fpreal32 getF32(GT_Offset offset, int idx=0) const
GLboolean * data
Definition: glcorearb.h:130
int int32
Definition: SYS_Types.h:35
virtual GT_Type getTypeInfo() const
virtual int32 getI32(GT_Offset offset, int idx) const
GA_AttributeOwner
Definition: GA_Types.h:33
virtual GT_Offset getStringIndex(GT_Offset, int) const
unsigned char uint8
Definition: SYS_Types.h:32
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
int64 GT_Offset
Definition: GT_Types.h:113
int64 GT_Size
Definition: GT_Types.h:112
virtual fpreal64 getF64(GT_Offset offset, int idx=0) const
short int16
Definition: SYS_Types.h:33
virtual GT_Size getTupleSize() const
virtual GT_Size getStringIndexCount() const
float fpreal32
Definition: SYS_Types.h:191
virtual const char * className() const
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:794