Apollo 11.0
自动驾驶开放平台
plane.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 <memory>
20
23
24class Plane : public RenderableObject {
25 /*
26 * struct Vertex
27 * {
28 * GLfloat _vert[2];
29 * GLfloat _texCoor[2];
30 * };
31 *
32 */
33
34 public:
35 static std::shared_ptr<Texture> NullTextureObj;
36
37 explicit Plane(const std::shared_ptr<Texture>& t = NullTextureObj);
38 virtual ~Plane(void) { texture_.reset(); }
39
40 void set_texture(const std::shared_ptr<Texture>& t) {
41 if (t != texture_) {
42 texture_ = t;
43 }
44 }
45
46 GLenum GetPrimitiveType(void) const override { return GL_QUADS; }
47 GLsizei texWidth(void) const { return texture_->width(); }
48 GLsizei texHeight(void) const { return texture_->height(); }
49
50 protected:
51 bool FillVertexBuffer(GLfloat* pBuffer) override;
52 void Draw(void) override;
53 void SetupAllAttrPointer(void) override;
54
55 private:
56 GLuint texture_id_;
57 std::shared_ptr<Texture> texture_;
58};
Definition plane.h:24
GLenum GetPrimitiveType(void) const override
Definition plane.h:46
void set_texture(const std::shared_ptr< Texture > &t)
Definition plane.h:40
void SetupAllAttrPointer(void) override
Definition plane.cc:64
static std::shared_ptr< Texture > NullTextureObj
Definition plane.h:35
bool FillVertexBuffer(GLfloat *pBuffer) override
Definition plane.cc:24
virtual ~Plane(void)
Definition plane.h:38
GLsizei texHeight(void) const
Definition plane.h:48
GLsizei texWidth(void) const
Definition plane.h:47
void Draw(void) override
Definition plane.cc:77