1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Purge some dead code (mostly Irrlicht) (#16111)

* Remove obsolete Irrlicht attributes system

* Remove dead GUI element types

* Remove some obsolete Irrlicht headers

* Fix some oopsies from d96f5e1
This commit is contained in:
Lars Müller 2025-05-04 16:31:44 +02:00 committed by GitHub
parent 377fa5bb14
commit f4285a59ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 24 additions and 831 deletions

View file

@ -21,6 +21,4 @@ Copyright (C) 2002-2012 Nikolaus Gebhardt
the Irrlicht Engine in your product, you must acknowledge somewhere in your the Irrlicht Engine in your product, you must acknowledge somewhere in your
documentation that you've used the IJPG code. It would also be nice to mention documentation that you've used the IJPG code. It would also be nice to mention
that you use the Irrlicht Engine, the zlib, libPng and aesGladman. See the that you use the Irrlicht Engine, the zlib, libPng and aesGladman. See the
corresponding license files for further informations. It is also possible to disable corresponding license files for further informations.
usage of those additional libraries by defines in the IrrCompileConfig.h header and
recompiling the engine.

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
#pragma once
namespace irr
{
namespace io
{
//! Types of attributes available for IAttributes
enum E_ATTRIBUTE_TYPE
{
// integer attribute
EAT_INT = 0,
// float attribute
EAT_FLOAT,
// boolean attribute
EAT_BOOL,
// known attribute type count
EAT_COUNT,
// unknown attribute
EAT_UNKNOWN
};
} // end namespace io
} // end namespace irr

View file

@ -24,9 +24,6 @@ enum EGUI_ELEMENT_TYPE
//! A combo box (IGUIComboBox) //! A combo box (IGUIComboBox)
EGUIET_COMBO_BOX, EGUIET_COMBO_BOX,
//! A context menu (IGUIContextMenu)
EGUIET_CONTEXT_MENU,
//! A menu (IGUIMenu) //! A menu (IGUIMenu)
EGUIET_MENU, EGUIET_MENU,
@ -36,54 +33,30 @@ enum EGUI_ELEMENT_TYPE
//! A file open dialog (IGUIFileOpenDialog) //! A file open dialog (IGUIFileOpenDialog)
EGUIET_FILE_OPEN_DIALOG, EGUIET_FILE_OPEN_DIALOG,
//! A color select open dialog (IGUIColorSelectDialog)
EGUIET_COLOR_SELECT_DIALOG,
//! A in/out fader (IGUIInOutFader)
EGUIET_IN_OUT_FADER,
//! An image (IGUIImage) //! An image (IGUIImage)
EGUIET_IMAGE, EGUIET_IMAGE,
//! A list box (IGUIListBox) //! A list box (IGUIListBox)
EGUIET_LIST_BOX, EGUIET_LIST_BOX,
//! A mesh viewer (IGUIMeshViewer)
EGUIET_MESH_VIEWER,
//! A message box (IGUIWindow)
EGUIET_MESSAGE_BOX,
//! A modal screen
EGUIET_MODAL_SCREEN,
//! A scroll bar (IGUIScrollBar) //! A scroll bar (IGUIScrollBar)
EGUIET_SCROLL_BAR, EGUIET_SCROLL_BAR,
//! A spin box (IGUISpinBox)
EGUIET_SPIN_BOX,
//! A static text (IGUIStaticText) //! A static text (IGUIStaticText)
EGUIET_STATIC_TEXT, EGUIET_STATIC_TEXT,
//! A table (GUITable)
EGUIET_TABLE,
//! A tab (IGUITab) //! A tab (IGUITab)
EGUIET_TAB, EGUIET_TAB,
//! A tab control //! A tab control
EGUIET_TAB_CONTROL, EGUIET_TAB_CONTROL,
//! A Table
EGUIET_TABLE,
//! A tool bar (IGUIToolBar) //! A tool bar (IGUIToolBar)
EGUIET_TOOL_BAR, EGUIET_TOOL_BAR,
//! A Tree View
EGUIET_TREE_VIEW,
//! A window
EGUIET_WINDOW,
//! Unknown type. //! Unknown type.
EGUIET_ELEMENT, EGUIET_ELEMENT,
@ -98,36 +71,5 @@ enum EGUI_ELEMENT_TYPE
}; };
//! Names for built-in element types
const c8 *const GUIElementTypeNames[] = {
"button",
"checkBox",
"comboBox",
"contextMenu",
"menu",
"editBox",
"fileOpenDialog",
"colorSelectDialog",
"inOutFader",
"image",
"listBox",
"meshViewer",
"messageBox",
"modalScreen",
"scrollBar",
"spinBox",
"staticText",
"tab",
"tabControl",
"table",
"toolBar",
"treeview",
"window",
"element",
"root",
"profiler",
0,
};
} // end namespace gui } // end namespace gui
} // end namespace irr } // end namespace irr

View file

@ -1,87 +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 "IReferenceCounted.h"
#include "EAttributes.h"
namespace irr
{
namespace video
{
class ITexture;
} // end namespace video
namespace io
{
//! Provides a generic interface for attributes and their values and the possibility to serialize them
class IAttributes : public virtual IReferenceCounted
{
public:
//! Returns the type of an attribute
//! \param attributeName: Name for the attribute
virtual E_ATTRIBUTE_TYPE getAttributeType(const c8 *attributeName) const = 0;
//! Returns if an attribute with a name exists
virtual bool existsAttribute(const c8 *attributeName) const = 0;
//! Removes all attributes
virtual void clear() = 0;
/*
Integer Attribute
*/
//! Adds an attribute as integer
virtual void addInt(const c8 *attributeName, s32 value) = 0;
//! Sets an attribute as integer value
virtual void setAttribute(const c8 *attributeName, s32 value) = 0;
//! Gets an attribute as integer value
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual s32 getAttributeAsInt(const c8 *attributeName, irr::s32 defaultNotFound = 0) const = 0;
/*
Float Attribute
*/
//! Adds an attribute as float
virtual void addFloat(const c8 *attributeName, f32 value) = 0;
//! Sets a attribute as float value
virtual void setAttribute(const c8 *attributeName, f32 value) = 0;
//! Gets an attribute as float value
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual f32 getAttributeAsFloat(const c8 *attributeName, irr::f32 defaultNotFound = 0.f) const = 0;
/*
Bool Attribute
*/
//! Adds an attribute as bool
virtual void addBool(const c8 *attributeName, bool value) = 0;
//! Sets an attribute as boolean value
virtual void setAttribute(const c8 *attributeName, bool value) = 0;
//! Gets an attribute as boolean value
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
virtual bool getAttributeAsBool(const c8 *attributeName, bool defaultNotFound = false) const = 0;
};
} // end namespace io
} // end namespace irr

