HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_PrimPart.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_PrimParticle.h (C++)
7  *
8  * COMMENTS:
9  * Header file for GU_PrimParticle.h class...
10  *
11  */
12 
13 #ifndef __GU_PrimParticle_h__
14 #define __GU_PrimParticle_h__
15 
16 #include "GU_API.h"
17 #include <GEO/GEO_PrimPart.h>
18 #include "GU_Detail.h"
19 
20 class UT_MemoryCounter;
21 class GEO_ConvertParms;
22 
23 /////////////////////////////////////////////////////////////
24 // //
25 // Class: GU_PrimParticle //
26 // Descr: This class is responsible for operations //
27 // done on particle primitives. As we need to //
28 // access the GU_Detail, the pointer is passed in //
29 // the constructor. //
30 // //
31 /////////////////////////////////////////////////////////////
32 
34 {
35 protected:
36  /// NOTE: Primitives should not be deleted directly. They are managed
37  /// by the GA_PrimitiveList and the stash.
38  ~GU_PrimParticle() override {}
39 
40 public:
41  /// NOTE: This constructor should only be called via GU_PrimitiveFactory.
43  : GEO_PrimParticle(gdp, offset)
44  {}
45 
46  /// Report approximate memory usage.
47  int64 getMemoryUsage() const override;
48 
49  /// Count memory usage using a UT_MemoryCounter in order to count
50  /// shared memory correctly.
51  /// NOTE: This should always include sizeof(*this).
52  void countMemory(UT_MemoryCounter &counter) const override;
53 
54  const GA_PrimitiveDefinition &getTypeDef() const override
55  {
56  UT_ASSERT(theDefinition);
57  return *theDefinition;
58  }
59 
60  // Conversion Method
62  GA_PointGroup *usedpts = 0) override;
63  GEO_Primitive *convertNew(GEO_ConvertParms &parms) override;
64 
65  void normal(NormalComp &output) const override;
66  void normal(NormalCompD &output) const override;
67 
68  void restrictedNormal(NormalComp &output,
69  const UT_BitArray &skip_pts) const;
70 
71  // NOTE: For static member functions please call in the following
72  // manner. <ptrvalue> = GU_PrimParticle::<functname>
73  // i.e. partptr = GU_PrimParticle::build(params...);
74 
75  // Optional Build Method
76 
77  static GU_PrimParticle *build(GU_Detail *gdp, GA_Size numparts,
78  bool appendPts = true);
79 
80  void clip(UT_Vector3 nml, float d = 0,
81  GA_PrimitiveGroup *delgroup = 0) override;
82 
83 private:
84  void create(GA_Size numparts);
85 
86  static GA_PrimitiveDefinition *theDefinition;
87  friend class GU_PrimitiveFactory;
89 };
91 
92 #endif
#define SYS_DEPRECATED_PUSH_DISABLE()
#define SYS_DEPRECATED_POP_DISABLE()
virtual int64 getMemoryUsage() const
Definition: GA_Primitive.h:209
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:235
#define GA_INVALID_OFFSET
Definition: GA_Types.h:678
virtual void normal(NormalComp &output) const =0
GA_Size GA_Offset
Definition: GA_Types.h:641
virtual void clip(UT_Vector3 normal, float distance=0, GA_PrimitiveGroup *clipgrp=NULL)
GU_PrimParticle(GU_Detail *gdp, GA_Offset offset=GA_INVALID_OFFSET)
NOTE: This constructor should only be called via GU_PrimitiveFactory.
Definition: GU_PrimPart.h:42
GLintptr offset
Definition: glcorearb.h:665
virtual void countMemory(UT_MemoryCounter &counter) const
long long int64
Definition: SYS_Types.h:116
#define GU_API
Definition: GU_API.h:14
const GA_PrimitiveDefinition & getTypeDef() const override
Definition: GU_PrimPart.h:54
virtual GEO_Primitive * convert(GEO_ConvertParms &parms, GA_PointGroup *usedpts=0)=0
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
Definition of a geometric primitive.
~GU_PrimParticle() override
Definition: GU_PrimPart.h:38
virtual GEO_Primitive * convertNew(GEO_ConvertParms &parms)=0