Delete deprecated video driver methods

This commit is contained in:
sfan5
2024-03-09 22:22:07 +01:00
parent a7dd075dec
commit 70b0b46d50
13 changed files with 0 additions and 1086 deletions

View File

@ -8,7 +8,6 @@
#include "CMeshBuffer.h"
#include "SAnimatedMesh.h"
#include "os.h"
#include "triangle3d.h"
namespace irr
{

View File

@ -1891,16 +1891,6 @@ void CNullDriver::enableClipPlane(u32 index, bool enable)
}
ITexture* CNullDriver::createRenderTargetTexture(const core::dimension2d<u32>& size,
const c8* name)
{
os::Printer::log("createRenderTargetTexture is deprecated, use addRenderTargetTexture instead");
ITexture* tex = addRenderTargetTexture(size, name);
tex->grab();
return tex;
}
void CNullDriver::setMinHardwareBufferVertexCount(u32 count)
{
MinVertexCountForVBO = count;

View File

@ -119,9 +119,6 @@ namespace video
virtual void draw3DLine(const core::vector3df& start,
const core::vector3df& end, 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,
SColor color = SColor(255,255,255,255)) override;
@ -129,32 +126,6 @@ namespace video
//! draws an 2d image
void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, bool useAlphaChannelOfTexture) override;
//! 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.
\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 on position
\param clipRect: Pointer to rectangle on the screen where the image is clipped to.
This pointer can be 0. Then the image is not clipped.
\param color: Color with which the image is colored.
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. */
[[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) {}
//! 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
@ -196,21 +167,11 @@ namespace video
SColor colorLeftUp, SColor colorRightUp, SColor colorLeftDown, SColor colorRightDown,
const core::rect<s32>* clip = 0) override;
//! Draws the outline of a 2d rectangle
[[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,
const core::position2d<s32>& end,
SColor color=SColor(255,255,255,255)) override;
//! Draws a pixel
[[deprecated]] virtual void drawPixel(u32 x, u32 y, const SColor & color) {}
//! Draws a non filled concyclic reqular 2d polygon.
[[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,
f32 start=50.0f, f32 end=100.0f, f32 density=0.01f,
@ -257,22 +218,6 @@ namespace video
//! Adds an external image writer to the engine.
void addExternalImageWriter(IImageWriter* writer) override;
//! 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.
[[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.
[[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)) {}
//! Removes a texture from the texture cache and deletes it, freeing lot of
//! memory.
void removeTexture(ITexture* texture) override;
@ -605,10 +550,6 @@ namespace video
virtual void convertColor(const void* sP, ECOLOR_FORMAT sF, s32 sN,
void* dP, ECOLOR_FORMAT dF) const override;
//! deprecated method
virtual ITexture* createRenderTargetTexture(const core::dimension2d<u32>& size,
const c8* name=0);
bool checkDriverReset() override {return false;}
protected:

View File

@ -1021,84 +1021,6 @@ void COGLES1Driver::draw2DImage(const video::ITexture* texture, u32 layer, bool
}
//! draws a set of 2d images, using a color and the alpha channel
void COGLES1Driver::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;
if (!CacheHandler->getTextureCache().set(0, texture))
return;
setRenderStates2DMode(color.getAlpha()<255, true, useAlphaChannelOfTexture);
if (clipRect)
{
if (!clipRect->isValid())
return;
glEnable(GL_SCISSOR_TEST);
const core::dimension2d<u32>& renderTargetSize = getCurrentRenderTargetSize();
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()*6);
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());
const u32 vstart = vertices.size();
vertices.push_back(S3DVertex((f32)poss.UpperLeftCorner.X, (f32)poss.UpperLeftCorner.Y, 0, 0,0,1, color, tcoords.UpperLeftCorner.X, tcoords.UpperLeftCorner.Y));
vertices.push_back(S3DVertex((f32)poss.LowerRightCorner.X, (f32)poss.UpperLeftCorner.Y, 0, 0,0,1, color, tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y));
vertices.push_back(S3DVertex((f32)poss.LowerRightCorner.X, (f32)poss.LowerRightCorner.Y, 0, 0,0,1, color, tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y));
vertices.push_back(S3DVertex((f32)poss.UpperLeftCorner.X, (f32)poss.LowerRightCorner.Y, 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())
drawVertexPrimitiveList2d3d(vertices.pointer(), vertices.size(),
quadIndices.pointer(), vertices.size()/2,
video::EVT_STANDARD, scene::EPT_TRIANGLES,
EIT_16BIT, false);
if (clipRect)
glDisable(GL_SCISSOR_TEST);
}
//! draws a set of 2d images, using a color and the alpha channel of the texture if desired.
void COGLES1Driver::draw2DImageBatch(const video::ITexture* texture,
const core::array<core::position2d<s32> >& positions,
@ -1312,22 +1234,6 @@ void COGLES1Driver::draw2DLine(const core::position2d<s32>& start,
}
//! Draws a pixel
void COGLES1Driver::drawPixel(u32 x, u32 y, const SColor &color)
{
const core::dimension2d<u32>& renderTargetSize = getCurrentRenderTargetSize();
if (x > (u32)renderTargetSize.Width || y > (u32)renderTargetSize.Height)
return;
setRenderStates2DMode(color.getAlpha() < 255, false, false);
u16 indices[] = {0};
S3DVertex vertices[1];
vertices[0] = S3DVertex((f32)x, (f32)y, 0, 0, 0, 1, color, 0, 0);
drawVertexPrimitiveList2d3d(vertices, 1, indices, 1, video::EVT_STANDARD, scene::EPT_POINTS, EIT_16BIT, false);
}
//! creates a matrix in supplied GLfloat array to pass to OGLES1
inline void COGLES1Driver::getGLMatrix(GLfloat gl_matrix[16], const core::matrix4& m)
{
@ -2077,182 +1983,6 @@ void COGLES1Driver::setViewPortRaw(u32 width, u32 height)
}
//! Draws a shadow volume into the stencil buffer.
void COGLES1Driver::drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail, u32 debugDataVisible)
{
const u32 count=triangles.size();
if (!StencilBuffer || !count)
return;
u8 colorMask = LastMaterial.ColorMask;
const GLboolean lightingEnabled = glIsEnabled(GL_LIGHTING);
const GLboolean fogEnabled = glIsEnabled(GL_FOG);
const GLboolean cullFaceEnabled = glIsEnabled(GL_CULL_FACE);
GLint cullFaceMode = 0;
glGetIntegerv(GL_CULL_FACE_MODE, &cullFaceMode);
GLint depthFunc = 0;
glGetIntegerv(GL_DEPTH_FUNC, &depthFunc);
GLboolean depthMask = 0;
glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask);
glDisable(GL_LIGHTING);
glDisable(GL_FOG);
glDepthFunc(GL_LEQUAL);
glDepthMask(GL_FALSE);
if (!(debugDataVisible & (scene::EDS_SKELETON|scene::EDS_MESH_WIRE_OVERLAY)))
{
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glEnable(GL_STENCIL_TEST);
}
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 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[COGLESCoreExtensionHandler::IRR_GL_OES_stencil_wrap])
{
decr = GL_DECR_WRAP_OES;
incr = GL_INCR_WRAP_OES;
}
#endif
glEnable(GL_CULL_FACE);
if (zfail)
{
glCullFace(GL_FRONT);
glStencilOp(GL_KEEP, incr, GL_KEEP);
glDrawArrays(GL_TRIANGLES, 0, count);
glCullFace(GL_BACK);
glStencilOp(GL_KEEP, decr, GL_KEEP);
glDrawArrays(GL_TRIANGLES, 0, count);
}
else // zpass
{
glCullFace(GL_BACK);
glStencilOp(GL_KEEP, GL_KEEP, incr);
glDrawArrays(GL_TRIANGLES, 0, count);
glCullFace(GL_FRONT);
glStencilOp(GL_KEEP, GL_KEEP, decr);
glDrawArrays(GL_TRIANGLES, 0, count);
}
glDisableClientState(GL_VERTEX_ARRAY);
glColorMask((colorMask & ECP_RED)?GL_TRUE:GL_FALSE,
(colorMask & ECP_GREEN)?GL_TRUE:GL_FALSE,
(colorMask & ECP_BLUE)?GL_TRUE:GL_FALSE,
(colorMask & ECP_ALPHA)?GL_TRUE:GL_FALSE);
glDisable(GL_STENCIL_TEST);
if (lightingEnabled)
glEnable(GL_LIGHTING);
if (fogEnabled)
glEnable(GL_FOG);
if (cullFaceEnabled)
glEnable(GL_CULL_FACE);
else
glDisable(GL_CULL_FACE);
glCullFace(cullFaceMode);
glDepthFunc(depthFunc);
glDepthMask(depthMask);
}
void COGLES1Driver::drawStencilShadow(bool clearStencilBuffer,
video::SColor leftUpEdge, video::SColor rightUpEdge,
video::SColor leftDownEdge, video::SColor rightDownEdge)
{
if (!StencilBuffer)
return;
setTextureRenderStates(SMaterial(), false);
u8 colorMask = LastMaterial.ColorMask;
const GLboolean lightingEnabled = glIsEnabled(GL_LIGHTING);
const GLboolean fogEnabled = glIsEnabled(GL_FOG);
const GLboolean blendEnabled = glIsEnabled(GL_BLEND);
GLboolean depthMask = 0;
glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask);
GLint shadeModel = 0;
glGetIntegerv(GL_SHADE_MODEL, &shadeModel);
GLint blendSrc = 0, blendDst = 0;
glGetIntegerv(GL_BLEND_SRC, &blendSrc);
glGetIntegerv(GL_BLEND_DST, &blendDst);
glDisable(GL_LIGHTING);
glDisable(GL_FOG);
glDepthMask(GL_FALSE);
glShadeModel(GL_FLAT);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_NOTEQUAL, 0, ~0);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
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);
drawVertexPrimitiveList2d3d(vertices, 4, indices, 2, EVT_STANDARD, scene::EPT_TRIANGLE_FAN, EIT_16BIT, false);
if (clearStencilBuffer)
glClear(GL_STENCIL_BUFFER_BIT);
glColorMask((colorMask & ECP_RED)?GL_TRUE:GL_FALSE,
(colorMask & ECP_GREEN)?GL_TRUE:GL_FALSE,
(colorMask & ECP_BLUE)?GL_TRUE:GL_FALSE,
(colorMask & ECP_ALPHA)?GL_TRUE:GL_FALSE);
glDisable(GL_STENCIL_TEST);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
if (lightingEnabled)
glEnable(GL_LIGHTING);
if (fogEnabled)
glEnable(GL_FOG);
if (!blendEnabled)
glDisable(GL_BLEND);
glDepthMask(depthMask);
glShadeModel(shadeModel);
glBlendFunc(blendSrc, blendDst);
}
//! Sets the fog mode.
void COGLES1Driver::setFog(SColor c, E_FOG_TYPE fogType, f32 start,
f32 end, f32 density, bool pixelFog, bool rangeFog)

