00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef NL_DRU_H
00027 #define NL_DRU_H
00028
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/misc/common.h"
00031 #include "3d/driver.h"
00032 #include "nel/3d/viewport.h"
00033 #include "nel/misc/geom_ext.h"
00034 #include "nel/misc/line.h"
00035
00036
00037 #ifdef NL_OS_WINDOWS
00038 # if _MSC_VER >= 1300 // visual .NET, use different dll name
00039
00040 # ifdef NL_DEBUG_FAST
00041 # define NL3D_DLL_NAME "nldriver_opengl_df.dll"
00042 # elif defined (NL_DEBUG)
00043 # define NL3D_DLL_NAME "nldriver_opengl_d.dll"
00044 # elif defined (NL_RELEASE_DEBUG)
00045 # define NL3D_DLL_NAME "nldriver_opengl_rd.dll"
00046 # elif defined (NL_RELEASE)
00047 # define NL3D_DLL_NAME "nldriver_opengl_r.dll"
00048 # else
00049 # error "Unknown dll name"
00050 # endif
00051 # else // visual 6 or lesser
00052
00053 # ifdef NL_DEBUG_FAST
00054 # define NL3D_DLL_NAME "nel_drv_opengl_win_df.dll"
00055 # elif defined (NL_DEBUG)
00056 # define NL3D_DLL_NAME "nel_drv_opengl_win_d.dll"
00057 # elif defined (NL_RELEASE_DEBUG)
00058 # define NL3D_DLL_NAME "nel_drv_opengl_win_rd.dll"
00059 # elif defined (NL_RELEASE)
00060 # define NL3D_DLL_NAME "nel_drv_opengl_win_r.dll"
00061 # else
00062 # error "Unknown dll name"
00063 # endif
00064 # endif
00065 #elif defined (NL_OS_UNIX)
00066 # define NL3D_DLL_NAME "libnel_drv_opengl.so.0"
00067 #else
00068 # error "Unknown system"
00069 #endif // NL_OS_UNIX
00070
00071 namespace NL3D
00072 {
00073
00075 struct EDru : public NLMISC::Exception
00076 {
00077 EDru(const std::string &reason) : Exception(reason) {}
00078 };
00079
00080 struct EDruOpenglDriverNotFound : public EDru
00081 {
00082 EDruOpenglDriverNotFound() : EDru( NL3D_DLL_NAME " not found" ) {}
00083 };
00084
00085 struct EDruOpenglDriverCorrupted : public EDru
00086 {
00087 EDruOpenglDriverCorrupted() : EDru( "Can't get NL3D_createIDriverInstance from " NL3D_DLL_NAME " (Bad dll?)" ) {}
00088 };
00089
00090 struct EDruOpenglDriverOldVersion : public EDru
00091 {
00092 EDruOpenglDriverOldVersion() : EDru( NL3D_DLL_NAME " is a too old version. Ask for a more recent file" ) {}
00093 };
00094
00095 struct EDruOpenglDriverUnknownVersion : public EDru
00096 {
00097 EDruOpenglDriverUnknownVersion() : EDru( NL3D_DLL_NAME " is more recent than the application" ) {}
00098 };
00099
00100 struct EDruOpenglDriverCantCreateDriver : public EDru
00101 {
00102 EDruOpenglDriverCantCreateDriver() : EDru( NL3D_DLL_NAME " can't create driver" ) {}
00103 };
00104
00106 class CDRU
00107 {
00108 public:
00109
00111 static IDriver *createGlDriver() throw(EDru);
00112
00114
00116
00118
00120
00122
00137 static void drawQuad (float x0, float y0, float x1, float y1, CRGBA col0, CRGBA col1, CRGBA col2, CRGBA col3, IDriver& driver, CViewport viewport);
00139 static void drawQuad (float xcenter, float ycenter, float radius, IDriver& driver, CRGBA col, CViewport viewport);
00141 static void drawWiredQuad (float x0, float y0, float x1, float y1, IDriver& driver, CRGBA col, CViewport viewport);
00143 static void drawWiredQuad (float xcenter, float ycenter, float radius, IDriver& driver, CRGBA col, CViewport viewport);
00144
00145
00146
00148
00152
00154
00156
00157
00159 static void drawLinesUnlit(const NLMISC::CLine *linelist, sint nlines, CMaterial &mat, IDriver& driver);
00161 static void drawLinesUnlit(const std::vector<NLMISC::CLine> &linelist, CMaterial &mat, IDriver& driver);
00163 static void drawLine(const CVector &a, const CVector &b, CRGBA color, IDriver& driver);
00164
00165
00166 };
00167
00168 }
00169
00170
00171 #endif // NL_DRU_H
00172
00173