# 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 "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 // must test debug fast first, because NL_DEBUG_FAST and NL_DEBUG are declared at same time.
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 // must test debug fast first, because NL_DEBUG_FAST and NL_DEBUG are declared at same time.
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         static void                     drawBitmap (float x, float y, float width, float height, class ITexture& texture, IDriver& driver, CViewport viewport=CViewport(), bool blend=true);
00118         static void                     drawLine (float x0, float y0, float x1, float y1, IDriver& driver, CRGBA col= CRGBA(255,255,255,255), CViewport viewport=CViewport());
00120         static void                     drawTriangle (float x0, float y0, float x1, float y1, float x2, float y2, IDriver& driver, CRGBA col, CViewport viewport);
00122         static void                     drawQuad (float x0, float y0, float x1, float y1, IDriver& driver, CRGBA col, CViewport viewport);
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         static void                     drawTrianglesUnlit(const NLMISC::CTriangleUV    *trilist, sint ntris, CMaterial &mat, IDriver& driver);
00156         static void                     drawTrianglesUnlit(const std::vector<NLMISC::CTriangleUV> &trilist, CMaterial &mat, IDriver& driver);
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 } // NL3D
00169 
00170 
00171 #endif // NL_DRU_H
00172 
00173 /* End of dru.h */