Apollo
11.0
自动驾驶开放平台
grid.cc
浏览该文件的文档.
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
#include "
modules/tools/visualizer/grid.h
"
18
19
Grid::Grid
(
int
cellCountBySide)
20
:
RenderableObject
((cellCountBySide << 2) + 4, 2),
21
grid_color_(128, 128, 128) {}
22
23
bool
Grid::FillVertexBuffer
(GLfloat* pBuffer) {
24
float
x =
static_cast<
float
>
(
CellCount
()) / 2.0f;
25
float
z;
26
27
for
(z = -x; z <= x; ++z) {
28
*pBuffer++ = -x;
29
*pBuffer++ = z;
30
*pBuffer++ = x;
31
*pBuffer++ = z;
32
}
33
34
z = x;
35
36
for
(x = -z; x <= z; ++x) {
37
*pBuffer++ = x;
38
*pBuffer++ = -z;
39
*pBuffer++ = x;
40
*pBuffer++ = z;
41
}
42
43
return
true
;
44
}
Grid::FillVertexBuffer
virtual bool FillVertexBuffer(GLfloat *pBuffer)
Definition
grid.cc:23
Grid::CellCount
int CellCount(void) const
Definition
grid.h:48
Grid::Grid
Grid(int cellCountBySide=1)
Definition
grid.cc:19
RenderableObject
Definition
renderable_object.h:25
grid.h
modules
tools
visualizer
grid.cc