View file

@ -19,7 +19,6 @@ namespace io
class IReadFile; class IReadFile;
class IWriteFile; class IWriteFile;
class IFileList; class IFileList;
class IAttributes;
//! The FileSystem manages files and archives and provides access to them. //! The FileSystem manages files and archives and provides access to them.
/** It manages where files are, so that modules which use the the IO do not /** It manages where files are, so that modules which use the the IO do not

View file

@ -662,13 +662,6 @@ public:
return type == Type; return type == Type;
} }
//! Returns the type name of the gui element.
/** This is needed serializing elements. */
virtual const c8 *getTypeName() const
{
return GUIElementTypeNames[Type];
}
//! Returns the name of the element. //! Returns the name of the element.
/** \return Name as character string. */ /** \return Name as character string. */
virtual const c8 *getName() const virtual const c8 *getName() const

View file

@ -10,7 +10,6 @@
#include "dimension2d.h" #include "dimension2d.h"
#include "SColor.h" #include "SColor.h"
#include "ESceneNodeTypes.h" #include "ESceneNodeTypes.h"
#include "SceneParameters.h" // IWYU pragma: export
namespace irr namespace irr
{ {
@ -20,7 +19,6 @@ struct SEvent;
namespace io namespace io
{ {
class IReadFile; class IReadFile;
class IAttributes;
class IWriteFile; class IWriteFile;
class IFileSystem; class IFileSystem;
} // end namespace io } // end namespace io
@ -373,11 +371,6 @@ public:
/** All scene nodes are removed. */ /** All scene nodes are removed. */
virtual void clear() = 0; virtual void clear() = 0;
//! Get interface to the parameters set in this scene.
/** String parameters can be used by plugins and mesh loaders.
See COLLADA_CREATE_SCENE_INSTANCES and DMF_USE_MATERIALS_DIRS */
virtual io::IAttributes *getParameters() = 0;
//! Get current render pass. //! Get current render pass.
/** All scene nodes are being rendered in a specific order. /** All scene nodes are being rendered in a specific order.
First lights, cameras, sky boxes, solid geometry, and then transparent First lights, cameras, sky boxes, solid geometry, and then transparent

View file

@ -25,7 +25,6 @@ namespace irr
{ {
namespace io namespace io
{ {
class IAttributes;
class IReadFile; class IReadFile;
class IWriteFile; class IWriteFile;
} // end namespace io } // end namespace io
@ -127,23 +126,6 @@ public:
\param flag When true the feature is disabled, otherwise it is enabled. */ \param flag When true the feature is disabled, otherwise it is enabled. */
virtual void disableFeature(E_VIDEO_DRIVER_FEATURE feature, bool flag = true) = 0; virtual void disableFeature(E_VIDEO_DRIVER_FEATURE feature, bool flag = true) = 0;
//! Get attributes of the actual video driver
/** The following names can be queried for the given types:
MaxTextures (int) The maximum number of simultaneous textures supported by the driver. This can be less than the supported number of textures of the driver. Use _IRR_MATERIAL_MAX_TEXTURES_ to adapt the number.
MaxSupportedTextures (int) The maximum number of simultaneous textures supported by the fixed function pipeline of the (hw) driver. The actual supported number of textures supported by the engine can be lower.
MaxAnisotropy (int) Number of anisotropy levels supported for filtering. At least 1, max is typically at 16 or 32.
MaxAuxBuffers (int) Special render buffers, which are currently not really usable inside Irrlicht. Only supported by OpenGL
MaxMultipleRenderTargets (int) Number of render targets which can be bound simultaneously. Rendering to MRTs is done via shaders.
MaxIndices (int) Number of indices which can be used in one render call (i.e. one mesh buffer).
MaxTextureSize (int) Dimension that a texture may have, both in width and height.
MaxGeometryVerticesOut (int) Number of vertices the geometry shader can output in one pass. Only OpenGL so far.
MaxTextureLODBias (float) Maximum value for LOD bias. Is usually at around 16, but can be lower on some systems.
Version (int) Version of the driver. Should be Major*100+Minor
ShaderLanguageVersion (int) Version of the high level shader language. Should be Major*100+Minor.
AntiAlias (int) Number of Samples the driver uses for each pixel. 0 and 1 means anti aliasing is off, typical values are 2,4,8,16,32
*/
virtual const io::IAttributes &getDriverAttributes() const = 0;
//! Sets transformation matrices. //! Sets transformation matrices.
/** \param state Transformation type to be set, e.g. view, /** \param state Transformation type to be set, e.g. view,
world, or projection. world, or projection.
@ -1132,7 +1114,6 @@ public:
//! Only used by the engine internally. //! Only used by the engine internally.
/** Passes the global material flag AllowZWriteOnTransparent. /** Passes the global material flag AllowZWriteOnTransparent.
Use the SceneManager attribute to set this value from your app.
\param flag Default behavior is to disable ZWrite, i.e. false. */ \param flag Default behavior is to disable ZWrite, i.e. false. */
virtual void setAllowZWriteOnTransparent(bool flag) = 0; virtual void setAllowZWriteOnTransparent(bool flag) = 0;

View file

@ -1,11 +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
// these are obsolete and never pre-defined
#define IRRCALLCONV
#define IRRLICHT_API

View file

@ -13,7 +13,6 @@
#include "ITimer.h" #include "ITimer.h"
#include "IOSOperator.h" #include "IOSOperator.h"
#include "irrArray.h" #include "irrArray.h"
#include "IrrCompileConfig.h"
#include "position2d.h" #include "position2d.h"
#include "SColor.h" // video::ECOLOR_FORMAT #include "SColor.h" // video::ECOLOR_FORMAT
#include <string> #include <string>
@ -45,7 +44,7 @@ class IContextManager;
class IImage; class IImage;
class ITexture; class ITexture;
class IVideoDriver; class IVideoDriver;
extern "C" IRRLICHT_API bool IRRCALLCONV isDriverSupported(E_DRIVER_TYPE driver); extern "C" bool isDriverSupported(E_DRIVER_TYPE driver);
} // end namespace video } // end namespace video
//! The Irrlicht device. You can create it with createDevice() or createDeviceEx(). //! The Irrlicht device. You can create it with createDevice() or createDeviceEx().

View file

@ -10,7 +10,6 @@
#include "EMaterialTypes.h" // IWYU pragma: export #include "EMaterialTypes.h" // IWYU pragma: export
#include "EMaterialProps.h" // IWYU pragma: export #include "EMaterialProps.h" // IWYU pragma: export
#include "SMaterialLayer.h" #include "SMaterialLayer.h"
#include "IrrCompileConfig.h" // for IRRLICHT_API
namespace irr namespace irr
{ {
@ -472,7 +471,7 @@ public:
}; };
//! global const identity Material //! global const identity Material
IRRLICHT_API extern const SMaterial IdentityMaterial; extern const SMaterial IdentityMaterial;
} // end namespace video } // end namespace video
} // end namespace irr } // end namespace irr

