# 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  

NL3D::IDriver Class Reference

#include <driver.h>

Inheritance diagram for NL3D::IDriver

Inheritance graph
[legend]
Collaboration diagram for NL3D::IDriver:

Collaboration graph
[legend]
List of all members.

Public Types

enum  TMessageBoxId {
  okId = 0,
  yesId,
  noId,
  abortId,
  retryId,
  cancelId,
  ignoreId,
  idCount
}
enum  TMessageBoxType {
  okType = 0,
  okCancelType,
  yesNoType,
  abortRetryIgnoreType,
  yesNoCancelType,
  retryCancelType,
  typeCount
}
enum  TMessageBoxIcon {
  noIcon = 0,
  handIcon,
  questionIcon,
  exclamationIcon,
  asteriskIcon,
  warningIcon,
  errorIcon,
  informationIcon,
  stopIcon,
  iconCount
}
enum  TPolygonMode {
  Filled = 0,
  Line,
  Point
}
 Driver's polygon modes. More...

enum  TMatrixCount {
  MaxModelMatrix = 16
}
 Driver Max matrix count. More...


Public Methods

 IDriver (void)
virtual ~IDriver (void)
virtual bool init (void) = 0
virtual ModeList enumModes () = 0
virtual bool setDisplay (void* wnd, const GfxMode& mode) = 0 throw (EBadDisplay)
virtual void* getDisplay () = 0
virtual bool activate (void) = 0
 Before rendering via a driver in a thread, must activate() (per thread).

virtual sint getNbTextureStages () = 0
 Get the number of texture stage avaliable, for multitexturing (Normal material shaders). Valid only after setDisplay().

virtual bool isTextureExist (const ITexture&tex) = 0
 is the texture is set up in the driver.

virtual NLMISC::IEventEmittergetEventEmitter (void) = 0
virtual bool clear2D (CRGBA rgba) = 0
virtual bool clearZBuffer (float zval=1) = 0
virtual bool setupTexture (ITexture& tex) = 0
virtual bool setupMaterial (CMaterial& mat) = 0
virtual void setFrustum (float left, float right, float bottom, float top, float znear, float zfar, bool perspective=true) = 0
virtual void setupViewMatrix (const CMatrix& mtx) = 0
 setup the view matrix (inverse of camera matrix). More...

virtual void setupModelMatrix (const CMatrix& mtx, uint8 n=0) = 0
 setup a model matrix. More...

virtual CMatrix getViewMatrix (void) const = 0
virtual void setupVertexMode (uint vmode) = 0
 setup the vertex transformation Mode. More...

virtual bool activeVertexBuffer (CVertexBuffer& VB) = 0
 active a current VB, for future render(). More...

virtual bool activeVertexBuffer (CVertexBuffer& VB, uint first, uint end) = 0
 active a current VB, for future render(). More...

virtual bool render (CPrimitiveBlock& PB, CMaterial& Mat) = 0
 render a block of primitive with previously setuped VertexBuffer / Matrixes. More...

virtual void renderTriangles (CMaterial& Mat, uint32 *tri, uint32 ntris) = 0
 render a list of triangles with previously setuped VertexBuffer / Matrixes. More...

virtual void renderPoints (CMaterial& Mat, uint32 numPoints) = 0
 render points with previously setuped VertexBuffer / Matrixes. More...

virtual bool swapBuffers (void) = 0
 Swap the back and front buffers.

virtual uint getNumMatrix () = 0
 Returns the number of model matrices supported in hardware by the driver. More...

virtual bool supportPaletteSkinning () = 0
 Returns true if the hardware support PaletteSkinning. More...

virtual bool fogEnabled () = 0
virtual void enableFog (bool enable) = 0
virtual void setupFog (float start, float end, CRGBA color) = 0
 setup fog parameters. fog must enabled to see result. start and end are in [0,1] range.

virtual bool release (void)
 Deriver should calls IDriver::release() first, to destroy all driver components (textures, shaders, VBuffers). More...

virtual bool isActive () = 0
 Return true if driver is still active. Return false else. If he user close the window, must return false.

virtual TMessageBoxId systemMessageBox (const char* message, const char* title, TMessageBoxType type=okType, TMessageBoxIcon icon=noIcon)
 Output a system message box and print a message with an icon. More...

virtual void setupViewport (const class CViewport& viewport) = 0
 Set the current viewport. More...

virtual void setupScissor (const class CViewport& viewport) = 0
 Set the current Scissor. More...

virtual uint32 getImplementationVersion () const = 0
 Get the driver version. More...

virtual const char* getDriverInformation () = 0
 Get driver informations. More...

