GLshape.h
Go to the documentation of this file.
1 #ifndef __GLSHAPE_H__
2 #define __GLSHAPE_H__
3 
4 #ifdef __APPLE__
5 #include <OpenGL/gl.h>
6 #else
7 #include <GL/gl.h>
8 #endif
9 #include <Eigen/Core>
10 #include <vector>
11 #include <boost/intrusive_ptr.hpp>
12 #include <hrpCorba/ModelLoader.hh>
13 #include "GLcoordinates.h"
14 
15 class GLtexture;
16 
17 class GLshape : public GLcoordinates
18 {
19 public:
20  GLshape();
21  ~GLshape();
22  size_t draw(int i_mode);
23  void setVertices(unsigned int nvertices, const float *vertices);
24  void setTriangles(unsigned int ntriangles, const int *vertexIndices);
25  void setNormals(unsigned int nnormal, const float *normals);
26  void setNormalIndices(unsigned int len, const int *normalIndices);
27  void setDiffuseColor(float r, float g, float b, float a);
28  void setSpecularColor(float r, float g, float b);
29  void setShininess(float s);
30  void setColors(unsigned int ncolors, const float *colors);
31  void normalPerVertex(bool flag);
32  void solid(bool flag);
33  void setTextureCoordinates(unsigned int len, const float *coordinates);
34  void setTextureCoordIndices(unsigned int len, const int *coordinates);
35  void setTexture(GLtexture *texture);
36  void compile();
37  void highlight(bool flag);
38  void divideLargeTriangles(double maxEdgeLen);
39  void computeAABB(const hrp::Vector3& i_p, const hrp::Matrix33& i_R,
40  hrp::Vector3& o_min, hrp::Vector3& o_max);
41 protected:
42  int doCompile(bool isWireFrameMode);
43 
44  std::vector<Eigen::Vector3f> m_vertices, m_normals, m_colors;
45  std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > m_textureCoordinates;
46  std::vector<Eigen::Vector3i> m_triangles;
50  bool m_solid;
54  GLuint m_textureId;
56 };
57 
58 #endif
std::vector< int > m_normalIndices
Definition: GLshape.h:47
int doCompile(bool isWireFrameMode)
Definition: GLshape.cpp:134
void compile()
Definition: GLshape.cpp:129
void divideLargeTriangles(double maxEdgeLen)
Definition: GLshape.cpp:281
void setNormals(unsigned int nnormal, const float *normals)
Definition: GLshape.cpp:64
void computeAABB(const hrp::Vector3 &i_p, const hrp::Matrix33 &i_R, hrp::Vector3 &o_min, hrp::Vector3 &o_max)
Definition: GLshape.cpp:391
void setTexture(GLtexture *texture)
Definition: GLshape.cpp:124
std::vector< Eigen::Vector3f > m_vertices
Definition: GLshape.h:44
void setTextureCoordinates(unsigned int len, const float *coordinates)
Definition: GLshape.cpp:107
void setTextureCoordIndices(unsigned int len, const int *coordinates)
Definition: GLshape.cpp:116
void setSpecularColor(float r, float g, float b)
Definition: GLshape.cpp:269
int m_wireFrameList
Definition: GLshape.h:53
void setVertices(unsigned int nvertices, const float *vertices)
Definition: GLshape.cpp:44
bool m_highlight
Definition: GLshape.h:55
std::vector< Eigen::Vector3f > m_colors
Definition: GLshape.h:44
GLshape()
Definition: GLshape.cpp:13
Eigen::Vector3d Vector3
Eigen::Matrix3d Matrix33
void solid(bool flag)
Definition: GLshape.cpp:94
std::vector< Eigen::Vector3i > m_triangles
Definition: GLshape.h:46
void setShininess(float s)
Definition: GLshape.cpp:264
std::vector< int > m_textureCoordIndices
Definition: GLshape.h:47
std::vector< Eigen::Vector2f, Eigen::aligned_allocator< Eigen::Vector2f > > m_textureCoordinates
Definition: GLshape.h:45
~GLshape()
Definition: GLshape.cpp:20
int m_shadingList
Definition: GLshape.h:53
void setColors(unsigned int ncolors, const float *colors)
Definition: GLshape.cpp:79
std::vector< Eigen::Vector3f > m_normals
Definition: GLshape.h:44
void setTriangles(unsigned int ntriangles, const int *vertexIndices)
Definition: GLshape.cpp:54
void setDiffuseColor(float r, float g, float b, float a)
Definition: GLshape.cpp:74
GLuint m_textureId
Definition: GLshape.h:54
float m_shininess
Definition: GLshape.h:48
float m_specular[4]
Definition: GLshape.h:48
GLtexture * m_texture
Definition: GLshape.h:51
bool m_normalPerVertex
Definition: GLshape.h:49
void highlight(bool flag)
Definition: GLshape.cpp:275
void setNormalIndices(unsigned int len, const int *normalIndices)
Definition: GLshape.cpp:99
size_t draw(int i_mode)
Definition: GLshape.cpp:30
bool m_solid
Definition: GLshape.h:50
void normalPerVertex(bool flag)
Definition: GLshape.cpp:89
png_infop png_uint_32 flag
float m_diffuse[4]
Definition: GLshape.h:48
bool m_requestCompile
Definition: GLshape.h:52


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Thu May 6 2021 02:41:50