1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-11-07 18:55:18 +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

@@ -11,9 +11,6 @@
class IOSOperator : public virtual IReferenceCounted class IOSOperator : public virtual IReferenceCounted
{ {
public: public:
//! Get the current OS version as string.
virtual const core::stringc &getOperatingSystemVersion() const = 0;
//! Copies text to the clipboard //! Copies text to the clipboard
//! \param text: text in utf-8 //! \param text: text in utf-8
virtual void copyToClipboard(const c8 *text) const = 0; virtual void copyToClipboard(const c8 *text) const = 0;
@@ -31,10 +28,4 @@ public:
//! This is a no-op on some platforms. //! This is a no-op on some platforms.
//! \return Returns 0 if no string is in there, otherwise an utf-8 string. //! \return Returns 0 if no string is in there, otherwise an utf-8 string.
virtual const c8 *getTextFromPrimarySelection() const = 0; virtual const c8 *getTextFromPrimarySelection() const = 0;
//! Get the total and available system RAM
/** \param totalBytes: will contain the total system memory in Kilobytes (1024 B)
\param availableBytes: will contain the available memory in Kilobytes (1024 B)
\return True if successful, false if not */
virtual bool getSystemMemory(u32 *totalBytes, u32 *availableBytes) const = 0;
}; };

View File

@@ -379,32 +379,6 @@ public:
/** This is glBlitFramebuffer in OpenGL. */ /** This is glBlitFramebuffer in OpenGL. */
virtual void blitRenderTarget(IRenderTarget *from, IRenderTarget *to) = 0; virtual void blitRenderTarget(IRenderTarget *from, IRenderTarget *to) = 0;
//! Sets a boolean alpha channel on the texture based on a color key.
/** This makes the texture fully transparent at the texels where
this color key can be found when using for example draw2DImage
with useAlphachannel==true. The alpha of other texels is not modified.
\param texture Texture whose alpha channel is modified.
\param color Color key color. Every texel with this color will
become fully transparent as described above. Please note that the
colors of a texture may be converted when loading it, so the
color values may not be exactly the same in the engine and for
example in picture edit programs. To avoid this problem, you
could use the makeColorKeyTexture method, which takes the
position of a pixel instead a color value. */
virtual void makeColorKeyTexture(video::ITexture *texture,
video::SColor color) const = 0;
//! Sets a boolean alpha channel on the texture based on the color at a position.
/** This makes the texture fully transparent at the texels where
the color key can be found when using for example draw2DImage
with useAlphachannel==true. The alpha of other texels is not modified.
\param texture Texture whose alpha channel is modified.
\param colorKeyPixelPos Position of a pixel with the color key
color. Every texel with this color will become fully transparent as
described above. */
virtual void makeColorKeyTexture(video::ITexture *texture,
core::position2d<s32> colorKeyPixelPos) const = 0;
//! Set a render target. //! Set a render target.
/** This will only work if the driver supports the /** This will only work if the driver supports the
EVDF_RENDER_TO_TARGET feature, which can be queried with EVDF_RENDER_TO_TARGET feature, which can be queried with
@@ -812,10 +786,6 @@ public:
f32 &start, f32 &end, f32 &density, f32 &start, f32 &end, f32 &density,
bool &pixelFog, bool &rangeFog) = 0; bool &pixelFog, bool &rangeFog) = 0;
//! Get the current color format of the color buffer
/** \return Color format of the color buffer. */
virtual ECOLOR_FORMAT getColorFormat() const = 0;
//! Get the size of the screen or render window. //! Get the size of the screen or render window.
/** \return Size of screen or render window. */ /** \return Size of screen or render window. */
virtual const core::dimension2d<u32> &getScreenSize() const = 0; virtual const core::dimension2d<u32> &getScreenSize() const = 0;
@@ -827,14 +797,6 @@ public:
\return Size of render target or screen/window */ \return Size of render target or screen/window */
virtual const core::dimension2d<u32> &getCurrentRenderTargetSize() const = 0; virtual const core::dimension2d<u32> &getCurrentRenderTargetSize() const = 0;
//! Returns current frames per second value.
/** This value is updated approximately every 1.5 seconds and
is only intended to provide a rough guide to the average frame
rate. It is not suitable for use in performing timing
calculations or framerate independent movement.
\return Approximate amount of frames per second drawn. */
virtual s32 getFPS() const = 0;
//! Return some statistics about the last frame //! Return some statistics about the last frame
virtual SFrameStats getFrameStats() const = 0; virtual SFrameStats getFrameStats() const = 0;
@@ -1006,26 +968,6 @@ public:
/** \return Amount of currently available material renderers. */ /** \return Amount of currently available material renderers. */
virtual u32 getMaterialRendererCount() const = 0; virtual u32 getMaterialRendererCount() const = 0;
//! Get name of a material renderer
/** This string can, e.g., be used to test if a specific
renderer already has been registered/created, or use this
string to store data about materials: This returned name will
be also used when serializing materials.
\param idx Id of the material renderer. Can be a value of the
E_MATERIAL_TYPE enum or a value which was returned by
addMaterialRenderer().
\return String with the name of the renderer, or 0 if not
existing */
virtual const c8 *getMaterialRendererName(u32 idx) const = 0;
//! Sets the name of a material renderer.
/** Will have no effect on built-in material renderers.
\param idx: Id of the material renderer. Can be a value of the
E_MATERIAL_TYPE enum or a value which was returned by
addMaterialRenderer().
\param name: New name of the material renderer. */
virtual void setMaterialRendererName(u32 idx, const c8 *name) = 0;
//! Swap the material renderers used for certain id's //! Swap the material renderers used for certain id's
/** Swap the IMaterialRenderers responsible for rendering specific /** Swap the IMaterialRenderers responsible for rendering specific
material-id's. This means every SMaterial using a MaterialType material-id's. This means every SMaterial using a MaterialType

View File

@@ -196,10 +196,6 @@ public:
or similar. */ or similar. */
virtual bool supportsTouchEvents() const { return false; } virtual bool supportsTouchEvents() const { return false; }
//! Get the current color format of the window
/** \return Color format of the window. */
virtual video::ECOLOR_FORMAT getColorFormat() const = 0;
//! Notifies the device that it should close itself. //! Notifies the device that it should close itself.
/** IrrlichtDevice::run() will always return false after closeDevice() was called. */ /** IrrlichtDevice::run() will always return false after closeDevice() was called. */
virtual void closeDevice() = 0; virtual void closeDevice() = 0;