View File

@ -96,15 +96,6 @@ namespace video
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;
//! draws a set of 2d images, using a color and the alpha channel of the texture if desired.
virtual void draw2DImageBatch(const video::ITexture* texture,
const core::array<core::position2d<s32> >& positions,
@ -127,9 +118,6 @@ namespace video
const core::position2d<s32>& end,
SColor color=SColor(255,255,255,255)) override;
//! Draws a single pixel
void drawPixel(u32 x, u32 y, const SColor & color) override;
//! Draws a 3d line.
virtual void draw3DLine(const core::vector3df& start,
const core::vector3df& end,
@ -141,16 +129,6 @@ namespace video
//! Sets the dynamic ambient light color.
void setAmbientLight(const SColorf& color) 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;

View File

@ -1614,103 +1614,6 @@ void COpenGLDriver::draw2DImageBatch(const video::ITexture* texture,
}
//! 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 COpenGLDriver::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;
disableTextures(1);
if (!CacheHandler->getTextureCache().set(0, texture))
return;
setRenderStates2DMode(color.getAlpha()<255, true, useAlphaChannelOfTexture);
if (clipRect)
{
if (!clipRect->isValid())
return;
glEnable(GL_SCISSOR_TEST);
const core::dimension2d<u32>& renderTargetSize = getCurrentRenderTargetSize();
glScissor(clipRect->UpperLeftCorner.X, renderTargetSize.Height-clipRect->LowerRightCorner.Y,
clipRect->getWidth(),clipRect->getHeight());
}
const core::dimension2d<u32>& ss = texture->getOriginalSize();
core::position2d<s32> targetPos(pos);
const f32 invW = 1.f / static_cast<f32>(ss.Width);
const f32 invH = 1.f / static_cast<f32>(ss.Height);
Quad2DVertices[0].Color = color;
Quad2DVertices[1].Color = color;
Quad2DVertices[2].Color = color;
Quad2DVertices[3].Color = color;
if (!FeatureAvailable[IRR_ARB_vertex_array_bgra] && !FeatureAvailable[IRR_EXT_vertex_array_bgra])
getColorBuffer(Quad2DVertices, 4, EVT_STANDARD);
CacheHandler->setClientState(true, false, true, true);
glTexCoordPointer(2, GL_FLOAT, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(Quad2DVertices))[0].TCoords);
glVertexPointer(2, GL_FLOAT, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(Quad2DVertices))[0].Pos);
#ifdef GL_BGRA
const GLint colorSize=(FeatureAvailable[IRR_ARB_vertex_array_bgra] || FeatureAvailable[IRR_EXT_vertex_array_bgra])?GL_BGRA:4;
#else
const GLint colorSize=4;
#endif
if (FeatureAvailable[IRR_ARB_vertex_array_bgra] || FeatureAvailable[IRR_EXT_vertex_array_bgra])
glColorPointer(colorSize, GL_UNSIGNED_BYTE, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(Quad2DVertices))[0].Color);
else
{
_IRR_DEBUG_BREAK_IF(ColorBuffer.size()==0);
glColorPointer(colorSize, GL_UNSIGNED_BYTE, 0, &ColorBuffer[0]);
}
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,
sourceRects[currentIndex].UpperLeftCorner.Y * invH,
sourceRects[currentIndex].LowerRightCorner.X * invW,
sourceRects[currentIndex].LowerRightCorner.Y * invH);
const core::rect<s32> poss(targetPos, sourceRects[currentIndex].getSize());
Quad2DVertices[0].Pos = core::vector3df((f32)poss.UpperLeftCorner.X, (f32)poss.UpperLeftCorner.Y, 0.0f);
Quad2DVertices[1].Pos = core::vector3df((f32)poss.LowerRightCorner.X, (f32)poss.UpperLeftCorner.Y, 0.0f);
Quad2DVertices[2].Pos = core::vector3df((f32)poss.LowerRightCorner.X, (f32)poss.LowerRightCorner.Y, 0.0f);
Quad2DVertices[3].Pos = core::vector3df((f32)poss.UpperLeftCorner.X, (f32)poss.LowerRightCorner.Y, 0.0f);
Quad2DVertices[0].TCoords = core::vector2df(tcoords.UpperLeftCorner.X, tcoords.UpperLeftCorner.Y);
Quad2DVertices[1].TCoords = core::vector2df(tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y);
Quad2DVertices[2].TCoords = core::vector2df(tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y);
Quad2DVertices[3].TCoords = core::vector2df(tcoords.UpperLeftCorner.X, tcoords.LowerRightCorner.Y);
glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_SHORT, Quad2DIndices);
targetPos.X += sourceRects[currentIndex].getWidth();
}
if (clipRect)
glDisable(GL_SCISSOR_TEST);
}
//! draw a 2d rectangle
void COpenGLDriver::draw2DRectangle(SColor color, const core::rect<s32>& position,
const core::rect<s32>* clip)
@ -1790,9 +1693,6 @@ void COpenGLDriver::draw2DRectangle(const core::rect<s32>& position,
void COpenGLDriver::draw2DLine(const core::position2d<s32>& start,
const core::position2d<s32>& end, SColor color)
{
if (start==end)
drawPixel(start.X, start.Y, color);
else
{
disableTextures();
setRenderStates2DMode(color.getAlpha() < 255, false, false);
@ -1832,42 +1732,6 @@ void COpenGLDriver::draw2DLine(const core::position2d<s32>& start,
}
}
//! Draws a pixel
void COpenGLDriver::drawPixel(u32 x, u32 y, const SColor &color)
{
const core::dimension2d<u32>& renderTargetSize = getCurrentRenderTargetSize();
if (x > (u32)renderTargetSize.Width || y > (u32)renderTargetSize.Height)
return;
disableTextures();
setRenderStates2DMode(color.getAlpha() < 255, false, false);
Quad2DVertices[0].Color = color;
Quad2DVertices[0].Pos = core::vector3df((f32)x, (f32)y, 0.0f);
if (!FeatureAvailable[IRR_ARB_vertex_array_bgra] && !FeatureAvailable[IRR_EXT_vertex_array_bgra])
getColorBuffer(Quad2DVertices, 1, EVT_STANDARD);
CacheHandler->setClientState(true, false, true, false);
glVertexPointer(2, GL_FLOAT, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(Quad2DVertices))[0].Pos);
#ifdef GL_BGRA
const GLint colorSize=(FeatureAvailable[IRR_ARB_vertex_array_bgra] || FeatureAvailable[IRR_EXT_vertex_array_bgra])?GL_BGRA:4;
#else
const GLint colorSize=4;
#endif
if (FeatureAvailable[IRR_ARB_vertex_array_bgra] || FeatureAvailable[IRR_EXT_vertex_array_bgra])
glColorPointer(colorSize, GL_UNSIGNED_BYTE, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(Quad2DVertices))[0].Color);
else
{
_IRR_DEBUG_BREAK_IF(ColorBuffer.size()==0);
glColorPointer(colorSize, GL_UNSIGNED_BYTE, 0, &ColorBuffer[0]);
}
glDrawArrays(GL_POINTS, 0, 1);
}
//! disables all textures beginning with the optional fromStage parameter. Otherwise all texture stages are disabled.
//! Returns whether disabling was successful or not.
@ -2957,234 +2821,6 @@ void COpenGLDriver::setViewPortRaw(u32 width, u32 height)
}
//! 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. Next use IVideoDriver::drawStencilShadow() to visualize the shadow.
void COpenGLDriver::drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail, u32 debugDataVisible)
{
const u32 count=triangles.size();
if (!StencilBuffer || !count)
return;
// unset last 3d material
if (CurrentRenderMode == ERM_3D &&
static_cast<u32>(Material.MaterialType) < MaterialRenderers.size())
{
MaterialRenderers[Material.MaterialType].Renderer->OnUnsetMaterial();
ResetRenderStates = true;
}
// store current OpenGL state
glPushAttrib(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT |
GL_POLYGON_BIT | GL_STENCIL_BUFFER_BIT);
glDisable(GL_LIGHTING);
glDisable(GL_FOG);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glDepthMask(GL_FALSE);
if (debugDataVisible & scene::EDS_MESH_WIRE_OVERLAY)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
if (!(debugDataVisible & (scene::EDS_SKELETON|scene::EDS_MESH_WIRE_OVERLAY)))
{
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // no color buffer drawing
glEnable(GL_STENCIL_TEST);
}
CacheHandler->setClientState(true, false, false, false);
glVertexPointer(3,GL_FLOAT,sizeof(core::vector3df),triangles.const_pointer());
glStencilMask(~0);
glStencilFunc(GL_ALWAYS, 0, ~0);
GLenum incr = GL_INCR;
GLenum decr = GL_DECR;
#ifdef GL_EXT_stencil_wrap
if (FeatureAvailable[IRR_EXT_stencil_wrap])
{
incr = GL_INCR_WRAP_EXT;
decr = GL_DECR_WRAP_EXT;
}
#endif
#ifdef GL_NV_depth_clamp
if (FeatureAvailable[IRR_NV_depth_clamp])
glEnable(GL_DEPTH_CLAMP_NV);
#elif defined(GL_ARB_depth_clamp)
if (FeatureAvailable[IRR_ARB_depth_clamp])
{
glEnable(GL_DEPTH_CLAMP);
}
#endif
// The first parts are not correctly working, yet.
#if 0
#ifdef GL_EXT_stencil_two_side
if (FeatureAvailable[IRR_EXT_stencil_two_side])
{
glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT);
glDisable(GL_CULL_FACE);
if (zfail)
{
extGlActiveStencilFace(GL_BACK);
glStencilOp(GL_KEEP, incr, GL_KEEP);
glStencilMask(~0);
glStencilFunc(GL_ALWAYS, 0, ~0);
extGlActiveStencilFace(GL_FRONT);
glStencilOp(GL_KEEP, decr, GL_KEEP);
}
else // zpass
{
extGlActiveStencilFace(GL_BACK);
glStencilOp(GL_KEEP, GL_KEEP, decr);
glStencilMask(~0);
glStencilFunc(GL_ALWAYS, 0, ~0);
extGlActiveStencilFace(GL_FRONT);
glStencilOp(GL_KEEP, GL_KEEP, incr);
}
glStencilMask(~0);
glStencilFunc(GL_ALWAYS, 0, ~0);
glDrawArrays(GL_TRIANGLES,0,count);
glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
}
else
#endif
if (FeatureAvailable[IRR_ATI_separate_stencil])
{
glDisable(GL_CULL_FACE);
if (zfail)
{
extGlStencilOpSeparate(GL_BACK, GL_KEEP, incr, GL_KEEP);
extGlStencilOpSeparate(GL_FRONT, GL_KEEP, decr, GL_KEEP);
}
else // zpass
{
extGlStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, decr);
extGlStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, incr);
}
extGlStencilFuncSeparate(GL_ALWAYS, GL_ALWAYS, 0, ~0);
glStencilMask(~0);
glDrawArrays(GL_TRIANGLES,0,count);
}
else
#endif
{
glEnable(GL_CULL_FACE);
if (zfail)
{
glCullFace(GL_FRONT);
glStencilOp(GL_KEEP, incr, GL_KEEP);
glDrawArrays(GL_TRIANGLES,0,count);
glCullFace(GL_BACK);
glStencilOp(GL_KEEP, decr, GL_KEEP);
glDrawArrays(GL_TRIANGLES,0,count);
}
else // zpass
{
glCullFace(GL_BACK);
glStencilOp(GL_KEEP, GL_KEEP, incr);
glDrawArrays(GL_TRIANGLES,0,count);
glCullFace(GL_FRONT);
glStencilOp(GL_KEEP, GL_KEEP, decr);
glDrawArrays(GL_TRIANGLES,0,count);
}
}
#ifdef GL_NV_depth_clamp
if (FeatureAvailable[IRR_NV_depth_clamp])
glDisable(GL_DEPTH_CLAMP_NV);
#elif defined(GL_ARB_depth_clamp)
if (FeatureAvailable[IRR_ARB_depth_clamp])
{
glDisable(GL_DEPTH_CLAMP);
}
#endif
glDisable(GL_POLYGON_OFFSET_FILL);
glPopAttrib();
}
//! 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 COpenGLDriver::drawStencilShadow(bool clearStencilBuffer, video::SColor leftUpEdge,
video::SColor rightUpEdge, video::SColor leftDownEdge, video::SColor rightDownEdge)
{
if (!StencilBuffer)
return;
disableTextures();
// store attributes
glPushAttrib(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT | GL_STENCIL_BUFFER_BIT | GL_LIGHTING_BIT);
glDisable(GL_LIGHTING);
glDisable(GL_FOG);
glDepthMask(GL_FALSE);
glShadeModel(GL_FLAT);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_NOTEQUAL, 0, ~0);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
// draw a shadow rectangle covering the entire screen using stencil buffer
CacheHandler->setMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
CacheHandler->setMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
Quad2DVertices[0].Color = leftDownEdge;
Quad2DVertices[1].Color = leftUpEdge;
Quad2DVertices[2].Color = rightUpEdge;
Quad2DVertices[3].Color = rightDownEdge;
Quad2DVertices[0].Pos = core::vector3df(-1.0f, -1.0f, -0.9f);
Quad2DVertices[1].Pos = core::vector3df(-1.0f, 1.0f, -0.9f);
Quad2DVertices[2].Pos = core::vector3df(1.0f, 1.0f, -0.9f);
Quad2DVertices[3].Pos = core::vector3df(1.0f, -1.0f, -0.9f);
if (!FeatureAvailable[IRR_ARB_vertex_array_bgra] && !FeatureAvailable[IRR_EXT_vertex_array_bgra])
getColorBuffer(Quad2DVertices, 4, EVT_STANDARD);
CacheHandler->setClientState(true, false, true, false);
glVertexPointer(3, GL_FLOAT, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(Quad2DVertices))[0].Pos);
#ifdef GL_BGRA
const GLint colorSize=(FeatureAvailable[IRR_ARB_vertex_array_bgra] || FeatureAvailable[IRR_EXT_vertex_array_bgra])?GL_BGRA:4;
#else
const GLint colorSize=4;
#endif
if (FeatureAvailable[IRR_ARB_vertex_array_bgra] || FeatureAvailable[IRR_EXT_vertex_array_bgra])
glColorPointer(colorSize, GL_UNSIGNED_BYTE, sizeof(S3DVertex), &(static_cast<const S3DVertex*>(Quad2DVertices))[0].Color);
else
{
_IRR_DEBUG_BREAK_IF(ColorBuffer.size()==0);
glColorPointer(colorSize, GL_UNSIGNED_BYTE, 0, &ColorBuffer[0]);
}
glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_SHORT, Quad2DIndices);
if (clearStencilBuffer)
glClear(GL_STENCIL_BUFFER_BIT);
// restore settings
glPopMatrix();
CacheHandler->setMatrixMode(GL_MODELVIEW);
glPopMatrix();
glPopAttrib();
}
//! Sets the fog mode.
void COpenGLDriver::setFog(SColor c, E_FOG_TYPE fogType, f32 start,
f32 end, f32 density, bool pixelFog, bool rangeFog)

