rtcMesh3DNode.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2008
00003  * Robert Bosch LLC
00004  * Research and Technology Center North America
00005  * Palo Alto, California
00006  *
00007  * All rights reserved.
00008  *
00009  *------------------------------------------------------------------------------
00010  * project ....: PUMA: Probablistic Unsupervised Model Acquisition
00011  * file .......: Mesh3DNode.h
00012  * authors ....: Benjamin Pitzer
00013  * organization: Robert Bosch LLC
00014  * creation ...: 04/16/2007
00015  * modified ...: $Date: 2009-09-10 13:26:19 -0700 (Thu, 10 Sep 2009) $
00016  * changed by .: $Author: benjaminpitzer $
00017  * revision ...: $Revision: 915 $
00018  */
00019 #ifndef MESH3DNODE_H
00020 #define MESH3DNODE_H
00021 
00022 //== INCLUDES ==================================================================
00023 #include <GL/glew.h>
00024 #include <GL/gl.h>
00025 #include <GL/glu.h>
00026 #include "rtc/rtcPose3D.h"
00027 #include "rtc/rtcMesh3D.h"
00028 #include "rtc/rtcRenderNode.h"
00029 
00030 //== NAMESPACES ================================================================
00031 namespace rtc {
00032 
00033 class Mesh3DNode : public RenderNode {
00034 public:
00035   using RenderNode::setTransform;
00036 
00037   // default constructor
00038   Mesh3DNode(Renderer* renderer, Mesh3D* mesh);
00039   // destructor
00040   virtual ~Mesh3DNode();
00041   // initialize rendering
00042   virtual void initialize(Mesh3D* mesh);
00043   // clear rendering
00044   virtual void clear();
00045   // rendering call
00046   virtual void render();
00047   // prerendering call
00048   virtual void preRender();
00049   // postrendering call
00050   virtual void postRender();
00051   // seperate gpu loading process
00052   void loadToGPU();
00053   void unloadGPU();
00054 protected:
00055   // draws mesh as faces in vertex buffer mode
00056   virtual void drawFacesVBO();
00057   // draws mesh as point cloud in vertex buffer mode
00058   virtual void drawPointsVBO();
00059   // draws mesh as wireframe in vertex buffer mode
00060   virtual void drawWireFrameVBO();
00061   // draws mesh as point cloud in immediate mode
00062   virtual void drawFaces();
00063   // draws mesh as point cloud in immediate mode
00064   virtual void drawPoints();
00065   // draws mesh as wireframe in immediate mode
00066   virtual void drawWireFrame();
00067 
00068   void bindVBO();
00069   void unbindVBO();
00070 protected:
00071   bool has_texture;
00072   Texture texture;
00073   Image<Vec3uc> teximage;
00074   unsigned int num_vertices;
00075   unsigned int num_faces;
00076 
00077   unsigned int position_buffer;
00078   int position_size;
00079   GLfloat* position_data;
00080 
00081   unsigned int normal_buffer;
00082   int normal_size;
00083   GLfloat* normal_data;
00084 
00085   unsigned int color_buffer;
00086   int color_size;
00087   GLubyte* color_data;
00088 
00089   unsigned int texture_coordinate_buffer;
00090   int texture_coordinate_size;
00091   GLfloat* texture_coordinate_data;
00092 
00093   unsigned int index_buffer;
00094   int index_size;
00095   GLuint* index_data;
00096 public:
00097   rtc::Pose3Df pose;
00098 };
00099 
00100 //==============================================================================
00101 } // NAMESPACE puma
00102 //==============================================================================
00103 #endif // MESH3DNODE_H defined
00104 //==============================================================================
00105 


rtc
Author(s): Benjamin Pitzer
autogenerated on Mon Oct 6 2014 10:07:35