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 "nel/3d/driver.h"
00032 #include "nel/3d/tmp/viewport.h"
00033 #include "nel/misc/geom_ext.h"
00034 #include "nel/misc/line.h"
00035
00036
00037 #ifdef NL_OS_WINDOWS
00038 #ifdef NL_DEBUG
00039 #define NL3D_DLL_NAME "nel_drv_opengl_win_debug.dll"
00040 #elif defined (NL_RELEASE_DEBUG)
00041 #define NL3D_DLL_NAME "nel_drv_opengl_win_rd.dll"
00042 #elif defined (NL_RELEASE)
00043 #define NL3D_DLL_NAME "nel_drv_opengl_win.dll"
00044 #else
00045 #error "Unknown dll name"
00046 #endif
00047 #elif defined (NL_OS_UNIX)
00048 #define NL3D_DLL_NAME "libnel_drv_opengl.so"
00049 #else
00050 #error "Unknown system"
00051 #endif
00052
00053 namespace NL3D
00054 {
00055
00057 struct EDru : public NLMISC::Exception
00058 {
00059 EDru(const std::string &reason) : Exception(reason) {}
00060 };
00061
00062 struct EDruOpenglDriverNotFound : public EDru
00063 {
00064 EDruOpenglDriverNotFound() : EDru( NL3D_DLL_NAME " not found" ) {}
00065 };
00066
00067 struct EDruOpenglDriverCorrupted : public EDru
00068 {
00069 EDruOpenglDriverCorrupted() : EDru( "Can't get NL3D_createIDriverInstance from " NL3D_DLL_NAME " (Bad dll?)" ) {}
00070 };
00071
00072 struct EDruOpenglDriverOldVersion : public EDru
00073 {
00074 EDruOpenglDriverOldVersion() : EDru( NL3D_DLL_NAME " is a too old version. Ask for a more recent file" ) {}
00075 };
00076
00077 struct EDruOpenglDriverUnknownVersion : public EDru
00078 {
00079 EDruOpenglDriverUnknownVersion() : EDru( NL3D_DLL_NAME " is more recent than the application" ) {}
00080 };
00081
00082 struct EDruOpenglDriverCantCreateDriver : public EDru
00083 {
00084 EDruOpenglDriverCantCreateDriver() : EDru( NL3D_DLL_NAME " can't create driver" ) {}
00085 };
00086
00088 class CDRU
00089 {
00090 public:
00091
00093 static IDriver *createGlDriver() throw(EDru);
00094
00096 00098 00100 00102 00104 00119 static void drawQuad (float x0, float y0, float x1, float y1, CRGBA col0, CRGBA col1, CRGBA col2, CRGBA col3, IDriver& driver, CViewport viewport);
00121 static void drawQuad (float xcenter, float ycenter, float radius, IDriver& driver, CRGBA col, CViewport viewport);
00123 static void drawWiredQuad (float x0, float y0, float x1, float y1, IDriver& driver, CRGBA col, CViewport viewport);
00125 static void drawWiredQuad (float xcenter, float ycenter, float radius, IDriver& driver, CRGBA col, CViewport viewport);
00126
00127
00128
00130
00134 00136 00138
00139
00141 static void drawLinesUnlit(const NLMISC::CLine *linelist, sint nlines, CMaterial &mat, IDriver& driver);
00143 static void drawLinesUnlit(const std::vector<NLMISC::CLine> &linelist, CMaterial &mat, IDriver& driver);
00145 static void drawLine(const CVector &a, const CVector &b, CRGBA color, IDriver& driver);
00146
00147
00148 };
00149
00150 }
00151
00152
00153 #endif // NL_DRU_H
00154
00155