00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _GALAXY_H_
00011 #define _GALAXY_H_
00012
00013 #include <vector>
00014 #include <string>
00015 #include <iostream>
00016 #include <celmath/vecmath.h>
00017 #include <celmath/quaternion.h>
00018 #include <celengine/deepskyobj.h>
00019
00020
00021
00022 struct Blob
00023 {
00024 Point3f position;
00025 unsigned int colorIndex;
00026 float brightness;
00027 };
00028
00029 struct GalacticForm
00030 {
00031 std::vector<Blob>* blobs;
00032 Vec3f scale;
00033 };
00034
00035 class Galaxy : public DeepSkyObject
00036 {
00037 public:
00038 Galaxy();
00039
00040 virtual const char* getType() const;
00041 virtual void setType(const std::string&);
00042 virtual size_t getDescription(char* buf, size_t bufLength) const;
00043
00044 float getDetail() const;
00045 void setDetail(float);
00046
00047
00048
00049 virtual bool load(AssociativeArray*, const std::string&);
00050 virtual void render(const GLContext& context,
00051 const Vec3f& offset,
00052 const Quatf& viewerOrientation,
00053 float brightness,
00054 float pixelSize);
00055 virtual void renderGalaxyPointSprites(const GLContext& context,
00056 const Vec3f& offset,
00057 const Quatf& viewerOrientation,
00058 float brightness,
00059 float pixelSize);
00060 virtual void renderGalaxyEllipsoid(const GLContext& context,
00061 const Vec3f& offset,
00062 const Quatf& viewerOrientation,
00063 float brightness,
00064 float pixelSize);
00065
00066 GalacticForm* getForm() const;
00067
00068 static void increaseLightGain();
00069 static void decreaseLightGain();
00070 static float getLightGain();
00071 static void setLightGain(float);
00072 static void hsv2rgb( float *r, float *g, float *b, float h, float s, float v );
00073
00074 virtual unsigned int getRenderMask() const;
00075 virtual unsigned int getLabelMask() const;
00076
00077 public:
00078 enum GalaxyType {
00079 S0 = 0,
00080 Sa = 1,
00081 Sb = 2,
00082 Sc = 3,
00083 SBa = 4,
00084 SBb = 5,
00085 SBc = 6,
00086 E0 = 7,
00087 E1 = 8,
00088 E2 = 9,
00089 E3 = 10,
00090 E4 = 11,
00091 E5 = 12,
00092 E6 = 13,
00093 E7 = 14,
00094 Irr = 15
00095 };
00096
00097 private:
00098 float detail;
00099
00100 GalaxyType type;
00101 GalacticForm* form;
00102
00103 static float lightGain;
00104 };
00105
00106
00107
00108 #endif // _GALAXY_H_