virtual const char* getVideocardInformation () = 0
 Get videocard informations. More...

virtual void showCursor (bool b) = 0
 show cursor if b is true, or hide it if b is false.

virtual void setMousePos (float x, float y) = 0
 x and y must be between 0.0 and 1.0.

virtual void getWindowSize (uint32 &width, uint32 &height) = 0
 Get the width and the height of the window.

virtual void setCapture (bool b) = 0
 If true, capture the mouse to force it to stay under the window.

virtual void getBuffer (CBitmap &bitmap) = 0
 get the RGBA back buffer. More...

virtual void getZBuffer (std::vector<float> &zbuffer) = 0
 get the ZBuffer (back buffer). More...

virtual void getBufferPart (CBitmap &bitmap, NLMISC::CRect &rect) = 0
 get a part of the RGBA back buffer NB: 0,0 is the bottom left corner of the screen. More...

virtual void getZBufferPart (std::vector<float> &zbuffer, NLMISC::CRect &rect) = 0
 get a part of the ZBuffer (back buffer). More...

virtual void setPolygonMode (TPolygonMode mode)
 Set the global polygon mode. More...

virtual void setLight (uint8 num, const CLight& light) = 0
 Setup a light. More...

virtual void enableLight (uint8 num, bool enable=true) = 0
 Enable / disable light. More...

virtual void setAmbientColor (CRGBA color) = 0
 Set ambiant. More...

TPolygonMode getPolygonMode ()
 Get the global polygon mode. More...


Static Public Attributes

const uint32 InterfaceVersion = 0x1A
 Version of the driver interface. To increment when the interface change. More...


Protected Methods

void removeVBDrvInfoPtr (ItVBDrvInfoPtrList vbDrvInfoIt)
 remove ptr from the lists in the driver. More...

void removeTextureDrvInfoPtr (ItTexDrvInfoPtrMap texDrvInfoIt)
void removeTextureDrvSharePtr (ItTexDrvSharePtrList texDrvShareIt)
void removeShaderPtr (ItShaderPtrList shaderIt)

Protected Attributes

CSynchronized<TTexDrvInfoPtrMap_SyncTexDrvInfos
TTexDrvSharePtrList _TexDrvShares
TShaderPtrList _Shaders
TVBDrvInfoPtrList _VBDrvInfos
TPolygonMode _PolygonMode

Friends

class  IVBDrvInfos
class  CTextureDrvShare
class  ITextureDrvInfos
class  IShader

Member Enumeration Documentation

enum NL3D::IDriver::TMatrixCount
 

Driver Max matrix count.

See also:
setupModelMatrix()
Enumeration values:
MaxModelMatrix  

Definition at line 137 of file driver.h.

enum NL3D::IDriver::TMessageBoxIcon
 

Enumeration values:
noIcon  
handIcon  
questionIcon  
exclamationIcon  
asteriskIcon  
warningIcon  
errorIcon  
informationIcon  
stopIcon  
iconCount  

Definition at line 122 of file driver.h.

enum NL3D::IDriver::TMessageBoxId
 

Enumeration values:
okId  
yesId  
noId  
abortId  
retryId  
cancelId  
ignoreId  
idCount  

Definition at line 120 of file driver.h.

enum NL3D::IDriver::TMessageBoxType
 

Enumeration values:
okType  
okCancelType  
yesNoType  
abortRetryIgnoreType  
yesNoCancelType  
retryCancelType  
typeCount  

Definition at line 121 of file driver.h.

enum NL3D::IDriver::TPolygonMode
 

Driver's polygon modes.

See also:
setPolygonMode(), getPolygonMode()
Enumeration values:
Filled  
Line  
Point  

Definition at line 129 of file driver.h.


Constructor & Destructor Documentation

NL3D::IDriver::IDriver ( void )
 

Definition at line 47 of file driver.cpp.

NL3D::IDriver::~IDriver ( void ) [virtual]
 

Definition at line 53 of file driver.cpp.


Member Function Documentation

bool NL3D::IDriver::activate ( void ) [pure virtual]
 

Before rendering via a driver in a thread, must activate() (per thread).

Reimplemented in NL3D::CDriverGL.

bool NL3D::IDriver::activeVertexBuffer ( CVertexBuffer & VB,
uint first,
uint end ) [pure virtual]
 

active a current VB, for future render().

This method suppose that only vertices in given range will be used in future render(). This could be usefull for DX or OpenGL driver, but it is usefull for software skinning too. Undefined results if primitives in render() use vertices not in this range.

NB: software skinning (if any) will be actuallay done in render*() call, only one time per vertex. Vertex Skinning Flags are reseted in activeVertexBuffer(), but only for given range here!

