HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GA_Primitive.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: GA_Primitive.h (GA Library, C++)
7  *
8  * COMMENTS: Interface for primitives.
9  */
10 
11 #pragma once
12 
13 #ifndef __GA_Primitive__
14 #define __GA_Primitive__
15 
16 #define GA_PRIMITIVE_VERTEXLIST 1
17 
18 #include "GA_API.h"
19 #include "GA_Detail.h"
20 #include "GA_IntrinsicManager.h"
21 #include "GA_OffsetList.h"
22 #include "GA_PrimCompat.h"
23 #include "GA_PrimitiveDefinition.h"
24 #include "GA_PrimitiveFamilyMask.h"
25 #include "GA_PrimitiveTypeId.h"
26 #include "GA_SharedDataHandle.h"
27 #include "GA_SharedLoadData.h"
28 #include "GA_Range.h"
29 #include "GA_Topology.h"
30 #include "GA_Types.h"
31 
32 #include <UT/UT_BoundingBox.h>
33 #include <UT/UT_BoundingRect.h>
34 #include <UT/UT_VectorTypes.h>
35 #include <SYS/SYS_Inline.h>
36 #include <SYS/SYS_Types.h>
37 
38 #include <functional>
39 #include <iosfwd>
40 #include <stddef.h>
41 
44 class GA_Attribute;
45 class GA_Defragment;
46 class GA_Detail;
47 class GA_IntrinsicEval;
48 class GA_MergeMap;
49 class GA_PrimitiveJSON;
50 class GA_PrimitiveList;
52 class GA_GeometryIndex;
53 
54 class UT_BoundingSphere;
55 class UT_IStream;
56 class UT_MemoryCounter;
57 class UT_Options;
58 class UT_String;
59 class UT_StringArray;
60 template <typename T> class UT_Array;
61 
62 template<typename T, bool B> class GA_EdgeT;
64 
65 
66 class GA_Primitive;
67 typedef void (* GA_EdgeApplyFunc)(const GA_Primitive &prim,
68  GA_Offset pt_a, GA_Offset pt_b, void *data);
69 typedef void (* GA_EdgeApplyIndexFunc)(const GA_Primitive &prim,
70  GA_Size v1, GA_Size v2, void *data);
71 
72 using GA_IterateEdgesFunc = std::function<bool(const GA_Edge &edge)>;
73 using GA_IterateEdgesByVertexFunc = std::function<bool(GA_Size, GA_Size)>;
74 
75 #define GA_NO_OVERRIDE
76 
77 /// Declare intrinsic callback functions in header file. See
78 /// GA_IntrinsicMacros.h for macros to help implement intrinsics.
79 #define GA_DECLARE_INTRINSICS(OVERRIDE) \
80  static GA_IntrinsicManager::Registrar \
81  registerIntrinsics(GA_PrimitiveDefinition &); \
82  virtual GA_Size localIntrinsicTupleSize(const GA_IntrinsicEval &) const \
83  OVERRIDE; \
84  virtual GA_Size localGetIntrinsicI(const GA_IntrinsicEval &, \
85  int64 *, GA_Size) const OVERRIDE; \
86  virtual GA_Size localGetIntrinsicF(const GA_IntrinsicEval &, \
87  fpreal64 *, GA_Size) const OVERRIDE; \
88  virtual GA_Size localGetIntrinsicS(const GA_IntrinsicEval &, \
89  UT_String &) const OVERRIDE; \
90  virtual GA_Size localGetIntrinsicSA(const GA_IntrinsicEval &, \
91  UT_StringArray &) const OVERRIDE; \
92  virtual GA_Size localSetIntrinsicI(const GA_IntrinsicEval &, \
93  const int64 *, GA_Size) OVERRIDE; \
94  virtual GA_Size localSetIntrinsicF(const GA_IntrinsicEval &, \
95  const fpreal64 *, GA_Size) OVERRIDE; \
96  virtual GA_Size localSetIntrinsicSS(const GA_IntrinsicEval &, \
97  const char **, GA_Size) OVERRIDE; \
98  virtual GA_Size localSetIntrinsicSA(const GA_IntrinsicEval &, \
99  const UT_StringArray &) OVERRIDE;
100 
102 {
103 protected:
104  /// NOTE: The constructor should only be called from subclass
105  /// constructors.
108  : myDetail(&detail)
109  , myOffset(offset)
110  {}
111 
112 public:
113  /// NOTE: The destructor should only be called from subclass
114  /// destructors; only GA_PrimitiveList should be calling
115  /// delete on GA_Primitive pointers.
116  virtual ~GA_Primitive()
117  {
118  // The detail should have already deleted the vertices, and
119  // myVertexList is automatically cleaned up in its destructor.
120  }
121 
122  virtual const GA_PrimitiveDefinition &getTypeDef() const = 0;
123 
124  const char *getTypeName() const
125  { return getTypeDef().getToken(); }
126 
127  /// Gets the detail containing this primitive.
128  ///
129  /// FIXME: This should return a const detail, and a non-const version should
130  /// return a non-const detail.
133  { return *myDetail; }
134 
135  /// Gets the offset of this primitive in the detail containing it.
138  { return myOffset; }
139 
140  /// Gets the index of this primitive in the detail containing it.
143  { return myDetail->primitiveIndex(myOffset); }
144 
145  /// Gets the index map for primitives in the detail containing this primitive.
147  const GA_IndexMap &getIndexMap() const
148  { return myDetail->getPrimitiveMap(); }
149 
150  SYS_DEPRECATED_HDK(13.0)
151  GA_Index getNum() const
152  { return getMapIndex(); }
153 
154  /// For defragmentation, we need to update the offset
155  void swapOffsetValue(const GA_Defragment &defrag);
156 
157  /// Returns true if the primitive is part of a 3D geometry detail
158  /// (GEO_Detail), and false if it is part of a 2D geometry detail
159  /// (GD_Detail) for trim/projection curves.
160  bool isPrimary() const
161  { return myDetail->isPrimary(); }
162 
163  // FIXME: Switch this back to SYS_FORCE_INLINE when Microsoft fixes
164  // Visual Studio bug report ID 2154929.
165  // It seems to be fixed in Update 3, so I updated the define,
166  // but we haven't switched our builds over yet from Update 1.
167 #if defined(_MSC_VER) && (_MSC_VER >= 1900) && (_MSC_FULL_VER < 190024210)
168  inline
169 #else
171 #endif
173  { return getTypeDef().getId(); }
175  { return getTypeDef().getFamilyMask(); }
176  bool isFamily(unsigned family_mask) const
177  { return ((getFamilyMask() & family_mask) != 0); }
178 
179  /// Whether the primitive has a transform associated with it
180  bool hasLocalTransform() const
181  { return getTypeDef().hasLocalTransform(); }
182  /// Return the local transform matrix for the primitive. Some primitives
183  /// don't store transforms (see @c hasLocalTransform()). The default
184  /// behaviour is to make the transform an identity.
185  virtual void getLocalTransform(UT_Matrix3D &matrix) const;
186 
187  /// Return the local transform matrix for the primitive, but with the
188  /// translates specified by the position of the first vertex of the
189  /// primitive. This only includes the local transform and the translate
190  /// due to the point position.
191  virtual void getLocalTransform4(UT_Matrix4D &matrix) const;
192 
193  /// Set the local transform. The default implementation does nothing.
194  virtual void setLocalTransform(const UT_Matrix3D &matrix);
195 
196  /// @deprecated This method is only for transitional backward compatibility
197  /// for the HDK and will be removed in a future release.
198  /// TODO: Should be pure virtual here, overwritten at GEO_Primitive.
200  { return primCompatMaskFromTypeId(getTypeId().get()); }
201 
202  /// Report approximate memory usage, including sizeof(*this) and
203  /// any shared memory.
204  virtual int64 getMemoryUsage() const
205  {
206  return sizeof(*this) + getBaseMemoryUsage();
207  }
208 
209  /// Count memory usage using a UT_MemoryCounter in order to count
210  /// shared memory correctly.
211  /// NOTE: This should always include sizeof(*this).
212  virtual void countMemory(UT_MemoryCounter &counter) const;
213 
214  /// @{
215  /// This method is called when the vertex index map is being defragmented.
216  /// Since the defragmentation process moves vertex offsets, primitives need
217  /// to update their references with the new values. @code
218  /// new_vtx_offset = defrag.mapOffset(new_vtx_offset);
219  /// myOffsetList.swapOffsetValues(defrag);
220  /// myOffsetMatrix.swapOffsetValues(defrag);
221  /// @endcode
222  virtual void swapVertexOffsets(const GA_Defragment &defrag);
223  /// @}
224 
225  /// Return the number of vertices used by this primitive
228  {
229  return myVertexList.size();
230  }
231 
232  /// Given an vertex number (into the primitive's vertex list), return the
233  /// vertex offset.
235  GA_Offset getVertexOffset(GA_Size primvertexnum) const
236  {
237  UT_ASSERT_P(primvertexnum >= 0 && primvertexnum < myVertexList.size());
238  return myVertexList.get(primvertexnum);
239  }
241  GA_Index getVertexIndex(GA_Size primvertexnum) const
242  {
243  return getDetail().vertexIndex(getVertexOffset(primvertexnum));
244  }
245 
246  /// Given a vertex number (into the primitive's vertex list), return the
247  /// point offset.
250  { return getDetail().vertexPoint(getVertexOffset(i)); }
251 
252  /// Given a vertex number (into the primitive's vertex list), set the
253  /// corresponding point offset.
256  {
257  getDetail().getTopology().wireVertexPoint(getVertexOffset(i), ptoff);
258  }
259 
260  /// Given a vertex number (into the primitive's vertex list), return its
261  /// point index number.
264  { return getDetail().pointIndex(getPointOffset(i)); }
265 
266  /// Given a vertex number (into the primitive's vertex list), return its
267  /// point's position.
270  { return getDetail().getPos3(getPointOffset(i)); }
271 
272  /// Given a vertex number (into the primitive's vertex list),
273  /// move the point to the specified position.
275  void setPos3(GA_Size i, const UT_Vector3 &pos) const
276  { getDetail().setPos3(getPointOffset(i), pos); }
277 
278  /// Given a vertex number (into the primitive's vertex list), return its
279  /// point's position.
282  { return getDetail().getPos4(getPointOffset(i)); }
283 
284  /// Given a vertex number (into the primitive's vertex list),
285  /// move the point to the specified position.
287  void setPos4(GA_Size i, const UT_Vector4 &pos) const
288  { getDetail().setPos4(getPointOffset(i), pos); }
289 
290  /// Get a range of all the vertices accessed by the primitive
291  GA_Range getVertexRange(bool harden=false) const
292  {
293  return GA_Range(getDetail(), getMapOffset(),
295  harden);
296  }
297  /// Get a range of all the points accessed by the primitive. Note, the
298  /// range may visit points multiple times.
299  GA_Range getPointRange(bool harden=false) const
300  {
301  return GA_Range(getDetail(), getMapOffset(),
303  harden);
304  }
305 
306  /// Return whether a point is referenced by a primitive. This simply
307  /// iterates over the vertices, checking if any vertices reference the
308  /// point.
309  bool isPointUsed(GA_Offset ptoff) const
310  {
311  GA_Size nvtx = getVertexCount();
312  for (GA_Size i = 0; i < nvtx; ++i)
313  {
314  if (getPointOffset(i) == ptoff)
315  return true;
316  }
317  return false;
318  }
319 
320  /// Add all points referenced by the primitive to the given group. This
321  /// defaults to iterating over the vertices and adding their referenced
322  /// points.
323  void addPointRefToGroup(GA_PointGroup &grp) const;
324 
325  /// Method to determine if a primitive has an edge (undirected).
326  virtual bool hasEdge(const GA_Edge &edge) const;
327 
328 
329  /// Calls apply for each directed edge in this primitive
330  /// @deprecated Use @c iterateEdges instead.
331  SYS_DEPRECATED_HDK_REPLACE(16.0, iterateEdges)
332  void edgeApply(GA_EdgeApplyFunc apply, void *data = nullptr) const;
333 
334  /// Calls apply for each directed edge in this primitive
335  /// @deprecated Use @c iterateEdgesByVertex instead.
336  SYS_DEPRECATED_HDK_REPLACE(16.0, iterateEdgesByVertex)
337  void edgeApplyIndex(GA_EdgeApplyIndexFunc apply, void *data = nullptr) const;
338 
339  /// Calls @c apply_func for each directed edge on the primitive.
340  /// If the @c apply_func function returns @c false, then the
341  /// traversal will be stopped.
342  virtual void iterateEdges(GA_IterateEdgesFunc apply_func) const
343  {
344  // Default implementation does nothing.
345  // Re-implemented by relevant primitives.
346  }
347 
348  /// Calls @c apply_func for each directed edge on the primitive,
349  /// passing in the @c GA_Size primitive vertex index for each point on the
350  /// edge. If the @c apply_func function returns @c false, then the
351  /// traversal will be stopped.
352  virtual void iterateEdgesByVertex(GA_IterateEdgesByVertexFunc apply_func) const
353  {
354  // Default implementation does nothing.
355  // Re-implemented by relevant primitives.
356  }
357 
358  /// Calls edgeApplyIndex to find the vertices within this primitive,
359  /// corresponding with the first undirected edge between ptoff0 and ptoff1.
360  /// If the edge is not in this primitive, vtx0 and vtx1 will not be
361  /// written-to, and the function will return false.
362  /// When written, vtx0->vtx1 will always be the direction the edge
363  /// appears in this primitive, which may be *opposite* ptoff0->ptoff1.
364  bool findEdgePoints(GA_Offset ptoff0, GA_Offset ptoff1,
365  GA_Size &vtx0, GA_Size &vtx1) const;
366 
367  /// The return status of @c dereferencePoint()
368  /// - GA_DEREFERENCE_FAIL @n
369  /// The primitive cannot detach itself from the points and thus the
370  /// points cannot be deleted. It's possible that the primitive may be
371  /// destroyed in this case if the user specified this behaviour (see
372  /// GA_Detail::GA_DestroyPointMode).
373  /// - GA_DEREFERENCE_OK @n
374  /// The primitive has detached the points and is still valid.
375  /// - GA_DEREFERENCE_DEGENERATE @n
376  /// The primitive has detached the points but is now degenerate.
377  /// - GA_DEREFERENCE_DESTROY @n
378  /// The primitive has detached the points and should now be destroyed.
380  {
385  };
386  /// Before points are deleted, all primitives referencing the points will
387  /// be notified using @c dereferencePoint or @c dereferencePoints. These
388  /// methods should return the appropriate DeferefenceStatus.
389  /// @example
390  /// A quadric primitive will return
391  /// - GA_DEREFERENCE_OK @n
392  /// If it's point is not in the point group
393  /// - GA_DEREFERENCE_DESTROY @n
394  /// If it destroyed its vertex
395  /// A hull primitive will return
396  /// - GA_DEREFERENCE_OK @n
397  /// If a full row or column was dereferenced
398  /// - GA_DEREFERENCE_DEGENERATE @n
399  /// If a full row/column was dereferenced, leaving a degenerate
400  /// primitive.
401  /// - GA_DEREFERENCE_FAIL @n
402  /// If a single point from within the hull cannot be dereferenced
403  /// The @c dry_run parameter will prevent the point from actually being
404  /// detached.
405  virtual GA_DereferenceStatus dereferencePoint(GA_Offset point,
406  bool dry_run=false) = 0;
407  virtual GA_DereferenceStatus dereferencePoints(
408  const GA_RangeMemberQuery &pt_q,
409  bool dry_run=false) = 0;
410 
411  /// @{
412  /// Enlarge a bounding box by the bounding box of the primitive. A
413  /// return value of false indicates an error in the operation, most
414  /// likely an invalid P. By default, these methods simply enlarge the
415  /// bounding box based on the vertices.
416  virtual bool enlargeBoundingBox(UT_BoundingRect &b,
417  const GA_Attribute *P) const;
418  virtual bool enlargeBoundingBox(UT_BoundingBox &b,
419  const GA_Attribute *P) const;
420  /// @}
421  /// Enlarge a bounding sphere to encompass the primitive. A return value
422  /// of false indicates an error in the operation, most likely an invalid
423  /// P. By default, this method simply enlarges the bounding box based on
424  /// the vertices.
425  virtual bool enlargeBoundingSphere(UT_BoundingSphere &b,
426  const GA_Attribute *P) const;
427 
428  /// Enlarge a point bounding box for implicit primitive bounds. If a
429  /// primitive (such as a sphere) has a bounding box larger than its point
430  /// hull, then it should implement this method. Otherwise, it can rely on
431  /// the default behaviour.
432  virtual void enlargePointBounds(UT_BoundingBox &box) const;
433 
434  /// Is the primitive degenerate
435  virtual bool isDegenerate() const = 0;
436 
437  /// Copy the specified primitive as part of the merge. The source
438  /// primitive will be of the same type.
439  ///
440  /// Since the vertex offsets will change for the merged geometry, the map
441  /// should be used to lookup the new vertex offsets. For example
442  /// @code
443  /// map.mapDestFromSource( GA_ATTRIB_VERTEX, source_vertex );
444  /// @endcode
445  ///
446  /// @see GA_MergeMap
447  virtual void copyUnwiredForMerge(
448  const GA_Primitive *src, const GA_MergeMap &map);
449 
450  /// This method returns the JSON interface for saving/loading the primitive
451  /// If the method returns a NULL pointer, then the primitive will @b not
452  /// be saved to geometry files (and thus cannot be loaded).
453  virtual const GA_PrimitiveJSON *getJSON() const = 0;
454 
455  /// Some primitives can have common/shared data between different
456  /// instances of the primitives. This method is invoked during the save
457  /// process to save data. The method requires you to save two objects
458  /// sequentially (the data is stored in a list) for each shared key:
459  /// - The primitive typedef name. This is used at load time to find the
460  /// definition which knows how to load the data.
461  /// - The data required to represent the shared object. This is
462  /// typically a list or map containing the type of data, the key value
463  /// (used for loading) and the actual object data.
464  ///
465  /// If there are multiple shared data pointers, the array can continue with name/value pairs.
466  ///
467  /// For example, you might have something like: @code
468  /// const char *key = makeKeyForSharedPtr(ptr);
469  /// bool ok = true;
470  /// if (!save.hasSavedSharedData(key))
471  /// {
472  /// save.setSavedSharedData(key); // Flag this data as saved
473  /// ok = ok && w.jsonStringToken(getTypeName());
474  /// ok = ok && w.jsonBeginArray();
475  /// ok = ok && w.jsonStringToken("datatype");
476  /// ok = ok && w.jsonStringToken(key);
477  /// ok = ok && saveSharedData(ptr);
478  /// ok = ok && w.jsonEndArray();
479  /// }
480  /// return ok;
481  /// @endcode
482  /// Then in the primitive JSON, you'd likely want to have two fields, one
483  /// for the shared data pointer, the other for an expanded version of the
484  /// data. The @c shouldSaveField() method would be something like: @code
485  /// if (index == SHARED_DATA_KEY)
486  /// return save.hasSavedSharedData(key);
487  /// if (index == EXPANDED_DATA_KEY)
488  /// return !save.hasSavedSharedData(key);
489  /// @endcode
490  ///
491  /// Then the saveField() method of the primitive JSON would look something
492  /// like: @code
493  /// switch (index)
494  /// {
495  /// case SHARED_DATA_KEY:
496  /// UT_ASSERT(save.hasSaveSharedData(key));
497  /// return w.jsonString(key);
498  /// case EXPANDED_DATA_KEY:
499  /// UT_ASSERT(!save.hasSaveSharedData(key));
500  /// return saveSharedData(ptr);
501  /// }
502  /// @endcode
503  ///
504  /// During the loading process, you can just get the shared data from the
505  /// load map. @code
506  /// MySharedDataContainer *data;
507  /// data = load.sharedLoadDataAs<MySharedDataContainer>(key);
508  /// if (data)
509  /// setSharedPointer(data->getSharedData();
510  /// else
511  /// return false;
512  /// @endcode
513  virtual bool saveSharedLoadData(UT_JSONWriter &w, GA_SaveMap &save, GA_GeometryIndex* geometryIndex) const;
514 
515 
516  virtual bool registerSharedLoadData(int load_data_type, GA_SharedDataHandlePtr item);
517 
518  virtual bool loadH9(UT_IStream &is,
519  const UT_Array<GA_AttribLoadDataH9> &prim_attribs,
520  const UT_Array<GA_AttribLoadDataH9> &vtx_attribs);
521  virtual bool saveH9(std::ostream &os, bool binary,
522  const UT_Array<GA_AttribSaveDataH9> &prim_attribs,
523  const UT_Array<GA_AttribSaveDataH9> &vtx_attribs)
524  const;
525 
526  // ------------ Intrinsic interface ------------
527  /// Get the intrinsic manager for primitive intrinsics.
528  /// All primitives have at least the following intrinsics:
529  /// - "string typename" @n The type name of the primitive
530  /// - "int typeid" @n The type id (may change per run)
531  /// - "int vertexcount" @n The number of vertices in the primitive
533  { return getTypeDef().getIntrinsicManager(); }
534 
535  /// @{
536  /// Query properties of the primitive intrinsic.
537  /// Note that the tuple size calls the virtual method since the tuple size
538  /// may be dynamic (i.e. basis knot vector)
539  GA_LocalIntrinsic findIntrinsic(const char *nm) const
540  { return getIntrinsicManager().getLocalHandle(nm); }
542  { return getIntrinsicManager().getLocalHandle(h); }
544  { return getIntrinsicManager().getGlobalHandle(h); }
545 
547  { return getIntrinsicManager().getName(h); }
548  GA_Size getIntrinsicTupleSize(GA_LocalIntrinsic h) const;
550  { return getIntrinsicManager().getStorage(h); }
552  { return getIntrinsicManager().getReadOnly(h); }
554  { return getIntrinsicManager().getOptions(h); }
555  /// @}
556 
557  /// @{
558  /// Get the value of a primitive intrinsic.
559  /// These methods return the number of items retrieved.
560  GA_Size getIntrinsic(GA_LocalIntrinsic h, UT_String &val) const;
561  GA_Size getIntrinsic(GA_LocalIntrinsic h, UT_StringArray &val) const;
562  GA_Size getIntrinsic(GA_LocalIntrinsic h, int64 *v, GA_Size size) const;
563  GA_Size getIntrinsic(GA_LocalIntrinsic h, fpreal64 *v, GA_Size sz) const;
564  /// @}
565 
566  /// @{
567  /// Get the value of a primitive intrinsic.
568  /// Returns false if not the right type or not found.
569  /// Always will clear out the provided value.
570  bool getIntrinsic(GA_LocalIntrinsic h, float &v) const;
571  bool getIntrinsic(GA_LocalIntrinsic h, int &v) const;
572  bool getIntrinsic(GA_LocalIntrinsic h, UT_Vector2 &v) const;
573  bool getIntrinsic(GA_LocalIntrinsic h, UT_Vector3 &v) const;
574  bool getIntrinsic(GA_LocalIntrinsic h, UT_Vector4 &v) const;
575  bool getIntrinsic(GA_LocalIntrinsic h, UT_Matrix2 &v) const;
576  bool getIntrinsic(GA_LocalIntrinsic h, UT_Matrix3 &v) const;
577  bool getIntrinsic(GA_LocalIntrinsic h, UT_Matrix4 &v) const;
578 
579  /// @}
580 
581  /// @{
582  /// Set intrinsic attributes. This will fail if the intrinsic is read-only.
583  /// These methods return the number of items set.
584  GA_Size setIntrinsic(GA_LocalIntrinsic h, const char *value);
585  GA_Size setIntrinsic(GA_LocalIntrinsic h, const UT_StringArray &value);
586  GA_Size setIntrinsic(GA_LocalIntrinsic h, const char **val, GA_Size s);
587  GA_Size setIntrinsic(GA_LocalIntrinsic h, const int64 val);
588  GA_Size setIntrinsic(GA_LocalIntrinsic h, const fpreal64 val);
589  GA_Size setIntrinsic(GA_LocalIntrinsic h, const int64 *val, GA_Size sz);
590  GA_Size setIntrinsic(GA_LocalIntrinsic h, const fpreal64 *v, GA_Size sz);
591  /// @}
592 
593  /// Private interface
594  /// The clearForDeletion() method is called just prior to the detail being
595  /// cleared out. This allows the primitive to simplify its data structures,
596  /// knowing that topology doesn't need to be maintained (i.e. unwiring all
597  /// vertices);
598  virtual void clearForDeletion() {}
599 
600  /// Return the next and previous vertex on the "boundary" of the primitive
601  /// (as understood by the primitive) relative to a given vertex. These are
602  /// needed to maintain half-edge topology attributes.
603  /// They must be implemented for primitives that realize a notion of a
604  /// boundary composed of one or more closed cycles of vertices if we want
605  /// to be able to use hedges to quickly move from such a primitive to
606  /// another sharing an edge with it. A GA_INVALID_OFFSET for prev_vtx or
607  /// next_vtx means that either the primitive doesn't care about hedges,
608  /// the input vertex is not a boundary vertex in the primitive (or not a
609  /// vertex at all), or vtx is at an end of a boundary (e.g. open polys).
611  GA_Offset &prev_vtx,
612  GA_Offset &next_vtx) const
613  { prev_vtx = next_vtx = GA_INVALID_OFFSET; }
614 
615  /// Primitives that implement getAdjacentBoundaryVertices must respond true
616  /// to supportsHedge().
617  virtual bool supportsHedge() const
618  { return false; }
619 
620  /// Release the given vertex. This is equivalent to deleting a vertex
621  /// without modifying its topology attributes. In other words, the primitive
622  /// doesn't use the vertex anymore, but the vertex stays wired to the
623  /// primitive and to the point it was wired to. The intended use is with
624  /// stealVertex methods, so that the same vertex can be aquired by another
625  /// primitive, thus maintaining its offset number and attributes The return
626  /// value is the vertex offset (same as input) if successful and
627  /// GA_INVALID_OFFSET otherwise.
629  { return GA_INVALID_OFFSET; }
630 
631 
632  /// Backward compatible methods for GD library
633  /// Determine whether the primitive is visisble on the interval of the
634  /// parent surface. Partial visiblity should return true as well.
635  /// @return
636  /// - @c 0: Not visible on parent surface
637  /// - @c 1: Full visibility (@b default)
638  /// - @c 2: Partial visibility
639  virtual int isVisible() const;
640 
641  /// A primitive may support any number of secondary details.
642  virtual unsigned getNumSecondaryDetails() const;
643  virtual const GA_Detail *getSecondaryDetail(GA_Index i) const;
644  virtual GA_Detail *getSecondaryDetail(GA_Index i);
645 
646  GA_Index getNumSecondary(GA_Index detail) const;
647  const GA_Primitive *getSecondaryByIndex(GA_Index detail, GA_Index i) const;
648  GA_Primitive *getSecondaryByIndex(GA_Index detail, GA_Index i);
649  const GA_Primitive *getSecondaryByOffset(GA_Index detail,
650  GA_Offset o) const;
651  GA_Primitive *getSecondaryByOffset(GA_Index detail, GA_Offset o);
652 
653  /// @{
654  /// Primitives must provide these methods
655  virtual void reverse() = 0;
656  /// @}
657 
658  /// @{
659  /// Measure the primitive.
660  virtual fpreal calcVolume(const UT_Vector3 &refpt) const
661  { return 0; }
662  virtual fpreal calcArea() const { return 0; }
663  virtual fpreal calcPerimeter() const { return 0; }
664  /// @}
665 
666  /// A trivial vertex list is a uniform ascending list, so
667  /// getFastVertexOffset(i) == getFastVertexOffset(0) + i
669  bool isVertexListTrivial() const { return myVertexList.isTrivial(); }
670  /// A trivial point list is doubly-trivial:
671  /// getPointOffset(i) == getPointOffset(0) + i
672  /// This requires testing every point so is slower than isVertexListTrivial.
673  bool isPointListTrivial() const;
674 
675  /// Calls a functor (e.g. a lambda) for each vertex offset in this
676  /// primitive, in the order they occur in the vertex list.
677  /// This is optimized to only check triviality once.
678  template<typename FUNCTOR>
680  void forEachVertex(FUNCTOR &&functor) const
681  {
682  myVertexList.forEach(functor);
683  }
684 
685  /// Calls a functor (e.g. a lambda) for each point offset in this
686  /// primitive, in the order they occur in the vertex list.
687  /// This is optimized to only check triviality once and only look up
688  /// the vertex-to-point topology attribute once.
689  template<typename FUNCTOR>
691  void forEachPoint(FUNCTOR &&functor) const
692  {
693  const GA_ATITopology *vtx_to_pt = myDetail->getTopology().getPointRef();
694  myVertexList.forEach([vtx_to_pt,&functor](GA_Offset vtx){
695  functor(vtx_to_pt->getLink(vtx));
696  });
697  }
698 
699  bool vertexApply(bool(*apply)(GA_Offset vtx, void *),
700  void *data = nullptr) const
701  {
702  for (GA_Size i = 0, n = getVertexCount(); i < n; ++i)
703  {
704  if (apply(getVertexOffset(i), data))
705  return true;
706  }
707  return false;
708  }
709 
710  /// Stash (deactivate) or unstash (reactivate) the primitive.
711  ///
712  /// Stashing a primitive will set its offset to that specified, typically
713  /// GA_INVALID_OFFSET. Primitives are only stashed as part of clearing a
714  /// detail, so there is no need to explicitly deallocate vertices. It is
715  /// safe to delete a stashed primitive.
716  ///
717  /// Unstashing a primitive will re-register that primitive with its parent
718  /// detail at the specified offset (or a new offset if GA_INVALID_OFFSET).
719  virtual void stashed(bool beingstashed,
721 
722  /// Copy any modified caches from the GPU back to CPU cache.
723  virtual void flushCEWriteCaches() {}
724 
725  /// Copy any modified caches from the GPU to CPU. Then delete the GPU
726  /// cache.
727  virtual void flushCECaches() {}
728 
729  static SYS_FORCE_INLINE
732  {
734  if (type_id < GA_PrimCompat::TypeMaskBits)
735  m = (GA_PrimCompat::value_type)1 << type_id;
736  return GA_PrimCompat::TypeMask(m);
737  }
738 
739 protected:
740  void setNumVertices(GA_Size nvertices);
741 
742  /// allocateVertex() will call wireVertex() if the point given is not -1
743  GA_Offset allocateVertex(GA_Offset point=GA_INVALID_OFFSET);
744  void destroyVertex(GA_Offset vertex);
745  void wireVertex(GA_Offset vertex, GA_Offset point);
746 
747  /// Create the topological binding between preallocated vertex and
748  /// primitive.
749  void registerVertex(GA_Offset vertex);
750 
751  /// Report approximate memory usage for myVertexList for subclasses.
754  {
755  return myVertexList.getMemoryUsage(false);
756  }
757 
758  /// This is called by the subclasses to count the
759  /// memory used by myVertexList
760  void countBaseMemory(UT_MemoryCounter &counter) const;
761 
762  /// This is the implementation of this level of copyUnwiredForMerge,
763  /// and enables GA_PrimitiveList to set the vertex list without a
764  /// source primitive.
765  void copyVertexListForMerge(
766  const GA_OffsetListRef &src_vertices, const GA_MergeMap &map);
767 
768  /// @{
769  /// Implementation of intrinsic attributes. See GA_IntrinsicEval
770  /// for further details. See GA_IntrinsicMacros.h for implementation of
771  /// intrinsics.
772  /// @note When implementing support for string intrinsic attributes, please
773  /// ensure to implement for @b all methods (localGetIntrinsicS,
774  /// localGetIntrinsicSA for reading and localSetIntrinsicSA,
775  /// localSetIntrinsicSS for writing). You should do this even if the
776  /// string tuple size is 1.
778  /// @}
779 
780 private:
781 
783  void unstashImpl(GA_Offset offset)
784  {
785  UT_ASSERT_P(myVertexList.size() == 0);
786  myOffset = offset;
787  }
788 
789  friend class GA_PrimitiveList;
790 
791  GA_Detail *myDetail;
792  GA_Offset myOffset;
793 protected:
795 };
796 
800 {
801  return myPrimitiveList.getVertexList(primoff);
802 }
803 
805 GA_Size
807 {
808  return myPrimitiveList.getVertexCount(primoff);
809 }
810 
812 GA_Offset
814 {
815  return myPrimitiveList.getVertexOffset(primoff, i);
816 }
817 
819 int
821 {
822  return myPrimitiveList.getTypeId(primoff);
823 }
824 
826 bool
828 {
829  return myPrimitiveList.getClosedFlag(primoff);
830 }
831 
833 void
835 {
836  myPrimitiveList.setClosedFlag(primoff, closed);
837 }
838 
839 #if COMPRESSED_PRIM_LIST
843 {
844  UT_ASSERT_P(!myDetail.getPrimitiveMap().isOffsetVacant(primoff));
845  const GA_Primitive *const*prim_array = myList;
846  if (!prim_array)
847  {
848  GA_PageNum pagenum = GAgetPageNum(primoff);
849  GA_PageOff pageoff = GAgetPageOff(primoff);
850  auto p = myVertexLists.getPageData(pagenum);
851  UT_ASSERT_COMPILETIME(2*sizeof(*p) == sizeof(GA_OffsetListRef));
852  auto po = reinterpret_cast<const GA_OffsetListRef*>(p);
853  if (myVertexLists.isPageConstant(pagenum))
854  {
855  exint size = po->size();
856  return GA_OffsetListRef(po->trivialStart() + size*pageoff, size, po->getExtraFlag());
857  }
858  else
859  {
860  return po[pageoff];
861  }
862  }
863  else
864  {
865  UT_ASSERT_P(GAisValid(primoff) && primoff < GA_Offset(getMyListSize()));
866  return GA_OffsetListRef(prim_array[primoff]->myVertexList);
867  }
868 }
869 
871 GA_Size
873 {
874  UT_ASSERT_P(!myDetail.getPrimitiveMap().isOffsetVacant(primoff));
875  const GA_Primitive *const*prim_array = myList;
876  if (!prim_array)
877  {
878  GA_PageNum pagenum = GAgetPageNum(primoff);
879  UT_ASSERT_COMPILETIME(2*sizeof(int64) == sizeof(GA_OffsetList));
880  auto p = reinterpret_cast<const GA_OffsetList*>(myVertexLists.getPageData(pagenum));
881  if (!myVertexLists.isPageConstant(pagenum))
882  {
883  p += GAgetPageOff(primoff);
884  }
885  return p->size();
886  }
887  else
888  {
889  UT_ASSERT_P(GAisValid(primoff) && primoff < GA_Offset(getMyListSize()));
890  return prim_array[primoff]->getVertexCount();
891  }
892 }
893 
895 GA_Offset
897 {
898  UT_ASSERT_P(!myDetail.getPrimitiveMap().isOffsetVacant(primoff));
899  const GA_Primitive *const*prim_array = myList;
900  if (!prim_array)
901  {
902  GA_PageNum pagenum = GAgetPageNum(primoff);
903  GA_PageOff pageoff = GAgetPageOff(primoff);
904  UT_ASSERT_COMPILETIME(2*sizeof(int64) == sizeof(GA_OffsetList));
905  auto p = reinterpret_cast<const GA_OffsetList*>(myVertexLists.getPageData(pagenum));
906  if (!myVertexLists.isPageConstant(pagenum))
907  {
908  return p[pageoff].get(i);
909  }
910  return p->trivialStart() + p->size()*pageoff + i;
911  }
912  else
913  {
914  UT_ASSERT_P(GAisValid(primoff) && primoff < GA_Offset(getMyListSize()));
915  return prim_array[primoff]->getVertexOffset(i);
916  }
917 }
918 
920 int
922 {
923  UT_ASSERT_P(!myDetail.getPrimitiveMap().isOffsetVacant(primoff));
924  const GA_Primitive *const*prim_array = myList;
925  if (!prim_array)
926  {
927  return myPrimitiveTypes.get(primoff);
928  }
929  else
930  {
931  UT_ASSERT_P(GAisValid(primoff) && primoff < GA_Offset(getMyListSize()));
932  return prim_array[primoff]->getTypeId().get();
933  }
934 }
935 
937 bool
939 {
940  UT_ASSERT_P(!myDetail.getPrimitiveMap().isOffsetVacant(primoff));
941  const GA_Primitive *const*prim_array = myList;
942  if (!prim_array)
943  {
944  GA_PageNum pagenum = GAgetPageNum(primoff);
945  auto p = myVertexLists.getPageData(pagenum);
946  if (!myVertexLists.isPageConstant(pagenum))
947  {
948  p += 2*GAgetPageOff(primoff);
949  }
950  UT_ASSERT_COMPILETIME(2*sizeof(*p) == sizeof(GA_OffsetList));
951  return reinterpret_cast<const GA_OffsetList*>(p)->getExtraFlag();
952  }
953  else
954  {
955  UT_ASSERT_P(GAisValid(primoff) && primoff < GA_Offset(getMyListSize()));
956  return prim_array[primoff]->myVertexList.getExtraFlag();
957  }
958 }
959 
961 void
963 {
964  UT_ASSERT_P(!myDetail.getPrimitiveMap().isOffsetVacant(primoff));
965  GA_Primitive *const*prim_array = myList;
966  if (!prim_array)
967  {
968  GA_PageNum pagenum = GAgetPageNum(primoff);
969  auto p = hardenVertexListPage(pagenum);
970  GA_PageOff pageoff = GAgetPageOff(primoff);
971  return p[pageoff].setExtraFlag(closed);
972  }
973  else
974  {
975  UT_ASSERT_P(GAisValid(primoff) && primoff < GA_Offset(getMyListSize()));
976  return prim_array[primoff]->myVertexList.setExtraFlag(closed);
977  }
978 }
979 #else
983 {
984  return GA_OffsetListRef(myList[off]->myVertexList);
985 }
986 
988 GA_Size
990 {
991  return myList[off]->getVertexCount();
992 }
993 
995 GA_Offset
997 {
998  return myList[primoff]->getVertexOffset(i);
999 }
1000 
1002 int
1004 {
1005  return myList[off]->getTypeId().get();
1006 }
1007 
1009 void
1011 {
1012  list = myList[off]->myVertexList;
1013 }
1014 
1016 bool
1018 {
1019  return myList[off]->myVertexList.getExtraFlag();
1020 }
1021 
1023 void
1024 GA_PrimitiveList::setClosedFlag(GA_Offset primoff, bool closed)
1025 {
1026  return myList[primoff]->myVertexList.setExtraFlag(closed);
1027 }
1028 #endif
1029 
1030 #endif
virtual void flushCEWriteCaches()
Copy any modified caches from the GPU back to CPU cache.
Definition: GA_Primitive.h:723
A class to manage an ordered array which has fixed offset handles.
Definition: GA_IndexMap.h:63
virtual void flushCECaches()
Definition: GA_Primitive.h:727
#define UT_ASSERT_COMPILETIME(expr)
Definition: UT_Assert.h:109
SYS_FORCE_INLINE const GA_IndexMap & getIndexMap() const
Gets the index map for primitives in the detail containing this primitive.
Definition: GA_Primitive.h:147
SYS_FORCE_INLINE bool isPageConstant(UT_PageNum pagenum) const
Returns true iff the specified page is constant-compressed.
Definition of a geometry attribute.
Definition: GA_Attribute.h:189
SYS_FORCE_INLINE GA_Offset getPrimitiveVertexOffset(GA_Offset primoff, GA_Size i) const
Definition: GA_Primitive.h:813
SYS_FORCE_INLINE GA_Offset getPointOffset(GA_Size i) const
Definition: GA_Primitive.h:249
SYS_FORCE_INLINE void setClosedFlag(GA_Offset primoff, bool closed)
Definition: GA_Primitive.h:962
GA_LocalIntrinsic findIntrinsic(const char *nm) const
Definition: GA_Primitive.h:539
SYS_FORCE_INLINE GA_Detail & getDetail() const
Definition: GA_Primitive.h:132
virtual void clearForDeletion()
Definition: GA_Primitive.h:598
Used to pass options and map offset values during saving.
Definition: GA_SaveMap.h:48
const GA_IndexMap & getPrimitiveMap() const
Definition: GA_Detail.h:666
SYS_FORCE_INLINE GA_Size getVertexCount() const
Return the number of vertices used by this primitive.
Definition: GA_Primitive.h:227
GA_Size GA_PageOff
Definition: GA_Types.h:621
virtual fpreal calcPerimeter() const
Definition: GA_Primitive.h:663
SYS_FORCE_INLINE GA_Offset getLink(GA_Offset ai) const
SYS_FORCE_INLINE int getPrimitiveTypeId(GA_Offset primoff) const
Definition: GA_Primitive.h:820
SYS_FORCE_INLINE GA_Index getVertexIndex(GA_Size primvertexnum) const
Definition: GA_Primitive.h:241
bool hasLocalTransform() const
Whether the primitive has a transform associated with it.
Definition: GA_Primitive.h:180
GA_StorageClass
Definition: GA_Types.h:68
bool getIntrinsicReadOnly(GA_LocalIntrinsic h) const
Definition: GA_Primitive.h:551
const GLdouble * v
Definition: glcorearb.h:836
GA_LocalIntrinsic findIntrinsic(GA_GlobalIntrinsic h) const
Definition: GA_Primitive.h:541
bool GAisValid(GA_Size v)
Definition: GA_Types.h:625
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
#define SYS_DEPRECATED_HDK_REPLACE(__V__, __R__)
const GLuint GLenum const void * binary
Definition: glcorearb.h:1923
bool isOffsetVacant(GA_Offset offset) const
SYS_FORCE_INLINE bool getExtraFlag() const
GA_PrimitiveFamilyMask getFamilyMask() const
Definition: GA_Primitive.h:174
virtual ~GA_Primitive()
Definition: GA_Primitive.h:116
The merge map keeps track of information when merging details.
Definition: GA_MergeMap.h:53
SYS_FORCE_INLINE void setPointOffset(GA_Size i, GA_Offset ptoff)
Definition: GA_Primitive.h:255
SYS_FORCE_INLINE DEST_DATA_T get(IDX_T i, exint component=0) const
Definition: UT_PageArray.h:484
SYS_FORCE_INLINE const GA_PrimitiveTypeId & getTypeId() const
Definition: GA_Primitive.h:172
Class used to map H9 geometry files to a form used by GA.
Definition: GA_AIFFileH9.h:317
#define GA_DECLARE_INTRINSICS(OVERRIDE)
Definition: GA_Primitive.h:79
Manager to keep track of global handle to name mappings.
#define GA_API
Definition: GA_API.h:12
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
Abstract base class for a range membership query object.
#define GA_NO_OVERRIDE
Definition: GA_Primitive.h:75
GLfloat GLfloat GLfloat v2
Definition: glcorearb.h:817
GA_ListTypeRef< GA_Size, GA_Offset > GA_OffsetListRef
virtual int64 getMemoryUsage() const
Definition: GA_Primitive.h:204
png_uint_32 i
Definition: png.h:2877
uint64 value_type
Definition: GA_PrimCompat.h:29
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:211
SYS_FORCE_INLINE int64 getBaseMemoryUsage() const
Report approximate memory usage for myVertexList for subclasses.
Definition: GA_Primitive.h:753
GA_PageOff GAgetPageOff(GA_Offset v)
Definition: GA_Types.h:636
bool isFamily(unsigned family_mask) const
Definition: GA_Primitive.h:176
GA_PrimitiveFamilyMask
SYS_FORCE_INLINE bool getPrimitiveClosedFlag(GA_Offset primoff) const
Definition: GA_Primitive.h:827
GLsizeiptr size
Definition: glcorearb.h:663
#define GA_INVALID_OFFSET
Definition: GA_Types.h:654
GA_OffsetList myVertexList
Definition: GA_Primitive.h:794
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:101
A range of elements in an index-map.
Definition: GA_Range.h:42
int GA_GlobalIntrinsic
Definition: GA_Types.h:667
SYS_FORCE_INLINE GA_Size getVertexCount(GA_Offset primoff) const
Definition: GA_Primitive.h:872
GA_Size GA_Offset
Definition: GA_Types.h:617
long long int64
Definition: SYS_Types.h:100
int GA_LocalIntrinsic
Definition: GA_Types.h:666
const GA_IntrinsicManager & getIntrinsicManager() const
Definition: GA_Primitive.h:532
SYS_FORCE_INLINE UT_Vector3 getPos3(GA_Size i) const
Definition: GA_Primitive.h:269
GLdouble n
Definition: glcorearb.h:2007
Class used to keep track of inheritance of intrinsic attribute evaluation.
SYS_FORCE_INLINE GA_OffsetListRef getVertexList(GA_Offset primoff) const
Definition: GA_Primitive.h:842
int64 exint
Definition: SYS_Types.h:109
virtual GA_PrimCompat::TypeMask getPrimitiveId() const
Definition: GA_Primitive.h:199
GA_Range getPointRange(bool harden=false) const
Definition: GA_Primitive.h:299
double fpreal64
Definition: SYS_Types.h:185
SYS_FORCE_INLINE GA_OffsetListRef getPrimitiveVertexList(GA_Offset primoff) const
Definition: GA_Primitive.h:799
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
GA_GlobalIntrinsic findGlobalIntrinsic(GA_LocalIntrinsic h) const
Definition: GA_Primitive.h:543
GLintptr offset
Definition: glcorearb.h:664
Provide a JSON interface to a primitive.
SYS_FORCE_INLINE void forEachPoint(FUNCTOR &&functor) const
Definition: GA_Primitive.h:691
virtual fpreal calcArea() const
Definition: GA_Primitive.h:662
SYS_FORCE_INLINE bool isVertexListTrivial() const
Definition: GA_Primitive.h:669
SYS_FORCE_INLINE UT_Vector4 getPos4(GA_Size i) const
Definition: GA_Primitive.h:281
std::function< bool(const GA_Edge &edge)> GA_IterateEdgesFunc
Definition: GA_Primitive.h:72
virtual bool supportsHedge() const
Definition: GA_Primitive.h:617
SYS_FORCE_INLINE int get() const
Defragmentation of IndexMaps.
Definition: GA_Defragment.h:45
GLboolean * data
Definition: glcorearb.h:130
#define SYS_DEPRECATED_HDK(__V__)
std::function< bool(GA_Size, GA_Size)> GA_IterateEdgesByVertexFunc
Definition: GA_Primitive.h:73
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:611
const NotVoidType * getPageData(UT_PageNum pagenum) const
SYS_FORCE_INLINE GA_Index getPointIndex(GA_Size i) const
Definition: GA_Primitive.h:263
SYS_FORCE_INLINE void setPos3(GA_Size i, const UT_Vector3 &pos) const
Definition: GA_Primitive.h:275
const char * getIntrinsicName(GA_LocalIntrinsic h) const
Definition: GA_Primitive.h:546
SYS_FORCE_INLINE bool getClosedFlag(GA_Offset primoff) const
Definition: GA_Primitive.h:938
A list of primitives.
bool vertexApply(bool(*apply)(GA_Offset vtx, void *), void *data=nullptr) const
Definition: GA_Primitive.h:699
SYS_FORCE_INLINE void setPos4(GA_Size i, const UT_Vector4 &pos) const
Definition: GA_Primitive.h:287
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2001
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:263
bool isPointUsed(GA_Offset ptoff) const
Definition: GA_Primitive.h:309
A map of string to various well defined value types.
Definition: UT_Options.h:42
SYS_FORCE_INLINE GA_Index getMapIndex() const
Gets the index of this primitive in the detail containing it.
Definition: GA_Primitive.h:142
const UT_Options * getIntrinsicOptions(GA_LocalIntrinsic h) const
Definition: GA_Primitive.h:553
virtual fpreal calcVolume(const UT_Vector3 &refpt) const
Definition: GA_Primitive.h:660
GA_StorageClass getIntrinsicStorage(GA_LocalIntrinsic h) const
Definition: GA_Primitive.h:549
virtual void getAdjacentBoundaryVertices(GA_Offset vtx, GA_Offset &prev_vtx, GA_Offset &next_vtx) const
Definition: GA_Primitive.h:610
SYS_FORCE_INLINE void setExtraFlag(bool v)
SYS_FORCE_INLINE void forEachVertex(FUNCTOR &&functor) const
Definition: GA_Primitive.h:680
GA_Size GA_PageNum
Definition: GA_Types.h:620
SYS_FORCE_INLINE GA_Offset getMapOffset() const
Gets the offset of this primitive in the detail containing it.
Definition: GA_Primitive.h:137
Class used to map the GA attribute into a form for H9 geometry files.
Definition: GA_AIFFileH9.h:261
GLfloat GLfloat v1
Definition: glcorearb.h:816
GLuint GLfloat * val
Definition: glcorearb.h:1607
void(* GA_EdgeApplyFunc)(const GA_Primitive &prim, GA_Offset pt_a, GA_Offset pt_b, void *data)
Definition: GA_Primitive.h:67
SYS_FORCE_INLINE GA_Offset getVertexOffset(GA_Size primvertexnum) const
Definition: GA_Primitive.h:235
SYS_FORCE_INLINE void setPrimitiveClosedFlag(GA_Offset primoff, bool closed)
Definition: GA_Primitive.h:834
SYS_FORCE_INLINE ToType get(FromType index) const
Get the the value at the index.
Container class for all geometry.
Definition: GA_Detail.h:96
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
SYS_FORCE_INLINE GA_Size getPrimitiveVertexCount(GA_Offset primoff) const
Definition: GA_Primitive.h:806
Definition of a geometric primitive.
#define const
Definition: zconf.h:214
bool isPrimary() const
Definition: GA_Primitive.h:160
const char * getTypeName() const
Definition: GA_Primitive.h:124
GA_Range getVertexRange(bool harden=false) const
Get a range of all the vertices accessed by the primitive.
Definition: GA_Primitive.h:291
SYS_FORCE_INLINE GA_Primitive(GA_Detail &detail, GA_Offset offset=GA_INVALID_OFFSET)
Definition: GA_Primitive.h:107
void(* GA_EdgeApplyIndexFunc)(const GA_Primitive &prim, GA_Size v1, GA_Size v2, void *data)
Definition: GA_Primitive.h:69
virtual GA_Offset releaseVertex(GA_Offset vtx)
Definition: GA_Primitive.h:628
virtual void iterateEdgesByVertex(GA_IterateEdgesByVertexFunc apply_func) const
Definition: GA_Primitive.h:352
SYS_FORCE_INLINE int getTypeId(GA_Offset primoff) const
Definition: GA_Primitive.h:921
GA_PageNum GAgetPageNum(GA_Offset v)
Definition: GA_Types.h:632
SYS_FORCE_INLINE FromType size() const
Returns the number of used elements in the list (always <= capacity())
static SYS_FORCE_INLINE GA_PrimCompat::TypeMask primCompatMaskFromTypeId(int type_id)
Definition: GA_Primitive.h:731
GLenum src
Definition: glcorearb.h:1792
SYS_FORCE_INLINE GA_Offset getVertexOffset(GA_Offset primoff, GA_Size i) const
Definition: GA_Primitive.h:896