From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/driver_8h-source.html | 557 +++++++++++++++++++++++++++++++++ 1 file changed, 557 insertions(+) create mode 100644 docs/doxygen/nel/driver_8h-source.html (limited to 'docs/doxygen/nel/driver_8h-source.html') diff --git a/docs/doxygen/nel/driver_8h-source.html b/docs/doxygen/nel/driver_8h-source.html new file mode 100644 index 00000000..bb692be3 --- /dev/null +++ b/docs/doxygen/nel/driver_8h-source.html @@ -0,0 +1,557 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# 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  
+

driver.h

Go to the documentation of this file.
00001 
+00008 /* Copyright, 2000 Nevrax Ltd.
+00009  *
+00010  * This file is part of NEVRAX NEL.
+00011  * NEVRAX NEL is free software; you can redistribute it and/or modify
+00012  * it under the terms of the GNU General Public License as published by
+00013  * the Free Software Foundation; either version 2, or (at your option)
+00014  * any later version.
+00015 
+00016  * NEVRAX NEL is distributed in the hope that it will be useful, but
+00017  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00019  * General Public License for more details.
+00020 
+00021  * You should have received a copy of the GNU General Public License
+00022  * along with NEVRAX NEL; see the file COPYING. If not, write to the
+00023  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00024  * MA 02111-1307, USA.
+00025  */
+00026 
+00027 #ifndef NL_DRV_H
+00028 #define NL_DRV_H
+00029 
+00030 #include "nel/misc/types_nl.h"
+00031 #include "nel/misc/common.h"
+00032 #include "nel/misc/smart_ptr.h"
+00033 #include "nel/misc/rgba.h"
+00034 #include "nel/misc/matrix.h"
+00035 #include "nel/misc/stream.h"
+00036 #include "nel/misc/uv.h"
+00037 #include "3d/texture.h"
+00038 #include "3d/shader.h"
+00039 #include "3d/vertex_buffer.h"
+00040 #include "3d/vertex_buffer_hard.h"
+00041 #include "3d/vertex_program.h"
+00042 #include "3d/material.h"
+00043 #include "nel/misc/mutex.h"
+00044 #include "nel/3d/primitive_profile.h"
+00045 
+00046 #include <vector>
+00047 #include <list>
+00048 
+00049 namespace NLMISC
+00050 {
+00051 class IEventEmitter;
+00052 struct IMouseDevice;
+00053 struct IKeyboardDevice;
+00054 struct IInputDeviceManager;
+00055 class CRect;
+00056 };
+00057 
+00058 namespace NL3D
+00059 {
+00060 
+00061 using NLMISC::CRefPtr;
+00062 using NLMISC::CRefCount;
+00063 using NLMISC::CSmartPtr;
+00064 using NLMISC::CRGBA;
+00065 using NLMISC::CVector;
+00066 using NLMISC::CMatrix;
+00067 using NLMISC::CSynchronized;
+00068 
+00069 
+00070 class CMaterial;
+00071 class CPrimitiveBlock;
+00072 class CLight;
+00073 class CScissor;
+00074 class CViewport;
+00075 struct CMonitorColorProperties;
+00076 
+00077 
+00078 
+00079 //****************************************************************************
+00081 class GfxMode 
+00082 {
+00083 public:
+00084         bool                            OffScreen;
+00085         bool                            Windowed;
+00086         uint16                          Width;
+00087         uint16                          Height;
+00088         uint8                           Depth;
+00089 
+00090                                                 GfxMode(void) 
+00091                                                 { 
+00092                                                         OffScreen=false;
+00093                                                         Windowed=false;
+00094                                                         Width=0;
+00095                                                         Height=0;
+00096                                                         Depth=0;
+00097                                                 }
+00098                                                 GfxMode(uint16 w, uint16 h, uint8 d, bool windowed= true, bool offscreen=false);
+00099 };
+00100 
+00101 typedef std::vector<GfxMode> ModeList;
+00102 
+00103 
+00104 //****************************************************************************
+00105 // Exceptions.
+00106 struct EBadDisplay : public NLMISC::Exception
+00107 {
+00108         EBadDisplay(const std::string &reason) : Exception(reason) { }
+00109 };
+00110 
+00111 //****************************************************************************
+00112 typedef void (*emptyProc)(void);
+00113 
+00114 //****************************************************************************
+00115 // *** IMPORTANT ********************
+00116 // *** IF YOU MODIFY THE STRUCTURE OF THIS CLASS, PLEASE INCREMENT IDriver::InterfaceVersion TO INVALIDATE OLD DRIVER DLL
+00117 // **********************************
+00118 // 
+00119 // * Driver implementation notes:
+00120 // *
+00121 // * Driver implementation must save monitor color parameters at initialization and restaure it at release.
+00122 class IDriver : public NLMISC::CRefCount
+00123 {
+00124 public:
+00126         static const uint32                                             InterfaceVersion;
+00127 
+00128 public:
+00129         enum TMessageBoxId { okId=0, yesId, noId, abortId, retryId, cancelId, ignoreId, idCount };
+00130         enum TMessageBoxType { okType=0, okCancelType, yesNoType, abortRetryIgnoreType, yesNoCancelType, retryCancelType, typeCount };
+00131         enum TMessageBoxIcon { noIcon=0, handIcon, questionIcon, exclamationIcon, asteriskIcon, warningIcon, errorIcon, informationIcon, stopIcon, iconCount };
+00132 
+00138         enum TPolygonMode { Filled=0, Line, Point };
+00139 
+00140 
+00146         enum TMatrixCount { MaxModelMatrix= 16 };
+00147 
+00148 
+00153         enum TVBHardType { VBHardAGP=0, VBHardVRAM, CountVBHard };
+00154 
+00155 
+00156 protected:
+00157 
+00158         CSynchronized<TTexDrvInfoPtrMap> _SyncTexDrvInfos;
+00159 
+00160         TTexDrvSharePtrList             _TexDrvShares;
+00161         TShaderPtrList                  _Shaders;
+00162         TVBDrvInfoPtrList               _VBDrvInfos;
+00163         TPolygonMode                    _PolygonMode;
+00164         TVtxPrgDrvInfoPtrList   _VtxPrgDrvInfos;
+00165 
+00166 public:
+00167                                                         IDriver(void);
+00168         virtual                                 ~IDriver(void);
+00169 
+00170         virtual bool                    init(void)=0;
+00171 
+00172         virtual ModeList                enumModes()=0;
+00173 
+00175 
+00178         // @{
+00179         virtual void                    disableHardwareVertexProgram()=0;
+00180         virtual void                    disableHardwareVertexArrayAGP()=0;
+00181         virtual void                    disableHardwareTextureShader()=0;
+00182         // @}
+00183 
+00184         // first param is the associated window. 
+00185         // Must be a HWND for Windows (WIN32).
+00186         virtual bool                    setDisplay(void* wnd, const GfxMode& mode) throw(EBadDisplay)=0;
+00187 
+00188         // Return is the associated window information. (Implementation dependant)
+00189         // Must be a HWND for Windows (WIN32).
+00190         virtual void                    *getDisplay() =0;
+00191 
+00197         virtual bool                    setMonitorColorProperties (const CMonitorColorProperties &properties) = 0;
+00198 
+00199         // Return is the associated default window proc for the driver. (Implementation dependant)
+00200         // Must be a void GlWndProc(IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) for Windows (WIN32).
+00201         virtual emptyProc               getWindowProc() =0;
+00202 
+00204         virtual bool                    activate(void)=0;
+00205 
+00207         virtual sint                    getNbTextureStages() const =0;
+00208 
+00210         virtual bool                    isTextureExist(const ITexture&tex)=0;
+00211 
+00212         virtual NLMISC::IEventEmitter*  getEventEmitter(void)=0;
+00213 
+00214         virtual bool                    clear2D(CRGBA rgba)=0;
+00215 
+00216         virtual bool                    clearZBuffer(float zval=1)=0;
+00217 
+00219         virtual void                    setColorMask (bool bRed, bool bGreen, bool bBlue, bool bAlpha)=0;
+00220 
+00223         virtual bool                    setupTexture(ITexture& tex)=0;
+00224 
+00236         virtual bool                    setupTextureEx (ITexture& tex, bool bUpload, bool& bAllUploaded, 
+00237                 bool bMustRecreateSharedTexture= false)=0;
+00238 
+00242         virtual bool                    uploadTexture (ITexture& tex, NLMISC::CRect& rect, uint8 nNumMipMap)=0;
+00243         virtual bool                    uploadTextureCube (ITexture& tex, NLMISC::CRect& rect, uint8 nNumMipMap, uint8 nNumFace)=0;
+00244 
+00248         bool                                    invalidateShareTexture (ITexture &);
+00249 
+00253         static void                             getTextureShareName (const ITexture& tex, std::string &output);
+00254 
+00259         virtual void                    forceDXTCCompression(bool dxtcComp)=0;
+00260 
+00266         virtual void                    forceTextureResize(uint divisor)=0;
+00267 
+00268 
+00269         virtual bool                    setupMaterial(CMaterial& mat)=0;
+00270 
+00271         // Setup the camera mode as a perspective/ortho camera. NB: znear and zfar must be >0 (if perspective).
+00272         virtual void                    setFrustum(float left, float right, float bottom, float top, float znear, float zfar, bool perspective=true)=0;
+00273 
+00278         virtual void                    setupViewMatrix(const CMatrix& mtx)=0;
+00279 
+00292         virtual void                    setupViewMatrixEx(const CMatrix& mtx, const CVector &cameraPos)=0;
+00293 
+00298         virtual void                    setupModelMatrix(const CMatrix& mtx)=0;
+00299 
+00306         virtual void                    multiplyModelMatrix(const CMatrix& mtx)=0;
+00307 
+00308 
+00309         virtual CMatrix                 getViewMatrix(void)const=0;
+00310 
+00311 
+00316         virtual void                    forceNormalize(bool normalize)=0;
+00317 
+00318 
+00321         virtual bool                    isForceNormalize() const =0;
+00322 
+00323 
+00324 
+00327         virtual bool                    supportVertexBufferHard() const =0;
+00328 
+00329 
+00332         virtual bool                    slowUnlockVertexBufferHard() const =0;
+00333 
+00334 
+00337         virtual uint                    getMaxVerticesByVertexBufferHard() const =0;
+00338 
+00339 
+00349         virtual bool                    initVertexArrayRange(uint agpMem, uint vramMem=0) =0;
+00350 
+00351 
+00367         virtual IVertexBufferHard       *createVertexBufferHard(uint16 vertexFormat, const uint8 *typeArray, uint32 numVertices, 
+00368                                                                                                                 TVBHardType vbType) =0;
+00369 
+00370 
+00373         virtual void                    deleteVertexBufferHard(IVertexBufferHard *VB) =0;
+00374 
+00375 
+00382         virtual void                    activeVertexBufferHard(IVertexBufferHard *VB)=0;
+00383 
+00384 
+00385 
+00393         virtual bool                    activeVertexBuffer(CVertexBuffer& VB)=0;
+00394 
+00395 
+00409         virtual bool                    activeVertexBuffer(CVertexBuffer& VB, uint first, uint end)=0;
+00410 
+00411 
+00423         virtual void                    mapTextureStageToUV(uint stage, uint uv)=0;
+00424 
+00425 
+00428         virtual bool                    render(CPrimitiveBlock& PB, CMaterial& Mat)=0;
+00429 
+00433         virtual void                    renderTriangles(CMaterial& Mat, uint32 *tri, uint32 ntris)=0;
+00434 
+00435 
+00443         virtual void                    renderSimpleTriangles(uint32 *tri, uint32 ntris)=0;
+00444 
+00445 
+00448         virtual void                    renderPoints(CMaterial& Mat, uint32 numPoints)=0;
+00449 
+00453         virtual void                    renderQuads(CMaterial& Mat, uint32 startIndex, uint32 numQuads)=0;
+00454 
+00455 
+00456 
+00458         virtual bool                    swapBuffers(void)=0;
+00459 
+00460 
+00462         // @{
+00463 
+00464 
+00470         virtual void                    profileRenderedPrimitives(CPrimitiveProfile &pIn, CPrimitiveProfile &pOut) =0;
+00471 
+00472 
+00476         virtual uint32                  profileAllocatedTextureMemory() =0;
+00477 
+00478         
+00481         virtual uint32                  profileSetupedMaterials() const =0;
+00482 
+00483 
+00486         virtual uint32                  profileSetupedModelMatrix() const =0;
+00487 
+00488 
+00491         virtual void                    enableUsedTextureMemorySum (bool enable=true) =0;
+00492         
+00493 
+00497         virtual uint32                  getUsedTextureMemory() const =0;
+00498 
+00499         // @}
+00500 
+00501 
+00503         // @{
+00504         virtual bool                    fogEnabled()=0;
+00505         virtual void                    enableFog(bool enable)=0;
+00507         virtual void                    setupFog(float start, float end, CRGBA color)=0;
+00508         // @}
+00509 
+00511         virtual bool                    release(void);
+00512 
+00514         virtual bool                    isActive()=0;
+00515 
+00517         virtual uint8                   getBitPerPixel ()=0;
+00518 
+00528         virtual TMessageBoxId   systemMessageBox (const char* message, const char* title, TMessageBoxType type=okType, TMessageBoxIcon icon=noIcon);
+00529 
+00534         virtual void                    setupViewport (const class CViewport& viewport)=0;
+00535 
+00536 
+00540         virtual void                    setupScissor (const class CScissor& scissor)=0;
+00541 
+00542 
+00548         virtual uint32                  getImplementationVersion () const = 0;
+00549 
+00554         virtual const char*             getDriverInformation () = 0;
+00555 
+00560         virtual const char*             getVideocardInformation () = 0;
+00561 
+00563         // @{
+00565                 virtual void                    showCursor (bool b) = 0;
+00566 
+00568                 virtual void                    setMousePos (float x, float y) = 0;
+00569 
+00578                 virtual NLMISC::IMouseDevice                    *enableLowLevelMouse(bool enable) = 0;
+00579 
+00587                 virtual NLMISC::IKeyboardDevice                 *enableLowLevelKeyboard(bool enable) = 0;
+00588 
+00592                 virtual void                    setCapture (bool b) = 0;
+00593 
+00597                 virtual NLMISC::IInputDeviceManager             *getLowLevelInputDeviceManager() = 0;
+00598 
+00599         // @}
+00600 
+00602         virtual void                    getWindowSize (uint32 &width, uint32 &height) = 0;
+00603         
+00604 
+00609         virtual void                    getBuffer (CBitmap &bitmap) = 0;
+00610 
+00615         virtual void                    getZBuffer (std::vector<float>  &zbuffer) = 0;
+00616 
+00623         virtual void                    getBufferPart (CBitmap &bitmap, NLMISC::CRect &rect) = 0;
+00624 
+00631         virtual void                    getZBufferPart (std::vector<float>  &zbuffer, NLMISC::CRect &rect) = 0;
+00632 
+00633 
+00650         virtual void                    copyFrameBufferToTexture(ITexture *tex,
+00651                                                              uint32 level,
+00652                                                                                                          uint32 offsetx,
+00653                                                                                                          uint32 offsety,
+00654                                                                                                          uint32 x,
+00655                                                                                                          uint32 y,
+00656                                                                                                          uint32 width,
+00657                                                                                                          uint32 height                                                                                                          
+00658                                                                                                         ) = 0 ;
+00659 
+00665         virtual bool                    fillBuffer (CBitmap &bitmap) = 0;
+00666 
+00667 
+00674         virtual void                    setPolygonMode (TPolygonMode mode)
+00675         {
+00676                 _PolygonMode=mode;
+00677         }
+00678 
+00679 
+00685         virtual uint                    getMaxLight () const = 0;
+00686 
+00696         virtual void                    setLight (uint8 num, const CLight& light) = 0;
+00697 
+00707         virtual void                    enableLight (uint8 num, bool enable=true) = 0;
+00708 
+00715         virtual void                    setAmbientColor (CRGBA color) = 0;
+00716 
+00721         virtual void                    setPerPixelLightingLight(CRGBA diffuse, CRGBA specular, float shininess) = 0;
+00722 
+00728         TPolygonMode    getPolygonMode ()
+00729         {
+00730                 return _PolygonMode;
+00731         }
+00732 
+00734         // @{
+00735 
+00736         enum TMatrix
+00737         {
+00738                 ModelView= 0,
+00739                 Projection,
+00740                 ModelViewProjection,
+00741                 NumMatrix
+00742         };
+00743 
+00744         enum TTransform
+00745         {
+00746                 Identity=0,
+00747                 Inverse,
+00748                 Transpose,
+00749                 InverseTranspose,
+00750                 NumTransform
+00751         };
+00752 
+00756         virtual bool                    isVertexProgramSupported () const =0;
+00757 
+00761         virtual bool                    isVertexProgramEmulated () const =0;
+00762 
+00763 
+00764 
+00772         virtual bool                    activeVertexProgram (CVertexProgram *program) =0;
+00773 
+00777         virtual void                    setConstant (uint index, float, float, float, float) =0;
+00778         virtual void                    setConstant (uint index, double, double, double, double) =0;
+00779         virtual void                    setConstant (uint index, const NLMISC::CVector& value) =0;
+00780         virtual void                    setConstant (uint index, const NLMISC::CVectorD& value) =0;
+00782         virtual void                    setConstant (uint index, uint num, const float *src) =0;
+00784         virtual void                    setConstant (uint index, uint num, const double *src) =0;
+00785 
+00786 
+00798         virtual void                    setConstantMatrix (uint index, TMatrix matrix, TTransform transform) =0;
+00799 
+00801         virtual bool                supportVertexProgramDoubleSidedColor() const = 0;
+00802           
+00803 
+00810         virtual void                    enableVertexProgramDoubleSidedColor(bool doubleSided) =0;
+00811 
+00812         // @}
+00813 
+00815         // @{
+00817                 virtual bool supportTextureShaders() const = 0;
+00819                 virtual bool isTextureAddrModeSupported(CMaterial::TTexAddressingMode mode) const = 0;
+00825                 virtual void setMatrix2DForTextureOffsetAddrMode(const uint stage, const float mat[4]) = 0;                     
+00827 
+00828 
+00836         // @{
+00837                 // Test if EMBM is supported.
+00838                 virtual bool supportEMBM() const = 0;
+00839                 // Test if EMBM is supported for the given stage
+00840                 virtual bool isEMBMSupportedAtStage(uint stage) const = 0;
+00841                 // set the matrix used for EMBM adressing :
+00842                 virtual void setEMBMMatrix(const uint stage, const float mat[4]) = 0;
+00843         // @}
+00844 
+00845         // Does the driver support the per-pixel lighting shader ?
+00846         virtual bool supportPerPixelLighting(bool specular) const = 0;
+00847 
+00848 
+00850         // @{
+00851 
+00855         virtual bool                    supportBlendConstantColor() const =0;
+00856 
+00859         virtual void                    setBlendConstantColor(NLMISC::CRGBA col)=0;
+00860 
+00863         virtual NLMISC::CRGBA   getBlendConstantColor() const =0;
+00864 
+00865         // @}
+00866 
+00867 
+00873         virtual void                    swapTextureHandle(ITexture &tex0, ITexture &tex1) =0;
+00874 
+00875 
+00876 protected:
+00877         friend  class   IVBDrvInfos;
+00878         friend  class   CTextureDrvShare;
+00879         friend  class   ITextureDrvInfos;
+00880         friend  class   IShader;
+00881         friend  class   IVertexProgramDrvInfos;
+00882 
+00884         void                    removeVBDrvInfoPtr(ItVBDrvInfoPtrList  vbDrvInfoIt);
+00885         void                    removeTextureDrvInfoPtr(ItTexDrvInfoPtrMap texDrvInfoIt);
+00886         void                    removeTextureDrvSharePtr(ItTexDrvSharePtrList texDrvShareIt);
+00887         void                    removeShaderPtr(ItShaderPtrList shaderIt);
+00888         void                    removeVtxPrgDrvInfoPtr(ItVtxPrgDrvInfoPtrList vtxPrgDrvInfoIt);
+00889 };
+00890 
+00891 // --------------------------------------------------
+00892 
+00893 }
+00894 
+00895 #endif // NL_DRV_H
+00896 
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1