GLshape.h
Go to the documentation of this file.
00001 #ifndef __GLSHAPE_H__
00002 #define __GLSHAPE_H__
00003 
00004 #ifdef __APPLE__
00005 #include <OpenGL/gl.h>
00006 #else
00007 #include <GL/gl.h>
00008 #endif
00009 #include <Eigen/Core>
00010 #include <vector>
00011 #include <boost/intrusive_ptr.hpp>
00012 #include <hrpCorba/ModelLoader.hh>
00013 #include "GLcoordinates.h"
00014 
00015 class GLtexture;
00016 
00017 class GLshape : public GLcoordinates
00018 {
00019 public:
00020     GLshape();
00021     ~GLshape();
00022     size_t draw(int i_mode);
00023     void setVertices(unsigned int nvertices, const float *vertices);
00024     void setTriangles(unsigned int ntriangles, const int *vertexIndices);
00025     void setNormals(unsigned int nnormal, const float *normals);
00026     void setNormalIndices(unsigned int len, const int *normalIndices);
00027     void setDiffuseColor(float r, float g, float b, float a);
00028     void setSpecularColor(float r, float g, float b);
00029     void setShininess(float s);
00030     void setColors(unsigned int ncolors, const float *colors);
00031     void normalPerVertex(bool flag);
00032     void solid(bool flag);
00033     void setTextureCoordinates(unsigned int len, const float *coordinates);
00034     void setTextureCoordIndices(unsigned int len, const int *coordinates);
00035     void setTexture(GLtexture *texture);
00036     void compile();
00037     void highlight(bool flag);
00038     void divideLargeTriangles(double maxEdgeLen);
00039     void computeAABB(const hrp::Vector3& i_p, const hrp::Matrix33& i_R,
00040                      hrp::Vector3& o_min, hrp::Vector3& o_max);
00041 protected:
00042     int doCompile(bool isWireFrameMode);
00043 
00044     std::vector<Eigen::Vector3f> m_vertices, m_normals, m_colors;
00045     std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > m_textureCoordinates;
00046     std::vector<Eigen::Vector3i> m_triangles;
00047     std::vector<int> m_normalIndices, m_textureCoordIndices;
00048     float m_diffuse[4], m_specular[4], m_shininess;
00049     bool m_normalPerVertex;
00050     bool m_solid;
00051     GLtexture *m_texture;
00052     bool m_requestCompile;
00053     int m_shadingList, m_wireFrameList;
00054     GLuint m_textureId;
00055     bool m_highlight;
00056 };
00057 
00058 #endif


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Wed Sep 6 2017 02:35:55