HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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;
75 
76  /// @{
77  /// Call base class to handle other data
79  int tuple_size, int stride) const
80  {
81  GT_DataArray::doFillArray(data, start, length,
82  tuple_size, stride);
83  }
85  int tuple_size, int stride) const
86  {
87  GT_DataArray::doFillArray(data, start, length,
88  tuple_size, stride);
89  }
91  int tuple_size, int stride) const
92  {
93  GT_DataArray::doFillArray(data, start, length,
94  tuple_size, stride);
95  }
97  int tuple_size, int stride) const
98  {
99  GT_DataArray::doFillArray(data, start, length,
100  tuple_size, stride);
101  }
102  /// @}
103 
104 private:
105  int64 getOffset(GT_Offset offset) const
106  {
107  GA_Offset gaoff = myOffsets(offset);
108  if (myVertexMap)
109  {
110  if (myOwner == GA_ATTRIB_POINT)
111  gaoff = myGdp->vertexPoint(gaoff);
112  else
113  gaoff = myGdp->vertexPrimitive(gaoff);
114  }
115  return gaoff;
116  }
117  GU_ConstDetailHandle myGdh;
118  const GU_Detail *myGdp;
119  GT_GEOOffsetList myOffsets;
120  GA_AttributeOwner myOwner;
121  bool myVertexMap;
122 };
123 
124 #endif
125 
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:108
virtual fpreal16 getF16(GT_Offset offset, int idx=0) const
#define GT_API
Definition: GT_API.h:11
GT_Type
Definition: GT_Types.h:31
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
GA_Size GA_Offset
Definition: GA_Types.h:617
long long int64
Definition: SYS_Types.h:106
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:191
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:397
virtual fpreal32 getF32(GT_Offset offset, int idx=0) const
GLboolean * data
Definition: glcorearb.h:130
int int32
Definition: SYS_Types.h:34
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:31
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:110
int64 GT_Size
Definition: GT_Types.h:109
virtual fpreal64 getF64(GT_Offset offset, int idx=0) const
virtual GT_Size getTupleSize() const
virtual GT_Size getStringIndexCount() const
float fpreal32
Definition: SYS_Types.h:190
virtual const char * className() const
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:794