mirror of
https://github.com/minetest/irrlicht.git
synced 2025-09-16 21:36:59 +02:00
Delete deprecated video driver methods
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user