HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GEO_PartRender.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: GEO library (C++)
7  *
8  * COMMENTS: Particle Render Options
9  *
10  */
11 
12 #ifndef __GEO_PartRender_h__
13 #define __GEO_PartRender_h__
14 
15 #include "GEO_API.h"
16 #include <SYS/SYS_Math.h>
17 #include <iosfwd>
18 class UT_IStream;
19 class UT_JSONWriter;
20 class UT_JSONParser;
21 class UT_JSONValue;
22 
23 /// Geometry type to use when rendering particles.
25 {
26  GEO_PARTICLE_SPHERE, ///< Render as spheres
27  GEO_PARTICLE_CIRCLE, ///< Render as oriented circles
28  GEO_PARTICLE_LINE, ///< Render as lines
29  GEO_PARTICLE_TUBE, ///< Render as open tubes
30  GEO_PARTICLE_TUBEC, ///< Render as capped tubes
31  GEO_PARTICLE_TUBES ///< Render as rounded tubes
32 };
33 
34 #define GEO_PART_MOTIONBLUR 0x0001 ///< Particles are motion blurred
35 #define GEO_PART_VIRTUAL 0x0004 ///< Particles not to be rendered
36 
37 /// A class to manage the various settings that control how a particle system
38 /// should be rendered.
40 {
41 public:
43  ~GEO_PartRender();
44 
45  void setDefaults();
46 
47  bool saveH9(std::ostream &os, bool binary) const;
48  bool loadH9(UT_IStream &is);
49 
51  {
52  myFlag = src.myFlag;
53  mySize = src.mySize;
54  myBlurTime = src.myBlurTime;
55  myType = src.myType;
56  return *this;
57  }
58  bool isEqual(const GEO_PartRender &src,
59  fpreal tol=SYS_FTOLERANCE) const
60  {
61  return myFlag == src.myFlag
62  && SYSisEqual(mySize, src.mySize, tol)
63  && SYSisEqual(myBlurTime, src.myBlurTime, tol)
64  && myType == src.myType;
65  }
66 
67  bool operator==(const GEO_PartRender &src) const
68  {
69  return isEqual(src);
70  }
71 
72  bool saveJSON(UT_JSONWriter &w) const;
73  bool saveJSON(UT_JSONValue &v) const;
74  bool loadJSON(UT_JSONParser &p);
75  bool loadJSON(UT_JSONParser &p, const UT_JSONValue &v);
76 
77  void setSize(float radius) { mySize = radius; }
78  void setBlurTime(float bt) { myBlurTime = bt; }
79  void setType(GEO_PART_TYPE t){ myType = t; }
80  void setMotionBlur(int on_off)
81  {
82  if (on_off) myFlag |= GEO_PART_MOTIONBLUR;
83  else myFlag &= ~GEO_PART_MOTIONBLUR;
84  }
85  void setVirtual(int on_off)
86  {
87  if (on_off) myFlag |= GEO_PART_VIRTUAL;
88  else myFlag &= ~GEO_PART_VIRTUAL;
89  }
90 
91 
92  float getSize() const { return mySize; }
93  float getBlurTime() const { return myBlurTime; }
94  GEO_PART_TYPE getType() const { return myType; }
95  int isMotionBlur() const
96  { return myFlag & GEO_PART_MOTIONBLUR; }
97  int isVirtual() const
98  { return myFlag & GEO_PART_VIRTUAL; }
99 
100  /// @{
101  /// Get/Set type by name (rather than enum)
102  const char *getTypeName() const;
103  void setTypeName(const char *type);
104  /// @}
105 
106 private:
107  int myFlag;
108  float mySize;
109  float myBlurTime;
110  GEO_PART_TYPE myType;
111 };
112 
113 #endif
#define GEO_PART_MOTIONBLUR
Particles are motion blurred.
const GLdouble * v
Definition: glcorearb.h:837
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
GEO_PART_TYPE getType() const
void setBlurTime(float bt)
float getSize() const
void setMotionBlur(int on_off)
void setSize(float radius)
bool isEqual(const GEO_PartRender &src, fpreal tol=SYS_FTOLERANCE) const
GEO_PART_TYPE
Geometry type to use when rendering particles.
Render as capped tubes.
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:87
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
int isVirtual() const
GEO_PartRender & operator=(const GEO_PartRender &src)
#define GEO_API
Definition: GEO_API.h:14
int isMotionBlur() const
Render as rounded tubes.
bool operator==(const GEO_PartRender &src) const
GLdouble t
Definition: glad.h:2397
Render as lines.
fpreal64 fpreal
Definition: SYS_Types.h:277
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:99
void setVirtual(int on_off)
Render as open tubes.
#define GEO_PART_VIRTUAL
Particles not to be rendered.
#define SYS_FTOLERANCE
Definition: SYS_Types.h:208
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
Render as spheres.
float getBlurTime() const
bool SYSisEqual(const UT_Vector2T< T > &a, const UT_Vector2T< T > &b, S tol=SYS_FTOLERANCE)
Componentwise equality.
Definition: UT_Vector2.h:674
Render as oriented circles.
type
Definition: core.h:1059
void setType(GEO_PART_TYPE t)
GLenum src
Definition: glcorearb.h:1793