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/a02440.html | 1466 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1466 insertions(+) create mode 100644 docs/doxygen/nel/a02440.html (limited to 'docs/doxygen/nel/a02440.html') diff --git a/docs/doxygen/nel/a02440.html b/docs/doxygen/nel/a02440.html new file mode 100644 index 00000000..a0d20a08 --- /dev/null +++ b/docs/doxygen/nel/a02440.html @@ -0,0 +1,1466 @@ + + +NeL: NL3D::CDRU class Reference + + + +
+

NL3D::CDRU Class Reference

#include <dru.h> +

+


Detailed Description

+The driver Utilities class of static. +

+ +

+Definition at line 106 of file dru.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Static Public Member Functions

IDrivercreateGlDriver () throw (EDru)
 Portable Function which create a GL Driver (using gl dll...).

2D render.
void drawBitmap (float x, float y, float width, float height, class ITexture &texture, IDriver &driver, CViewport viewport=CViewport(), bool blend=true)
 Draw a bitmap 2D. Warning: this is slow...

void drawLine (float x0, float y0, float x1, float y1, IDriver &driver, CRGBA col=CRGBA(255, 255, 255, 255), CViewport viewport=CViewport())
 Draw a line in 2D. Warning: this is slow...

void drawQuad (float xcenter, float ycenter, float radius, IDriver &driver, CRGBA col, CViewport viewport)
 Draw a Quad in 2D. Warning: this is slow...

void drawQuad (float x0, float y0, float x1, float y1, CRGBA col0, CRGBA col1, CRGBA col2, CRGBA col3, IDriver &driver, CViewport viewport)
void drawQuad (float x0, float y0, float x1, float y1, IDriver &driver, CRGBA col, CViewport viewport)
 Draw a Quad in 2D. Warning: this is slow...

void drawTriangle (float x0, float y0, float x1, float y1, float x2, float y2, IDriver &driver, CRGBA col, CViewport viewport)
 Draw a Triangle in 2D. Warning: this is slow...

void drawWiredQuad (float xcenter, float ycenter, float radius, IDriver &driver, CRGBA col, CViewport viewport)
 Draw a Quad in 2D. Warning: this is slow...

void drawWiredQuad (float x0, float y0, float x1, float y1, IDriver &driver, CRGBA col, CViewport viewport)
 Draw a Quad in 2D. Warning: this is slow...

Easy render (2D or 3D).
void drawLine (const CVector &a, const CVector &b, CRGBA color, IDriver &driver)
 Draw one line in 3D only, with a specific color.

void drawLinesUnlit (const std::vector< NLMISC::CLine > &linelist, CMaterial &mat, IDriver &driver)
 Draw the Lines, with Vertex only. "mat" should not be a lighted material since no normal is computed.

void drawLinesUnlit (const NLMISC::CLine *linelist, sint nlines, CMaterial &mat, IDriver &driver)
 Draw the Lines, with Vertex only. "mat" should not be a lighted material since no normal is computed.

void drawTrianglesUnlit (const std::vector< NLMISC::CTriangleUV > &trilist, CMaterial &mat, IDriver &driver)
 Draw the triangles, with Vertex and 1 UV. "mat" should not be a lighted material since no normal is computed.

void drawTrianglesUnlit (const NLMISC::CTriangleUV *trilist, sint ntris, CMaterial &mat, IDriver &driver)
 Draw the triangles, with Vertex and 1 UV. "mat" should not be a lighted material since no normal is computed.

void drawWiredBox (const CVector &corner, const CVector &vi, const CVector &vj, const CVector &vk, CRGBA color, IDriver &driver)
 Draw a wired box in 3D, with a specific color.

+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + +
IDriver * NL3D::CDRU::createGlDriver  )  throw (EDru) [static]
+
+ + + + + +
+   + + +

+Portable Function which create a GL Driver (using gl dll...). +

+ +

+Definition at line 59 of file dru.cpp. +

+References buffer, NL3D::IDRV_CREATE_PROC, NL3D::IDRV_CREATE_PROC_NAME, NL3D::IDRV_VERSION_PROC, NL3D::IDRV_VERSION_PROC_NAME, nlinfo, and nlwarning. +

+

