HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_BVLeafIterator.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  */
7 
8 #ifndef __GU_BVLeafIterator_h__
9 #define __GU_BVLeafIterator_h__
10 
11 #include "GU_API.h"
12 #include "GU_DetailHandle.h"
13 #include <BV/BV_LeafIterator.h>
14 #include <UT/UT_DMatrix4.h>
15 #include <GA/GA_Iterator.h>
16 
17 class GA_PrimitiveGroup;
18 class GEO_Primitive;
19 class GU_Detail;
20 
21 /// Iterator for leaves to be enclosed by bounding volume. This iterator
22 /// fills each leaf with a single primitive.
23 /// Iterator retrieves info about each leaf:
24 /// - a set of vertices forming a bounding volume for the leaf
25 /// - barycenter (centroid) of primitive
27 {
28 public:
30 
31  explicit GU_BVLeafIterator(const GU_ConstDetailHandle &gdh,
32  const GA_PrimitiveGroup *group = 0);
33  explicit GU_BVLeafIterator(const GU_ConstDetailHandle &gdh,
34  const UT_DMatrix4 &transform,
35  const GA_PrimitiveGroup *group = 0);
36  explicit GU_BVLeafIterator(const GU_Detail &gdp,
37  const GA_PrimitiveGroup *group = 0);
38  explicit GU_BVLeafIterator(const GU_Detail &gdp,
39  const UT_DMatrix4 &transform,
40  const GA_PrimitiveGroup *group = 0);
41  ~GU_BVLeafIterator() override;
42 
43 protected:
44  void advanceSubclass() override;
45  void jumpSubclass(int leafId) override;
46  bool atEndSubclass() const override;
47  void rewindSubclass() override;
48  int getLeafIdSubclass() const override;
49 
50  UT_Vector3 calcBarycenterSubclass() const override;
51 
52  void advanceVertexSubclass() override;
53  bool atEndVertexSubclass() const override;
54  void rewindVertexSubclass() override;
55  UT_Vector4 getVertexSubclass() const override;
56 
57  void setSkipDupVertsSubclass(bool flag) override;
58 private:
59  const GU_Detail &getGdp() const;
60 
61  const GEO_Primitive *getOurPrimitive() const;
62  const UT_DMatrix4 &getOurTransform() const;
63 
64  const GEO_Primitive *getPrimitiveByOffset(GA_Offset offset) const;
65 
66  /// Disallowed.
67  /// @{
70  /// @}
71 
73  const GU_Detail &myGdp;
74  bool myHasTransform;
75  const UT_DMatrix4 myTransform;
76  const GA_PrimitiveGroup
77  *myGroup;
78  GA_Iterator myPrimIterator;
79  const GEO_Primitive *myPrim;
80  int myVertex;
81 
82  int *myDupArray;
83  int myDupId;
84 };
85 
86 #endif
virtual void jumpSubclass(int leafId)=0
BV_LeafIterator BaseClass
Iteration over a range of elements.
Definition: GA_Iterator.h:29
virtual int getLeafIdSubclass() const =0
virtual void advanceSubclass()=0
virtual UT_Vector3 calcBarycenterSubclass() const =0
virtual void rewindVertexSubclass()=0
virtual bool atEndSubclass() const =0
GA_Size GA_Offset
Definition: GA_Types.h:646
GLintptr offset
Definition: glcorearb.h:665
virtual void advanceVertexSubclass()=0
#define GU_API
Definition: GU_API.h:14
GA_API const UT_StringHolder transform
virtual UT_Vector4 getVertexSubclass() const =0
virtual bool atEndVertexSubclass() const =0
LeafData & operator=(const LeafData &)=delete
virtual void setSkipDupVertsSubclass(bool flag)=0
virtual void rewindSubclass()=0