Geom.hh
Go to the documentation of this file.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
00026
00027 #ifndef GEOM_HH
00028 #define GEOM_HH
00029
00030 #include "GL/gl.h"
00031 #include "Global.hh"
00032 #include "Color.hh"
00033 #include "RenderOptions.hh"
00034 #include "BaseGeom.hh"
00035
00036
00037 class GzImage;
00038
00039
00040 typedef struct _Lib3dsNode Lib3dsNode;
00041 typedef struct _Lib3dsFile Lib3dsFile;
00042 typedef struct _Lib3dsMesh Lib3dsMesh;
00043
00049 class Geom : public BaseGeom
00050 {
00051 public: Geom(dSpaceID spaceId);
00052 public: virtual ~Geom();
00053
00054
00055 public: void SetColor( const GzColor &color );
00056 public: void SetAmbientColor( const GzColor &color );
00057 public: void SetDiffuseColor( const GzColor &color );
00058 public: void SetSpecularColor( const GzColor &color );
00059 public: void SetEmissionColor( const GzColor &color );
00060 public: void SetShadeModel( const char *mode );
00061 public: void SetPolygonMode( const char *mode );
00062 public: void SetTransparency( bool enable );
00063 public: void SetShininess( float num );
00064 public: void SetLaser( float num );
00065 public: void SetRetro( float num );
00066 public: void SetFiducial( int id );
00067 public: void SetPickId( GLuint id );
00068
00073 public: int SetTexture2D( int width, int height, const uint8_t *data );
00074
00078 public: int SetTexture2DFile( const char *filename );
00079
00082 public: void SetTexture2DSize( GzVector size );
00083
00086 public: int SetSkinFile( const char *filename );
00087
00093 public: void SetSkinNull(bool enable) {this->skinNull = enable;}
00094
00097 public: void SetSkinPose( GzPose pose );
00098
00101 public: void SetSkinScale( GzVector scale );
00102
00104 public: bool HasSkin() {return this->skinFile != NULL;}
00105
00107 public: bool HasSkinNull() {return this->skinNull;}
00108
00109
00110 public: GzColor GetAmbientColor() const;
00111 public: GzColor GetDiffuseColor() const;
00112 public: GzColor GetSpecularColor() const;
00113 public: float GetTransparency() const;
00114 public: float GetShininess() const;
00115 public: float GetLaser() const;
00116 public: float GetRetro() const;
00117 public: int GetFiducial() const;
00118 public: GLuint GetPickId() const;
00119
00121 protected: void SetList(int camera, GLuint listId, RenderOptions opt);
00122
00124 protected: void GetList(int camera, GLuint *listId, RenderOptions *opt);
00125
00126
00127
00128 public: virtual void PreRender(RenderOptions *opt);
00129 public: virtual void Render(RenderOptions *opt);
00130 public: virtual void PostRender(RenderOptions *opt);
00131
00133 public: void RenderSkin(RenderOptions *opt);
00134
00135
00136 private: void RenderSkinNode(Lib3dsNode *node);
00137
00138
00139 private: void RenderSkinMesh( Lib3dsMesh *mesh );
00140
00141
00142 public: int renderOrder;
00143
00144
00145 protected: bool transparency;
00146 protected: float laser;
00147 protected: float retro;
00148 protected: int fiducial;
00149 protected: GLfloat colorDiffuse[4];
00150 protected: GLfloat colorAmbient[4];
00151 protected: GLfloat colorSpecular[4];
00152 protected: GLfloat colorEmission[4];
00153 protected: GLfloat shininess;
00154
00156 protected: GzImage *textureImage;
00157
00159 protected: GzVector textureSize;
00160
00161
00162 protected: int pick;
00163
00165 private: struct
00166 {
00167 GLuint listId;
00168 RenderOptions opt;
00169 } listList[256];
00170
00172 private: Lib3dsFile *skinFile;
00173
00175 private: bool skinNull;
00176
00178 private: GzPose skinPose;
00179 private: GzVector skinScale;
00180 private: GLuint meshListId;
00181
00183 protected: bool dirty;
00184 };
00185
00186 #endif
00187
Last updated 12 September 2005 21:38:45
|