forked from pioneerspacesim/pioneer
/
CityOnPlanet.h
54 lines (45 loc) · 1.41 KB
/
CityOnPlanet.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright © 2008-2012 Pioneer Developers. See AUTHORS.txt for details
// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
#ifndef _CITYONPLANET_H
#define _CITYONPLANET_H
#include "libs.h"
#include "mtrand.h"
#include "Object.h"
#include "LmrModel.h"
class Planet;
class SpaceStation;
class Frame;
class Geom;
class Camera;
namespace Graphics { class Renderer; }
#define CITY_ON_PLANET_RADIUS 5000.0
class CityOnPlanet: public Object {
public:
OBJDEF(CityOnPlanet, Object, CITYONPLANET);
CityOnPlanet(Planet *planet, SpaceStation *station, Uint32 seed);
virtual ~CityOnPlanet();
void Render(Graphics::Renderer *r, Camera *camera, const SpaceStation *station, const vector3d &viewCoords, const matrix4x4d &viewTransform, double illumination, double minIllumination);
inline Planet *GetPlanet() const { return m_planet; }
static void Init();
static void Uninit();
private:
void PutCityBit(MTRand &rand, const matrix4x4d &rot, vector3d p1, vector3d p2, vector3d p3, vector3d p4);
void AddStaticGeomsToCollisionSpace();
void RemoveStaticGeomsFromCollisionSpace();
struct BuildingDef {
LmrModel *model;
float clipRadius;
int rotation; // 0-3
vector3d pos;
Geom *geom;
// may not be at lower detail level
bool isEnabled;
};
Planet *m_planet;
Frame *m_frame;
std::vector<BuildingDef> m_buildings;
int m_detailLevel;
// position of city center
vector3d m_position;
};
#endif /* _CITYONPLANET_H */