View File

@ -153,31 +153,6 @@ namespace video
SColor color,
bool useAlphaChannelOfTexture) override;
//! 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.
\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 clipRect: Pointer to rectangle on the screen where the image is clipped to.
This pointer can be 0. Then the image is not clipped.
\param color: Color with which the image is colored.
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) override;
//! draw an 2d rectangle
virtual void draw2DRectangle(SColor color, const core::rect<s32>& pos,
const core::rect<s32>* clip = 0) override;
@ -192,9 +167,6 @@ namespace video
const core::position2d<s32>& end,
SColor color=SColor(255,255,255,255)) override;
//! Draws a single pixel
void drawPixel(u32 x, u32 y, const SColor & color) override;
//! Draws a 3d box
void draw3DBox( const core::aabbox3d<f32>& box, SColor color = SColor(255,255,255,255 ) ) override;
@ -212,20 +184,6 @@ namespace video
//! \param color: New color of the ambient light.
void setAmbientLight(const SColorf& color) override;
//! 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 drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail, u32 debugDataVisible=0) override;
//! 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,
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;

View File

@ -8,18 +8,9 @@
#include "SColor.h"
#include "vector3d.h"
#include "vector2d.h"
#include "line2d.h"
#include "line3d.h"
#include "triangle3d.h"
#include "position2d.h"
#include "rect.h"
#include "dimension2d.h"
#include "matrix4.h"
#include "quaternion.h"
#include "plane3d.h"
#include "triangle3d.h"
#include "line2d.h"
#include "line3d.h"
#include "irrString.h"
#include "irrArray.h"
#include "EAttributes.h"