View File

@@ -26,7 +26,7 @@ struct SMesh final : public IAnimatedMesh
} }
//! clean mesh //! clean mesh
virtual void clear() void clear()
{ {
for (auto *buf : MeshBuffers) for (auto *buf : MeshBuffers)
buf->drop(); buf->drop();

View File

@@ -90,7 +90,7 @@ struct SSkinMeshBuffer final : public IMeshBuffer
} }
//! Get standard vertex at given index //! Get standard vertex at given index
virtual video::S3DVertex *getVertex(u32 index) video::S3DVertex *getVertex(u32 index)
{ {
switch (VertexType) { switch (VertexType) {
case video::EVT_2TCOORDS: case video::EVT_2TCOORDS:

View File

@@ -312,13 +312,6 @@ typedef union
f32 f; f32 f;
} inttofloat; } inttofloat;
#define F32_AS_S32(f) (*((s32 *)&(f)))
#define F32_AS_U32(f) (*((u32 *)&(f)))
#define F32_AS_U32_POINTER(f) (((u32 *)&(f)))
#define F32_VALUE_0 0x00000000
#define F32_VALUE_1 0x3f800000
//! code is taken from IceFPU //! code is taken from IceFPU
//! Integer representation of a floating-point value. //! Integer representation of a floating-point value.
inline u32 IR(f32 x) inline u32 IR(f32 x)
@@ -420,12 +413,6 @@ REALINLINE f64 reciprocal(const f64 f)
return 1.0 / f; return 1.0 / f;
} }
// calculate: 1 / x, low precision allowed
REALINLINE f32 reciprocal_approxim(const f32 f)
{
return 1.f / f;
}
REALINLINE s32 floor32(f32 x) REALINLINE s32 floor32(f32 x)
{ {
return (s32)floorf(x); return (s32)floorf(x);
@@ -442,16 +429,6 @@ REALINLINE s32 round32(f32 x)
return (s32)round_(x); return (s32)round_(x);
} }
inline f32 f32_max3(const f32 a, const f32 b, const f32 c)
{
return a > b ? (a > c ? a : c) : (b > c ? b : c);
}
inline f32 f32_min3(const f32 a, const f32 b, const f32 c)
{
return a < b ? (a < c ? a : c) : (b < c ? b : c);
}
inline f32 fract(f32 x) inline f32 fract(f32 x)
{ {
return x - floorf(x); return x - floorf(x);

View File

@@ -1,32 +0,0 @@
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CFPSCounter.h"
#include "irrMath.h"
namespace video
{
CFPSCounter::CFPSCounter() :
FPS(0), StartTime(0), FramesCounted(0)
{
}
//! to be called every frame
void CFPSCounter::registerFrame(u32 now)
{
++FramesCounted;
const u32 milliseconds = now - StartTime;
if (milliseconds >= 1500) {
const f32 invMilli = core::reciprocal((f32)milliseconds);
FPS = core::ceil32((1000 * FramesCounted) * invMilli);
FramesCounted = 0;
StartTime = now;
}
}
} // end namespace video

View File

@@ -1,29 +0,0 @@
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#pragma once
#include "irrTypes.h"
namespace video
{
class CFPSCounter
{
public:
CFPSCounter();
//! returns current fps
s32 getFPS() const { return FPS; }
//! to be called every frame
void registerFrame(u32 now);
private:
s32 FPS;
u32 StartTime;
u32 FramesCounted;
};
} // end namespace video

View File

@@ -384,7 +384,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters &param) :
sdlver += SDL_GetPlatform(); sdlver += SDL_GetPlatform();
} }
Operator = new COSOperator(sdlver); Operator = new COSOperator();
if (SDLDeviceInstances == 1) { if (SDLDeviceInstances == 1) {
os::Printer::log(sdlver.c_str(), ELL_INFORMATION); os::Printer::log(sdlver.c_str(), ELL_INFORMATION);
} }
@@ -1351,26 +1351,6 @@ bool CIrrDeviceSDL::isWindowMinimized() const
return Window && (SDL_GetWindowFlags(Window) & SDL_WINDOW_MINIMIZED) != 0; return Window && (SDL_GetWindowFlags(Window) & SDL_WINDOW_MINIMIZED) != 0;
} }
//! returns color format of the window.
video::ECOLOR_FORMAT CIrrDeviceSDL::getColorFormat() const
{
if (Window) {
SDL_Surface *surface = SDL_GetWindowSurface(Window);
if (surface->format->BitsPerPixel == 16) {
if (surface->format->Amask != 0)
return video::ECF_A1R5G5B5;
else
return video::ECF_R5G6B5;
} else {
if (surface->format->Amask != 0)
return video::ECF_A8R8G8B8;
else
return video::ECF_R8G8B8;
}
} else
return CIrrDeviceStub::getColorFormat();
}
void CIrrDeviceSDL::createKeyMap() void CIrrDeviceSDL::createKeyMap()
{ {
// I don't know if this is the best method to create // I don't know if this is the best method to create

View File

@@ -54,9 +54,6 @@ public:
//! returns if window is minimized. //! returns if window is minimized.
bool isWindowMinimized() const override; bool isWindowMinimized() const override;
//! returns color format of the window.
video::ECOLOR_FORMAT getColorFormat() const override;
//! notifies the device that it should close itself //! notifies the device that it should close itself
void closeDevice() override; void closeDevice() override;

View File

@@ -261,12 +261,6 @@ bool CIrrDeviceStub::isFullscreen() const
return CreationParams.Fullscreen; return CreationParams.Fullscreen;
} }
//! returns color format
video::ECOLOR_FORMAT CIrrDeviceStub::getColorFormat() const
{
return video::ECF_R5G6B5;
}
//! No-op in this implementation //! No-op in this implementation
bool CIrrDeviceStub::activateJoysticks(core::array<SJoystickInfo> &joystickInfo) bool CIrrDeviceStub::activateJoysticks(core::array<SJoystickInfo> &joystickInfo)
{ {

View File

@@ -101,9 +101,6 @@ public:
//! Checks if the window is running in fullscreen mode. //! Checks if the window is running in fullscreen mode.
bool isFullscreen() const override; bool isFullscreen() const override;
//! get color format of the current window
video::ECOLOR_FORMAT getColorFormat() const override;
//! Activate any joysticks, and generate events for them. //! Activate any joysticks, and generate events for them.
bool activateJoysticks(core::array<SJoystickInfo> &joystickInfo) override; bool activateJoysticks(core::array<SJoystickInfo> &joystickInfo) override;

View File

@@ -341,8 +341,6 @@ set(IRRIMAGEOBJ
) )
add_library(IRRVIDEOOBJ OBJECT add_library(IRRVIDEOOBJ OBJECT
CFPSCounter.h
CFPSCounter.cpp
${IRRDRVROBJ} ${IRRDRVROBJ}
${IRRIMAGEOBJ} ${IRRIMAGEOBJ}
) )

View File

@@ -208,7 +208,6 @@ bool CNullDriver::beginScene(u16 clearFlag, SColor clearColor, f32 clearDepth, u
bool CNullDriver::endScene() bool CNullDriver::endScene()
{ {
FPSCounter.registerFrame(os::Timer::getRealTime());
expireHardwareBuffers(); expireHardwareBuffers();
updateAllOcclusionQueries(); updateAllOcclusionQueries();
return true; 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 //! returns screen size
const core::dimension2d<u32> &CNullDriver::getScreenSize() const const core::dimension2d<u32> &CNullDriver::getScreenSize() const
{ {
@@ -706,12 +699,6 @@ const core::dimension2d<u32> &CNullDriver::getCurrentRenderTargetSize() const
return CurrentRenderTargetSize; return CurrentRenderTargetSize;
} }
// returns current frames per second value
s32 CNullDriver::getFPS() const
{
return FPSCounter.getFPS();
}
SFrameStats CNullDriver::getFrameStats() const SFrameStats CNullDriver::getFrameStats() const
{ {
return FrameStats; return FrameStats;
@@ -725,118 +712,6 @@ const char *CNullDriver::getName() const
return "Irrlicht NullDevice"; 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 CNullDriver::getLimits() const
{ {
SDriverLimits ret; SDriverLimits ret;
@@ -1427,15 +1302,6 @@ s32 CNullDriver::addMaterialRenderer(IMaterialRenderer *renderer, const char *na
return MaterialRenderers.size() - 1; 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) void CNullDriver::swapMaterialRenderers(u32 idx1, u32 idx2, bool swapNames)
{ {
if (idx1 < MaterialRenderers.size() && idx2 < MaterialRenderers.size()) { if (idx1 < MaterialRenderers.size() && idx2 < MaterialRenderers.size()) {
@@ -1483,15 +1349,6 @@ u32 CNullDriver::getMaterialRendererCount() const
return MaterialRenderers.size(); 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. //! Returns pointer to the IGPUProgrammingServices interface.
IGPUProgrammingServices *CNullDriver::getGPUProgrammingServices() IGPUProgrammingServices *CNullDriver::getGPUProgrammingServices()
{ {

View File

@@ -12,7 +12,6 @@
#include "IMesh.h" #include "IMesh.h"
#include "IMeshBuffer.h" #include "IMeshBuffer.h"
#include "IMeshSceneNode.h" #include "IMeshSceneNode.h"
#include "CFPSCounter.h"
#include "S3DVertex.h" #include "S3DVertex.h"
#include "SVertexIndex.h" #include "SVertexIndex.h"
#include "SExposedVideoData.h" #include "SExposedVideoData.h"
@@ -175,9 +174,6 @@ public:
f32 &start, f32 &end, f32 &density, f32 &start, f32 &end, f32 &density,
bool &pixelFog, bool &rangeFog) override; bool &pixelFog, bool &rangeFog) override;
//! get color format of the current color buffer
ECOLOR_FORMAT getColorFormat() const override;
//! get screen size //! get screen size
const core::dimension2d<u32> &getScreenSize() const override; const core::dimension2d<u32> &getScreenSize() const override;
@@ -187,9 +183,6 @@ public:
//! get render target size //! get render target size
const core::dimension2d<u32> &getCurrentRenderTargetSize() const override; const core::dimension2d<u32> &getCurrentRenderTargetSize() const override;
// get current frames per second value
s32 getFPS() const override;
SFrameStats getFrameStats() const override; SFrameStats getFrameStats() const override;
//! \return Returns the name of the video driver. Example: In case of the DIRECT3D8 //! \return Returns the name of the video driver. Example: In case of the DIRECT3D8
@@ -222,13 +215,6 @@ public:
ITexture *addRenderTargetTextureCubemap(const u32 sideLen, ITexture *addRenderTargetTextureCubemap(const u32 sideLen,
const io::path &name, const ECOLOR_FORMAT format) override; const io::path &name, const ECOLOR_FORMAT format) override;
//! Creates an 1bit alpha channel of the texture based of an color key.
void makeColorKeyTexture(video::ITexture *texture, video::SColor color) const override;
//! Creates an 1bit alpha channel of the texture based of an color key position.
virtual void makeColorKeyTexture(video::ITexture *texture,
core::position2d<s32> colorKeyPixelPos) const override;
SDriverLimits getLimits() const override; SDriverLimits getLimits() const override;
//! Enables or disables a texture creation flag. //! Enables or disables a texture creation flag.
@@ -436,8 +422,6 @@ public:
//! Returns amount of currently available material renderers. //! Returns amount of currently available material renderers.
u32 getMaterialRendererCount() const override; u32 getMaterialRendererCount() const override;
//! Returns name of the material renderer
const char *getMaterialRendererName(u32 idx) const override;
//! Adds a new material renderer to the VideoDriver, based on a high level shading language. //! Adds a new material renderer to the VideoDriver, based on a high level shading language.
virtual s32 addHighLevelShaderMaterial( virtual s32 addHighLevelShaderMaterial(
@@ -492,9 +476,6 @@ public:
//! Writes the provided image to a file. //! Writes the provided image to a file.
bool writeImageToFile(IImage *image, io::IWriteFile *file, u32 param = 0) override; bool writeImageToFile(IImage *image, io::IWriteFile *file, u32 param = 0) override;
//! Sets the name of a material renderer.
void setMaterialRendererName(u32 idx, const char *name) override;
//! Swap the material renderers used for certain id's //! Swap the material renderers used for certain id's
void swapMaterialRenderers(u32 idx1, u32 idx2, bool swapNames) override; void swapMaterialRenderers(u32 idx1, u32 idx2, bool swapNames) override;
@@ -692,7 +673,6 @@ protected:
core::dimension2d<u32> ScreenSize; core::dimension2d<u32> ScreenSize;
core::matrix4 TransformationMatrix; core::matrix4 TransformationMatrix;
CFPSCounter FPSCounter;
SFrameStats FrameStats; SFrameStats FrameStats;
u32 MinVertexCountForVBO; u32 MinVertexCountForVBO;

View File

@@ -25,8 +25,7 @@
#include "fast_atof.h" #include "fast_atof.h"
// constructor // constructor
COSOperator::COSOperator(const core::stringc &osVersion) : COSOperator::COSOperator()
OperatingSystem(osVersion)
{} {}
COSOperator::~COSOperator() COSOperator::~COSOperator()
@@ -37,12 +36,6 @@ COSOperator::~COSOperator()
#endif #endif
} }
//! returns the current operating system version as string.
const core::stringc &COSOperator::getOperatingSystemVersion() const
{
return OperatingSystem;
}
//! copies text to the clipboard //! copies text to the clipboard
void COSOperator::copyToClipboard(const c8 *text) const void COSOperator::copyToClipboard(const c8 *text) const
{ {
@@ -97,52 +90,3 @@ const c8 *COSOperator::getTextFromPrimarySelection() const
#endif #endif
} }
bool COSOperator::getSystemMemory(u32 *Total, u32 *Avail) const
{
#if defined(_IRR_WINDOWS_API_)
MEMORYSTATUSEX MemoryStatusEx;
MemoryStatusEx.dwLength = sizeof(MEMORYSTATUSEX);
// cannot fail
GlobalMemoryStatusEx(&MemoryStatusEx);
if (Total)
*Total = (u32)(MemoryStatusEx.ullTotalPhys >> 10);
if (Avail)
*Avail = (u32)(MemoryStatusEx.ullAvailPhys >> 10);
return true;
#elif defined(_IRR_POSIX_API_) && defined(_SC_PHYS_PAGES) && defined(_SC_AVPHYS_PAGES)
long ps = sysconf(_SC_PAGESIZE);
long pp = sysconf(_SC_PHYS_PAGES);
long ap = sysconf(_SC_AVPHYS_PAGES);
if (ps == -1 || (Total && pp == -1) || (Avail && ap == -1))
return false;
if (Total)
*Total = (u32)((pp >> 10) * ps);
if (Avail)
*Avail = (u32)((ap >> 10) * ps);
return true;
#elif defined(_IRR_OSX_PLATFORM_)
int mib[2];
int64_t physical_memory;
size_t length;
// Get the Physical memory size
mib[0] = CTL_HW;
mib[1] = HW_MEMSIZE;
length = sizeof(int64_t);
sysctl(mib, 2, &physical_memory, &length, NULL, 0);
if (Total)
*Total = (u32)(physical_memory >> 10);
if (Avail)
*Avail = (u32)(physical_memory >> 10); // we don't know better
return true;
#else
return false;
#endif
}

View File

@@ -11,16 +11,13 @@ class COSOperator : public IOSOperator
{ {
public: public:
// constructor // constructor
COSOperator(const core::stringc &osversion); COSOperator();
~COSOperator(); ~COSOperator();
COSOperator(const COSOperator &) = delete; COSOperator(const COSOperator &) = delete;
COSOperator &operator=(const COSOperator &) = delete; COSOperator &operator=(const COSOperator &) = delete;
//! Get the current OS version as string.
const core::stringc &getOperatingSystemVersion() const override;
//! Copies text to the clipboard //! Copies text to the clipboard
//! \param text: text in utf-8 //! \param text: text in utf-8
void copyToClipboard(const c8 *text) const override; void copyToClipboard(const c8 *text) const override;
@@ -39,15 +36,7 @@ public:
//! \return Returns 0 if no string is in there, otherwise an utf-8 string. //! \return Returns 0 if no string is in there, otherwise an utf-8 string.
const c8 *getTextFromPrimarySelection() const override; const c8 *getTextFromPrimarySelection() const override;
//! Get the total and available system RAM
/** \param totalBytes: will contain the total system memory in Kilobytes (1024 B)
\param availableBytes: will contain the available memory in Kilobytes (1024 B)
\return True if successful, false if not */
bool getSystemMemory(u32 *Total, u32 *Avail) const override;
private: private:
core::stringc OperatingSystem;
#ifdef _IRR_WINDOWS_API_ #ifdef _IRR_WINDOWS_API_
mutable core::stringc ClipboardBuf; mutable core::stringc ClipboardBuf;
#endif #endif

View File

@@ -151,7 +151,7 @@ public:
OriginalColorFormat = format; OriginalColorFormat = format;
if (ECF_UNKNOWN == OriginalColorFormat) if (ECF_UNKNOWN == OriginalColorFormat)
ColorFormat = getBestColorFormat(Driver->getColorFormat()); ColorFormat = getBestColorFormat(video::ECF_A8R8G8B8);
else else
ColorFormat = OriginalColorFormat; ColorFormat = OriginalColorFormat;

View File

@@ -28,7 +28,7 @@ const u16 COpenGLDriver::Quad2DIndices[4] = {0, 1, 2, 3};
COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters &params, io::IFileSystem *io, IContextManager *contextManager) : COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters &params, io::IFileSystem *io, IContextManager *contextManager) :
CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(), CacheHandler(0), CurrentRenderMode(ERM_NONE), ResetRenderStates(true), CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(), CacheHandler(0), CurrentRenderMode(ERM_NONE), ResetRenderStates(true),
Transformation3DChanged(true), AntiAlias(params.AntiAlias), ColorFormat(ECF_R8G8B8), FixedPipelineState(EOFPS_ENABLE), Params(params), Transformation3DChanged(true), AntiAlias(params.AntiAlias), FixedPipelineState(EOFPS_ENABLE), Params(params),
ContextManager(contextManager) ContextManager(contextManager)
{} {}
@@ -2505,12 +2505,6 @@ E_DRIVER_TYPE COpenGLDriver::getDriverType() const
return EDT_OPENGL; return EDT_OPENGL;
} }
//! returns color format
ECOLOR_FORMAT COpenGLDriver::getColorFormat() const
{
return ColorFormat;
}
//! Get a vertex shader constant index. //! Get a vertex shader constant index.
s32 COpenGLDriver::getVertexShaderConstantID(const c8 *name) s32 COpenGLDriver::getVertexShaderConstantID(const c8 *name)
{ {
@@ -2776,7 +2770,7 @@ IImage *COpenGLDriver::createScreenShot(video::ECOLOR_FORMAT format, video::E_RE
return 0; return 0;
if (format == video::ECF_UNKNOWN) if (format == video::ECF_UNKNOWN)
format = getColorFormat(); format = video::ECF_R8G8B8;
// TODO: Maybe we could support more formats (floating point and some of those beyond ECF_R8), didn't really try yet // TODO: Maybe we could support more formats (floating point and some of those beyond ECF_R8), didn't really try yet
if (IImage::isCompressedFormat(format) || IImage::isDepthFormat(format) || IImage::isFloatingPointFormat(format) || format >= ECF_R8) if (IImage::isCompressedFormat(format) || IImage::isDepthFormat(format) || IImage::isFloatingPointFormat(format) || format >= ECF_R8)

View File

@@ -183,9 +183,6 @@ public:
//! Returns type of video driver //! Returns type of video driver
E_DRIVER_TYPE getDriverType() const override; E_DRIVER_TYPE getDriverType() const override;
//! get color format of the current color buffer
ECOLOR_FORMAT getColorFormat() const override;
//! Returns the transformation set by setTransform //! Returns the transformation set by setTransform
const core::matrix4 &getTransform(E_TRANSFORMATION_STATE state) const override; const core::matrix4 &getTransform(E_TRANSFORMATION_STATE state) const override;
@@ -368,9 +365,6 @@ private:
core::matrix4 TextureFlipMatrix; core::matrix4 TextureFlipMatrix;
//! Color buffer format
ECOLOR_FORMAT ColorFormat;
E_OPENGL_FIXED_PIPELINE_STATE FixedPipelineState; E_OPENGL_FIXED_PIPELINE_STATE FixedPipelineState;
SIrrlichtCreationParameters Params; SIrrlichtCreationParameters Params;

View File

@@ -152,7 +152,7 @@ COpenGL3DriverBase::COpenGL3DriverBase(const SIrrlichtCreationParameters &params
MaterialRenderer2DActive(0), MaterialRenderer2DTexture(0), MaterialRenderer2DNoTexture(0), MaterialRenderer2DActive(0), MaterialRenderer2DTexture(0), MaterialRenderer2DNoTexture(0),
CurrentRenderMode(ERM_NONE), Transformation3DChanged(true), CurrentRenderMode(ERM_NONE), Transformation3DChanged(true),
OGLES2ShaderPath(params.OGLES2ShaderPath), OGLES2ShaderPath(params.OGLES2ShaderPath),
ColorFormat(ECF_R8G8B8), ContextManager(contextManager), EnableErrorTest(params.DriverDebug) ContextManager(contextManager), EnableErrorTest(params.DriverDebug)
{ {
if (!ContextManager) if (!ContextManager)
return; return;
@@ -1560,12 +1560,6 @@ E_DRIVER_TYPE COpenGL3DriverBase::getDriverType() const
return EDT_OPENGL3; return EDT_OPENGL3;
} }
//! returns color format
ECOLOR_FORMAT COpenGL3DriverBase::getColorFormat() const
{
return ColorFormat;
}
//! Get a vertex shader constant index. //! Get a vertex shader constant index.
s32 COpenGL3DriverBase::getVertexShaderConstantID(const c8 *name) s32 COpenGL3DriverBase::getVertexShaderConstantID(const c8 *name)
{ {

View File

@@ -144,9 +144,6 @@ public:
//! Returns type of video driver //! Returns type of video driver
E_DRIVER_TYPE getDriverType() const override; E_DRIVER_TYPE getDriverType() const override;
//! get color format of the current color buffer
ECOLOR_FORMAT getColorFormat() const override;
//! Returns the transformation set by setTransform //! Returns the transformation set by setTransform
const core::matrix4 &getTransform(E_TRANSFORMATION_STATE state) const override; const core::matrix4 &getTransform(E_TRANSFORMATION_STATE state) const override;
@@ -351,9 +348,6 @@ private:
SMaterial Material, LastMaterial; SMaterial Material, LastMaterial;
//! Color buffer format
ECOLOR_FORMAT ColorFormat;
IContextManager *ContextManager; IContextManager *ContextManager;
void printTextureFormats(); void printTextureFormats();