1 // qlobular.h 2 // 3 // Copyright (C) 2008, Celestia Development Team 4 // Initial implementation by Dr. Fridger Schrempp <fridger.schrempp@desy.de> 5 // 6 // Simulation of globular clusters, theoretical framework by 7 // Ivan King, Astron. J. 67 (1962) 471; ibid. 71 (1966) 64 8 // 9 // 10 // This program is free software; you can redistribute it and/or 11 // modify it under the terms of the GNU General Public License 12 // as published by the Free Software Foundation; either version 2 13 // of the License, or (at your option) any later version. 14 15 #ifndef _GLOBULAR_H_ 16 #define _GLOBULAR_H_ 17 18 #include <celengine/deepskyobj.h> 19 20 21 struct GBlob 22 { 23 Point3f position; 24 unsigned int colorIndex; 25 float radius_2d; 26 }; 27 28 struct GlobularForm 29 { 30 std::vector<GBlob>* gblobs; 31 Vec3f scale; 32 }; 33 34 class Globular : public DeepSkyObject 35 { 36 public: 37 Globular(); 38 virtual const char* getType() const; 39 virtual void setType(const std::string&); 40 virtual size_t getDescription(char* buf, size_t bufLength) const; 41 virtual std::string getCustomTmpName() const; 42 virtual void setCustomTmpName(const std::string&); 43 float getDetail() const; 44 void setDetail(float); 45 float getCoreRadius() const; 46 void setCoreRadius(const float); 47 void setConcentration(const float); 48 float getConcentration() const; 49 float getHalfMassRadius() const; 50 unsigned int cSlot(float) const; 51 getBoundingSphereRadius()52 virtual float getBoundingSphereRadius() const { return tidalRadius; } 53 54 virtual bool pick(const Ray3d& ray, 55 double& distanceToPicker, 56 double& cosAngleToBoundCenter) const; 57 virtual bool load(AssociativeArray*, const std::string&); 58 virtual void render(const GLContext& context, 59 const Vec3f& offset, 60 const Quatf& viewerOrientation, 61 float brightness, 62 float pixelSize); 63 virtual void renderGlobularPointSprites(const GLContext& context, 64 const Vec3f& offset, 65 const Quatf& viewerOrientation, 66 float brightness, 67 float pixelSize); 68 GlobularForm* getForm() const; 69 70 virtual unsigned int getRenderMask() const; 71 virtual unsigned int getLabelMask() const; 72 virtual const char* getObjTypeName() const; 73 74 private: 75 void recomputeTidalRadius(); 76 77 private: 78 float detail; 79 std::string* customTmpName; 80 GlobularForm* form; 81 float r_c; 82 float c; 83 float tidalRadius; 84 }; 85 86 #endif // _GLOBULAR_H_ 87