Skinning is enabled only when VB has skinning, and when vertexMode has flag NL3D_VERTEX_MODE_SKINNING.

Parameters:
VB   the vertexBuffer to activate.
first   the first vertex important for render (begin to 0). nlassert(first<=end);
end   the last vertex important for render, +1. count==end-first. nlassert(end<=VB.getNumVertices);

See also:
setupVertexMode()

Reimplemented in NL3D::CDriverGL.

bool NL3D::IDriver::activeVertexBuffer ( CVertexBuffer & VB ) [pure virtual]
 

active a current VB, for future render().

This method suppose that all vertices in the VB will be used.

NB: software skinning (if any) will be actuallay done in render*() call, only one time per vertex. Vertex Skinning Flags are reseted in activeVertexBuffer().

Skinning is enabled only when VB has skinning, and when vertexMode has flag NL3D_VERTEX_MODE_SKINNING.

See also:
setupVertexMode()

Reimplemented in NL3D::CDriverGL.

virtual bool NL3D::IDriver::clear2D ( CRGBA rgba ) [pure virtual]
 

Reimplemented in NL3D::CDriverGL.

virtual bool NL3D::IDriver::clearZBuffer ( float zval = 1 ) [pure virtual]
 

Reimplemented in NL3D::CDriverGL.

virtual void NL3D::IDriver::enableFog ( bool enable ) [pure virtual]
 

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::enableLight ( uint8 num,
bool enable = true ) [pure virtual]
 

Enable / disable light.

You must call setLight() if you active the ligth.

Parameters:
num   is the number of the light to enable / disable.
enable   is true to enable the light, false to disable it.
See also:
setLight()

Reimplemented in NL3D::CDriverGL.

virtual ModeList NL3D::IDriver::enumModes ( ) [pure virtual]
 

Reimplemented in NL3D::CDriverGL.

bool NL3D::IDriver::fogEnabled ( ) [pure virtual]
 

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::getBuffer ( CBitmap & bitmap ) [pure virtual]
 

get the RGBA back buffer.

Parameters:
bitmap   the buffer will be written in this bitmap

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::getBufferPart ( CBitmap & bitmap,
NLMISC::CRect & rect ) [pure virtual]
 

get a part of the RGBA back buffer NB: 0,0 is the bottom left corner of the screen.

Parameters:
bitmap   the buffer will be written in this bitmap
rect   the in/out (wanted/clipped) part of Color buffer to retrieve.

Reimplemented in NL3D::CDriverGL.

virtual void* NL3D::IDriver::getDisplay ( ) [pure virtual]
 

Reimplemented in NL3D::CDriverGL.

const char * NL3D::IDriver::getDriverInformation ( ) [pure virtual]
 

Get driver informations.

get the nel name of the driver (ex: "Opengl 1.2 NeL Driver")

Reimplemented in NL3D::CDriverGL.

virtual NLMISC::IEventEmitter* NL3D::IDriver::getEventEmitter ( void ) [pure virtual]
 

Reimplemented in NL3D::CDriverGL.

uint32 NL3D::IDriver::getImplementationVersion ( ) const [pure virtual]
 

Get the driver version.

Not the same than interface version. Incremented at each implementation change.

See also:
InterfaceVersion

Reimplemented in NL3D::CDriverGL.

sint NL3D::IDriver::getNbTextureStages ( ) [pure virtual]
 

Get the number of texture stage avaliable, for multitexturing (Normal material shaders). Valid only after setDisplay().

Reimplemented in NL3D::CDriverGL.

uint NL3D::IDriver::getNumMatrix ( ) [pure virtual]
 

Returns the number of model matrices supported in hardware by the driver.

NeL will support from 2 to 4 matrices by vertices. If the user uses a model with a greater count of matrices than the hardware can support, the skinning will be made in software.

For the time, driver opengl supports 2 matrices in hardware on Geforce, and implement nothing in software. (Use paletted skinning instead)

Reimplemented in NL3D::CDriverGL.

TPolygonMode NL3D::IDriver::getPolygonMode ( ) [inline]
 

Get the global polygon mode.

Parameters:
polygon   mode choose in this driver.
See also:
setPolygonMode(), TPolygonMode

Definition at line 427 of file driver.h.

const char * NL3D::IDriver::getVideocardInformation ( ) [pure virtual]
 

Get videocard informations.

get the official name of the driver

Reimplemented in NL3D::CDriverGL.

virtual CMatrix NL3D::IDriver::getViewMatrix ( void ) const [pure virtual]
 

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::getWindowSize ( uint32 & width,
uint32 & height ) [pure virtual]
 

