CARLA
 
载入中...
搜索中...
未找到
rpc/Color.h
浏览该文件的文档.
1// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#pragma once
8
9#include "carla/MsgPack.h"
10
11#include <cstdint>
12
13#ifdef LIBCARLA_INCLUDED_FROM_UE4
15#include "Math/Color.h"
17#endif // LIBCARLA_INCLUDED_FROM_UE4
18
19namespace carla {
20namespace rpc {
21
22 class Color {
23 public:
24
25 uint8_t r = 0u;
26 uint8_t g = 0u;
27 uint8_t b = 0u;
28
29 Color() = default;
30 Color(const Color &) = default;
31
32 Color(uint8_t r, uint8_t g, uint8_t b)
33 : r(r), g(g), b(b) {}
34
35 Color &operator=(const Color &) = default;
36
37#ifdef LIBCARLA_INCLUDED_FROM_UE4
38
39 Color(const FColor &color)
40 : Color(color.R, color.G, color.B) {}
41
42 Color(const FLinearColor &color)
43 : Color(color.R * 255.0f, color.G * 255.0f, color.B * 255.0f) {}
44
45 operator FColor() const {
46 return FColor{r, g, b};
47 }
48
49 operator FLinearColor() const {
50 return FLinearColor{
51 static_cast<float>(r)/255.0f,
52 static_cast<float>(g)/255.0f,
53 static_cast<float>(b)/255.0f,
54 1.0f
55 };
56 }
57
58#endif // LIBCARLA_INCLUDED_FROM_UE4
59
61 };
62
63} // namespace rpc
64} // namespace carla
Color(const FColor &color)
Definition rpc/Color.h:39
Color(const FLinearColor &color)
Definition rpc/Color.h:42
Color(const Color &)=default
MSGPACK_DEFINE_ARRAY(r, g, b)
Color & operator=(const Color &)=default
Color(uint8_t r, uint8_t g, uint8_t b)
Definition rpc/Color.h:32
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133