drawable_object.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2014 Google Inc. All Rights Reserved.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef TANGO_GL_DRAWABLE_OBJECT_H_
00018 #define TANGO_GL_DRAWABLE_OBJECT_H_
00019 
00020 #include <vector>
00021 
00022 #include "tango-gl/color.h"
00023 #include "tango-gl/transform.h"
00024 #include "tango-gl/util.h"
00025 
00026 namespace tango_gl {
00027 class DrawableObject : public Transform {
00028  public:
00029   DrawableObject() : red_(0), green_(0), blue_(0), alpha_(1.0f) {};
00030   DrawableObject(const DrawableObject& other) = delete;
00031   const DrawableObject& operator=(const DrawableObject&) = delete;
00032 
00033   void DeleteGlResources();
00034   void SetShader();
00035   void SetColor(const Color& color);
00036   void SetColor(const float red, const float green, const float blue);
00037   void SetAlpha(const float alpha);
00038   void SetVertices(const std::vector<GLfloat>& vertices);
00039   void SetVertices(const std::vector<GLfloat>& vertices,
00040                    const std::vector<GLushort>& indices);
00041   void SetVertices(const std::vector<GLfloat>& vertices,
00042                    const std::vector<GLfloat>& normals);
00043   virtual void Render(const glm::mat4& projection_mat,
00044                       const glm::mat4& view_mat) const = 0;
00045 
00046  protected:
00047   float red_;
00048   float green_;
00049   float blue_;
00050   float alpha_;
00051   std::vector<GLushort> indices_;
00052   std::vector<GLfloat> vertices_;
00053   std::vector<GLfloat> normals_;
00054 
00055   GLenum render_mode_;
00056   GLuint shader_program_;
00057   GLuint uniform_color_;
00058   GLuint uniform_mvp_mat_;
00059   GLuint attrib_vertices_;
00060   GLuint attrib_normals_;
00061 };
00062 }  // namespace tango_gl
00063 #endif  // TANGO_GL_DRAWABLE_OBJECT_H_


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jun 6 2019 21:59:19