Get the width and the height of the window.

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::getZBuffer ( std::vector< float >& zbuffer ) [pure virtual]
 

get the ZBuffer (back buffer).

Parameters:
zbuffer   the returned array of Z. size of getWindowSize() .

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::getZBufferPart ( std::vector< float >& zbuffer,
NLMISC::CRect & rect ) [pure virtual]
 

get a part of the ZBuffer (back buffer).

NB: 0,0 is the bottom left corner of the screen.

Parameters:
zbuffer   the returned array of Z. size of rec.Width*rec.Height.
rect   the in/out (wanted/clipped) part of ZBuffer to retrieve.

Reimplemented in NL3D::CDriverGL.

virtual bool NL3D::IDriver::init ( void ) [pure virtual]
 

Reimplemented in NL3D::CDriverGL.

bool NL3D::IDriver::isActive ( ) [pure virtual]
 

Return true if driver is still active. Return false else. If he user close the window, must return false.

Reimplemented in NL3D::CDriverGL.

bool NL3D::IDriver::isTextureExist ( const ITexture & tex ) [pure virtual]
 

is the texture is set up in the driver.

Reimplemented in NL3D::CDriverGL.

bool NL3D::IDriver::release ( void ) [virtual]
 

Deriver should calls IDriver::release() first, to destroy all driver components (textures, shaders, VBuffers).

Reimplemented in NL3D::CDriverGL.

Definition at line 70 of file driver.cpp.

void NL3D::IDriver::removeShaderPtr ( ItShaderPtrList shaderIt ) [protected]
 

Definition at line 219 of file driver.cpp.

void NL3D::IDriver::removeTextureDrvInfoPtr ( ItTexDrvInfoPtrMap texDrvInfoIt ) [protected]
 

Definition at line 206 of file driver.cpp.

void NL3D::IDriver::removeTextureDrvSharePtr ( ItTexDrvSharePtrList texDrvShareIt ) [protected]
 

Definition at line 214 of file driver.cpp.

void NL3D::IDriver::removeVBDrvInfoPtr ( ItVBDrvInfoPtrList vbDrvInfoIt ) [protected]
 

remove ptr from the lists in the driver.

Definition at line 201 of file driver.cpp.

bool NL3D::IDriver::render ( CPrimitiveBlock & PB,
CMaterial & Mat ) [pure virtual]
 

render a block of primitive with previously setuped VertexBuffer / Matrixes.

NB: nlassert() if setupModelMatrix() or setupViewMatrix() has been called between activeVertexBuffer() and render*().

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::renderPoints ( CMaterial & Mat,
uint32 numPoints ) [pure virtual]
 

render points with previously setuped VertexBuffer / Matrixes.

NB: nlassert() if setupModelMatrix() or setupViewMatrix() has been called between activeVertexBuffer() and render*().

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::renderTriangles ( CMaterial & Mat,
uint32 * tri,
uint32 ntris ) [pure virtual]
 

render a list of triangles with previously setuped VertexBuffer / Matrixes.

NB: nlassert() if setupModelMatrix() or setupViewMatrix() has been called between activeVertexBuffer() and render*(). NB: this is usefull for landscape....

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::setAmbientColor ( CRGBA color ) [pure virtual]
 

Set ambiant.

Parameters:
color   is the new global ambiant color for the scene.
See also:
setLight(), enableLight()

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::setCapture ( bool b ) [pure virtual]
 

If true, capture the mouse to force it to stay under the window.

Reimplemented in NL3D::CDriverGL.

virtual bool NL3D::IDriver::setDisplay ( void * wnd,
const GfxMode & mode ) throw (EBadDisplay) [pure virtual]
 

Reimplemented in NL3D::CDriverGL.

virtual void NL3D::IDriver::setFrustum ( float left,
float right,
float bottom,
float top,
float znear,
float zfar,
bool perspective = true ) [pure virtual]
 

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::setLight ( uint8 num,
const CLight & light ) [pure virtual]
 

Setup a light.

You must call enableLight() to active the ligth.

Parameters:
num   is the number of the light to set.
light   is a light to set in this slot.
See also:
enableLight()

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::setMousePos ( float x,
float y ) [pure virtual]
 

x and y must be between 0.0 and 1.0.

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::setPolygonMode ( TPolygonMode mode ) [inline, virtual]
 

Set the global polygon mode.

Can be filled, line or point. The implementation driver must call IDriver::setPolygonMode() and active this mode.

Parameters:
polygon   mode choose in this driver.
See also:
getPolygonMode(), TPolygonMode

Reimplemented in NL3D::CDriverGL.

