Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
planet.h
Go to the documentation of this file.
1 /* planet.h
2  * ok *
3  * Unit type that is a gravity source, and follows a set orbit pattern
4  */
5 #ifndef _PLANET_H_
6 #define _PLANET_H_
7 
8 #include <stdio.h>
9 
10 #include "unit.h"
11 #include "planet_generic.h"
12 #include "ai/order.h"
13 #include "collection.h"
14 #include <vector>
15 #include <string>
16 
17 struct GFXMaterial;
18 /* Orbits in the xy plane with the given radius. Depends on a reorientation of coordinate bases */
19 
20 class Texture;
21 class Atmosphere;
22 
23 class ContinuousTerrain;
24 
25 class GamePlanet : public GameUnit< class Planet >
26 {
27 private:
28  Animation *shine;
29 protected:
31  GamePlanet();
32 
35  QVector y,
36  float vely,
37  const Vector &rotvel,
38  float pos,
39  float gravity,
40  float radius,
41  const std::string &filename,
42  const std::string &technique,
43  const std::string &unitname,
44  BLENDFUNC blendsrc,
45  BLENDFUNC blenddst,
46  const std::vector< std::string > &dest,
47  const QVector &orbitcent,
48  Unit *parent,
49  const GFXMaterial &ourmat,
50  const std::vector< GFXLightLocal >&,
51  int faction,
52  string fullname,
53  bool inside_out = false );
54 
55  friend class UnitFactory;
56 
57 public:
59  virtual ~GamePlanet();
60  virtual void AddFog( const std::vector< AtmosphericFogMesh >&, bool optical_illusion );
61  Vector AddSpaceElevator( const std::string &name, const std::string &faction, char direction );
62  void AddAtmosphere( const std::string &texture, float radius, BLENDFUNC blendSrc, BLENDFUNC blendDst, bool inside_out );
63  void AddRing( const std::string &texture,
64  float iradius,
65  float oradius,
66  const QVector &r,
67  const QVector &s,
68  int slices,
69  int numwrapx,
70  int numwrapy,
71  BLENDFUNC blendSrc,
72  BLENDFUNC blendDst );
73  void AddCity( const std::string &texture,
74  float radius,
75  int numwrapx,
76  int numwrapy,
77  BLENDFUNC blendSrc,
78  BLENDFUNC blendDst,
79  bool inside_out = false,
80  bool reverse_normals = true );
81  void DisableLights();
82  void EnableLights();
83  virtual void Draw( const Transformation &quat = identity_transformation, const Matrix &m = identity_matrix );
84  void DrawTerrain();
85  static void ProcessTerrains();
86  virtual void Kill( bool erasefromsave = false );
87 
88  PlanetaryTransform * setTerrain( ContinuousTerrain*, float ratiox, int numwraps, float scaleatmos );
89  ContinuousTerrain * getTerrain( PlanetaryTransform* &t )
90  {
91  t = terraintrans;
92  return terrain;
93  }
94  void setAtmosphere( Atmosphere* );
96  {
97  return atmosphere;
98  }
99  void reactToCollision( Unit *smaller,
100  const QVector &biglocation,
101  const Vector &bignormal,
102  const QVector &smalllocation,
103  const Vector &smallnormal,
104  float dist );
105 
107  friend class PlanetaryOrbit;
108 
109 private:
111  GamePlanet( const Planet& );
113  GamePlanet& operator=( const Planet& );
114 };
115 
116 #endif
117