Caelum
Sun.h
1 /*
2 This file is part of Caelum.
3 See http://www.ogre3d.org/wiki/index.php/Caelum
4 
5 Copyright (c) 2006-2007 Caelum team. See Contributors.txt for details.
6 
7 Caelum is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published
9 by the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Caelum is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License
18 along with Caelum. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef CAELUM__SUN_H
22 #define CAELUM__SUN_H
23 
24 #include "CaelumPrerequisites.h"
25 #include "CameraBoundElement.h"
26 #include "SkyLight.h"
27 #include "PrivatePtr.h"
28 
29 namespace Caelum
30 {
31  class BaseSkyLight;
32  class SphereSun;
33  class SpriteSun;
34 
35  typedef SpriteSun Sun;
36 
40  class CAELUM_EXPORT SphereSun : public BaseSkyLight
41  {
42  public:
44  static const Ogre::String SUN_MATERIAL_NAME;
45 
46  private:
48  PrivateMaterialPtr mSunMaterial;
49 
51  PrivateEntityPtr mSunEntity;
52 
53  public:
57  SphereSun (
58  Ogre::SceneManager *sceneMgr,
59  Ogre::SceneNode *caelumRootNode,
60  const Ogre::String &meshName = "sphere.mesh");
61 
65  virtual ~SphereSun ();
66 
70  void setBodyColour (const Ogre::ColourValue &colour);
71 
72  public:
74  virtual void notifyCameraChanged (Ogre::Camera *cam);
75 
76  virtual void setQueryFlags (uint flags) { mSunEntity->setQueryFlags (flags); }
77  virtual uint getQueryFlags () const { return mSunEntity->getQueryFlags (); }
78  virtual void setVisibilityFlags (uint flags) { mSunEntity->setVisibilityFlags (flags); }
79  virtual uint getVisibilityFlags () const { return mSunEntity->getVisibilityFlags (); }
80  };
81 
84  class CAELUM_EXPORT SpriteSun : public BaseSkyLight
85  {
86  public:
88  static const Ogre::String SUN_MATERIAL_NAME;
89 
90  protected:
93 
96 
98  Ogre::Degree mSunTextureAngularSize;
99 
100  public:
105  SpriteSun (
106  Ogre::SceneManager *sceneMgr,
107  Ogre::SceneNode *caelumRootNode,
108  const Ogre::String& sunTextureName = "sun_disc.png",
109  const Ogre::Degree& sunTextureAngularSize = Ogre::Degree(3.77f));
110 
114  virtual ~SpriteSun ();
115 
119  void setSunTexture (const Ogre::String &textureName);
120 
124  void setSunTextureAngularSize(const Ogre::Degree& sunTextureAngularSize);
125 
129  void setBodyColour (const Ogre::ColourValue &colour);
130 
131  public:
133  virtual void notifyCameraChanged (Ogre::Camera *cam);
134 
135  virtual void setQueryFlags (uint flags) { mSunBillboardSet->setQueryFlags (flags); }
136  virtual uint getQueryFlags () const { return mSunBillboardSet->getQueryFlags (); }
137  virtual void setVisibilityFlags (uint flags) { mSunBillboardSet->setVisibilityFlags (flags); }
138  virtual uint getVisibilityFlags () const { return mSunBillboardSet->getVisibilityFlags (); }
139  };
140 }
141 
142 #endif // CAELUM__SUN_H
Base class for sky lights (sun and moon).
Definition: SkyLight.h:31
Class representing the sun as billboard with texture on it.
Definition: Sun.h:84
PrivateBillboardSetPtr mSunBillboardSet
The sun sprite / billboard.
Definition: Sun.h:95
PrivateMaterialPtr mSunMaterial
The sun material.
Definition: Sun.h:92
static const Ogre::String SUN_MATERIAL_NAME
Name of the sun material.
Definition: Sun.h:44
Class representing the sun as sphere with emissive color on it.
Definition: Sun.h:40
Ogre::Degree mSunTextureAngularSize
The sun sprite visible angle.
Definition: Sun.h:98
static const Ogre::String SUN_MATERIAL_NAME
Name of the sun material.
Definition: Sun.h:88
Caelum namespace.
Definition: Astronomy.cpp:24