Definition at line 387 of file driver.h.

void NL3D::IDriver::setupFog ( float start,
float end,
CRGBA color ) [pure virtual]
 

setup fog parameters. fog must enabled to see result. start and end are in [0,1] range.

Reimplemented in NL3D::CDriverGL.

virtual bool NL3D::IDriver::setupMaterial ( CMaterial & mat ) [pure virtual]
 

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::setupModelMatrix ( const CMatrix & mtx,
uint8 n = 0 ) [pure virtual]
 

setup a model matrix.

IDdriver::MaxModelMatrix (16) can be setuped. The 0th model matrix is the principal one. Others are only usefull fro skinning (see CVertexBuffer, and setupVertexMode).

NB: you must setupModelMatrix() AFTER setupViewMatrix(), or else undefined results.

See also:
setupVertexMode()

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::setupScissor ( const class CViewport & viewport ) [pure virtual]
 

Set the current Scissor.

Parameters:
viewport   is a viewport to setup the current Scissor, in Window relative coordinate (0,1).

Reimplemented in NL3D::CDriverGL.

virtual bool NL3D::IDriver::setupTexture ( ITexture & tex ) [pure virtual]
 

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::setupVertexMode ( uint vmode ) [pure virtual]
 

setup the vertex transformation Mode.

(or vertex program). This should be a ORed of NL3D_VMODE_* Default is NL3D_VERTEX_MODE_NORMAL.

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::setupViewMatrix ( const CMatrix & mtx ) [pure virtual]
 

setup the view matrix (inverse of camera matrix).

NB: you must setupViewMatrix() BEFORE setupModelMatrix(), or else undefined results.

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::setupViewport ( const class CViewport & viewport ) [pure virtual]
 

Set the current viewport.

Parameters:
viewport   is a viewport to setup as current viewport.

Reimplemented in NL3D::CDriverGL.

void NL3D::IDriver::showCursor ( bool b ) [pure virtual]
 

show cursor if b is true, or hide it if b is false.

Reimplemented in NL3D::CDriverGL.

bool NL3D::IDriver::supportPaletteSkinning ( ) [pure virtual]
 

Returns true if the hardware support PaletteSkinning.

NeL will support 4 matrices by vertices, and up to IDriver::MaxModelMatrix (16) model matrixes. If the user uses PaletteSkinning while the hardware does not support it, the skinning will be made in software.

Reimplemented in NL3D::CDriverGL.

bool NL3D::IDriver::swapBuffers ( void ) [pure virtual]
 

Swap the back and front buffers.

Reimplemented in NL3D::CDriverGL.

IDriver::TMessageBoxId NL3D::IDriver::systemMessageBox ( const char * message,
const char * title,
TMessageBoxType type = okType,
TMessageBoxIcon icon = noIcon ) [virtual]
 

Output a system message box and print a message with an icon.

This method can be call even if the driver is not initialized. This method is used to return internal driver problem when string can't be displayed in the driver window. If the driver can't open a messageBox, it should not override this method and let the IDriver class manage it with the ASCII console.

Parameters:
message   This is the message to display in the message box.
title   This is the title of the message box.
type   This is the type of the message box, ie number of button and label of buttons.
icon   This is the icon of the message box should use like warning, error etc...

Reimplemented in NL3D::CDriverGL.

Definition at line 124 of file driver.cpp.


Friends And Related Function Documentation

class CTextureDrvShare [friend]
 

Definition at line 434 of file driver.h.

class IShader [friend]
 

Definition at line 436 of file driver.h.

class ITextureDrvInfos [friend]
 

Definition at line 435 of file driver.h.

class IVBDrvInfos [friend]
 

Definition at line 433 of file driver.h.


Member Data Documentation

const uint32 NL3D::IDriver::InterfaceVersion = 0x1A [static]
 

Version of the driver interface. To increment when the interface change.

Definition at line 44 of file driver.cpp.

TPolygonMode NL3D::IDriver::_PolygonMode [protected]
 

Definition at line 147 of file driver.h.

TShaderPtrList NL3D::IDriver::_Shaders [protected]
 

Definition at line 145 of file driver.h.

CSynchronized< TTexDrvInfoPtrMap > NL3D::IDriver::_SyncTexDrvInfos [protected]
 

Definition at line 142 of file driver.h.

TTexDrvSharePtrList NL3D::IDriver::_TexDrvShares [protected]
 

Definition at line 144 of file driver.h.

TVBDrvInfoPtrList NL3D::IDriver::_VBDrvInfos [protected]
 

Definition at line 146 of file driver.h.


The documentation for this class was generated from the following files: