CloudyDay
 All Classes Functions Variables Enumerations
CloudGenerator.h
1 #pragma once
2 #include "Scene.h"
3 #include "Export.h"
4 #include "ImportClouds.h"
5 #include "WangCloud.h"
6 #include <osg/Vec2>
7 
8 #define PI 3.14159265
9 inline float frand()
10 {
11  return rand() / (float) RAND_MAX;
12 }
13 
14 namespace osgCloudyDay
15 {
21  {
22  public:
26  CloudGenerator(osg::Vec4 density);
30  virtual ~CloudGenerator(void)=0;
31 
35  WangCloud* Create();
36 
43  WangCloud* Create(osg::Vec3 middlepoint);
44 
48  virtual void Initialize() = 0;
49 
53  void DecideInsideOutside();
54 
66  void AddCloudBox(int box_iter, osg::Vec3 origin, osg::Vec3 sizes, osg::Vec3 cloud_size, osg::Vec3 jitter_sizes, bool buttom, float s, osg::Vec4 min_max_scale, osg::Vec4 density = osg::Vec4(1.0f,1.0f,1.0f,1.0f));
67 
80  void AddCloudBox(CloudCreateVolume* volume, int box_iter, osg::Vec3 origin, osg::Vec3 sizes, osg::Vec3 cloud_size, osg::Vec3 jitter_sizes, bool buttom, osg::Vec4 density = osg::Vec4(1.0f,1.0f,1.0f,1.0f));
81 
86 
90  void AddBox(osg::ref_ptr<osg::Vec3Array> box_triangles, osg::Vec3 posHelper, osg::Vec3 size);
91 
95  static void DoExport();
96 
97  static Export* ex;
98  static int numClouds;
99  WangCloud* m_cloud;
100 
101  osg::ref_ptr<osg::Geode> dBoxes;
102  protected:
103  static float* m_frands;
107  static void GenerateRandomNumber();
112  static float GetRandomFloat();
113  static int m_iterFloatRand;
114 
115  osg::ref_ptr<osg::Vec3Array> dBoxes_vertices;
116  std::vector<unsigned short> dBoxes_indices;
117  osg::ref_ptr<osg::Geometry> dBoxes_geometry;
118 
119  int m_category;
120 
121  osg::Vec3 m_middlepoint;
122  osg::Vec4 m_density;
123  };
124 }