View file

@ -1,50 +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"
/*! \file SceneParameters.h
\brief Header file containing all scene parameters for modifying mesh loading etc.
This file includes all parameter names which can be set using ISceneManager::getParameters()
to modify the behavior of plugins and mesh loaders.
*/
namespace irr
{
namespace scene
{
//! Name of the parameter for changing how Irrlicht handles the ZWrite flag for transparent (blending) materials
/** The default behavior in Irrlicht is to disable writing to the
z-buffer for all really transparent, i.e. blending materials. This
avoids problems with intersecting faces, but can also break renderings.
If transparent materials should use the SMaterial flag for ZWriteEnable
just as other material types use this attribute.
Use it like this:
\code
SceneManager->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true);
\endcode
**/
const c8 *const ALLOW_ZWRITE_ON_TRANSPARENT = "Allow_ZWrite_On_Transparent";
//! Flag to avoid loading group structures in .obj files
/** Use it like this:
\code
SceneManager->getParameters()->setAttribute(scene::OBJ_LOADER_IGNORE_GROUPS, true);
\endcode
**/
const c8 *const OBJ_LOADER_IGNORE_GROUPS = "OBJ_IgnoreGroups";
//! Flag to avoid loading material .mtl file for .obj files
/** Use it like this:
\code
SceneManager->getParameters()->setAttribute(scene::OBJ_LOADER_IGNORE_MATERIAL_FILES, true);
\endcode
**/
const c8 *const OBJ_LOADER_IGNORE_MATERIAL_FILES = "OBJ_IgnoreMaterialFiles";
} // end namespace scene
} // end namespace irr

View file

@ -1,21 +0,0 @@
// Copyright (C) 2015 Patryk Nadrowski
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#pragma once
#include "path.h"
namespace irr
{
static io::path getExampleMediaPath()
{
#ifdef IRR_MOBILE_PATHS
return io::path("media/");
#else
return io::path("../../media/");
#endif
}
} // end namespace irr

View file

@ -34,7 +34,6 @@
#include "IEventReceiver.h" #include "IEventReceiver.h"
#include "irrTypes.h" #include "irrTypes.h"
#include "SIrrCreationParameters.h" #include "SIrrCreationParameters.h"
#include "IrrCompileConfig.h" // for IRRLICHT_API and IRRCALLCONV
//! Everything in the Irrlicht Engine can be found in this namespace. //! Everything in the Irrlicht Engine can be found in this namespace.
namespace irr namespace irr
@ -56,7 +55,7 @@ for the vertical retrace period, otherwise not.
\return Returns pointer to the created IrrlichtDevice or null if the \return Returns pointer to the created IrrlichtDevice or null if the
device could not be created. device could not be created.
*/ */
extern "C" IRRLICHT_API IrrlichtDevice *IRRCALLCONV createDevice( extern "C" IrrlichtDevice *createDevice(
video::E_DRIVER_TYPE driverType = video::EDT_OPENGL, video::E_DRIVER_TYPE driverType = video::EDT_OPENGL,
// parentheses are necessary for some compilers // parentheses are necessary for some compilers
const core::dimension2d<u32> &windowSize = (core::dimension2d<u32>(640, 480)), const core::dimension2d<u32> &windowSize = (core::dimension2d<u32>(640, 480)),
@ -74,7 +73,7 @@ handle in which the device should be created.
See irr::SIrrlichtCreationParameters for details. See irr::SIrrlichtCreationParameters for details.
\return Returns pointer to the created IrrlichtDevice or null if the \return Returns pointer to the created IrrlichtDevice or null if the
device could not be created. */ device could not be created. */
extern "C" IRRLICHT_API IrrlichtDevice *IRRCALLCONV createDeviceEx( extern "C" IrrlichtDevice *createDeviceEx(
const SIrrlichtCreationParameters &parameters); const SIrrlichtCreationParameters &parameters);
// THE FOLLOWING IS AN EMPTY LIST OF ALL SUB NAMESPACES // THE FOLLOWING IS AN EMPTY LIST OF ALL SUB NAMESPACES

View file

@ -11,7 +11,6 @@
#include "plane3d.h" #include "plane3d.h"
#include "aabbox3d.h" #include "aabbox3d.h"
#include "rect.h" #include "rect.h"
#include "IrrCompileConfig.h" // for IRRLICHT_API
#include <cassert> #include <cassert>
namespace irr namespace irr
@ -1899,7 +1898,7 @@ inline CMatrix4<T> operator*(const T scalar, const CMatrix4<T> &mat)
typedef CMatrix4<f32> matrix4; typedef CMatrix4<f32> matrix4;
//! global const identity matrix //! global const identity matrix
IRRLICHT_API extern const matrix4 IdentityMatrix; extern const matrix4 IdentityMatrix;
} // end namespace core } // end namespace core
} // end namespace irr } // end namespace irr

View file

