render_face_model.h

00001 /* -- 2007-05-07 -- 
00002  *  ardev - an augmented reality library for robot developers
00003  *  Copyright 2005-2007 - Toby Collett (ardev _at_ plan9.net.nz)
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Lesser General Public
00007  *  License as published by the Free Software Foundation; either
00008  *  version 2.1 of the License, or (at your option) any later version.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00013  *  Lesser General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Lesser General Public
00016  *  License along with this library; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
00018  *
00019  */
00020 #include "config.h"
00021 #ifdef HAVE_LIBFEP
00022 
00030 #if !defined(_MODEL_H)
00031 #define _MODEL_H
00032 
00033 using namespace std;
00034 
00035 #define MAX_TEXTURES 1
00036 
00037 #include <fep/fep.h>
00038 #include <ardev/ardev.h>
00039 
00040 
00043 class RenderFace : public RenderObject
00044 {
00045         public:
00047                 RenderFace(const char * ModelFile = "model/chris.wfm",float _Size = 0.1, bool debug=false)
00048                 {
00049                         face = new VirtualFace(ModelFile, 800, 600, (VIRTUALFACE_MANUAL), debug);               
00050                         Size=_Size;
00051                 };
00052                 
00053                 ~RenderFace()
00054                 {
00055                         delete face;
00056                 }; 
00057         
00059                 void Render()
00060                 {
00061                         if (face)                               
00062                         {
00063                                 glEnable(GL_TEXTURE_2D);
00064                         glShadeModel(GL_SMOOTH);// Enables Smooth Color Shading
00065                         glEnable(GL_LINE_SMOOTH);
00066                         glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);        
00067                                 glEnable(GL_LIGHTING);
00068                                 glScalef(Size,Size,Size);
00069                                 glRotatef(-90,0,0,1);
00070                                 glRotatef(-90,1,0,0);                   
00071                                 face->Render(TextureID);
00072                                 glDisable(GL_TEXTURE_2D);
00073                                 glDisable(GL_LINE_SMOOTH);
00074                                 glDisable(GL_LIGHTING);
00075                         }
00076                         
00077                 }; 
00078                 
00079                 void ThreadInit()
00080                 {
00081                         glEnable(GL_TEXTURE_2D);
00082                         TextureID = face->createTexture();
00083                         glDisable(GL_TEXTURE_2D);                       
00084                 }
00085         
00087                 VirtualFace * face;
00089                 unsigned int TextureID;
00090 
00091 };
00092 
00093 
00094 #endif //- !defined(_MODEL_H)
00095 #endif

SourceForge.net Logo Generated on Sat May 12 15:25:43 2007 for ardev by doxygen 1.5.1