CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
carla
rpc
Texture.h
Go to the documentation of this file.
1
// Copyright (c) 2026 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
#include "
carla/rpc/FloatColor.h
"
11
#include "
carla/sensor/data/Color.h
"
12
13
#include <vector>
14
15
namespace
carla
{
16
namespace
rpc
{
17
18
template
<
typename
T>
19
class
Texture
{
20
public
:
21
22
Texture
() =
default
;
23
24
Texture
(uint32_t width, uint32_t height)
25
:
_width
(width),
_height
(height) {
26
_texture_data
.resize(
_width
*
_height
);
27
}
28
29
uint32_t
GetWidth
()
const
{
30
return
_width
;
31
}
32
33
uint32_t
GetHeight
()
const
{
34
return
_height
;
35
}
36
37
void
SetDimensions
(uint32_t width, uint32_t height) {
38
_width
= width;
39
_height
= height;
40
_texture_data
.resize(
_width
*
_height
);
41
}
42
43
T&
At
(uint32_t x, uint32_t y) {
44
return
_texture_data
[y*
_width
+ x];
45
}
46
47
const
T&
At
(uint32_t x, uint32_t y)
const
{
48
return
_texture_data
[y*
_width
+ x];
49
}
50
51
const
T*
GetDataPtr
()
const
{
52
return
_texture_data
.data();
53
}
54
55
private
:
56
57
uint32_t
_width
= 0;
58
uint32_t
_height
= 0;
59
std::vector<T>
_texture_data
;
60
61
public
:
62
63
MSGPACK_DEFINE_ARRAY
(
_width
,
_height
,
_texture_data
);
64
};
65
66
using
TextureColor
=
Texture<sensor::data::Color>
;
67
using
TextureFloatColor
=
Texture<FloatColor>
;
68
69
}
70
}
FloatColor.h
MsgPack.h
carla::rpc::Texture
Definition
Texture.h:19
carla::rpc::Texture::GetDataPtr
const T * GetDataPtr() const
Definition
Texture.h:51
carla::rpc::Texture< sensor::data::Color >::_texture_data
std::vector< sensor::data::Color > _texture_data
Definition
Texture.h:59
carla::rpc::Texture::At
T & At(uint32_t x, uint32_t y)
Definition
Texture.h:43
carla::rpc::Texture::At
const T & At(uint32_t x, uint32_t y) const
Definition
Texture.h:47
carla::rpc::Texture::Texture
Texture()=default
carla::rpc::Texture::MSGPACK_DEFINE_ARRAY
MSGPACK_DEFINE_ARRAY(_width, _height, _texture_data)
carla::rpc::Texture< sensor::data::Color >::_height
uint32_t _height
Definition
Texture.h:58
carla::rpc::Texture::SetDimensions
void SetDimensions(uint32_t width, uint32_t height)
Definition
Texture.h:37
carla::rpc::Texture< sensor::data::Color >::_width
uint32_t _width
Definition
Texture.h:57
carla::rpc::Texture::GetWidth
uint32_t GetWidth() const
Definition
Texture.h:29
carla::rpc::Texture::GetHeight
uint32_t GetHeight() const
Definition
Texture.h:33
carla::rpc::Texture::Texture
Texture(uint32_t width, uint32_t height)
Definition
Texture.h:24
carla::rpc
Definition
DebugShapeDrawer.h:11
carla::rpc::TextureColor
Texture< sensor::data::Color > TextureColor
Definition
Texture.h:66
carla::rpc::TextureFloatColor
Texture< FloatColor > TextureFloatColor
Definition
Texture.h:67
carla
This file contains definitions of common data structures used in traffic manager.
Definition
SignComponent.h:21
Color.h
Generated by
1.18.0