HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GEO_PrimMetaBall.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: Geometry Library (C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __GEO_PrimMetaBall_H__
13 #define __GEO_PrimMetaBall_H__
14 
15 #include "GEO_API.h"
16 #include <UT/UT_Vector3.h>
17 #include "GEO_MetaPrim.h"
18 #include "GEO_PrimSphere.h"
19 
20 class TS_MetaEllipsoid;
21 class UT_MemoryCounter;
22 
24 {
25 protected:
26  /// NOTE: The constructor should only be called from subclass
27  /// constructors.
30  {}
31 
32  /// NOTE: The destructor should only be called from subclass
33  /// destructors.
34  ~GEO_PrimMetaBall() override {}
35 
36 public:
37  void copyPrimitive(
38  const GEO_Primitive *src) override;
39  bool isDegenerate() const override;
40  GEO_Primitive *copy(int preserve_shared_pts=0) const override;
41  void copySubclassData(
42  const GA_Primitive *source) override;
43 
44 //
45 // Methods to handle meta interface
46  void fillTSPrim(TS_MetaEllipsoid &tsprim) const;
47 
48  // A function that allocates a new TS_MetaEllipsoid and returns it.
49  // Used in the metaExpression parser to handle multiple instances
50  // of a metaball being used in the same expression
51  TS_MetaPrimitive *getNewMetaPrim() const override;
52 
53  float density(const UT_Vector3 &pos) const override;
54  void getBBox(UT_BoundingBox &bbox) const override;
55 
56  bool getBBox(UT_BoundingBox *bbox) const override
57  { return GEO_PrimSphere::getBBox(bbox); }
58 
59  GEO_MetaPrim *castToMetaPrim() override;
60  const GEO_MetaPrim *castToMetaPrim() const override;
61 
62  const GA_PrimitiveJSON *getJSON() const override;
63 
64 protected:
65  /// We explicitly do not include the mask from the GEO_PrimSphere base.
67  { return GEO_FAMILY_META; }
68 
69  // Declare intrinsic attributes
70  GA_DECLARE_INTRINSICS(override);
71 
72  bool savePrivateH9(std::ostream &os,
73  bool binary) const override;
74  bool loadPrivateH9(UT_IStream &is) override;
75 };
76 #endif
GEO_PrimMetaBall(GEO_Detail *d, GA_Offset offset=GA_INVALID_OFFSET)
bool getBBox(UT_BoundingBox *bbox) const override
virtual GEO_MetaPrim * castToMetaPrim()
virtual void getBBox(UT_BoundingBox &bbox) const =0
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
const GA_PrimitiveJSON * getJSON() const override
#define GA_DECLARE_INTRINSICS(OVERRIDE)
Definition: GA_Primitive.h:80
virtual float density(const UT_Vector3 &pos) const =0
void copyPrimitive(const GEO_Primitive *src) override
GA_PrimitiveFamilyMask
#define GA_INVALID_OFFSET
Definition: GA_Types.h:687
GA_Size GA_Offset
Definition: GA_Types.h:646
virtual bool savePrivateH9(std::ostream &os, bool binary) const
GLintptr offset
Definition: glcorearb.h:665
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
Provide a JSON interface to a primitive.
#define GEO_API
Definition: GEO_API.h:14
static GA_PrimitiveFamilyMask buildFamilyMask()
We explicitly do not include the mask from the GEO_PrimSphere base.
void copySubclassData(const GA_Primitive *source) override
virtual bool loadPrivateH9(UT_IStream &is)
bool getBBox(UT_BoundingBox *bbox) const override
virtual TS_MetaPrimitive * getNewMetaPrim() const =0
#define GEO_FAMILY_META
Definition: GEO_PrimType.h:81
bool isDegenerate() const override
Is the primitive degenerate.
~GEO_PrimMetaBall() override
GLenum src
Definition: glcorearb.h:1793