Pioneer
Loading...
Searching...
No Matches
ModelSkin.h
Go to the documentation of this file.
1// Copyright © 2008-2024 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 "JsonFwd.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:29
Definition: ModelSkin.h:22
void SetColors(const std::vector< Color > &colors)
Definition: ModelSkin.cpp:36
void SetDecal(const std::string &name, unsigned int index=0)
Definition: ModelSkin.cpp:64
void Save(Serializer::Writer &wr) const
Definition: ModelSkin.cpp:123
void ClearDecals()
Definition: ModelSkin.cpp:76
void SetPrimaryColor(const Color &color)
Definition: ModelSkin.cpp:42
void LoadFromJson(const Json &jsonObj)
Definition: ModelSkin.cpp:99
ModelSkin()
Definition: ModelSkin.cpp:19
void SetSecondaryColor(const Color &color)
Definition: ModelSkin.cpp:47
const std::vector< Color > & GetColors() const
Definition: ModelSkin.h:45
void ClearDecal(unsigned int index=0)
Definition: ModelSkin.cpp:70
void SetLabel(const std::string &label)
Definition: ModelSkin.cpp:82
void Apply(Model *model) const
Definition: ModelSkin.cpp:24
void SaveToJson(Json &jsonObj) const
Definition: ModelSkin.cpp:135
void SetTrimColor(const Color &color)
Definition: ModelSkin.cpp:52
void Load(Serializer::Reader &rd)
Definition: ModelSkin.cpp:87
void SetRandomColors(Random &rand)
Definition: ModelSkin.cpp:57
Definition: Model.h:87
Definition: Serializer.h:111
Definition: Serializer.h:36
Definition: CityOnPlanet.h:32
Definition: GeomTree.h:12
Definition: Color.h:66