virtual void draw3DLine(const core::vector3df& start,\r
const core::vector3df& end, SColor color = SColor(255,255,255,255)) =0;\r
\r
- //! Draws a 3d triangle.\r
- /** This method calls drawVertexPrimitiveList for some triangles.\r
- This method works with all drivers because it simply calls\r
- drawVertexPrimitiveList, but it is hence not very fast.\r
- Note that the triangle is drawn using the current\r
- transformation matrix and material. So if you need to draw it\r
- independently of the current transformation, use\r
- \code\r
- driver->setMaterial(someMaterial);\r
- driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);\r
- \endcode\r
- for some properly set up material before drawing the triangle.\r
- \param triangle The triangle to draw.\r
- \param color Color of the line. */\r
- virtual void draw3DTriangle(const core::triangle3df& triangle,\r
- SColor color = SColor(255,255,255,255)) =0;\r
-\r
//! Draws a 3d axis aligned box.\r
/** This method simply calls draw3DLine for the edges of the\r
box. Note that the box is drawn using the current transformation\r
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect =0,\r
SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false) =0;\r
\r
- //! Draws a set of 2d images, using a color and the alpha channel of the texture.\r
- /** The images are drawn beginning at pos and concatenated in\r
- one line. All drawings are clipped against clipRect (if != 0).\r
- The subtextures are defined by the array of sourceRects and are\r
- chosen by the indices given.\r
- \param texture Texture to be drawn.\r
- \param pos Upper left 2d destination position where the image\r
- will be drawn.\r
- \param sourceRects Source rectangles of the image.\r
- \param indices List of indices which choose the actual\r
- rectangle used each time.\r
- \param kerningWidth Offset to Position on X\r
- \param clipRect Pointer to rectangle on the screen where the\r
- image is clipped to.\r
- If this pointer is 0 then the image is not clipped.\r
- \param color Color with which the image is drawn.\r
- Note that the alpha component is used. If alpha is other than\r
- 255, the image will be transparent.\r
- \param useAlphaChannelOfTexture: If true, the alpha channel of\r
- the texture is used to draw the image. */\r
- virtual void draw2DImageBatch(const video::ITexture* texture,\r
- const core::position2d<s32>& pos,\r
- const core::array<core::rect<s32> >& sourceRects,\r
- const core::array<s32>& indices,\r
- s32 kerningWidth=0,\r
- const core::rect<s32>* clipRect=0,\r
- SColor color=SColor(255,255,255,255),\r
- bool useAlphaChannelOfTexture=false) =0;\r
-\r
//! Draws a set of 2d images, using a color and the alpha channel of the texture.\r
/** All drawings are clipped against clipRect (if != 0).\r
The subtextures are defined by the array of sourceRects and are\r
SColor colorLeftDown, SColor colorRightDown,\r
const core::rect<s32>* clip =0) =0;\r
\r
- //! Draws the outline of a 2D rectangle.\r
- /** \param pos Position of the rectangle.\r
- \param color Color of the rectangle to draw. The alpha component\r
- specifies how transparent the rectangle outline will be. */\r
- virtual void draw2DRectangleOutline(const core::recti& pos,\r
- SColor color=SColor(255,255,255,255)) =0;\r
-\r
//! Draws a 2d line.\r
/** In theory both start and end will be included in coloring.\r
BUG: Currently d3d ignores the last pixel\r
const core::position2d<s32>& end,\r
SColor color=SColor(255,255,255,255)) =0;\r
\r
- //! Draws a pixel.\r
- /** \param x The x-position of the pixel.\r
- \param y The y-position of the pixel.\r
- \param color Color of the pixel to draw. */\r
- virtual void drawPixel(u32 x, u32 y, const SColor& color) =0;\r
-\r
- //! Draws a non filled concyclic regular 2d polygon.\r
- /** This method can be used to draw circles, but also\r
- triangles, tetragons, pentagons, hexagons, heptagons, octagons,\r
- enneagons, decagons, hendecagons, dodecagon, triskaidecagons,\r
- etc. I think you'll got it now. And all this by simply\r
- specifying the vertex count. Welcome to the wonders of\r
- geometry.\r
- \param center Position of center of circle (pixels).\r
- \param radius Radius of circle in pixels.\r
- \param color Color of the circle.\r
- \param vertexCount Amount of vertices of the polygon. Specify 2\r
- to draw a line, 3 to draw a triangle, 4 for tetragons and a lot\r
- (>10) for nearly a circle. */\r
- virtual void draw2DPolygon(core::position2d<s32> center,\r
- f32 radius,\r
- video::SColor color=SColor(100,255,255,255),\r
- s32 vertexCount=10) =0;\r
-\r
- //! Draws a shadow volume into the stencil buffer.\r
- /** To draw a stencil shadow, do this: First, draw all geometry.\r
- Then use this method, to draw the shadow volume. Then, use\r
- IVideoDriver::drawStencilShadow() to visualize the shadow.\r
- Please note that the code for the opengl version of the method\r
- is based on free code sent in by Philipp Dortmann, lots of\r
- thanks go to him!\r
- \param triangles Array of 3d vectors, specifying the shadow\r
- volume.\r
- \param zfail If set to true, zfail method is used, otherwise\r
- zpass.\r
- \param debugDataVisible The debug data that is enabled for this\r
- shadow node\r
- */\r
- virtual void drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail=true, u32 debugDataVisible=0) =0;\r
-\r
- //! Fills the stencil shadow with color.\r
- /** After the shadow volume has been drawn into the stencil\r
- buffer using IVideoDriver::drawStencilShadowVolume(), use this\r
- to draw the color of the shadow.\r
- Please note that the code for the opengl version of the method\r
- is based on free code sent in by Philipp Dortmann, lots of\r
- thanks go to him!\r
- \param clearStencilBuffer Set this to false, if you want to\r
- draw every shadow with the same color, and only want to call\r
- drawStencilShadow() once after all shadow volumes have been\r
- drawn. Set this to true, if you want to paint every shadow with\r
- its own color.\r
- \param leftUpEdge Color of the shadow in the upper left corner\r
- of screen.\r
- \param rightUpEdge Color of the shadow in the upper right\r
- corner of screen.\r
- \param leftDownEdge Color of the shadow in the lower left\r
- corner of screen.\r
- \param rightDownEdge Color of the shadow in the lower right\r
- corner of screen. */\r
- virtual void drawStencilShadow(bool clearStencilBuffer=false,\r
- video::SColor leftUpEdge = video::SColor(255,0,0,0),\r
- video::SColor rightUpEdge = video::SColor(255,0,0,0),\r
- video::SColor leftDownEdge = video::SColor(255,0,0,0),\r
- video::SColor rightDownEdge = video::SColor(255,0,0,0)) =0;\r
-\r
//! Draws a mesh buffer\r
/** \param mb Buffer to draw */\r
virtual void drawMeshBuffer(const scene::IMeshBuffer* mb) =0;\r
}\r
\r
\r
-//! Draws a 3d triangle.\r
-void CNullDriver::draw3DTriangle(const core::triangle3df& triangle, SColor color)\r
-{\r
- S3DVertex vertices[3];\r
- vertices[0].Pos=triangle.pointA;\r
- vertices[0].Color=color;\r
- vertices[0].Normal=triangle.getNormal().normalize();\r
- vertices[0].TCoords.set(0.f,0.f);\r
- vertices[1].Pos=triangle.pointB;\r
- vertices[1].Color=color;\r
- vertices[1].Normal=vertices[0].Normal;\r
- vertices[1].TCoords.set(0.5f,1.f);\r
- vertices[2].Pos=triangle.pointC;\r
- vertices[2].Color=color;\r
- vertices[2].Normal=vertices[0].Normal;\r
- vertices[2].TCoords.set(1.f,0.f);\r
- const u16 indexList[] = {0,1,2};\r
- drawVertexPrimitiveList(vertices, 3, indexList, 1, EVT_STANDARD, scene::EPT_TRIANGLES, EIT_16BIT);\r
-}\r
-\r
-\r
//! Draws a 3d axis aligned box.\r
void CNullDriver::draw3DBox(const core::aabbox3d<f32>& box, SColor color)\r
{\r
}\r
\r
\r
-\r
-//! draws a set of 2d images, using a color and the alpha channel of the\r
-//! texture if desired. The images are drawn beginning at pos and concatenated\r
-//! in one line. All drawings are clipped against clipRect (if != 0).\r
-//! The subtextures are defined by the array of sourceRects and are chosen\r
-//! by the indices given.\r
-void CNullDriver::draw2DImageBatch(const video::ITexture* texture,\r
- const core::position2d<s32>& pos,\r
- const core::array<core::rect<s32> >& sourceRects,\r
- const core::array<s32>& indices,\r
- s32 kerningWidth,\r
- const core::rect<s32>* clipRect, SColor color,\r
- bool useAlphaChannelOfTexture)\r
-{\r
- core::position2d<s32> target(pos);\r
-\r
- for (u32 i=0; i<indices.size(); ++i)\r
- {\r
- draw2DImage(texture, target, sourceRects[indices[i]],\r
- clipRect, color, useAlphaChannelOfTexture);\r
- target.X += sourceRects[indices[i]].getWidth();\r
- target.X += kerningWidth;\r
- }\r
-}\r
-\r
//! draws a set of 2d images, using a color and the alpha channel of the\r
//! texture if desired.\r
void CNullDriver::draw2DImageBatch(const video::ITexture* texture,\r
}\r
\r
\r
-//! Draws the outline of a 2d rectangle\r
-void CNullDriver::draw2DRectangleOutline(const core::recti& pos, SColor color)\r
-{\r
- draw2DLine(pos.UpperLeftCorner, core::position2di(pos.LowerRightCorner.X, pos.UpperLeftCorner.Y), color);\r
- draw2DLine(core::position2di(pos.LowerRightCorner.X, pos.UpperLeftCorner.Y), pos.LowerRightCorner, color);\r
- draw2DLine(pos.LowerRightCorner, core::position2di(pos.UpperLeftCorner.X, pos.LowerRightCorner.Y), color);\r
- draw2DLine(core::position2di(pos.UpperLeftCorner.X, pos.LowerRightCorner.Y), pos.UpperLeftCorner, color);\r
-}\r
-\r
-\r
//! Draw a 2d rectangle\r
void CNullDriver::draw2DRectangle(SColor color, const core::rect<s32>& pos, const core::rect<s32>* clip)\r
{\r
{\r
}\r
\r
-//! Draws a pixel\r
-void CNullDriver::drawPixel(u32 x, u32 y, const SColor & color)\r
-{\r
-}\r
-\r
-\r
-//! Draws a non filled concyclic regular 2d polygon.\r
-void CNullDriver::draw2DPolygon(core::position2d<s32> center,\r
- f32 radius, video::SColor color, s32 count)\r
-{\r
- if (count < 2)\r
- return;\r
-\r
- core::position2d<s32> first;\r
- core::position2d<s32> a,b;\r
-\r
- for (s32 j=0; j<count; ++j)\r
- {\r
- b = a;\r
-\r
- f32 p = j / (f32)count * (core::PI*2);\r
- a = center + core::position2d<s32>((s32)(sin(p)*radius), (s32)(cos(p)*radius));\r
-\r
- if (j==0)\r
- first = a;\r
- else\r
- draw2DLine(a, b, color);\r
- }\r
-\r
- draw2DLine(a, first, color);\r
-}\r
-\r
\r
//! returns color format\r
ECOLOR_FORMAT CNullDriver::getColorFormat() const\r
}\r
\r
\r
-\r
-//! Draws a shadow volume into the stencil buffer. To draw a stencil shadow, do\r
-//! this: First, draw all geometry. Then use this method, to draw the shadow\r
-//! volume. Then, use IVideoDriver::drawStencilShadow() to visualize the shadow.\r
-void CNullDriver::drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail, u32 debugDataVisible)\r
-{\r
-}\r
-\r
-\r
-//! Fills the stencil shadow with color. After the shadow volume has been drawn\r
-//! into the stencil buffer using IVideoDriver::drawStencilShadowVolume(), use this\r
-//! to draw the color of the shadow.\r
-void CNullDriver::drawStencilShadow(bool clearStencilBuffer,\r
- video::SColor leftUpEdge, video::SColor rightUpEdge,\r
- video::SColor leftDownEdge, video::SColor rightDownEdge)\r
-{\r
-}\r
-\r
-\r
//! Creates a boolean alpha channel of the texture based of an color key.\r
void CNullDriver::makeColorKeyTexture(video::ITexture* texture,\r
video::SColor color,\r
virtual void draw3DLine(const core::vector3df& start,\r
const core::vector3df& end, SColor color = SColor(255,255,255,255)) override;\r
\r
- //! Draws a 3d triangle.\r
- virtual void draw3DTriangle(const core::triangle3df& triangle,\r
- SColor color = SColor(255,255,255,255)) override;\r
+ [[deprecated]] virtual void draw3DTriangle(const core::triangle3df& triangle,\r
+ SColor color = SColor(255,255,255,255)) {}\r
\r
//! Draws a 3d axis aligned box.\r
virtual void draw3DBox(const core::aabbox3d<f32>& box,\r
Note that the alpha component is used: If alpha is other than 255, the image will be transparent.\r
\param useAlphaChannelOfTexture: If true, the alpha channel of the texture is\r
used to draw the image. */\r
- virtual void draw2DImageBatch(const video::ITexture* texture,\r
+ [[deprecated]] virtual void draw2DImageBatch(const video::ITexture* texture,\r
const core::position2d<s32>& pos,\r
const core::array<core::rect<s32> >& sourceRects,\r
const core::array<s32>& indices,\r
s32 kerningWidth = 0,\r
const core::rect<s32>* clipRect = 0,\r
SColor color=SColor(255,255,255,255),\r
- bool useAlphaChannelOfTexture=false) override;\r
+ bool useAlphaChannelOfTexture=false) {}\r
\r
//! Draws a set of 2d images, using a color and the alpha channel of the texture.\r
/** All drawings are clipped against clipRect (if != 0).\r
const core::rect<s32>* clip = 0) override;\r
\r
//! Draws the outline of a 2d rectangle\r
- void draw2DRectangleOutline(const core::recti& pos, SColor color=SColor(255,255,255,255)) override;\r
+ [[deprecated]] virtual void draw2DRectangleOutline(const core::recti& pos, SColor color=SColor(255,255,255,255)) {}\r
\r
//! Draws a 2d line.\r
virtual void draw2DLine(const core::position2d<s32>& start,\r
SColor color=SColor(255,255,255,255)) override;\r
\r
//! Draws a pixel\r
- void drawPixel(u32 x, u32 y, const SColor & color) override;\r
+ [[deprecated]] virtual void drawPixel(u32 x, u32 y, const SColor & color) {}\r
\r
//! Draws a non filled concyclic reqular 2d polygon.\r
- virtual void draw2DPolygon(core::position2d<s32> center,\r
- f32 radius, video::SColor Color, s32 vertexCount) override;\r
+ [[deprecated]] virtual void draw2DPolygon(core::position2d<s32> center,\r
+ f32 radius, video::SColor Color, s32 vertexCount) {}\r
\r
virtual void setFog(SColor color=SColor(0,255,255,255),\r
E_FOG_TYPE fogType=EFT_FOG_LINEAR,\r
//! Draws a shadow volume into the stencil buffer. To draw a stencil shadow, do\r
//! this: First, draw all geometry. Then use this method, to draw the shadow\r
//! volume. Then, use IVideoDriver::drawStencilShadow() to visualize the shadow.\r
- virtual void drawStencilShadowVolume(const core::array<core::vector3df>& triangles,\r
- bool zfail=true, u32 debugDataVisible=0) override;\r
+ [[deprecated]] virtual void drawStencilShadowVolume(const core::array<core::vector3df>& triangles,\r
+ bool zfail=true, u32 debugDataVisible=0) {}\r
\r
//! Fills the stencil shadow with color. After the shadow volume has been drawn\r
//! into the stencil buffer using IVideoDriver::drawStencilShadowVolume(), use this\r
//! to draw the color of the shadow.\r
- virtual void drawStencilShadow(bool clearStencilBuffer=false,\r
+ [[deprecated]] virtual void drawStencilShadow(bool clearStencilBuffer=false,\r
video::SColor leftUpEdge = video::SColor(0,0,0,0),\r
video::SColor rightUpEdge = video::SColor(0,0,0,0),\r
video::SColor leftDownEdge = video::SColor(0,0,0,0),\r
- video::SColor rightDownEdge = video::SColor(0,0,0,0)) override;\r
+ video::SColor rightDownEdge = video::SColor(0,0,0,0)) {}\r
\r
\r
//! Removes a texture from the texture cache and deletes it, freeing lot of\r
}\r
\r
\r
- //! draws a set of 2d images, using a color and the alpha channel\r
- void COpenGL3Driver::draw2DImageBatch(const video::ITexture* texture,\r
- const core::position2d<s32>& pos,\r
- const core::array<core::rect<s32> >& sourceRects,\r
- const core::array<s32>& indices, s32 kerningWidth,\r
- const core::rect<s32>* clipRect, SColor color,\r
- bool useAlphaChannelOfTexture)\r
- {\r
- if (!texture)\r
- return;\r
-\r
- chooseMaterial2D();\r
- if (!setMaterialTexture(0, texture))\r
- return;\r
-\r
- setRenderStates2DMode(color.getAlpha() < 255, true, useAlphaChannelOfTexture);\r
-\r
- const core::dimension2d<u32>& renderTargetSize = getCurrentRenderTargetSize();\r
-\r
- if (clipRect)\r
- {\r
- if (!clipRect->isValid())\r
- return;\r
-\r
- glEnable(GL_SCISSOR_TEST);\r
- glScissor(clipRect->UpperLeftCorner.X, renderTargetSize.Height - clipRect->LowerRightCorner.Y,\r
- clipRect->getWidth(), clipRect->getHeight());\r
- }\r
-\r
- const core::dimension2du& ss = texture->getOriginalSize();\r
- core::position2d<s32> targetPos(pos);\r
- // texcoords need to be flipped horizontally for RTTs\r
- const bool isRTT = texture->isRenderTarget();\r
- const f32 invW = 1.f / static_cast<f32>(ss.Width);\r
- const f32 invH = 1.f / static_cast<f32>(ss.Height);\r
-\r
- core::array<S3DVertex> vertices;\r
- core::array<u16> quadIndices;\r
- vertices.reallocate(indices.size()*4);\r
- quadIndices.reallocate(indices.size()*3);\r
-\r
- for (u32 i = 0; i < indices.size(); ++i)\r
- {\r
- const s32 currentIndex = indices[i];\r
- if (!sourceRects[currentIndex].isValid())\r
- break;\r
-\r
- const core::rect<f32> tcoords(\r
- sourceRects[currentIndex].UpperLeftCorner.X * invW,\r
- (isRTT ? sourceRects[currentIndex].LowerRightCorner.Y : sourceRects[currentIndex].UpperLeftCorner.Y) * invH,\r
- sourceRects[currentIndex].LowerRightCorner.X * invW,\r
- (isRTT ? sourceRects[currentIndex].UpperLeftCorner.Y : sourceRects[currentIndex].LowerRightCorner.Y) * invH);\r
-\r
- const core::rect<s32> poss(targetPos, sourceRects[currentIndex].getSize());\r
-\r
- f32 left = (f32)poss.UpperLeftCorner.X / (f32)renderTargetSize.Width * 2.f - 1.f;\r
- f32 right = (f32)poss.LowerRightCorner.X / (f32)renderTargetSize.Width * 2.f - 1.f;\r
- f32 down = 2.f - (f32)poss.LowerRightCorner.Y / (f32)renderTargetSize.Height * 2.f - 1.f;\r
- f32 top = 2.f - (f32)poss.UpperLeftCorner.Y / (f32)renderTargetSize.Height * 2.f - 1.f;\r
-\r
- const u32 vstart = vertices.size();\r
- vertices.push_back(S3DVertex(left, top, 0, 0, 0, 1, color, tcoords.UpperLeftCorner.X, tcoords.UpperLeftCorner.Y));\r
- vertices.push_back(S3DVertex(right, top, 0, 0, 0, 1, color, tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y));\r
- vertices.push_back(S3DVertex(right, down, 0, 0, 0, 1, color, tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y));\r
- vertices.push_back(S3DVertex(left, down, 0, 0, 0, 1, color, tcoords.UpperLeftCorner.X, tcoords.LowerRightCorner.Y));\r
- quadIndices.push_back(vstart);\r
- quadIndices.push_back(vstart+1);\r
- quadIndices.push_back(vstart+2);\r
- quadIndices.push_back(vstart);\r
- quadIndices.push_back(vstart+2);\r
- quadIndices.push_back(vstart+3);\r
-\r
- targetPos.X += sourceRects[currentIndex].getWidth();\r
- }\r
-\r
- if (vertices.size())\r
- {\r
- glEnableVertexAttribArray(EVA_POSITION);\r
- glEnableVertexAttribArray(EVA_COLOR);\r
- glEnableVertexAttribArray(EVA_TCOORD0);\r
- glVertexAttribPointer(EVA_POSITION, 3, GL_FLOAT, false, sizeof(S3DVertex), &vertices[0].Pos);\r
- glVertexAttribPointer(EVA_COLOR, 4, GL_UNSIGNED_BYTE, true, sizeof(S3DVertex), &vertices[0].Color);\r
- glVertexAttribPointer(EVA_TCOORD0, 2, GL_FLOAT, false, sizeof(S3DVertex), &vertices[0].TCoords);\r
- glDrawElements(GL_TRIANGLES, quadIndices.size(), GL_UNSIGNED_SHORT, quadIndices.pointer());\r
- glDisableVertexAttribArray(EVA_TCOORD0);\r
- glDisableVertexAttribArray(EVA_COLOR);\r
- glDisableVertexAttribArray(EVA_POSITION);\r
- }\r
-\r
- if (clipRect)\r
- glDisable(GL_SCISSOR_TEST);\r
-\r
- testGLError(__LINE__);\r
- }\r
-\r
-\r
//! draw a 2d rectangle\r
void COpenGL3Driver::draw2DRectangle(SColor color,\r
const core::rect<s32>& position,\r
}\r
\r
\r
- //! Draws a shadow volume into the stencil buffer.\r
- void COpenGL3Driver::drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail, u32 debugDataVisible)\r
- {\r
- const u32 count=triangles.size();\r
- if (!StencilBuffer || !count)\r
- return;\r
-\r
- bool fog = Material.FogEnable;\r
- bool lighting = Material.Lighting;\r
- E_MATERIAL_TYPE materialType = Material.MaterialType;\r
-\r
- Material.FogEnable = false;\r
- Material.Lighting = false;\r
- Material.MaterialType = EMT_SOLID; // Dedicated material in future.\r
-\r
- setRenderStates3DMode();\r
-\r
- CacheHandler->setDepthTest(true);\r
- CacheHandler->setDepthFunc(GL_LESS);\r
- CacheHandler->setDepthMask(false);\r
-\r
- if (!(debugDataVisible & (scene::EDS_SKELETON|scene::EDS_MESH_WIRE_OVERLAY)))\r
- {\r
- CacheHandler->setColorMask(ECP_NONE);\r
- glEnable(GL_STENCIL_TEST);\r
- }\r
-\r
- glEnableVertexAttribArray(EVA_POSITION);\r
- glVertexAttribPointer(EVA_POSITION, 3, GL_FLOAT, false, sizeof(core::vector3df), triangles.const_pointer());\r
-\r
- glStencilMask(~0);\r
- glStencilFunc(GL_ALWAYS, 0, ~0);\r
-\r
- GLenum decr = GL_DECR;\r
- GLenum incr = GL_INCR;\r
-\r
-#if defined(GL_OES_stencil_wrap)\r
- if (FeatureAvailable[IRR_OES_stencil_wrap])\r
- {\r
- decr = GL_DECR_WRAP_OES;\r
- incr = GL_INCR_WRAP_OES;\r
- }\r
-#endif\r
-\r
- CacheHandler->setCullFace(true);\r
-\r
- if (zfail)\r
- {\r
- CacheHandler->setCullFaceFunc(GL_FRONT);\r
- glStencilOp(GL_KEEP, incr, GL_KEEP);\r
- glDrawArrays(GL_TRIANGLES, 0, count);\r
-\r
- CacheHandler->setCullFaceFunc(GL_BACK);\r
- glStencilOp(GL_KEEP, decr, GL_KEEP);\r
- glDrawArrays(GL_TRIANGLES, 0, count);\r
- }\r
- else // zpass\r
- {\r
- CacheHandler->setCullFaceFunc(GL_BACK);\r
- glStencilOp(GL_KEEP, GL_KEEP, incr);\r
- glDrawArrays(GL_TRIANGLES, 0, count);\r
-\r
- CacheHandler->setCullFaceFunc(GL_FRONT);\r
- glStencilOp(GL_KEEP, GL_KEEP, decr);\r
- glDrawArrays(GL_TRIANGLES, 0, count);\r
- }\r
-\r
- glDisableVertexAttribArray(EVA_POSITION);\r
-\r
- glDisable(GL_STENCIL_TEST);\r
-\r
- Material.FogEnable = fog;\r
- Material.Lighting = lighting;\r
- Material.MaterialType = materialType;\r
- }\r
-\r
-\r
- void COpenGL3Driver::drawStencilShadow(bool clearStencilBuffer,\r
- video::SColor leftUpEdge, video::SColor rightUpEdge,\r
- video::SColor leftDownEdge, video::SColor rightDownEdge)\r
- {\r
- if (!StencilBuffer)\r
- return;\r
-\r
- chooseMaterial2D();\r
- setMaterialTexture(0, 0);\r
-\r
- setRenderStates2DMode(true, false, false);\r
-\r
- CacheHandler->setDepthMask(false);\r
- CacheHandler->setColorMask(ECP_ALL);\r
-\r
- CacheHandler->setBlend(true);\r
- CacheHandler->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\r
-\r
- glEnable(GL_STENCIL_TEST);\r
- glStencilFunc(GL_NOTEQUAL, 0, ~0);\r
- glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);\r
-\r
- u16 indices[] = {0, 1, 2, 3};\r
- S3DVertex vertices[4];\r
- vertices[0] = S3DVertex(-1.f, 1.f, 0.9f, 0, 0, 1, leftDownEdge, 0, 0);\r
- vertices[1] = S3DVertex(1.f, 1.f, 0.9f, 0, 0, 1, leftUpEdge, 0, 0);\r
- vertices[2] = S3DVertex(1.f, -1.f, 0.9f, 0, 0, 1, rightUpEdge, 0, 0);\r
- vertices[3] = S3DVertex(-1.f, -1.f, 0.9f, 0, 0, 1, rightDownEdge, 0, 0);\r
-\r
- glEnableVertexAttribArray(EVA_POSITION);\r
- glEnableVertexAttribArray(EVA_COLOR);\r
- glVertexAttribPointer(EVA_POSITION, 3, GL_FLOAT, false, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(vertices))[0].Pos);\r
- glVertexAttribPointer(EVA_COLOR, 4, GL_UNSIGNED_BYTE, true, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(vertices))[0].Color);\r
- glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_SHORT, indices);\r
- glDisableVertexAttribArray(EVA_COLOR);\r
- glDisableVertexAttribArray(EVA_POSITION);\r
-\r
- if (clearStencilBuffer)\r
- glClear(GL_STENCIL_BUFFER_BIT);\r
-\r
- glDisable(GL_STENCIL_TEST);\r
- }\r
-\r
-\r
//! Draws a 3d line.\r
void COpenGL3Driver::draw3DLine(const core::vector3df& start,\r
const core::vector3df& end, SColor color)\r
// internally used\r
virtual void draw2DImage(const video::ITexture* texture, u32 layer, bool flip);\r
\r
- //! draws a set of 2d images\r
- virtual void draw2DImageBatch(const video::ITexture* texture,\r
- const core::position2d<s32>& pos,\r
- const core::array<core::rect<s32> >& sourceRects,\r
- const core::array<s32>& indices, s32 kerningWidth = 0,\r
- const core::rect<s32>* clipRect = 0,\r
- SColor color = SColor(255, 255, 255, 255),\r
- bool useAlphaChannelOfTexture = false) override;\r
-\r
void draw2DImageBatch(const video::ITexture* texture,\r
const core::array<core::position2d<s32> >& positions,\r
const core::array<core::rect<s32> >& sourceRects,\r
//! Returns the maximum texture size supported.\r
core::dimension2du getMaxTextureSize() const override;\r
\r
- //! Draws a shadow volume into the stencil buffer.\r
- void drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail, u32 debugDataVisible=0) override;\r
-\r
- //! Fills the stencil shadow with color.\r
- virtual void drawStencilShadow(bool clearStencilBuffer=false,\r
- video::SColor leftUpEdge = video::SColor(0,0,0,0),\r
- video::SColor rightUpEdge = video::SColor(0,0,0,0),\r
- video::SColor leftDownEdge = video::SColor(0,0,0,0),\r
- video::SColor rightDownEdge = video::SColor(0,0,0,0)) override;\r
-\r
//! sets a viewport\r
void setViewPort(const core::rect<s32>& area) override;\r
\r