Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
blob: 2643263d11176de39c4cffcbb0e4869b974c5f8e (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
   core/entityglobe.h
   This file is part of the Osirion project and is distributed under
   the terms of the GNU General Public License version 2.
*/

#ifndef __INCLUDED_CORE_ENTITYGLOBE_H__
#define __INCLUDED_CORE_ENTITYGLOBE_H__

#include "core/entity.h"

namespace core
{

/// a Globe entity
class EntityGlobe : public Entity
{
public:
	/// server-side constructor
	EntityGlobe();
	EntityGlobe(std::istream & is);

	virtual ~EntityGlobe();

	/*----- inspectors ----------------------------------------------- */
	/// core type id
	virtual inline const unsigned int type() const {
		return Entity::Globe;
	}
	
	/// texture name
	inline const std::string &texturename() const {
		return entity_texturename;
	}
	
	/// texture render id
	inline size_t texture_id() const {
		return entity_texture_id;
	}
	
	/// corona texture name
	inline const std::string &coronaname() const {
		return entity_coronaname;
	}

	/// corona texture id
	inline size_t corona_id() const {
		return entity_corona_id;
	}
	
	/// rings texture name
	inline const std::string &ringsname() const {
		return entity_ringsname;
	}
	
	/// rings texture id
	inline size_t rings_id() const {
		return entity_rings_id;
	}
	
	/// rotation speed in degrees per second
	inline float rotationspeed() const {
		return entity_rotationspeed;
	}

	/*----- mutators -------------------------------------------------- */
	
	inline void set_rotationspeed(const float rotationspeed) {
		entity_rotationspeed = rotationspeed;
	}
	
	inline void set_texture_id(size_t texture_id) {
		entity_texture_id = texture_id;
	}
	
	inline void set_corona_id(size_t texture_id) {
		entity_corona_id = texture_id;
	}
	
	inline void set_rings_id(size_t texture_id) {
		entity_rings_id = texture_id;
	}
	
	inline void set_texturename(const std::string & texturename) {
		entity_texturename.assign(texturename);
	}
	
	inline void set_coronaname(const std::string & texturename) {
		entity_coronaname.assign(texturename);
	}
	
	inline void set_ringsname(const std::string & texturename) {
		entity_ringsname.assign(texturename);
	}

	/*----- serializers ----------------------------------------------- */

	/// serialize the entity to a stream
	virtual void serialize_server_create(std::ostream & os) const;

	/// receive a server-to-client create from a stream
	virtual void receive_server_create(std::istream &is);

private:
	float 			entity_rotationspeed;
	size_t			entity_texture_id;
	size_t			entity_corona_id;
	size_t			entity_rings_id;

	std::string		entity_texturename;
	std::string		entity_coronaname;
	std::string		entity_ringsname;
};

}

#endif // __INCLUDED_CORE_ENTITYGLOBE_H__