Apollo
11.0
自动驾驶开放平台
texture.h
浏览该文件的文档.
1
/******************************************************************************
2
* Copyright 2018 The Apollo Authors. All Rights Reserved.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*****************************************************************************/
16
17
#pragma once
18
19
#include <QtGui/QImage>
20
#include <QtGui/QOpenGLBuffer>
21
#include <memory>
22
23
#include "modules/common_msgs/sensor_msgs/sensor_image.pb.h"
24
25
class
Texture
{
26
public
:
27
Texture
(
void
);
28
~Texture
() {
29
if
(data_) {
30
delete
[] data_;
31
data_ =
nullptr
;
32
}
33
}
34
35
bool
isSizeChanged
(
void
)
const
{
return
is_size_changed_
; }
36
bool
isDirty
(
void
)
const
{
return
is_dirty_
; }
37
void
removeDirty
(
void
) {
is_size_changed_
=
is_dirty_
=
false
; }
38
void
setDirty
(
void
) {
is_dirty_
=
true
; }
39
void
setSizeChanged
(
void
) {
is_size_changed_
=
is_dirty_
=
true
; }
40
41
GLsizei
width
(
void
)
const
{
return
image_width_; }
42
GLsizei
height
(
void
)
const
{
return
image_height_; }
43
GLenum
texture_format
(
void
)
const
{
return
texture_format_; }
44
GLsizei
data_size
(
void
)
const
{
return
data_size_; }
45
46
bool
UpdateData
(
const
QImage& img);
47
bool
UpdateData
(
const
std::shared_ptr<const apollo::drivers::Image>&);
48
const
GLubyte*
data
(
void
)
const
{
return
data_; }
49
50
private
:
51
struct
{
52
int : 30;
53
bool
is_size_changed_
: 1;
54
bool
is_dirty_
: 1;
55
};
56
GLenum texture_format_;
57
GLsizei image_width_;
58
GLsizei image_height_;
59
GLsizei data_size_;
60
GLubyte* data_;
61
};
Texture
Definition
texture.h:25
Texture::~Texture
~Texture()
Definition
texture.h:28
Texture::removeDirty
void removeDirty(void)
Definition
texture.h:37
Texture::width
GLsizei width(void) const
Definition
texture.h:41
Texture::data_size
GLsizei data_size(void) const
Definition
texture.h:44
Texture::UpdateData
bool UpdateData(const QImage &img)
Definition
texture.cc:30
Texture::texture_format
GLenum texture_format(void) const
Definition
texture.h:43
Texture::isSizeChanged
bool isSizeChanged(void) const
Definition
texture.h:35
Texture::Texture
Texture(void)
Definition
texture.cc:21
Texture::is_size_changed_
bool is_size_changed_
Definition
texture.h:53
Texture::setDirty
void setDirty(void)
Definition
texture.h:38
Texture::setSizeChanged
void setSizeChanged(void)
Definition
texture.h:39
Texture::height
GLsizei height(void) const
Definition
texture.h:42
Texture::is_dirty_
bool is_dirty_
Definition
texture.h:54
Texture::data
const GLubyte * data(void) const
Definition
texture.h:48
Texture::isDirty
bool isDirty(void) const
Definition
texture.h:36
modules
tools
visualizer
texture.h