@ -5,7 +5,6 @@
#include <string> #include <string>
#include <unordered_set> #include <unordered_set>
#include "IrrCompileConfig.h" // for IRRLICHT_API
#include "IContextManager.h" #include "IContextManager.h"
#include <KHR/khrplatform.h> #include <KHR/khrplatform.h>
@ -3199,4 +3198,4 @@ public:
}; };
// Global GL procedures object. // Global GL procedures object.
IRRLICHT_API extern OpenGLProcedures GL; extern OpenGLProcedures GL;

View file

@ -349,7 +349,6 @@ f:write[[
#include <string> #include <string>
#include <unordered_set> #include <unordered_set>
#include "IrrCompileConfig.h" // for IRRLICHT_API
#include "IContextManager.h" #include "IContextManager.h"
#include <KHR/khrplatform.h> #include <KHR/khrplatform.h>
@ -415,7 +414,7 @@ f:write[[
]]; ]];
f:write( "};\n" ); f:write( "};\n" );
f:write( "\n// Global GL procedures object.\n" ); f:write( "\n// Global GL procedures object.\n" );
f:write( "IRRLICHT_API extern OpenGLProcedures GL;\n" ); f:write( "extern OpenGLProcedures GL;\n" );
f:close(); f:close();
-- Write loader implementation -- Write loader implementation

View file

@ -1,141 +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 "CAttributes.h"
namespace irr
{
namespace io
{
/*
Basic types, check documentation in IAttribute.h to see how they generally work.
*/
// Attribute implemented for boolean values
class CBoolAttribute : public IAttribute
{
public:
CBoolAttribute(const char *name, bool value)
{
Name = name;
setBool(value);
}
s32 getInt() const override
{
return BoolValue ? 1 : 0;
}
f32 getFloat() const override
{
return BoolValue ? 1.0f : 0.0f;
}
bool getBool() const override
{
return BoolValue;
}
void setInt(s32 intValue) override
{
BoolValue = (intValue != 0);
}
void setFloat(f32 floatValue) override
{
BoolValue = (floatValue != 0);
}
void setBool(bool boolValue) override
{
BoolValue = boolValue;
}
E_ATTRIBUTE_TYPE getType() const override
{
return EAT_BOOL;
}
bool BoolValue;
};
// Attribute implemented for integers
class CIntAttribute : public IAttribute
{
public:
CIntAttribute(const char *name, s32 value)
{
Name = name;
setInt(value);
}
s32 getInt() const override
{
return Value;
}
f32 getFloat() const override
{
return (f32)Value;
}
void setInt(s32 intValue) override
{
Value = intValue;
}
void setFloat(f32 floatValue) override
{
Value = (s32)floatValue;
};
E_ATTRIBUTE_TYPE getType() const override
{
return EAT_INT;
}
s32 Value;
};
// Attribute implemented for floats
class CFloatAttribute : public IAttribute
{
public:
CFloatAttribute(const char *name, f32 value)
{
Name = name;
setFloat(value);
}
s32 getInt() const override
{
return (s32)Value;
}
f32 getFloat() const override
{
return Value;
}
void setInt(s32 intValue) override
{
Value = (f32)intValue;
}
void setFloat(f32 floatValue) override
{
Value = floatValue;
}
E_ATTRIBUTE_TYPE getType() const override
{
return EAT_FLOAT;
}
f32 Value;
};
} // end namespace io
} // end namespace irr

View file

@ -1,121 +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 "CAttributes.h"
#include "CAttributeImpl.h"
#include "ITexture.h"
#include "IVideoDriver.h"
namespace irr
{
namespace io
{
CAttributes::CAttributes() {}
CAttributes::~CAttributes()
{
clear();
}
//! Removes all attributes
void CAttributes::clear()
{
for (auto it : Attributes)
delete it.second;
Attributes.clear();
}
//! Sets a attribute as boolean value
void CAttributes::setAttribute(const c8 *attributeName, bool value)
{
auto it = Attributes.find(attributeName);
if (it != Attributes.end()) {
it->second->setBool(value);
} else {
Attributes[attributeName] = new CBoolAttribute(attributeName, value);
}
}
//! Gets a attribute as boolean value
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() as bool
//! or 0 if attribute is not set.
bool CAttributes::getAttributeAsBool(const c8 *attributeName, bool defaultNotFound) const
{
auto it = Attributes.find(attributeName);
if (it != Attributes.end())
return it->second->getBool();
else
return defaultNotFound;
}
//! Sets a attribute as integer value
void CAttributes::setAttribute(const c8 *attributeName, s32 value)
{
auto it = Attributes.find(attributeName);
if (it != Attributes.end()) {
it->second->setInt(value);
} else {
Attributes[attributeName] = new CIntAttribute(attributeName, value);
}
}
//! Gets a attribute as integer value
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() as integer
//! or 0 if attribute is not set.
s32 CAttributes::getAttributeAsInt(const c8 *attributeName, irr::s32 defaultNotFound) const
{
auto it = Attributes.find(attributeName);
if (it != Attributes.end())
return it->second->getInt();
else
return defaultNotFound;
}
//! Sets a attribute as float value
void CAttributes::setAttribute(const c8 *attributeName, f32 value)
{
auto it = Attributes.find(attributeName);
if (it != Attributes.end()) {
it->second->setFloat(value);
} else {
Attributes[attributeName] = new CFloatAttribute(attributeName, value);
}
}
//! Gets a attribute as integer value
//! \param attributeName: Name of the attribute to get.
//! \return Returns value of the attribute previously set by setAttribute() as float value
//! or 0 if attribute is not set.
f32 CAttributes::getAttributeAsFloat(const c8 *attributeName, irr::f32 defaultNotFound) const
{
auto it = Attributes.find(attributeName);
if (it != Attributes.end())
return it->second->getFloat();
else
return defaultNotFound;
}
//! Returns the type of an attribute
E_ATTRIBUTE_TYPE CAttributes::getAttributeType(const c8 *attributeName) const
{
E_ATTRIBUTE_TYPE ret = EAT_UNKNOWN;
auto it = Attributes.find(attributeName);
if (it != Attributes.end())
ret = it->second->getType();
return ret;
}
//! Returns if an attribute with a name exists
bool CAttributes::existsAttribute(const c8 *attributeName) const
{
return Attributes.find(attributeName) != Attributes.end();
}
} // end namespace io
} // end namespace irr

