render_base.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 #ifndef RENDER_TEAPOT_H
00021 #define RENDER_TEAPOT_H
00022 
00023 #include <ardev/ardev.h>
00024 #include <GL/glut.h>
00025 
00026 class CLoad3DS;
00027 class t3DModel;
00030 class RenderModel : public RenderObject
00031 {
00032         public:
00034                 RenderModel(const char * ModelFile, const char * TextureBase = "", double Scale = 1);
00036                 ~RenderModel();
00037         
00039                 void Render();
00041                 void ThreadInit();
00042         
00043         protected:
00044                 double Scale;
00045                 unsigned int * g_Texture ;                     // This holds the texture info, referenced by an ID
00046 
00047                 char * TextureBase;
00048                 char * ModelName;
00049                 CLoad3DS * g_Load3ds;                                     // This is 3DS class.  This should go in a good model class.
00050                 t3DModel * g_3DModel;                                     // This holds the 3D Model info that we load in
00051 };      
00052 
00053 
00056 class RenderTeapot : public RenderObject
00057 {
00058         public:
00060         RenderTeapot(const ARColour & _Colour, float _size)
00061         {
00062                 Size = _size;
00063                 Colour = _Colour;
00064         }
00065         
00066         void Render() 
00067         {
00068                 //glEnable(GL_LIGHTING);
00069                 GLfloat mat_specular[] = { Colour.r, Colour.g, Colour.b, Colour.a };
00070                 GLfloat mat_diffuse[] = { Colour.r, Colour.g, Colour.b, Colour.a };
00071                 GLfloat mat_shininess[] = { 50.0 };
00072 
00073                 glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
00074                 glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
00075                 glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);            
00076                 glColor3f(Colour.r, Colour.g, Colour.b);
00077                 glutSolidTeapot(Size);
00078                 //glDisable(GL_LIGHTING);
00079         }
00080 };
00081 
00082 
00083 #endif

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