Page principale | Hiérarchie des classes | Liste alphabétique | Liste des classes | Liste des fichiers | Membres de classe

C:/Projects/ngn/include/object.h

00001 /***************************************************************************
00002  *            object.h
00003  *
00004  *  Tue Sep  7 14:32:34 2004
00005  *  Copyright  2004  thierry schartz
00006  *  thierry.schartz@bluebottle.com
00007  ****************************************************************************/
00008 
00009 /*
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00023  */
00024  
00025 #ifndef _OBJECT_H
00026 #define _OBJECT_H
00027 
00028 #ifdef WIN32
00029 #include <windows.h>
00030 #endif
00031 
00032 
00033 #include "GLee.h"
00034 #include "vector3d.h"
00035 #include "material.h"
00036 #include "color.h"
00037 #include "texture.h"
00038 
00039 namespace ngn
00040 {
00041                 class Camera;
00042 
00043                 
00047                 class NGN_API Object3d 
00048                 {
00049                         public:
00050                                 Object3d();
00051                                 Object3d( const Object3d& other );
00052                                 
00054                                 void setID( int id );
00056                                 void enableTexture( bool state );
00058                                 void bindTexture( const core::Texture& tex, int numtex = 0 );
00060                                 void setColor( const core::Colorf& color );
00062                                 void setMaterial( const core::Material& mat );
00064                                 void setRenderMode( GLenum mode );
00066                                 virtual void setPosition( const core::Vector3df& pos );
00068                                 void setBlend( bool state );
00070                                 bool isBlended() const;
00072                                 void setBlendFunc( GLenum src, GLenum dst );
00074                                 const core::Vector3df& getPosition() const;
00076                                 int getID() const;
00078                                 bool isTextureBound( int texnum = 0 ) const;
00080                                 bool useTexture() const;
00082                                 const core::Texture& getTexture( int texnum = 0 ) const;
00084                                 const core::Colorf& getColor() const;
00086                                 const core::Material& getMaterial() const;
00088                                 const core::Vector3df& getCentre() const;
00090                                 GLenum getRenderMode() const;
00091 
00093                                 virtual void render( const Camera& cam ) = 0;
00094                                 
00095                         protected:
00097                                 virtual void computeCentre() = 0;
00098 
00099                                 // centre of the object
00100                                 core::Vector3df m_position;
00101                                 // texture of the object
00102                                 core::Texture m_tex0;
00103                                 // second texture of the object ( for lightmap use or other )
00104                                 core::Texture m_tex1;
00105                                 // color of the object
00106                                 core::Colorf m_color;
00107                                 // material of the object
00108                                 core::Material m_mat;
00109                                 // id number of the object
00110                                 int m_id;
00111                                 // enable/disable use of texture
00112                                 bool m_use_texture;
00113                                 bool m_tex0_bound;
00114                                 bool m_tex1_bound;
00115                                 GLenum m_rendermode;
00116                                 bool m_blend;
00117                                 GLenum m_blend_src, m_blend_dst;
00118                 };
00119 
00120 
00121 
00122 
00123 
00127                 class NGN_API Object2d 
00128                 {
00129                 public:
00130                         Object2d();
00131                         Object2d( const Object2d& other );
00132 
00134                         void setColor( const core::Colorf& color );
00136                         void setID( int id );
00138                         void enableTexture( bool state );
00140                         void bindTexture( const core::Texture& tex, int numtex = 0 );
00142                         void blend( bool state );
00144                         void setBlendFunc( GLenum src, GLenum dst );
00146                         int getID() const;
00148                         bool isTextureBound( int texnum = 0 ) const;
00150                         bool useTexture() const;
00152                         const core::Texture& getTexture( int texnum = 0 ) const;
00154                         const core::Colorf& getColor() const;
00156                         bool isBlended() const;
00157 
00159                         virtual void render() = 0;
00160 
00161                 protected:
00162                         core::Texture m_tex0;
00163                         // second texture of the object ( for lightmap use or other multitexturing )
00164                         core::Texture m_tex1;
00165                         GLenum m_blend_src;
00166                         GLenum m_blend_dst;
00167                 private:
00168                         // color of the object
00169                         core::Colorf m_color;
00170                         // id number of the object
00171                         int m_id;
00172                         // enable/disable use of texture
00173                         bool m_use_texture;
00174                         bool m_tex0_bound;
00175                         bool m_tex1_bound;
00176                         bool m_blended;
00177                         
00178 
00179                 };
00180 
00181 
00182                 
00183                 
00184                 
00185 }//ngn
00186 
00187 #endif /* _OBJECT_H */

Généré le Fri Nov 19 14:20:29 2004 pour NGN par  doxygen 1.3.9.1