View file

@ -1,102 +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 <map>
#include <string>
#include "IAttributes.h"
#include "IAttribute.h"
namespace irr
{
namespace io
{
//! Implementation of the IAttributes interface
class CAttributes : public IAttributes
{
public:
CAttributes();
~CAttributes();
//! Returns the type of an attribute
//! \param attributeName: Name for the attribute
E_ATTRIBUTE_TYPE getAttributeType(const c8 *attributeName) const override;
//! Returns if an attribute with a name exists
bool existsAttribute(const c8 *attributeName) const override;
//! Removes all attributes
void clear() override;
/*
Integer Attribute
*/
//! Adds an attribute as integer
void addInt(const c8 *attributeName, s32 value) override {
setAttribute(attributeName, value);
}
//! Sets an attribute as integer value
void setAttribute(const c8 *attributeName, s32 value) override;
//! Gets an attribute as integer value
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
s32 getAttributeAsInt(const c8 *attributeName, irr::s32 defaultNotFound = 0) const override;
/*
Float Attribute
*/
//! Adds an attribute as float
void addFloat(const c8 *attributeName, f32 value) override {
setAttribute(attributeName, value);
}
//! Sets a attribute as float value
void setAttribute(const c8 *attributeName, f32 value) override;
//! Gets an attribute as float value
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
f32 getAttributeAsFloat(const c8 *attributeName, irr::f32 defaultNotFound = 0.f) const override;
/*
Bool Attribute
*/
//! Adds an attribute as bool
void addBool(const c8 *attributeName, bool value) override {
setAttribute(attributeName, value);
}
//! Sets an attribute as boolean value
void setAttribute(const c8 *attributeName, bool value) override;
//! Gets an attribute as boolean value
//! \param attributeName: Name of the attribute to get.
//! \param defaultNotFound Value returned when attributeName was not found
//! \return Returns value of the attribute previously set by setAttribute()
bool getAttributeAsBool(const c8 *attributeName, bool defaultNotFound = false) const override;
protected:
typedef std::basic_string<c8> string;
// specify a comparator so we can directly look up in the map with const c8*
// (works since C++14)
std::map<string, IAttribute*, std::less<>> Attributes;
};
} // end namespace io
} // end namespace irr

View file

