# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

dru.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL 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, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
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         static void                     drawBitmap (float x, float y, float width, float height, class ITexture& texture, IDriver& driver, CViewport viewport=CViewport(), bool blend=true);
00100         static void                     drawLine (float x0, float y0, float x1, float y1, IDriver& driver, CRGBA col= CRGBA(255,255,255,255), CViewport viewport=CViewport());
00102         static void                     drawTriangle (float x0, float y0, float x1, float y1, float x2, float y2, IDriver& driver, CRGBA col, CViewport viewport);
00104         static void                     drawQuad (float x0, float y0, float x1, float y1, IDriver& driver, CRGBA col, CViewport viewport);
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         static void                     drawTrianglesUnlit(const NLMISC::CTriangleUV    *trilist, sint ntris, CMaterial &mat, IDriver& driver);
00138         static void                     drawTrianglesUnlit(const std::vector<NLMISC::CTriangleUV> &trilist, CMaterial &mat, IDriver& driver);
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 } // NL3D
00151 
00152 
00153 #endif // NL_DRU_H
00154 
00155 /* End of dru.h */