HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GU_LoopHelper.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: GU_LoopHelper.h
7  *
8  * COMMENTS:
9  * This is a helper class for creating nice edge/prim/point loops.
10  */
11 
12 #ifndef __GU_LoopHelper_h__
13 #define __GU_LoopHelper_h__
14 
15 #include "GU_API.h"
16 #include "GU_SelectType.h"
17 #include "GU_PathFinder.h"
18 #include "GU_Detail.h"
19 #include <GEO/GEO_HedgeInterface.h>
20 
22 {
26 };
27 
29 {
30 public:
31  GU_LoopHelper();
32  ~GU_LoopHelper();
33 
34  // New edge loop methods to later fully replace the old ones
35  bool primLoop(const GA_Index start,
36  const GA_Index end,
37  GU_LoopType loop_type,
38  UT_Array<GEO_SHedge> &loop);
39 
40  bool edgeLoop(const GEO_Hedge &start,
41  const GEO_Hedge &end,
42  GU_LoopType loop_type,
43  bool allow_ring,
44  UT_Array<GEO_SHedge> &loop);
45 
46  bool edgeRing(const GEO_Hedge &start,
47  const GEO_Hedge &end,
48  GU_LoopType loop_type,
49  UT_Array<GEO_SHedge> &loop);
50 
51  bool pointLoop(const GA_Index start,
52  const GA_Index end,
53  GU_LoopType loop_type,
54  UT_Array<GEO_SHedge> &loop);
55 
56  // Sets the active detail, should only be called by setActiveNode.
57  void setActiveDetail(const GU_Detail *gdp);
58 
59  // Returns our active detail. May be NULL.
60  const GU_Detail *getActiveDetail() const;
61 
62  // Access our cached ring zero. The first time this is called with a new
63  // detail it will create a new ring zero.
65  *getActiveRingZero();
66 
67  // Access our cached hedge interface. The first time this is called with
68  // a new detail it will create a new hedge interface.
70  *getActiveHedgeInterface();
71 
72 private:
73  GU_EdgeRingFinder *getRingFinder();
74 
75  GU_EdgeRingFinder *getLeftRingFinder();
76  GU_EdgeRingFinder *getRightRingFinder();
77  GU_EdgeRingFinder *getSpareRingFinder();
78 
79  GU_EdgeLoopFinder *getLeftLoopFinder();
80  GU_EdgeLoopFinder *getRightLoopFinder();
81  GU_EdgeLoopFinder *getSpareLoopFinder();
82 
83  void addPathToPointGroup(
85  GA_PointGroup *grp);
86 
87  void addPathToPrimitiveGroup(
88  const UT_Array<GEO_SHedge> &path,
89  GA_PrimitiveGroup *grp);
90 
91  // Returns true (and returns the shortest partial edge ring in "path") if
92  // the the start and end edges given by ssh and esh suggest an edge ring
93  // selection more than they do an edge loop one. This is the case exactly
94  // when ssh and esh are distinct and there is a perfect partial edge
95  // from start and end but while no perfect edge loops can be found between
96  // them. If false is returned the shortest perfect edge loop between start
97  // and end is returned as evidence.
98  bool shouldFindEdgeRingInstead(GEO_SHedge ssh,
99  GEO_SHedge esh, UT_Array<GEO_SHedge> &path);
100 
101  bool findPartialEdgeLoop(UT_Array<GEO_SHedge> &loop);
102  bool findPartialEdgeRing(UT_Array<GEO_SHedge> &loop);
103 
104  bool findEdgeLoop(UT_Array<GEO_SHedge> &loop,
105  GU_LoopType loop_type,
106  bool same_start_and_end = false);
107 
108  bool findEdgeRing(UT_Array<GEO_SHedge> &loop,
109  GU_LoopType loop_type,
110  bool is_for_prim_loop = false);
111 
112  int myActiveDetailId;
113  int myActiveDetailMetaCount;
114 
115  UT_UniquePtr<GU_EdgeLoopFinder> myLeftLoopFinder;
116  UT_UniquePtr<GU_EdgeLoopFinder> myRightLoopFinder;
117  UT_UniquePtr<GU_EdgeRingFinder> myLeftRingFinder;
118  UT_UniquePtr<GU_EdgeRingFinder> myRightRingFinder;
119 
120  const GU_Detail *myActiveDetail;
121  UT_UniquePtr<const GEO_DetachedHedgeInterface> myActiveHedgeInterface;
123 };
124 
125 #endif
GLuint start
Definition: glcorearb.h:474
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
GEO_Hedge encapsulates a half-edge (hedge) which is the restriction of.
Definition: GEO_Hedge.h:47
GLuint GLuint end
Definition: glcorearb.h:474
#define GU_API
Definition: GU_API.h:11
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:611
GU_LoopType
Definition: GU_LoopHelper.h:21
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:47