@ -10,7 +10,6 @@
#include "IGUISpriteBank.h" #include "IGUISpriteBank.h"
#include "IGUIElement.h" #include "IGUIElement.h"
#include "IVideoDriver.h" #include "IVideoDriver.h"
#include "IAttributes.h"
namespace irr namespace irr
{ {

View file

@ -13,7 +13,6 @@
#include "CTimer.h" #include "CTimer.h"
#include "CLogger.h" #include "CLogger.h"
#include "irrString.h" #include "irrString.h"
#include "IrrCompileConfig.h" // for IRRLICHT_SDK_VERSION
namespace irr namespace irr
{ {

View file

@ -401,7 +401,6 @@ add_library(IRRIOOBJ OBJECT
CReadFile.cpp CReadFile.cpp
CWriteFile.cpp CWriteFile.cpp
CZipReader.cpp CZipReader.cpp
CAttributes.cpp
) )
add_library(IRROTHEROBJ OBJECT add_library(IRROTHEROBJ OBJECT

View file

@ -3,9 +3,10 @@
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CNullDriver.h" #include "CNullDriver.h"
#include "IVideoDriver.h"
#include "SMaterial.h"
#include "os.h" #include "os.h"
#include "CImage.h" #include "CImage.h"
#include "CAttributes.h"
#include "IReadFile.h" #include "IReadFile.h"
#include "IWriteFile.h" #include "IWriteFile.h"
#include "IImageLoader.h" #include "IImageLoader.h"
@ -55,20 +56,6 @@ CNullDriver::CNullDriver(io::IFileSystem *io, const core::dimension2d<u32> &scre
ViewPort(0, 0, 0, 0), ScreenSize(screenSize), MinVertexCountForVBO(500), ViewPort(0, 0, 0, 0), ScreenSize(screenSize), MinVertexCountForVBO(500),
TextureCreationFlags(0), OverrideMaterial2DEnabled(false), AllowZWriteOnTransparent(false) TextureCreationFlags(0), OverrideMaterial2DEnabled(false), AllowZWriteOnTransparent(false)
{ {
DriverAttributes = new io::CAttributes();
DriverAttributes->addInt("MaxTextures", MATERIAL_MAX_TEXTURES);
DriverAttributes->addInt("MaxSupportedTextures", MATERIAL_MAX_TEXTURES);
DriverAttributes->addInt("MaxAnisotropy", 1);
// DriverAttributes->addInt("MaxAuxBuffers", 0);
DriverAttributes->addInt("MaxMultipleRenderTargets", 1);
DriverAttributes->addInt("MaxIndices", -1);
DriverAttributes->addInt("MaxTextureSize", -1);
// DriverAttributes->addInt("MaxGeometryVerticesOut", 0);
// DriverAttributes->addFloat("MaxTextureLODBias", 0.f);
DriverAttributes->addInt("Version", 1);
// DriverAttributes->addInt("ShaderLanguageVersion", 0);
// DriverAttributes->addInt("AntiAlias", 0);
setFog(); setFog();
setTextureCreationFlag(ETCF_ALWAYS_32_BIT, true); setTextureCreationFlag(ETCF_ALWAYS_32_BIT, true);
@ -113,9 +100,6 @@ CNullDriver::CNullDriver(io::IFileSystem *io, const core::dimension2d<u32> &scre
//! destructor //! destructor
CNullDriver::~CNullDriver() CNullDriver::~CNullDriver()
{ {
if (DriverAttributes)
DriverAttributes->drop();
if (FileSystem) if (FileSystem)
FileSystem->drop(); FileSystem->drop();
@ -236,12 +220,6 @@ bool CNullDriver::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
return false; return false;
} }
//! Get attributes of the actual video driver
const io::IAttributes &CNullDriver::getDriverAttributes() const
{
return *DriverAttributes;
}
//! sets transformation //! sets transformation
void CNullDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4 &mat) void CNullDriver::setTransform(E_TRANSFORMATION_STATE state, const core::matrix4 &mat)
{ {

View file

@ -9,7 +9,6 @@
#include "IGPUProgrammingServices.h" #include "IGPUProgrammingServices.h"
#include "irrArray.h" #include "irrArray.h"
#include "irrString.h" #include "irrString.h"
#include "IAttributes.h"
#include "IMesh.h" #include "IMesh.h"
#include "IMeshBuffer.h" #include "IMeshBuffer.h"
#include "IMeshSceneNode.h" #include "IMeshSceneNode.h"
@ -50,9 +49,6 @@ public:
//! queries the features of the driver, returns true if feature is available //! queries the features of the driver, returns true if feature is available
bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const override; bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const override;
//! Get attributes of the actual video driver
const io::IAttributes &getDriverAttributes() const override;
//! sets transformation //! sets transformation
void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4 &mat) override; void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4 &mat) override;
@ -717,8 +713,6 @@ protected:
SColor FogColor; SColor FogColor;
SExposedVideoData ExposedData; SExposedVideoData ExposedData;
io::IAttributes *DriverAttributes;
SOverrideMaterial OverrideMaterial; SOverrideMaterial OverrideMaterial;
SMaterial OverrideMaterial2D; SMaterial OverrideMaterial2D;
SMaterial InitMaterial2D; SMaterial InitMaterial2D;

View file

@ -9,7 +9,6 @@
#include "SMeshBuffer.h" #include "SMeshBuffer.h"
#include "SAnimatedMesh.h" #include "SAnimatedMesh.h"
#include "IReadFile.h" #include "IReadFile.h"
#include "IAttributes.h"
#include "fast_atof.h" #include "fast_atof.h"
#include "coreutil.h" #include "coreutil.h"
#include "os.h" #include "os.h"
@ -74,8 +73,6 @@ IAnimatedMesh *COBJMeshFileLoader::createMesh(io::IReadFile *file)
const c8 *bufPtr = buf; const c8 *bufPtr = buf;
core::stringc grpName, mtlName; core::stringc grpName, mtlName;
bool mtlChanged = false; bool mtlChanged = false;
bool useGroups = !SceneManager->getParameters()->getAttributeAsBool(OBJ_LOADER_IGNORE_GROUPS);
bool useMaterials = !SceneManager->getParameters()->getAttributeAsBool(OBJ_LOADER_IGNORE_MATERIAL_FILES);
[[maybe_unused]] irr::u32 lineNr = 1; // only counts non-empty lines, still useful in debugging to locate errors [[maybe_unused]] irr::u32 lineNr = 1; // only counts non-empty lines, still useful in debugging to locate errors
core::array<int> faceCorners; core::array<int> faceCorners;
faceCorners.reallocate(32); // should be large enough faceCorners.reallocate(32); // should be large enough
@ -85,15 +82,7 @@ IAnimatedMesh *COBJMeshFileLoader::createMesh(io::IReadFile *file)
while (bufPtr != bufEnd) { while (bufPtr != bufEnd) {
switch (bufPtr[0]) { switch (bufPtr[0]) {
case 'm': // mtllib (material) case 'm': // mtllib (material)
{ break; // not supported
if (useMaterials) {
c8 name[WORD_BUFFER_LENGTH];
bufPtr = goAndCopyNextWord(name, bufPtr, WORD_BUFFER_LENGTH, bufEnd);
#ifdef _IRR_DEBUG_OBJ_LOADER_
os::Printer::log("Ignoring material file", name);
#endif
}
} break;
case 'v': // v, vn, vt case 'v': // v, vn, vt
switch (bufPtr[1]) { switch (bufPtr[1]) {
@ -127,12 +116,7 @@ IAnimatedMesh *COBJMeshFileLoader::createMesh(io::IReadFile *file)
#ifdef _IRR_DEBUG_OBJ_LOADER_ #ifdef _IRR_DEBUG_OBJ_LOADER_
os::Printer::log("Loaded group start", grp, ELL_DEBUG); os::Printer::log("Loaded group start", grp, ELL_DEBUG);
#endif #endif
if (useGroups) { grpName = ('\0' != grp[0]) ? grp : "default";
if (0 != grp[0])
grpName = grp;
else
grpName = "default";
}
mtlChanged = true; mtlChanged = true;
} break; } break;

View file

@ -116,18 +116,6 @@ bool COpenGLDriver::genericDriverInit()
os::Printer::log("GLSL version", buf, ELL_INFORMATION); os::Printer::log("GLSL version", buf, ELL_INFORMATION);
} else } else
os::Printer::log("GLSL not available.", ELL_INFORMATION); os::Printer::log("GLSL not available.", ELL_INFORMATION);
DriverAttributes->setAttribute("MaxTextures", (s32)Feature.MaxTextureUnits);
DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Feature.MaxTextureUnits);
DriverAttributes->setAttribute("MaxAnisotropy", MaxAnisotropy);
DriverAttributes->setAttribute("MaxAuxBuffers", MaxAuxBuffers);
DriverAttributes->setAttribute("MaxMultipleRenderTargets", (s32)Feature.MultipleRenderTarget);
DriverAttributes->setAttribute("MaxIndices", (s32)MaxIndices);
DriverAttributes->setAttribute("MaxTextureSize", (s32)MaxTextureSize);
DriverAttributes->setAttribute("MaxGeometryVerticesOut", (s32)MaxGeometryVerticesOut);
DriverAttributes->setAttribute("MaxTextureLODBias", MaxTextureLODBias);
DriverAttributes->setAttribute("Version", Version);
DriverAttributes->setAttribute("ShaderLanguageVersion", ShaderLanguageVersion);
DriverAttributes->setAttribute("AntiAlias", AntiAlias);
glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_PACK_ALIGNMENT, 1);

View file

@ -42,7 +42,7 @@ CSceneManager::CSceneManager(video::IVideoDriver *driver,
ISceneNode(0, 0), ISceneNode(0, 0),
Driver(driver), Driver(driver),
CursorControl(cursorControl), CursorControl(cursorControl),
ActiveCamera(0), Parameters(0), ActiveCamera(0),
MeshCache(cache), CurrentRenderPass(ESNRP_NONE) MeshCache(cache), CurrentRenderPass(ESNRP_NONE)
{ {
// root node's scene manager // root node's scene manager
@ -60,9 +60,6 @@ CSceneManager::CSceneManager(video::IVideoDriver *driver,
else else
MeshCache->grab(); MeshCache->grab();
// set scene parameters
Parameters = new io::CAttributes();
// create collision manager // create collision manager
CollisionManager = new CSceneCollisionManager(this, Driver); CollisionManager = new CSceneCollisionManager(this, Driver);
@ -105,9 +102,6 @@ CSceneManager::~CSceneManager()
if (MeshCache) if (MeshCache)
MeshCache->drop(); MeshCache->drop();
if (Parameters)
Parameters->drop();
// remove all nodes before dropping the driver // remove all nodes before dropping the driver
// as render targets may be destroyed twice // as render targets may be destroyed twice
@ -472,8 +466,7 @@ void CSceneManager::drawAll()
Driver->setTransform(video::ETS_WORLD, core::IdentityMatrix); Driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
for (u32 i = video::ETS_COUNT - 1; i >= video::ETS_TEXTURE_0; --i) for (u32 i = video::ETS_COUNT - 1; i >= video::ETS_TEXTURE_0; --i)
Driver->setTransform((video::E_TRANSFORMATION_STATE)i, core::IdentityMatrix); Driver->setTransform((video::E_TRANSFORMATION_STATE)i, core::IdentityMatrix);
// TODO: This should not use an attribute here but a real parameter when necessary (too slow!) Driver->setAllowZWriteOnTransparent(true);
Driver->setAllowZWriteOnTransparent(Parameters->getAttributeAsBool(ALLOW_ZWRITE_ON_TRANSPARENT));
// do animations and other stuff. // do animations and other stuff.
OnAnimate(os::Timer::getTime()); OnAnimate(os::Timer::getTime());
@ -743,12 +736,6 @@ void CSceneManager::clear()
removeAll(); removeAll();
} }
//! Returns interface to the parameters set in this scene.
io::IAttributes *CSceneManager::getParameters()
{
return Parameters;
}
//! Returns current render pass. //! Returns current render pass.
E_SCENE_NODE_RENDER_PASS CSceneManager::getSceneNodeRenderPass() const E_SCENE_NODE_RENDER_PASS CSceneManager::getSceneNodeRenderPass() const
{ {

View file

@ -11,7 +11,6 @@
#include "irrString.h" #include "irrString.h"
#include "irrArray.h" #include "irrArray.h"
#include "IMeshLoader.h" #include "IMeshLoader.h"
#include "CAttributes.h"
namespace irr namespace irr
{ {
@ -158,9 +157,6 @@ public:
//! Removes all children of this scene node //! Removes all children of this scene node
void removeAll() override; void removeAll() override;
//! Returns interface to the parameters set in this scene.
io::IAttributes *getParameters() override;
//! Returns current render pass. //! Returns current render pass.
E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const override; E_SCENE_NODE_RENDER_PASS getSceneNodeRenderPass() const override;
@ -266,10 +262,6 @@ private:
ICameraSceneNode *ActiveCamera; ICameraSceneNode *ActiveCamera;
core::vector3df camWorldPos; // Position of camera for transparent nodes. core::vector3df camWorldPos; // Position of camera for transparent nodes.
//! String parameters
// NOTE: Attributes are slow and should only be used for debug-info and not in release
io::CAttributes *Parameters;
//! Mesh cache //! Mesh cache
IMeshCache *MeshCache; IMeshCache *MeshCache;

View file

@ -1,35 +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"
#include "irrString.h"
#include "EAttributes.h"
namespace irr
{
namespace io
{
class IAttribute
{
public:
virtual ~IAttribute(){};
virtual s32 getInt() const { return 0; }
virtual f32 getFloat() const { return 0; }
virtual bool getBool() const { return false; }
virtual void setInt(s32 intValue){};
virtual void setFloat(f32 floatValue){};
virtual void setBool(bool boolValue){};
core::stringc Name;
virtual E_ATTRIBUTE_TYPE getType() const = 0;
};
} // end namespace io
} // end namespace irr

View file

@ -27,7 +27,7 @@ static const char *const copyright = "Irrlicht Engine (c) 2002-2017 Nikolaus Geb
namespace irr namespace irr
{ {
//! stub for calling createDeviceEx //! stub for calling createDeviceEx
IRRLICHT_API IrrlichtDevice *IRRCALLCONV createDevice(video::E_DRIVER_TYPE driverType, IrrlichtDevice *createDevice(video::E_DRIVER_TYPE driverType,
const core::dimension2d<u32> &windowSize, const core::dimension2d<u32> &windowSize,
u32 bits, bool fullscreen, u32 bits, bool fullscreen,
bool stencilbuffer, bool vsync, IEventReceiver *res) bool stencilbuffer, bool vsync, IEventReceiver *res)
@ -46,7 +46,7 @@ IRRLICHT_API IrrlichtDevice *IRRCALLCONV createDevice(video::E_DRIVER_TYPE drive
return createDeviceEx(p); return createDeviceEx(p);
} }
extern "C" IRRLICHT_API IrrlichtDevice *IRRCALLCONV createDeviceEx(const SIrrlichtCreationParameters &params) extern "C" IrrlichtDevice *createDeviceEx(const SIrrlichtCreationParameters &params)
{ {
IrrlichtDevice *dev = 0; IrrlichtDevice *dev = 0;
@ -90,7 +90,7 @@ namespace video
{ {
const SMaterial IdentityMaterial; const SMaterial IdentityMaterial;
extern "C" IRRLICHT_API bool IRRCALLCONV isDriverSupported(E_DRIVER_TYPE driver) extern "C" bool isDriverSupported(E_DRIVER_TYPE driver)
{ {
switch (driver) { switch (driver) {
case EDT_NULL: case EDT_NULL:

View file

@ -261,16 +261,6 @@ bool COpenGL3DriverBase::genericDriverInit(const core::dimension2d<u32> &screenS
StencilBuffer = stencilBuffer; StencilBuffer = stencilBuffer;
DriverAttributes->setAttribute("MaxTextures", (s32)Feature.MaxTextureUnits);
DriverAttributes->setAttribute("MaxSupportedTextures", (s32)Feature.MaxTextureUnits);
DriverAttributes->setAttribute("MaxAnisotropy", MaxAnisotropy);
DriverAttributes->setAttribute("MaxIndices", (s32)MaxIndices);
DriverAttributes->setAttribute("MaxTextureSize", (s32)MaxTextureSize);
DriverAttributes->setAttribute("MaxArrayTextureLayers", (s32)MaxArrayTextureLayers);
DriverAttributes->setAttribute("MaxTextureLODBias", MaxTextureLODBias);
DriverAttributes->setAttribute("Version", 100 * Version.Major + Version.Minor);
DriverAttributes->setAttribute("AntiAlias", AntiAlias);
GL.PixelStorei(GL_PACK_ALIGNMENT, 1); GL.PixelStorei(GL_PACK_ALIGNMENT, 1);
for (s32 i = 0; i < ETS_COUNT; ++i) for (s32 i = 0; i < ETS_COUNT; ++i)

View file

@ -2,7 +2,6 @@
// SPDX-License-Identifier: LGPL-2.1-or-later // SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com> // Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "IAttributes.h"
#include "gui/mainmenumanager.h" #include "gui/mainmenumanager.h"
#include "clouds.h" #include "clouds.h"
#include "gui/touchcontrols.h" #include "gui/touchcontrols.h"
@ -111,9 +110,6 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
init_input(); init_input();
m_rendering_engine->get_scene_manager()->getParameters()->
setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true);
guienv = m_rendering_engine->get_gui_env(); guienv = m_rendering_engine->get_gui_env();
config_guienv(); config_guienv();
g_settings->registerChangedCallback("dpi_change_notifier", setting_changed_callback, this); g_settings->registerChangedCallback("dpi_change_notifier", setting_changed_callback, this);

View file

@ -5,7 +5,6 @@
#include "game.h" #include "game.h"
#include <cmath> #include <cmath>
#include "IAttributes.h"
#include "client/renderingengine.h" #include "client/renderingengine.h"
#include "camera.h" #include "camera.h"
#include "client.h" #include "client.h"
@ -959,8 +958,6 @@ bool Game::startup(bool *kill,
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, g_settings->getBool("mip_map")); driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, g_settings->getBool("mip_map"));
smgr->getParameters()->setAttribute(scene::OBJ_LOADER_IGNORE_MATERIAL_FILES, true);
// Reinit runData // Reinit runData
runData = GameRunData(); runData = GameRunData();
runData.time_from_last_punch = 10.0; runData.time_from_last_punch = 10.0;

View file

@ -10,9 +10,11 @@
#include <limits> #include <limits>
#include <sstream> #include <sstream>
#include "guiFormSpecMenu.h" #include "guiFormSpecMenu.h"
#include "EGUIElementTypes.h"
#include "constants.h" #include "constants.h"
#include "gamedef.h" #include "gamedef.h"
#include "client/keycode.h" #include "client/keycode.h"
#include "gui/guiTable.h"
#include "util/strfnd.h" #include "util/strfnd.h"
#include <IGUIButton.h> #include <IGUIButton.h>
#include <IGUICheckBox.h> #include <IGUICheckBox.h>
@ -198,7 +200,7 @@ void GUIFormSpecMenu::setInitialFocus()
// 3. first table // 3. first table
for (gui::IGUIElement *it : children) { for (gui::IGUIElement *it : children) {
if (it->getTypeName() == std::string("GUITable")) { if (it->getType() == gui::EGUIET_TABLE) {
Environment->setFocus(it); Environment->setFocus(it);
return; return;
} }

View file

@ -8,7 +8,6 @@
#include <IAnimatedMeshSceneNode.h> #include <IAnimatedMeshSceneNode.h>
#include <IVideoDriver.h> #include <IVideoDriver.h>
#include <ISceneManager.h> #include <ISceneManager.h>
#include "IAttributes.h"
#include "porting.h" #include "porting.h"
#include "client/mesh.h" #include "client/mesh.h"
@ -21,8 +20,6 @@ GUIScene::GUIScene(gui::IGUIEnvironment *env, scene::ISceneManager *smgr,
m_cam = m_smgr->addCameraSceneNode(0, v3f(0.f, 0.f, -100.f), v3f(0.f)); m_cam = m_smgr->addCameraSceneNode(0, v3f(0.f, 0.f, -100.f), v3f(0.f));
m_cam->setFOV(30.f * core::DEGTORAD); m_cam->setFOV(30.f * core::DEGTORAD);
m_smgr->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true);
} }
GUIScene::~GUIScene() GUIScene::~GUIScene()

View file

@ -635,11 +635,6 @@ void GUITable::setDynamicData(const DynamicData &dyndata)
m_scrollbar->setPos(dyndata.scrollpos); m_scrollbar->setPos(dyndata.scrollpos);
} }
const c8* GUITable::getTypeName() const
{
return "GUITable";
}
void GUITable::updateAbsolutePosition() void GUITable::updateAbsolutePosition()
{ {
IGUIElement::updateAbsolutePosition(); IGUIElement::updateAbsolutePosition();

View file

@ -118,9 +118,6 @@ public:
/* Set selection, scroll position and opened (sub)trees */ /* Set selection, scroll position and opened (sub)trees */
void setDynamicData(const DynamicData &dyndata); void setDynamicData(const DynamicData &dyndata);
/* Returns "GUITable" */
virtual const c8* getTypeName() const;
/* Must be called when position or size changes */ /* Must be called when position or size changes */
virtual void updateAbsolutePosition(); virtual void updateAbsolutePosition();

View file

@ -1085,9 +1085,8 @@ std::optional<double> my_string_to_double(const std::string &s)
if (s.empty()) if (s.empty())
return std::nullopt; return std::nullopt;
char *end = nullptr; char *end = nullptr;
errno = 0;
// Note: this also supports hexadecimal notation like "0x1.0p+1" // Note: this also supports hexadecimal notation like "0x1.0p+1"
double number = std::strtod(s.data(), &end); double number = std::strtod(s.c_str(), &end);
if (end != &*s.end()) if (end != &*s.end())
return std::nullopt; return std::nullopt;
return number; return number;