1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-11-30 20:53:45 +01:00

Irrlicht: remove some dead code

This commit is contained in:
sfan5
2025-11-03 14:43:52 +01:00
parent 2368126d0a
commit 8042b5512f
22 changed files with 9 additions and 452 deletions

View File

@@ -208,7 +208,6 @@ bool CNullDriver::beginScene(u16 clearFlag, SColor clearColor, f32 clearDepth, u
bool CNullDriver::endScene()
{
FPSCounter.registerFrame(os::Timer::getRealTime());
expireHardwareBuffers();
updateAllOcclusionQueries();
return true;
@@ -680,12 +679,6 @@ void CNullDriver::draw2DLine(const core::position2d<s32> &start,
{
}
//! returns color format
ECOLOR_FORMAT CNullDriver::getColorFormat() const
{
return ECF_R5G6B5;
}
//! returns screen size
const core::dimension2d<u32> &CNullDriver::getScreenSize() const
{
@@ -706,12 +699,6 @@ const core::dimension2d<u32> &CNullDriver::getCurrentRenderTargetSize() const
return CurrentRenderTargetSize;
}
// returns current frames per second value
s32 CNullDriver::getFPS() const
{
return FPSCounter.getFPS();
}
SFrameStats CNullDriver::getFrameStats() const
{
return FrameStats;
@@ -725,118 +712,6 @@ const char *CNullDriver::getName() const
return "Irrlicht NullDevice";
}
//! Creates a boolean alpha channel of the texture based of an color key.
void CNullDriver::makeColorKeyTexture(video::ITexture *texture,
video::SColor color) const
{
if (!texture)
return;
if (texture->getColorFormat() != ECF_A1R5G5B5 &&
texture->getColorFormat() != ECF_A8R8G8B8) {
os::Printer::log("Error: Unsupported texture color format for making color key channel.", ELL_ERROR);
return;
}
if (texture->getColorFormat() == ECF_A1R5G5B5) {
u16 *p = (u16 *)texture->lock();
if (!p) {
os::Printer::log("Could not lock texture for making color key channel.", ELL_ERROR);
return;
}
const core::dimension2d<u32> dim = texture->getSize();
const u32 pitch = texture->getPitch() / 2;
// color with alpha disabled (i.e. fully transparent)
const u16 refZeroAlpha = (0x7fff & color.toA1R5G5B5());
const u32 pixels = pitch * dim.Height;
for (u32 pixel = 0; pixel < pixels; ++pixel) {
// If the color matches the reference color, ignoring alphas,
// set the alpha to zero.
if (((*p) & 0x7fff) == refZeroAlpha)
(*p) = refZeroAlpha;
++p;
}
texture->unlock();
} else {
u32 *p = (u32 *)texture->lock();
if (!p) {
os::Printer::log("Could not lock texture for making color key channel.", ELL_ERROR);
return;
}
core::dimension2d<u32> dim = texture->getSize();
u32 pitch = texture->getPitch() / 4;
// color with alpha disabled (fully transparent)
const u32 refZeroAlpha = 0x00ffffff & color.color;
const u32 pixels = pitch * dim.Height;
for (u32 pixel = 0; pixel < pixels; ++pixel) {
// If the color matches the reference color, ignoring alphas,
// set the alpha to zero.
if (((*p) & 0x00ffffff) == refZeroAlpha)
(*p) = refZeroAlpha;
++p;
}
texture->unlock();
}
texture->regenerateMipMapLevels();
}
//! Creates an boolean alpha channel of the texture based of an color key position.
void CNullDriver::makeColorKeyTexture(video::ITexture *texture,
core::position2d<s32> colorKeyPixelPos) const
{
if (!texture)
return;
if (texture->getColorFormat() != ECF_A1R5G5B5 &&
texture->getColorFormat() != ECF_A8R8G8B8) {
os::Printer::log("Error: Unsupported texture color format for making color key channel.", ELL_ERROR);
return;
}
SColor colorKey;
if (texture->getColorFormat() == ECF_A1R5G5B5) {
u16 *p = (u16 *)texture->lock(ETLM_READ_ONLY);
if (!p) {
os::Printer::log("Could not lock texture for making color key channel.", ELL_ERROR);
return;
}
u32 pitch = texture->getPitch() / 2;
const u16 key16Bit = 0x7fff & p[colorKeyPixelPos.Y * pitch + colorKeyPixelPos.X];
colorKey = video::A1R5G5B5toA8R8G8B8(key16Bit);
} else {
u32 *p = (u32 *)texture->lock(ETLM_READ_ONLY);
if (!p) {
os::Printer::log("Could not lock texture for making color key channel.", ELL_ERROR);
return;
}
u32 pitch = texture->getPitch() / 4;
colorKey = 0x00ffffff & p[colorKeyPixelPos.Y * pitch + colorKeyPixelPos.X];
}
texture->unlock();
makeColorKeyTexture(texture, colorKey);
}
SDriverLimits CNullDriver::getLimits() const
{
SDriverLimits ret;
@@ -1427,15 +1302,6 @@ s32 CNullDriver::addMaterialRenderer(IMaterialRenderer *renderer, const char *na
return MaterialRenderers.size() - 1;
}
//! Sets the name of a material renderer.
void CNullDriver::setMaterialRendererName(u32 idx, const char *name)
{
if (idx < numBuiltInMaterials || idx >= MaterialRenderers.size())
return;
MaterialRenderers[idx].Name = name;
}
void CNullDriver::swapMaterialRenderers(u32 idx1, u32 idx2, bool swapNames)
{
if (idx1 < MaterialRenderers.size() && idx2 < MaterialRenderers.size()) {
@@ -1483,15 +1349,6 @@ u32 CNullDriver::getMaterialRendererCount() const
return MaterialRenderers.size();
}
//! Returns name of the material renderer
const char *CNullDriver::getMaterialRendererName(u32 idx) const
{
if (idx < MaterialRenderers.size())
return MaterialRenderers[idx].Name.c_str();
return 0;
}
//! Returns pointer to the IGPUProgrammingServices interface.
IGPUProgrammingServices *CNullDriver::getGPUProgrammingServices()
{