00060 {
+00061         IDRV_CREATE_PROC        createDriver = NULL;
+00062         IDRV_VERSION_PROC       versionDriver = NULL;
+00063 
+00064 #ifdef NL_OS_WINDOWS
+00065 
+00066         // WINDOWS code.
+00067         HINSTANCE                       hInst;
+00068 
+00069         hInst=LoadLibrary(NL3D_DLL_NAME);
+00070 
+00071         if (!hInst)
+00072         {
+00073                 throw EDruOpenglDriverNotFound();
+00074         }
+00075 
+00076         char buffer[1024], *ptr;
+00077         SearchPath (NULL, NL3D_DLL_NAME, NULL, 1023, buffer, &ptr);
+00078         nlinfo ("Using the library '"NL3D_DLL_NAME"' that is in the directory: '%s'", buffer);
+00079 
+00080         createDriver = (IDRV_CREATE_PROC) GetProcAddress (hInst, IDRV_CREATE_PROC_NAME);
+00081         if (createDriver == NULL)
+00082         {
+00083                 throw EDruOpenglDriverCorrupted();
+00084         }
+00085 
+00086         versionDriver = (IDRV_VERSION_PROC) GetProcAddress (hInst, IDRV_VERSION_PROC_NAME);
+00087         if (versionDriver != NULL)
+00088         {
+00089                 if (versionDriver()<IDriver::InterfaceVersion)
+00090                         throw EDruOpenglDriverOldVersion();
+00091                 else if (versionDriver()>IDriver::InterfaceVersion)
+00092                         throw EDruOpenglDriverUnknownVersion();
+00093         }
+00094 
+00095 #elif defined (NL_OS_UNIX)
+00096 
+00097         void *handle = dlopen(NL3D_DLL_NAME, RTLD_NOW);
+00098 
+00099         if (handle == NULL)
+00100         {
+00101                 nlwarning ("when loading dynamic library '%s': %s", NL3D_DLL_NAME, dlerror());
+00102                 throw EDruOpenglDriverNotFound();
+00103         }
+00104 
+00105         /* Not ANSI. Might produce a warning */
+00106         createDriver = (IDRV_CREATE_PROC) dlsym (handle, IDRV_CREATE_PROC_NAME);
+00107         if (createDriver == NULL)
+00108         {
+00109                 nlwarning ("when getting function in dynamic library '%s': %s", NL3D_DLL_NAME, dlerror());
+00110                 throw EDruOpenglDriverCorrupted();
+00111         }
+00112 
+00113         versionDriver = (IDRV_VERSION_PROC) dlsym (handle, IDRV_VERSION_PROC_NAME);
+00114         if (versionDriver != NULL)
+00115         {
+00116                 if (versionDriver()<IDriver::InterfaceVersion)
+00117                         throw EDruOpenglDriverOldVersion();
+00118                 else if (versionDriver()>IDriver::InterfaceVersion)
+00119                         throw EDruOpenglDriverUnknownVersion();
+00120         }
+00121 
+00122 #else // NL_OS_UNIX
+00123 #error "Dynamic DLL loading not implemented!"
+00124 #endif // NL_OS_UNIX
+00125 
+00126         IDriver         *ret= createDriver();
+00127         if (ret == NULL)
+00128         {
+00129                 throw EDruOpenglDriverCantCreateDriver();
+00130         }
+00131         return ret;
+00132 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CDRU::drawBitmap float  x,
float  y,
float  width,
float  height,
class ITexture texture,
IDriver driver,
CViewport  viewport = CViewport(),
bool  blend = true
[static]
+
+ + + + + +
+   + + +

+Draw a bitmap 2D. Warning: this is slow... +

+ +

+Definition at line 136 of file dru.cpp. +

+References NL3D::IDriver::activeVertexBuffer(), height, NLMISC::CMatrix::identity(), NL3D::CMaterial::initUnlit(), NL3D::IDriver::render(), NL3D::CMaterial::setBlend(), NL3D::IDriver::setFrustum(), NL3D::CPrimitiveBlock::setNumQuad(), NL3D::CVertexBuffer::setNumVertices(), NL3D::CPrimitiveBlock::setQuad(), NL3D::CVertexBuffer::setTexCoord(), NL3D::CMaterial::setTexture(), NL3D::IDriver::setupModelMatrix(), NL3D::IDriver::setupViewMatrix(), NL3D::IDriver::setupViewport(), NL3D::CVertexBuffer::setVertexCoord(), NL3D::CVertexBuffer::setVertexFormat(), NL3D::CMaterial::setZFunc(), width, x, and y. +

+

00137 {
+00138         CMatrix mtx;
+00139         mtx.identity();
+00140         driver.setupViewport (viewport);
+00141         driver.setupViewMatrix (mtx);
+00142         driver.setupModelMatrix (mtx);
+00143         driver.setFrustum (0.f, 1.f, 0.f, 1.f, -1.f, 1.f, false);
+00144 
+00145         static CMaterial mat;
+00146         mat.initUnlit ();
+00147         mat.setTexture (0, &texture);
+00148         mat.setBlend(blend);
+00149         mat.setZFunc(CMaterial::always);
+00150 
+00151         static CVertexBuffer vb;
+00152         vb.setVertexFormat (CVertexBuffer::PositionFlag|CVertexBuffer::TexCoord0Flag);
+00153         vb.setNumVertices (4);
+00154         vb.setVertexCoord (0, CVector (x, 0, y));
+00155         vb.setVertexCoord (1, CVector (x+width, 0, y));
+00156         vb.setVertexCoord (2, CVector (x+width, 0, y+height));
+00157         vb.setVertexCoord (3, CVector (x, 0, y+height));
+00158         vb.setTexCoord (0, 0, 0.f, 1.f);
+00159         vb.setTexCoord (1, 0, 1.f, 1.f);
+00160         vb.setTexCoord (2, 0, 1.f, 0.f);
+00161         vb.setTexCoord (3, 0, 0.f, 0.f);
+00162         driver.activeVertexBuffer(vb);
+00163 
+00164         CPrimitiveBlock pb;
+00165         pb.setNumQuad (1);
+00166         pb.setQuad (0, 0, 1, 2, 3);
+00167 
+00168         driver.render(pb, mat);
+00169 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CDRU::drawLine const CVector a,
const CVector b,
CRGBA  color,
IDriver driver
[static]
+
+ + + + + +
+   + + +

+Draw one line in 3D only, with a specific color. +

+ +

+Definition at line 404 of file dru.cpp. +

+References NL3D::CMaterial::initUnlit(), and NL3D::CMaterial::setColor(). +

+

00405 {
+00406         static  NLMISC::CLine           line;
+00407         static  CMaterial       mat;
+00408         static  bool            inited= false;
+00409 
+00410         // Setup material.
+00411         if(!inited)
+00412         {
+00413                 inited= true;
+00414                 mat.initUnlit();
+00415         }
+00416         mat.setColor(color);
+00417 
+00418 
+00419         line.V0= a;
+00420         line.V1= b;
+00421         CDRU::drawLinesUnlit(&line, 1, mat, driver);
+00422 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CDRU::drawLine float  x0,
float  y0,
float  x1,
float  y1,
IDriver driver,
CRGBA  col = CRGBA(255, 255, 255, 255),
CViewport  viewport = CViewport()
[static]
+
+ + + + + +
+   + + +

+Draw a line in 2D. Warning: this is slow... +

+ +

+Definition at line 173 of file dru.cpp. +

+References NL3D::IDriver::activeVertexBuffer(), NLMISC::CMatrix::identity(), NL3D::CMaterial::initUnlit(), NL3D::IDriver::render(), NL3D::CMaterial::setBlend(), NL3D::CMaterial::setColor(), NL3D::CMaterial::setDstBlend(), NL3D::IDriver::setFrustum(), NL3D::CPrimitiveBlock::setLine(), NL3D::CPrimitiveBlock::setNumLine(), NL3D::CVertexBuffer::setNumVertices(), NL3D::CMaterial::setSrcBlend(), NL3D::IDriver::setupModelMatrix(), NL3D::IDriver::setupViewMatrix(), NL3D::IDriver::setupViewport(), NL3D::CVertexBuffer::setVertexCoord(), NL3D::CVertexBuffer::setVertexFormat(), and NL3D::CMaterial::setZFunc(). +

+Referenced by drawWiredBox(). +

+

00174 {
+00175         CMatrix mtx;
+00176         mtx.identity();
+00177         driver.setupViewport (viewport);
+00178         driver.setupViewMatrix (mtx);
+00179         driver.setupModelMatrix (mtx);
+00180         driver.setFrustum (0.f, 1.f, 0.f, 1.f, -1.f, 1.f, false);
+00181 
+00182         static CMaterial mat;
+00183         mat.initUnlit ();
+00184         mat.setSrcBlend(CMaterial::srcalpha);
+00185         mat.setDstBlend(CMaterial::invsrcalpha);
+00186         mat.setBlend(true);
+00187         mat.setColor(col);
+00188         mat.setZFunc (CMaterial::always);
+00189 
+00190         static CVertexBuffer vb;
+00191         vb.setVertexFormat (CVertexBuffer::PositionFlag);
+00192         vb.setNumVertices (2);
+00193         vb.setVertexCoord (0, CVector (x0, 0, y0));
+00194         vb.setVertexCoord (1, CVector (x1, 0, y1));
+00195         driver.activeVertexBuffer(vb);
+00196 
+00197         CPrimitiveBlock pb;
+00198         pb.setNumLine (1);
+00199         pb.setLine (0, 0, 1);
+00200 
+00201         driver.render(pb, mat);
+00202 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CDRU::drawLinesUnlit const std::vector< NLMISC::CLine > &  linelist,
CMaterial mat,
IDriver driver
[static]
+
+ + + + + +
+   + + +

+Draw the Lines, with Vertex only. "mat" should not be a lighted material since no normal is computed. +

+ +

+Definition at line 397 of file dru.cpp. +

+

00398 {
+00399         if(linelist.size()==0)
+00400                 return;
+00401         CDRU::drawLinesUnlit( &(*linelist.begin()), linelist.size(), mat, driver);
+00402 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CDRU::drawLinesUnlit const NLMISC::CLine linelist,
sint  nlines,
CMaterial mat,
IDriver driver
[static]
+
+ + + + + +
+   + + +

+Draw the Lines, with Vertex only. "mat" should not be a lighted material since no normal is computed. +

+ +

+Definition at line 377 of file dru.cpp. +

+References NL3D::IDriver::activeVertexBuffer(), NL3D::IDriver::render(), NL3D::CPrimitiveBlock::setLine(), NL3D::CPrimitiveBlock::setNumLine(), NL3D::CVertexBuffer::setNumVertices(), NL3D::CVertexBuffer::setVertexCoord(), NL3D::CVertexBuffer::setVertexFormat(), and sint. +

+

00378 {
+00379         static CVertexBuffer vb;
+00380         vb.setVertexFormat (CVertexBuffer::PositionFlag);
+00381         vb.setNumVertices (nlines*2);
+00382 
+00383         static  CPrimitiveBlock pb;
+00384         pb.setNumLine(nlines);
+00385 
+00386         for(sint i=0;i<nlines;i++)
+00387         {
+00388                 vb.setVertexCoord (i*2+0, linelist[i].V0);
+00389                 vb.setVertexCoord (i*2+1, linelist[i].V1);
+00390                 pb.setLine(i, i*2+0, i*2+1);
+00391         }
+00392         
+00393         driver.activeVertexBuffer(vb);
+00394         driver.render(pb, mat);
+00395 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CDRU::drawQuad float  xcenter,
float  ycenter,
float  radius,
IDriver driver,
CRGBA  col,
CViewport  viewport
[static]
+
+ + + + + +
+   + + +

+Draw a Quad in 2D. Warning: this is slow... +

+ +

+Definition at line 277 of file dru.cpp. +

+References NL3D::IDriver::activeVertexBuffer(), NLMISC::CMatrix::identity(), NL3D::CMaterial::initUnlit(), NL3D::IDriver::render(), NL3D::CMaterial::setBlend(), NL3D::CMaterial::setColor(), NL3D::CMaterial::setDstBlend(), NL3D::IDriver::setFrustum(), NL3D::CPrimitiveBlock::setNumQuad(), NL3D::CVertexBuffer::setNumVertices(), NL3D::CPrimitiveBlock::setQuad(), NL3D::CMaterial::setSrcBlend(), NL3D::IDriver::setupModelMatrix(), NL3D::IDriver::setupViewMatrix(), NL3D::IDriver::setupViewport(), NL3D::CVertexBuffer::setVertexCoord(), NL3D::CVertexBuffer::setVertexFormat(), and NL3D::CMaterial::setZFunc(). +

+

00278 {
+00279         CMatrix mtx;
+00280         mtx.identity();
+00281         driver.setupViewport (viewport);
+00282         driver.setupViewMatrix (mtx);
+00283         driver.setupModelMatrix (mtx);
+00284         driver.setFrustum (0.f, 1.f, 0.f, 1.f, -1.f, 1.f, false);
+00285 
+00286         static CMaterial mat;
+00287         mat.initUnlit();
+00288         mat.setSrcBlend(CMaterial::srcalpha);
+00289         mat.setDstBlend(CMaterial::invsrcalpha);
+00290         mat.setBlend(true);
+00291         mat.setColor(col);
+00292         mat.setZFunc (CMaterial::always);
+00293         
+00294         static CVertexBuffer vb;
+00295         vb.setVertexFormat (CVertexBuffer::PositionFlag);
+00296         vb.setNumVertices (4);
+00297         vb.setVertexCoord (0, CVector (xcenter-radius, 0, ycenter-radius));
+00298         vb.setVertexCoord (1, CVector (xcenter+radius, 0, ycenter-radius));
+00299         vb.setVertexCoord (2, CVector (xcenter+radius, 0, ycenter+radius));
+00300         vb.setVertexCoord (3, CVector (xcenter-radius, 0, ycenter+radius));
+00301         
+00302         driver.activeVertexBuffer(vb);
+00303 
+00304         CPrimitiveBlock pb;
+00305         pb.setNumQuad (1);
+00306         pb.setQuad (0, 0, 1, 2, 3);
+00307 
+00308         driver.render(pb, mat);
+00309 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CDRU::drawQuad float  x0,
float  y0,
float  x1,
float  y1,
CRGBA  col0,
CRGBA  col1,
CRGBA  col2,
CRGBA  col3,
IDriver driver,
CViewport  viewport
[static]
+
+ + + + + +
+   + + +

+Draw a color Quad in 2D. Warning: this is slow...

+

Parameters:
+ + + + + + + + + + + +
x0 is the x coordinate of the lower left corner.
y0 is the y coordinate of the lower left corner.
x1 is the x coordinate of the upper right corner.
y1 is the y coordinate of the upper right corner.
col0 is the color of the lower left corner.
col0 is the color of the lower right corner.
col0 is the color of the upper right corner.
col0 is the color of the upper left corner.
driver is the driver to use to render the quad.
viewport is the viewport to use to render the quad.
+
+ +

+Definition at line 424 of file dru.cpp. +

+References NL3D::IDriver::activeVertexBuffer(), NLMISC::CMatrix::identity(), NL3D::CMaterial::initUnlit(), NL3D::IDriver::render(), NL3D::CMaterial::setBlend(), NL3D::CVertexBuffer::setColor(), NL3D::CMaterial::setDstBlend(), NL3D::IDriver::setFrustum(), NL3D::CPrimitiveBlock::setNumQuad(), NL3D::CVertexBuffer::setNumVertices(), NL3D::CPrimitiveBlock::setQuad(), NL3D::CMaterial::setSrcBlend(), NL3D::IDriver::setupModelMatrix(), NL3D::IDriver::setupViewMatrix(), NL3D::IDriver::setupViewport(), NL3D::CVertexBuffer::setVertexCoord(), NL3D::CVertexBuffer::setVertexFormat(), and NL3D::CMaterial::setZFunc(). +

+

00425 {
+00426         CMatrix mtx;
+00427         mtx.identity();
+00428         driver.setupViewport (viewport);
+00429         driver.setupViewMatrix (mtx);
+00430         driver.setupModelMatrix (mtx);
+00431         driver.setFrustum (0.f, 1.f, 0.f, 1.f, -1.f, 1.f, false);
+00432 
+00433         static CMaterial mat;
+00434         mat.initUnlit();
+00435         mat.setSrcBlend(CMaterial::srcalpha);
+00436         mat.setDstBlend(CMaterial::invsrcalpha);
+00437         mat.setBlend(true);
+00438         mat.setZFunc (CMaterial::always);
+00439         
+00440         static CVertexBuffer vb;
+00441         vb.setVertexFormat (CVertexBuffer::PositionFlag|CVertexBuffer::PrimaryColorFlag);
+00442         vb.setNumVertices (4);
+00443         vb.setVertexCoord (0, CVector (x0, 0, y0));
+00444         vb.setColor (0, col0);
+00445         vb.setVertexCoord (1, CVector (x1, 0, y0));
+00446         vb.setColor (1, col1);
+00447         vb.setVertexCoord (2, CVector (x1, 0, y1));
+00448         vb.setColor (2, col2);
+00449         vb.setVertexCoord (3, CVector (x0, 0, y1));
+00450         vb.setColor (3, col3);
+00451 
+00452         driver.activeVertexBuffer(vb);
+00453 
+00454         CPrimitiveBlock pb;
+00455         pb.setNumQuad (1);
+00456         pb.setQuad (0, 0, 1, 2, 3);
+00457 
+00458         driver.render(pb, mat);
+00459 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CDRU::drawQuad float  x0,
float  y0,
float  x1,
float  y1,
IDriver driver,
CRGBA  col,
CViewport  viewport
[static]
+
+ + + + + +
+   + + +

+Draw a Quad in 2D. Warning: this is slow... +

+ +

+Definition at line 241 of file dru.cpp. +

+References NL3D::IDriver::activeVertexBuffer(), NLMISC::CMatrix::identity(), NL3D::CMaterial::initUnlit(), NL3D::IDriver::render(), NL3D::CMaterial::setBlend(), NL3D::CMaterial::setColor(), NL3D::CMaterial::setDstBlend(), NL3D::IDriver::setFrustum(), NL3D::CPrimitiveBlock::setNumQuad(), NL3D::CVertexBuffer::setNumVertices(), NL3D::CPrimitiveBlock::setQuad(), NL3D::CMaterial::setSrcBlend(), NL3D::IDriver::setupModelMatrix(), NL3D::IDriver::setupViewMatrix(), NL3D::IDriver::setupViewport(), NL3D::CVertexBuffer::setVertexCoord(), NL3D::CVertexBuffer::setVertexFormat(), and NL3D::CMaterial::setZFunc(). +

+

00242 {
+00243         CMatrix mtx;
+00244         mtx.identity();
+00245         driver.setupViewport (viewport);
+00246         driver.setupViewMatrix (mtx);
+00247         driver.setupModelMatrix (mtx);
+00248         driver.setFrustum (0.f, 1.f, 0.f, 1.f, -1.f, 1.f, false);
+00249 
+00250         static CMaterial mat;
+00251         mat.initUnlit();
+00252         mat.setSrcBlend(CMaterial::srcalpha);
+00253         mat.setDstBlend(CMaterial::invsrcalpha);
+00254         mat.setBlend(true);
+00255         mat.setColor(col);
+00256         mat.setZFunc (CMaterial::always);
+00257         
+00258         static CVertexBuffer vb;
+00259         vb.setVertexFormat (CVertexBuffer::PositionFlag);
+00260         vb.setNumVertices (4);
+00261         vb.setVertexCoord (0, CVector (x0, 0, y0));
+00262         vb.setVertexCoord (1, CVector (x1, 0, y0));
+00263         vb.setVertexCoord (2, CVector (x1, 0, y1));
+00264         vb.setVertexCoord (3, CVector (x0, 0, y1));
+00265         
+00266         driver.activeVertexBuffer(vb);
+00267 
+00268         CPrimitiveBlock pb;
+00269         pb.setNumQuad (1);
+00270         pb.setQuad (0, 0, 1, 2, 3);
+00271 
+00272         driver.render(pb, mat);
+00273 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CDRU::drawTriangle float  x0,
float  y0,
float  x1,
float  y1,
float  x2,
float  y2,
IDriver driver,
CRGBA  col,
CViewport  viewport
[static]
+
+ + + + + +
+   + + +

+Draw a Triangle in 2D. Warning: this is slow... +

+ +

+Definition at line 206 of file dru.cpp. +

+References NL3D::IDriver::activeVertexBuffer(), NLMISC::CMatrix::identity(), NL3D::CMaterial::initUnlit(), NL3D::IDriver::render(), NL3D::CMaterial::setBlend(), NL3D::CMaterial::setColor(), NL3D::CMaterial::setDstBlend(), NL3D::IDriver::setFrustum(), NL3D::CPrimitiveBlock::setNumTri(), NL3D::CVertexBuffer::setNumVertices(), NL3D::CMaterial::setSrcBlend(), NL3D::CPrimitiveBlock::setTri(), NL3D::IDriver::setupModelMatrix(), NL3D::IDriver::setupViewMatrix(), NL3D::IDriver::setupViewport(), NL3D::CVertexBuffer::setVertexCoord(), NL3D::CVertexBuffer::setVertexFormat(), and NL3D::CMaterial::setZFunc(). +

+

00207 {
+00208         CMatrix mtx;
+00209         mtx.identity();
+00210         driver.setupViewport (viewport);
+00211         driver.setupViewMatrix (mtx);
+00212         driver.setupModelMatrix (mtx);
+00213         driver.setFrustum (0.f, 1.f, 0.f, 1.f, -1.f, 1.f, false);
+00214 
+00215         static CMaterial mat;
+00216         mat.initUnlit();
+00217         mat.setSrcBlend(CMaterial::srcalpha);
+00218         mat.setDstBlend(CMaterial::invsrcalpha);
+00219         mat.setBlend(true);
+00220         mat.setColor(col);
+00221         mat.setZFunc (CMaterial::always);
+00222 
+00223         static CVertexBuffer vb;
+00224         vb.setVertexFormat (CVertexBuffer::PositionFlag);
+00225         vb.setNumVertices (3);
+00226         vb.setVertexCoord (0, CVector (x0, 0, y0));
+00227         vb.setVertexCoord (1, CVector (x1, 0, y1));
+00228         vb.setVertexCoord (2, CVector (x2, 0, y2));
+00229         driver.activeVertexBuffer(vb);
+00230 
+00231         CPrimitiveBlock pb;
+00232         pb.setNumTri (1);
+00233         pb.setTri (0, 0, 1, 2);
+00234 
+00235         driver.render(pb, mat);
+00236 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CDRU::drawTrianglesUnlit const std::vector< NLMISC::CTriangleUV > &  trilist,
CMaterial mat,
IDriver driver
[static]
+
+ + + + + +
+   + + +

+Draw the triangles, with Vertex and 1 UV. "mat" should not be a lighted material since no normal is computed. +

+ +

+Definition at line 367 of file dru.cpp. +

+

00368 {
+00369         if(trilist.size()==0)
+00370                 return;
+00371         
+00372         CDRU::drawTrianglesUnlit( &(*trilist.begin()), trilist.size(), mat, driver);
+00373 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CDRU::drawTrianglesUnlit const NLMISC::CTriangleUV trilist,
sint  ntris,
CMaterial mat,
IDriver driver
[static]
+
+ + + + + +
+   + + +

+Draw the triangles, with Vertex and 1 UV. "mat" should not be a lighted material since no normal is computed. +

+Those render methods work in the current driver viewport/frustum/matrixes. Since no vertex sharing is performed, their use may be slower than direct use of VBuffer/PBlock etc... Also, A VBuffer and a PBlock is created, and copies are made from the list of primitives to the driver... +

+Definition at line 341 of file dru.cpp. +

+References NL3D::IDriver::activeVertexBuffer(), NL3D::IDriver::render(), NL3D::CPrimitiveBlock::setNumTri(), NL3D::CVertexBuffer::setNumVertices(), NL3D::CVertexBuffer::setTexCoord(), NL3D::CPrimitiveBlock::setTri(), NL3D::CVertexBuffer::setVertexCoord(), NL3D::CVertexBuffer::setVertexFormat(), and sint. +

+

00342 {
+00343         static CVertexBuffer vb;
+00344         vb.setVertexFormat (CVertexBuffer::PositionFlag | CVertexBuffer::TexCoord0Flag);
+00345         vb.setNumVertices (ntris*3);
+00346 
+00347         static  CPrimitiveBlock pb;
+00348         pb.setNumTri(ntris);
+00349 
+00350         for(sint i=0;i<ntris;i++)
+00351         {
+00352                 vb.setVertexCoord (i*3+0, trilist[i].V0);
+00353                 vb.setVertexCoord (i*3+1, trilist[i].V1);
+00354                 vb.setVertexCoord (i*3+2, trilist[i].V2);
+00355                 vb.setTexCoord (i*3+0, 0, trilist[i].Uv0);
+00356                 vb.setTexCoord (i*3+1, 0, trilist[i].Uv1);
+00357                 vb.setTexCoord (i*3+2, 0, trilist[i].Uv2);
+00358                 pb.setTri(i, i*3+0, i*3+1, i*3+2);
+00359         }
+00360         
+00361         driver.activeVertexBuffer(vb);
+00362         driver.render(pb, mat);
+00363 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CDRU::drawWiredBox const CVector corner,
const CVector vi,
const CVector vj,
const CVector vk,
CRGBA  color,
IDriver driver
[static]
+
+ + + + + +
+   + + +

+Draw a wired box in 3D, with a specific color. +

+ +

+Definition at line 462 of file dru.cpp. +

+References drawLine(). +

+

00463 {
+00464         CVector         p0= corner;
+00465         CVector         p1= p0 + vi + vj + vk;
+00466         drawLine(p0, p0+vi, color, drv);
+00467         drawLine(p0, p0+vj, color, drv);
+00468         drawLine(p0, p0+vk, color, drv);
+00469         drawLine(p1, p1-vi, color, drv);
+00470         drawLine(p1, p1-vj, color, drv);
+00471         drawLine(p1, p1-vk, color, drv);
+00472         drawLine(p0+vi, p0+vi+vj, color, drv);
+00473         drawLine(p0+vi, p0+vi+vk, color, drv);
+00474         drawLine(p0+vj, p0+vj+vi, color, drv);
+00475         drawLine(p0+vj, p0+vj+vk, color, drv);
+00476         drawLine(p0+vk, p0+vk+vi, color, drv);
+00477         drawLine(p0+vk, p0+vk+vj, color, drv);
+00478 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CDRU::drawWiredQuad float  xcenter,
float  ycenter,
float  radius,
IDriver driver,
CRGBA  col,
CViewport  viewport
[static]
+
+ + + + + +
+   + + +

+Draw a Quad in 2D. Warning: this is slow... +

+ +

+Definition at line 327 of file dru.cpp. +

+

00328 {
+00329         // v-left
+00330         CDRU::drawLine(xcenter-radius,ycenter-radius,xcenter-radius,ycenter+radius,driver,col,viewport);        
+00331         // v-right
+00332         CDRU::drawLine(xcenter+radius,ycenter-radius,xcenter+radius,ycenter+radius,driver,col,viewport);        
+00333         // h-up
+00334         CDRU::drawLine(xcenter-radius,ycenter+radius,xcenter+radius,ycenter+radius,driver,col,viewport);        
+00335         // h-bottom
+00336         CDRU::drawLine(xcenter-radius,ycenter-radius,xcenter+radius,ycenter-radius,driver,col,viewport);
+00337 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NL3D::CDRU::drawWiredQuad float  x0,
float  y0,
float  x1,
float  y1,
IDriver driver,
CRGBA  col,
CViewport  viewport
[static]
+
+ + + + + +
+   + + +

+Draw a Quad in 2D. Warning: this is slow... +

+ +

+Definition at line 313 of file dru.cpp. +

+

00314 {
+00315         // v-left
+00316         CDRU::drawLine(x0,y0,x0,y1 ,driver,col,viewport);       
+00317         // v-right
+00318         CDRU::drawLine(x1,y0,x1,y1 ,driver,col,viewport);       
+00319         // h-up
+00320         CDRU::drawLine(x0,y1,x1,y1,driver,col,viewport);        
+00321         // h-bottom
+00322         CDRU::drawLine(x0,y0,x1,y0,driver,col,viewport);        
+00323 }
+
+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 06:46:23 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1