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