Pioneer
Loading...
Searching...
No Matches
ModelSkin.h
Go to the documentation of this file.
1// Copyright © 2008-2023 Pioneer Developers. See AUTHORS.txt for details
2// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
3
4#ifndef SCENEGRAPH_MODELSKIN_H
5#define SCENEGRAPH_MODELSKIN_H
6
7#include "Color.h"
8#include "Json.h"
9#include "Random.h"
10#include "lua/LuaWrappable.h"
11#include <string>
12
13namespace Serializer {
14 class Reader;
15 class Writer;
16} // namespace Serializer
17
18namespace SceneGraph {
19
20 class Model;
21
22 class ModelSkin : public LuaWrappable {
23 public:
24 ModelSkin();
25
26 void Apply(Model *model) const;
27
28 void SetColors(const std::vector<Color> &colors);
29 void SetPrimaryColor(const Color &color);
30 void SetSecondaryColor(const Color &color);
31 void SetTrimColor(const Color &color);
32 void SetRandomColors(Random &rand);
33
34 void SetDecal(const std::string &name, unsigned int index = 0);
35 void ClearDecal(unsigned int index = 0);
36 void ClearDecals();
37
38 void SetLabel(const std::string &label);
39
40 void Load(Serializer::Reader &rd);
41 void LoadFromJson(const Json &jsonObj);
42 void Save(Serializer::Writer &wr) const;
43 void SaveToJson(Json &jsonObj) const;
44
45 const std::vector<Color> &GetColors() const { return m_colors; }
46
47 private:
48 static const unsigned int MAX_DECAL_MATERIALS = 4;
49
50 std::vector<Color> m_colors;
51 std::string m_decals[MAX_DECAL_MATERIALS];
52 std::string m_label;
53 };
54
55} // namespace SceneGraph
56
57#endif
nlohmann::json Json
Definition Json.h:8
Definition LuaWrappable.h:13
Definition Random.h:27
Definition ModelSkin.h:22
void SetColors(const std::vector< Color > &colors)
Definition ModelSkin.cpp:35
void SetDecal(const std::string &name, unsigned int index=0)
Definition ModelSkin.cpp:63
void Save(Serializer::Writer &wr) const
Definition ModelSkin.cpp:122
void ClearDecals()
Definition ModelSkin.cpp:75
void SetPrimaryColor(const Color &color)
Definition ModelSkin.cpp:41
void LoadFromJson(const Json &jsonObj)
Definition ModelSkin.cpp:98
ModelSkin()
Definition ModelSkin.cpp:18
void SetSecondaryColor(const Color &color)
Definition ModelSkin.cpp:46
const std::vector< Color > & GetColors() const
Definition ModelSkin.h:45
void ClearDecal(unsigned int index=0)
Definition ModelSkin.cpp:69
void SetLabel(const std::string &label)
Definition ModelSkin.cpp:81
void Apply(Model *model) const
Definition ModelSkin.cpp:23
void SaveToJson(Json &jsonObj) const
Definition ModelSkin.cpp:134
void SetTrimColor(const Color &color)
Definition ModelSkin.cpp:51
void Load(Serializer::Reader &rd)
Definition ModelSkin.cpp:86
void SetRandomColors(Random &rand)
Definition ModelSkin.cpp:56
Definition Model.h:88
Definition Serializer.h:110
Definition Serializer.h:35
Definition CityOnPlanet.h:31
Definition GeomTree.h:9
Definition Color.h:66