00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
00100 core::Vector3df m_position;
00101
00102 core::Texture m_tex0;
00103
00104 core::Texture m_tex1;
00105
00106 core::Colorf m_color;
00107
00108 core::Material m_mat;
00109
00110 int m_id;
00111
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
00164 core::Texture m_tex1;
00165 GLenum m_blend_src;
00166 GLenum m_blend_dst;
00167 private:
00168
00169 core::Colorf m_color;
00170
00171 int m_id;
00172
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 }
00186
00187 #endif