HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 onOff)
81  {
82  if (onOff) myFlag |= GEO_PART_MOTIONBLUR;
83  else myFlag &= ~GEO_PART_MOTIONBLUR;
84  }
85  void setVirtual(int onOff)
86  {
87  if (onOff) 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.
void setVirtual(int onOff)
const GLdouble * v
Definition: glcorearb.h:836
const GLuint GLenum const void * binary
Definition: glcorearb.h:1923
GEO_PART_TYPE getType() const
void setBlurTime(float bt)
float getSize() const
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:72
void setMotionBlur(int onOff)
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
int isVirtual() const
GEO_PartRender & operator=(const GEO_PartRender &src)
#define GEO_API
Definition: GEO_API.h:10
int isMotionBlur() const
Render as rounded tubes.
bool operator==(const GEO_PartRender &src) const
double fpreal
Definition: SYS_Types.h:263
Render as lines.
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:75
Render as open tubes.
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
#define GEO_PART_VIRTUAL
Particles not to be rendered.
#define SYS_FTOLERANCE
Definition: SYS_Types.h:196
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
Render as spheres.
float getBlurTime() const
Render as oriented circles.
void setType(GEO_PART_TYPE t)
GLenum src
Definition: glcorearb.h:1792