HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_PrimGroup.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 Library (C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __GU_PrimGroup_h__
13 #define __GU_PrimGroup_h__
14 
15 #include "GU_API.h"
16 #include <GEO/GEO_Primitive.h>
17 #include "GU_ElementGroup.h"
18 #include "GU_Detail.h"
19 
20 ////////////////////////////////////////////////////////////////////////////
21 //
22 // GU_PrimGroup - Creates a primitive group and selects specific
23 // primitives to be members given a set of parameters
24 //
25 ////////////////////////////////////////////////////////////////////////////
26 
27 
29 {
30 public:
31  /// Create a detached group that we own.
32  GU_PrimGroup(const GU_Detail *gdp, const GA_PrimitiveTypeId &id)
34  , myId(id)
35  { newGroup(NULL); }
36  GU_PrimGroup(const char *n, GU_Detail *gdp, const GA_PrimitiveTypeId &id)
37  : GU_ElementGroup(gdp)
38  , myId(id)
39  { newGroup(n); }
41  : GU_ElementGroup(gdp)
42  {
43  myName = primGroup->getName();
44  setGroup(primGroup);
45  }
46  ~GU_PrimGroup() override;
47 
48  GA_PrimitiveGroup *primGroup() const;
49 
50  GA_ElementGroup *newGroup(const char *name) override;
51  GA_ElementGroup *find(const char *name) const override;
52  void destroy() override;
53 
54  // Goes through the methods below with the given parameters and creates
55  // a group.
56  void generateGroup(const GU_GroupParms &parms) override;
57 
58  // methods that allow you to select objects to be in the group
59  void range(int num, int, int, int, int, int) const override;
60  void pattern(const char *pattern, int nelements,
61  int) const override;
62  void patternGroup(const char *pattern,
63  bool order) const override;
64  int boundingBox(float, float, float, float, float, float,
65  float, float, float, bool) override;
66  void boundingSphere(float tx, float ty, float tz,
67  float radx, float rady, float radz,
68  bool includeNotWhollyContained)
69  const override;
70  void normal(UT_Vector3 &nml, float angle,
71  bool include_opposite=false) const override;
72  void backface(const UT_Vector3 &eye) const;
73  void degenerate(bool degenerate, bool zaf, bool doOpen,
74  float tol) const override;
75 
76  void nonplanar(float tol) const;
77 
78  void randomChance(float seed, float frac, bool use_attrib,
79  const char *attrib_name) const override;
80 private:
81  /// The name of the group, or NULL if a detached group
82  const char *myName;
83  GA_PrimitiveTypeId myId;
84 
85  bool primInsideSphere(const GU_Detail &detail, GA_Offset primoff,
86  float, float, float, float, float, float, bool) const;
87 
88  bool matchTypeId(const GA_PrimitiveTypeId &id) const;
89 };
90 
91 #endif
virtual void normal(UT_Vector3 &nml, float angle, bool include_opposite) const =0
virtual int boundingBox(float, float, float, float, float, float, float, float, float, bool)
virtual void randomChance(float seed, float frac, bool use_attrib, const char *attrib_name) const =0
SIM_API const UT_StringHolder angle
SYS_FORCE_INLINE T * SYSconst_cast(const T *foo)
Definition: SYS_Types.h:136
virtual void generateGroup(const GU_GroupParms &parms)=0
virtual void patternGroup(const char *pattern, bool order) const =0
SYS_FORCE_INLINE const UT_StringHolder & getName() const
Definition: GA_Attribute.h:283
GA_Size GA_Offset
Definition: GA_Types.h:646
virtual void range(int, int, int, int, int, int) const =0
void setGroup(GA_Group *grp)
Definition: GU_Group.h:227
virtual GA_Group * find(const char *) const =0
GLdouble n
Definition: glcorearb.h:2008
virtual void destroy()=0
virtual void pattern(const char *pattern, int nelements, int order) const =0
GU_PrimGroup(GU_Detail *gdp, GA_PrimitiveGroup *primGroup)
Definition: GU_PrimGroup.h:40
GLdouble GLdouble GLint GLint order
Definition: glad.h:2676
#define GU_API
Definition: GU_API.h:14
GLuint const GLchar * name
Definition: glcorearb.h:786
GLushort pattern
Definition: glad.h:2583
virtual void boundingSphere(float, float, float, float, float, float, bool) const =0
virtual void degenerate(bool degenerate, bool zaf, bool doOpen, float tol) const =0
GU_PrimGroup(const char *n, GU_Detail *gdp, const GA_PrimitiveTypeId &id)
Definition: GU_PrimGroup.h:36
virtual GA_Group * newGroup(const char *)=0
GU_PrimGroup(const GU_Detail *gdp, const GA_PrimitiveTypeId &id)
Create a detached group that we own.
Definition: GU_PrimGroup.h:32