View File

@ -1068,9 +1068,6 @@ COpenGL3DriverBase::~COpenGL3DriverBase()
void COpenGL3DriverBase::draw2DLine(const core::position2d<s32>& start,
const core::position2d<s32>& end, SColor color)
{
if (start==end)
drawPixel(start.X, start.Y, color);
else
{
chooseMaterial2D();
setMaterialTexture(0, 0);
@ -1092,28 +1089,6 @@ COpenGL3DriverBase::~COpenGL3DriverBase()
}
}
//! Draws a pixel
void COpenGL3DriverBase::drawPixel(u32 x, u32 y, const SColor &color)
{
const core::dimension2d<u32>& renderTargetSize = getCurrentRenderTargetSize();
if (x > (u32)renderTargetSize.Width || y > (u32)renderTargetSize.Height)
return;
chooseMaterial2D();
setMaterialTexture(0, 0);
setRenderStates2DMode(color.getAlpha() < 255, false, false);
f32 X = (f32)x / (f32)renderTargetSize.Width * 2.f - 1.f;
f32 Y = 2.f - (f32)y / (f32)renderTargetSize.Height * 2.f - 1.f;
S3DVertex vertices[1];
vertices[0] = S3DVertex(X, Y, 0, 0, 0, 1, color, 0, 0);
drawArrays(GL_POINTS, vtPrimitive, vertices, 1);
}
void COpenGL3DriverBase::drawQuad(const VertexType &vertexType, const S3DVertex (&vertices)[4])
{
drawArrays(GL_TRIANGLE_FAN, vertexType, vertices, 4);

View File

@ -124,17 +124,11 @@ namespace video
const core::position2d<s32>& end,
SColor color = SColor(255, 255, 255, 255)) override;
//! Draws a single pixel
void drawPixel(u32 x, u32 y, const SColor & color) override;
//! Draws a 3d line.
virtual void draw3DLine(const core::vector3df& start,
const core::vector3df& end,
SColor color = SColor(255, 255, 255, 255)) override;
//! Draws a pixel
// virtual void drawPixel(u32 x, u32 y, const SColor & color);
//! Returns the name of the video driver.
const char* getName() const override;