Apollo 11.0
自动驾驶开放平台
Grid类 参考

#include <grid.h>

类 Grid 继承关系图:
Grid 的协作图:

Public 成员函数

 Grid (int cellCountBySide=1)
 
 ~Grid ()
 
GLenum GetPrimitiveType (void) const
 
void SetupExtraUniforms (void)
 
int red (void) const
 
int green (void) const
 
int blue (void) const
 
const QColor & grid_color (void) const
 
void set_grid_color (const QColor &color)
 
void SetCellCount (int cellCount)
 
int CellCount (void) const
 
- Public 成员函数 继承自 RenderableObject
 RenderableObject (int vertex_count=1, int vertex_element_count=3, const std::shared_ptr< QOpenGLShaderProgram > &shaderProgram=NullRenderableObj)
 
virtual ~RenderableObject (void)
 
bool is_renderable (void) const
 
void set_is_renderable (bool b)
 
int vertex_count (void) const
 
void set_vertex_count (int vertexCount)
 
int vertex_element_count (void) const
 
void set_vertex_element_count (int vertexElementCount)
 
int VertexBufferSize (void) const
 
void set_shader_program (const std::shared_ptr< QOpenGLShaderProgram > &shaderProgram)
 
bool haveShaderProgram (void)
 
bool Init (std::shared_ptr< QOpenGLShaderProgram > &shaderProgram=NullRenderableObj)
 
void Destroy (void)
 
void Render (const QMatrix4x4 *mvp=nullptr)
 

Protected 成员函数

virtual bool FillVertexBuffer (GLfloat *pBuffer)
 
- Protected 成员函数 继承自 RenderableObject
virtual void Draw (void)
 
virtual void SetupAllAttrPointer (void)
 

额外继承的成员函数

- 静态 Public 成员函数 继承自 RenderableObject
static std::shared_ptr< QOpenGLShaderProgram > CreateShaderProgram (const QString &vertexShaderFileName, const QString &fragShaderFileName)
 
- 静态 Public 属性 继承自 RenderableObject
static std::shared_ptr< QOpenGLShaderProgram > NullRenderableObj
 
- Protected 属性 继承自 RenderableObject
bool is_init_
 
bool is_renderable_
 
int vertex_count_
 
int vertex_element_count_
 
std::shared_ptr< QOpenGLShaderProgram > shader_program_
 
QOpenGLVertexArrayObject vao_
 
QOpenGLBuffer vbo_
 

详细描述

在文件 grid.h 第 23 行定义.

构造及析构函数说明

◆ Grid()

Grid::Grid ( int  cellCountBySide = 1)
explicit

在文件 grid.cc 第 19 行定义.

20 : RenderableObject((cellCountBySide << 2) + 4, 2),
21 grid_color_(128, 128, 128) {}

◆ ~Grid()

Grid::~Grid ( )
inline

在文件 grid.h 第 26 行定义.

26{}

成员函数说明

◆ blue()

int Grid::blue ( void  ) const
inline

在文件 grid.h 第 39 行定义.

39{ return grid_color_.blue(); }

◆ CellCount()

int Grid::CellCount ( void  ) const
inline

在文件 grid.h 第 48 行定义.

48 {
49 return (vertex_count() / vertex_element_count() - 2) >> 1;
50 }
int vertex_element_count(void) const
int vertex_count(void) const

◆ FillVertexBuffer()

bool Grid::FillVertexBuffer ( GLfloat *  pBuffer)
protectedvirtual

实现了 RenderableObject.

在文件 grid.cc 第 23 行定义.

23 {
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}
int CellCount(void) const
Definition grid.h:48

◆ GetPrimitiveType()

GLenum Grid::GetPrimitiveType ( void  ) const
inlinevirtual

实现了 RenderableObject.

在文件 grid.h 第 28 行定义.

28{ return GL_LINES; }

◆ green()

int Grid::green ( void  ) const
inline

在文件 grid.h 第 38 行定义.

38{ return grid_color_.green(); }

◆ grid_color()

const QColor & Grid::grid_color ( void  ) const
inline

在文件 grid.h 第 41 行定义.

41{ return grid_color_; }

◆ red()

int Grid::red ( void  ) const
inline

在文件 grid.h 第 37 行定义.

37{ return grid_color_.red(); }

◆ set_grid_color()

void Grid::set_grid_color ( const QColor &  color)
inline

在文件 grid.h 第 42 行定义.

42{ grid_color_ = color; }

◆ SetCellCount()

void Grid::SetCellCount ( int  cellCount)
inline

在文件 grid.h 第 44 行定义.

44 {
45 set_vertex_count(((cellCount << 1) + 2) * vertex_element_count());
46 }
void set_vertex_count(int vertexCount)

◆ SetupExtraUniforms()

void Grid::SetupExtraUniforms ( void  )
inlinevirtual

重载 RenderableObject .

在文件 grid.h 第 29 行定义.

29 {
30 QVector3D color;
31 color.setX(static_cast<float>(grid_color_.redF()));
32 color.setY(static_cast<float>(grid_color_.greenF()));
33 color.setZ(static_cast<float>(grid_color_.blueF()));
34 shader_program_->setUniformValue("color", color);
35 }
std::shared_ptr< QOpenGLShaderProgram > shader_program_

该类的文档由以下文件生成: