Merge pull request 'master' (#3) from Mirrorlandia_minetest/irrlicht:master into master

Reviewed-on: #3
This commit is contained in:
Bruno Rybársky 2024-01-09 17:55:40 +01:00
commit 66ccfc3a3f
18 changed files with 209 additions and 96 deletions

@ -21,7 +21,7 @@ jobs:
- name: Build - name: Build
run: | run: |
cmake . cmake . -DUSE_SDL2=OFF
make VERBOSE=1 -j2 make VERBOSE=1 -j2
- name: Test - name: Test
@ -52,7 +52,7 @@ jobs:
- name: Build - name: Build
run: | run: |
cmake . -DBUILD_EXAMPLES=1 -DENABLE_OPENGL=OFF -DENABLE_GLES2=ON cmake . -DBUILD_EXAMPLES=1 -DUSE_SDL2=OFF -DENABLE_OPENGL=OFF -DENABLE_GLES2=ON
make -j2 make -j2
- name: Test (headless) - name: Test (headless)
@ -143,7 +143,7 @@ jobs:
mingw: mingw:
name: "MinGW ${{matrix.config.variant}}${{matrix.config.extras}}" name: "MinGW ${{matrix.config.variant}}${{matrix.config.extras}}"
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:

@ -15,6 +15,7 @@
#include "matrix4.h" #include "matrix4.h"
#include "IAttributes.h" #include "IAttributes.h"
#include <list> #include <list>
#include <optional>
namespace irr namespace irr
{ {
@ -275,33 +276,33 @@ namespace scene
child->grab(); child->grab();
child->remove(); // remove from old parent child->remove(); // remove from old parent
Children.push_back(child); // Note: This iterator is not invalidated until we erase it.
child->ThisIterator = Children.insert(Children.end(), child);
child->Parent = this; child->Parent = this;
} }
} }
//! Removes a child from this scene node. //! Removes a child from this scene node.
/** If found in the children list, the child pointer is also /**
dropped and might be deleted if no other grab exists.
\param child A pointer to the child which shall be removed. \param child A pointer to the child which shall be removed.
\return True if the child was removed, and false if not, \return True if the child was removed, and false if not,
e.g. because it couldn't be found in the children list. */ e.g. because it belongs to a different parent or no parent. */
virtual bool removeChild(ISceneNode* child) virtual bool removeChild(ISceneNode* child)
{ {
ISceneNodeList::iterator it = Children.begin(); if (child->Parent != this)
for (; it != Children.end(); ++it) return false;
if ((*it) == child)
{ // The iterator must be set since the parent is not null.
(*it)->Parent = 0; _IRR_DEBUG_BREAK_IF(!child->ThisIterator.has_value());
(*it)->drop(); auto it = *child->ThisIterator;
child->ThisIterator = std::nullopt;
child->Parent = nullptr;
child->drop();
Children.erase(it); Children.erase(it);
return true; return true;
} }
return false;
}
//! Removes all children of this scene node //! Removes all children of this scene node
/** The scene nodes found in the children list are also dropped /** The scene nodes found in the children list are also dropped
@ -309,13 +310,11 @@ namespace scene
*/ */
virtual void removeAll() virtual void removeAll()
{ {
ISceneNodeList::iterator it = Children.begin(); for (auto &child : Children) {
for (; it != Children.end(); ++it) child->Parent = nullptr;
{ child->ThisIterator = std::nullopt;
(*it)->Parent = 0; child->drop();
(*it)->drop();
} }
Children.clear(); Children.clear();
} }
@ -508,10 +507,8 @@ namespace scene
grab(); grab();
remove(); remove();
Parent = newParent; if (newParent)
newParent->addChild(this);
if (Parent)
Parent->addChild(this);
drop(); drop();
} }
@ -618,12 +615,15 @@ namespace scene
//! Relative scale of the scene node. //! Relative scale of the scene node.
core::vector3df RelativeScale; core::vector3df RelativeScale;
//! Pointer to the parent
ISceneNode* Parent;
//! List of all children of this node //! List of all children of this node
std::list<ISceneNode*> Children; std::list<ISceneNode*> Children;
//! Iterator pointing to this node in the parent's child list.
std::optional<ISceneNodeList::iterator> ThisIterator;
//! Pointer to the parent
ISceneNode* Parent;
//! Pointer to the scene manager //! Pointer to the scene manager
ISceneManager* SceneManager; ISceneManager* SceneManager;

@ -177,6 +177,10 @@ namespace irr
/** \return True if window is fullscreen. */ /** \return True if window is fullscreen. */
virtual bool isFullscreen() const = 0; virtual bool isFullscreen() const = 0;
//! Checks if the window could possibly be visible.
//! Currently, this only returns false when the app is paused on Android.
virtual bool isWindowVisible() const { return true; };
//! Get the current color format of the window //! Get the current color format of the window
/** \return Color format of the window. */ /** \return Color format of the window. */
virtual video::ECOLOR_FORMAT getColorFormat() const = 0; virtual video::ECOLOR_FORMAT getColorFormat() const = 0;

@ -241,7 +241,7 @@ public:
/** \return Size of elements in the array which are actually occupied. */ /** \return Size of elements in the array which are actually occupied. */
u32 size() const u32 size() const
{ {
return m_data.size(); return static_cast<u32>(m_data.size());
} }
@ -317,7 +317,7 @@ public:
// *it = first element in [first, last) that is >= element, or last if not found. // *it = first element in [first, last) that is >= element, or last if not found.
if (*it < element || element < *it) if (*it < element || element < *it)
return -1; return -1;
return it - m_data.begin(); return static_cast<u32>(it - m_data.begin());
} }
@ -335,8 +335,8 @@ public:
auto iters = std::equal_range(m_data.begin(), m_data.end(), element); auto iters = std::equal_range(m_data.begin(), m_data.end(), element);
if (iters.first == iters.second) if (iters.first == iters.second)
return -1; return -1;
last = (iters.second - m_data.begin()) - 1; last = static_cast<s32>((iters.second - m_data.begin()) - 1);
return iters.first - m_data.begin(); return static_cast<s32>(iters.first - m_data.begin());
} }
@ -351,7 +351,7 @@ public:
auto it = std::find(m_data.begin(), m_data.end(), element); auto it = std::find(m_data.begin(), m_data.end(), element);
if (it == m_data.end()) if (it == m_data.end())
return -1; return -1;
return it - m_data.begin(); return static_cast<u32>(it - m_data.begin());
} }

@ -266,7 +266,7 @@ public:
the trailing NUL. */ the trailing NUL. */
u32 size() const u32 size() const
{ {
return str.size(); return static_cast<u32>(str.size());
} }
//! Informs if the string is empty or not. //! Informs if the string is empty or not.
@ -834,7 +834,7 @@ public:
if (!delimiter) if (!delimiter)
return 0; return 0;
const u32 oldSize=ret.size(); const u32 oldSize=static_cast<u32>(ret.size());
u32 tokenStartIdx = 0; u32 tokenStartIdx = 0;
for (u32 i=0; i<size()+1; ++i) for (u32 i=0; i<size()+1; ++i)
@ -862,7 +862,7 @@ public:
else if (!ignoreEmptyTokens) else if (!ignoreEmptyTokens)
ret.push_back(string<T>()); ret.push_back(string<T>());
return ret.size()-oldSize; return static_cast<u32>(ret.size()-oldSize);
} }
// This function should not be used and is only kept for "CGUIFileOpenDialog::pathToStringW". // This function should not be used and is only kept for "CGUIFileOpenDialog::pathToStringW".
@ -888,10 +888,10 @@ private:
return len; return len;
} }
static inline u32 calclen(const char* p) { static inline u32 calclen(const char* p) {
return strlen(p); return static_cast<u32>(strlen(p));
} }
static inline u32 calclen(const wchar_t* p) { static inline u32 calclen(const wchar_t* p) {
return wcslen(p); return static_cast<u32>(wcslen(p));
} }
//! strcmp wrapper //! strcmp wrapper

@ -11,7 +11,7 @@
#include <KHR/khrplatform.h> #include <KHR/khrplatform.h>
#ifndef APIENTRY #ifndef APIENTRY
#define APIENTRY #define APIENTRY KHRONOS_APIENTRY
#endif #endif
#ifndef APIENTRYP #ifndef APIENTRYP
#define APIENTRYP APIENTRY * #define APIENTRYP APIENTRY *
@ -705,7 +705,6 @@ private:
typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC_MT) (GLenum mode, const void * indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC_MT) (GLenum mode, const void * indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC_MT) (GLenum mode, GLenum type, const void * indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC_MT) (GLenum mode, GLenum type, const void * indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
typedef void (APIENTRYP PFNGLPOLYGONOFFSETCLAMPPROC_MT) (GLfloat factor, GLfloat units, GLfloat clamp); typedef void (APIENTRYP PFNGLPOLYGONOFFSETCLAMPPROC_MT) (GLfloat factor, GLfloat units, GLfloat clamp);
typedef void (APIENTRYP PFNGLGENPERFMONITORSEXPROC_MT) (GLsizei n, GLuint * monitors);
typedef void (APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXPROC_MT) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); typedef void (APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXPROC_MT) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEPROC_MT) (GLuint texture); typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEPROC_MT) (GLuint texture);
typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEPROC_MT) (GLuint texture, GLuint sampler); typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEPROC_MT) (GLuint texture, GLuint sampler);
@ -781,9 +780,9 @@ public:
// Call this once after creating the context. // Call this once after creating the context.
void LoadAllProcedures(irr::video::IContextManager *cmgr); void LoadAllProcedures(irr::video::IContextManager *cmgr);
// Check if an extension is supported. // Check if an extension is supported.
inline bool IsExtensionPresent(const std::string &ext) inline bool IsExtensionPresent(const std::string &ext) const
{ {
return extensions.find(ext) != extensions.end(); return extensions.count(ext) > 0;
} }
PFNGLCULLFACEPROC_MT CullFace = NULL; PFNGLCULLFACEPROC_MT CullFace = NULL;
@ -1436,7 +1435,6 @@ public:
PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC_MT MultiDrawArraysIndirectCount = NULL; PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC_MT MultiDrawArraysIndirectCount = NULL;
PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC_MT MultiDrawElementsIndirectCount = NULL; PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC_MT MultiDrawElementsIndirectCount = NULL;
PFNGLPOLYGONOFFSETCLAMPPROC_MT PolygonOffsetClamp = NULL; PFNGLPOLYGONOFFSETCLAMPPROC_MT PolygonOffsetClamp = NULL;
PFNGLGENPERFMONITORSEXPROC_MT GenPerfMonitorsEX = NULL;
PFNGLPRIMITIVEBOUNDINGBOXPROC_MT PrimitiveBoundingBox = NULL; PFNGLPRIMITIVEBOUNDINGBOXPROC_MT PrimitiveBoundingBox = NULL;
PFNGLGETTEXTUREHANDLEPROC_MT GetTextureHandle = NULL; PFNGLGETTEXTUREHANDLEPROC_MT GetTextureHandle = NULL;
PFNGLGETTEXTURESAMPLERHANDLEPROC_MT GetTextureSamplerHandle = NULL; PFNGLGETTEXTURESAMPLERHANDLEPROC_MT GetTextureSamplerHandle = NULL;
@ -3020,6 +3018,16 @@ public:
static constexpr const GLenum TEXTURE_SRGB_DECODE = 0x8A48; static constexpr const GLenum TEXTURE_SRGB_DECODE = 0x8A48;
static constexpr const GLenum DECODE = 0x8A49; static constexpr const GLenum DECODE = 0x8A49;
static constexpr const GLenum SKIP_DECODE = 0x8A4A; static constexpr const GLenum SKIP_DECODE = 0x8A4A;
static constexpr const GLenum ALPHA8 = 0x803C;
static constexpr const GLenum LUMINANCE8 = 0x8040;
static constexpr const GLenum LUMINANCE8_ALPHA8 = 0x8045;
static constexpr const GLenum ALPHA32F = 0x8816;
static constexpr const GLenum LUMINANCE32F = 0x8818;
static constexpr const GLenum LUMINANCE_ALPHA32F = 0x8819;
static constexpr const GLenum ALPHA16F = 0x881C;
static constexpr const GLenum LUMINANCE16F = 0x881E;
static constexpr const GLenum LUMINANCE_ALPHA16F = 0x881F;
static constexpr const GLenum BGRA8 = 0x93A1;
static constexpr const GLenum INCLUSIVE = 0x8F10; static constexpr const GLenum INCLUSIVE = 0x8F10;
static constexpr const GLenum EXCLUSIVE = 0x8F11; static constexpr const GLenum EXCLUSIVE = 0x8F11;
static constexpr const GLenum WINDOW_RECTANGLE = 0x8F12; static constexpr const GLenum WINDOW_RECTANGLE = 0x8F12;
@ -3044,10 +3052,7 @@ public:
static constexpr const GLenum GEOMETRY_LINKED_VERTICES_OUT = 0x8916; static constexpr const GLenum GEOMETRY_LINKED_VERTICES_OUT = 0x8916;
static constexpr const GLenum GEOMETRY_LINKED_INPUT_TYPE = 0x8917; static constexpr const GLenum GEOMETRY_LINKED_INPUT_TYPE = 0x8917;
static constexpr const GLenum GEOMETRY_LINKED_OUTPUT_TYPE = 0x8918; static constexpr const GLenum GEOMETRY_LINKED_OUTPUT_TYPE = 0x8918;
static constexpr const GLenum ALPHA8 = 0x803C;
static constexpr const GLenum LUMINANCE4_ALPHA4 = 0x8043; static constexpr const GLenum LUMINANCE4_ALPHA4 = 0x8043;
static constexpr const GLenum LUMINANCE8_ALPHA8 = 0x8045;
static constexpr const GLenum LUMINANCE8 = 0x8040;
static constexpr const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET = 0x8CD4; static constexpr const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET = 0x8CD4;
static constexpr const GLenum COMPRESSED_RGBA_ASTC_3x3x3 = 0x93C0; static constexpr const GLenum COMPRESSED_RGBA_ASTC_3x3x3 = 0x93C0;
static constexpr const GLenum COMPRESSED_RGBA_ASTC_4x3x3 = 0x93C1; static constexpr const GLenum COMPRESSED_RGBA_ASTC_4x3x3 = 0x93C1;
@ -3070,7 +3075,6 @@ public:
static constexpr const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5 = 0x93E8; static constexpr const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5 = 0x93E8;
static constexpr const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6 = 0x93E9; static constexpr const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6 = 0x93E9;
static constexpr const GLenum INT_10_10_10_2 = 0x8DF7; static constexpr const GLenum INT_10_10_10_2 = 0x8DF7;
static constexpr const GLenum BGRA8 = 0x93A1;
static constexpr const GLenum MALI_PROGRAM_BINARY_ARM = 0x8F61; static constexpr const GLenum MALI_PROGRAM_BINARY_ARM = 0x8F61;
static constexpr const GLenum MALI_SHADER_BINARY_ARM = 0x8F60; static constexpr const GLenum MALI_SHADER_BINARY_ARM = 0x8F60;
static constexpr const GLenum FETCH_PER_SAMPLE_ARM = 0x8F65; static constexpr const GLenum FETCH_PER_SAMPLE_ARM = 0x8F65;
@ -3080,8 +3084,37 @@ public:
static constexpr const GLenum SMAPHS_PROGRAM_BINARY_DMP = 0x9252; static constexpr const GLenum SMAPHS_PROGRAM_BINARY_DMP = 0x9252;
static constexpr const GLenum DMP_PROGRAM_BINARY_DMP = 0x9253; static constexpr const GLenum DMP_PROGRAM_BINARY_DMP = 0x9253;
static constexpr const GLenum SHADER_BINARY_DMP = 0x9250; static constexpr const GLenum SHADER_BINARY_DMP = 0x9250;
static constexpr const GLenum SURFACE_COMPRESSION = 0x96C0;
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_NONE = 0x96C1;
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_DEFAULT = 0x96C2;
static constexpr const GLenum SAMPLER_EXTERNAL_2D_Y2Y = 0x8BE7; static constexpr const GLenum SAMPLER_EXTERNAL_2D_Y2Y = 0x8BE7;
static constexpr const GLenum GPU_DISJOINT = 0x8FBB; static constexpr const GLenum GPU_DISJOINT = 0x8FBB;
static constexpr const GLenum SHADING_RATE_1X1_PIXELS = 0x96A6;
static constexpr const GLenum SHADING_RATE_1X2_PIXELS = 0x96A7;
static constexpr const GLenum SHADING_RATE_2X1_PIXELS = 0x96A8;
static constexpr const GLenum SHADING_RATE_2X2_PIXELS = 0x96A9;
static constexpr const GLenum SHADING_RATE_1X4_PIXELS = 0x96AA;
static constexpr const GLenum SHADING_RATE_4X1_PIXELS = 0x96AB;
static constexpr const GLenum SHADING_RATE_4X2_PIXELS = 0x96AC;
static constexpr const GLenum SHADING_RATE_2X4_PIXELS = 0x96AD;
static constexpr const GLenum SHADING_RATE_4X4_PIXELS = 0x96AE;
static constexpr const GLenum SHADING_RATE = 0x96D0;
static constexpr const GLenum SHADING_RATE_ATTACHMENT = 0x96D1;
static constexpr const GLenum FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP = 0x96D2;
static constexpr const GLenum FRAGMENT_SHADING_RATE_COMBINER_OP_REPLACE = 0x96D3;
static constexpr const GLenum FRAGMENT_SHADING_RATE_COMBINER_OP_MIN = 0x96D4;
static constexpr const GLenum FRAGMENT_SHADING_RATE_COMBINER_OP_MAX = 0x96D5;
static constexpr const GLenum FRAGMENT_SHADING_RATE_COMBINER_OP_MUL = 0x96D6;
static constexpr const GLenum MIN_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_WIDTH = 0x96D7;
static constexpr const GLenum MAX_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_WIDTH = 0x96D8;
static constexpr const GLenum MIN_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_HEIGHT = 0x96D9;
static constexpr const GLenum MAX_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_HEIGHT = 0x96DA;
static constexpr const GLenum MAX_FRAGMENT_SHADING_RATE_ATTACHMENT_TEXEL_ASPECT_RATIO = 0x96DB;
static constexpr const GLenum MAX_FRAGMENT_SHADING_RATE_ATTACHMENT_LAYERS = 0x96DC;
static constexpr const GLenum FRAGMENT_SHADING_RATE_WITH_SHADER_DEPTH_STENCIL_WRITES_SUPPORTED = 0x96DD;
static constexpr const GLenum FRAGMENT_SHADING_RATE_WITH_SAMPLE_MASK_SUPPORTED = 0x96DE;
static constexpr const GLenum FRAGMENT_SHADING_RATE_ATTACHMENT_WITH_DEFAULT_FRAMEBUFFER_SUPPORTED = 0x96DF;
static constexpr const GLenum FRAGMENT_SHADING_RATE_NON_TRIVIAL_COMBINERS_SUPPORTED = 0x8F6F;
static constexpr const GLenum TEXTURE_TILING = 0x9580; static constexpr const GLenum TEXTURE_TILING = 0x9580;
static constexpr const GLenum DEDICATED_MEMORY_OBJECT = 0x9581; static constexpr const GLenum DEDICATED_MEMORY_OBJECT = 0x9581;
static constexpr const GLenum PROTECTED_MEMORY_OBJECT = 0x959B; static constexpr const GLenum PROTECTED_MEMORY_OBJECT = 0x959B;
@ -3136,12 +3169,19 @@ public:
static constexpr const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT3 = 0x8C4E; static constexpr const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT3 = 0x8C4E;
static constexpr const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT5 = 0x8C4F; static constexpr const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT5 = 0x8C4F;
static constexpr const GLenum TEXTURE_FORMAT_SRGB_OVERRIDE = 0x8FBF; static constexpr const GLenum TEXTURE_FORMAT_SRGB_OVERRIDE = 0x8FBF;
static constexpr const GLenum ALPHA32F = 0x8816; static constexpr const GLenum NUM_SURFACE_COMPRESSION_FIXED_RATES = 0x8F6E;
static constexpr const GLenum LUMINANCE32F = 0x8818; static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_1BPC = 0x96C4;
static constexpr const GLenum LUMINANCE_ALPHA32F = 0x8819; static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_2BPC = 0x96C5;
static constexpr const GLenum ALPHA16F = 0x881C; static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_3BPC = 0x96C6;
static constexpr const GLenum LUMINANCE16F = 0x881E; static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_4BPC = 0x96C7;
static constexpr const GLenum LUMINANCE_ALPHA16F = 0x881F; static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_5BPC = 0x96C8;
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_6BPC = 0x96C9;
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_7BPC = 0x96CA;
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_8BPC = 0x96CB;
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_9BPC = 0x96CC;
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_10BPC = 0x96CD;
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_11BPC = 0x96CE;
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_12BPC = 0x96CF;
static constexpr const GLenum GCCSO_SHADER_BINARY_FJ = 0x9260; static constexpr const GLenum GCCSO_SHADER_BINARY_FJ = 0x9260;
static constexpr const GLenum STATE_RESTORE = 0x8BDC; static constexpr const GLenum STATE_RESTORE = 0x8BDC;
static constexpr const GLenum SHADER_BINARY_VIV = 0x8FC4; static constexpr const GLenum SHADER_BINARY_VIV = 0x8FC4;
@ -3151,5 +3191,5 @@ public:
static constexpr const GLenum NONE = 0; static constexpr const GLenum NONE = 0;
}; };
//Global GL procedures object. // Global GL procedures object.
IRRLICHT_API extern OpenGLProcedures GL; IRRLICHT_API extern OpenGLProcedures GL;

@ -355,7 +355,7 @@ f:write[[
#include <KHR/khrplatform.h> #include <KHR/khrplatform.h>
#ifndef APIENTRY #ifndef APIENTRY
#define APIENTRY #define APIENTRY KHRONOS_APIENTRY
#endif #endif
#ifndef APIENTRYP #ifndef APIENTRYP
#define APIENTRYP APIENTRY * #define APIENTRYP APIENTRY *
@ -387,9 +387,9 @@ public:
// Call this once after creating the context. // Call this once after creating the context.
void LoadAllProcedures(irr::video::IContextManager *cmgr); void LoadAllProcedures(irr::video::IContextManager *cmgr);
// Check if an extension is supported. // Check if an extension is supported.
inline bool IsExtensionPresent(const std::string &ext) inline bool IsExtensionPresent(const std::string &ext) const
{ {
return extensions.find(ext) != extensions.end(); return extensions.count(ext) > 0;
} }
]]; ]];
@ -403,13 +403,16 @@ f:write[[
static constexpr const GLenum NONE = 0; static constexpr const GLenum NONE = 0;
]]; ]];
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( "IRRLICHT_API extern OpenGLProcedures GL;\n" );
f:close(); f:close();
-- Write loader implementation -- Write loader implementation
f = io.open( sourceTreePath .. "/source/Irrlicht/mt_opengl_loader.cpp", "wb" ); f = io.open( sourceTreePath .. "/source/Irrlicht/mt_opengl_loader.cpp", "wb" );
f:write[[ f:write[[
// This code was generated by scripts/BindingGenerator.lua
// Do not modify it, modify and run the generator instead.
#include "mt_opengl.h" #include "mt_opengl.h"
#include <string> #include <string>
#include <sstream> #include <sstream>
@ -423,9 +426,24 @@ void OpenGLProcedures::LoadAllProcedures(irr::video::IContextManager *cmgr)
f:write( loader:Concat() ); f:write( loader:Concat() );
f:write[[ f:write[[
// OpenGL 3 way to enumerate extensions
GLint ext_count = 0;
GetIntegerv(NUM_EXTENSIONS, &ext_count);
extensions.reserve(ext_count);
for (GLint k = 0; k < ext_count; k++) {
auto tmp = GetStringi(EXTENSIONS, k);
if (tmp)
extensions.emplace((char*)tmp);
}
if (!extensions.empty())
return;
// OpenGL 2 / ES 2 way to enumerate extensions
auto ext_str = GetString(EXTENSIONS);
if (!ext_str)
return;
// get the extension string, chop it up // get the extension string, chop it up
std::string ext_string = std::string((char*)GetString(EXTENSIONS)); std::stringstream ext_ss((char*)ext_str);
std::stringstream ext_ss(ext_string);
std::string tmp; std::string tmp;
while (std::getline(ext_ss, tmp, ' ')) while (std::getline(ext_ss, tmp, ' '))
extensions.emplace(tmp); extensions.emplace(tmp);

@ -9,10 +9,10 @@ with_sdl=0
#with_gl3=0 #with_gl3=0
#[[ "$extras" == *"-gl3"* ]] && with_gl3=1 #[[ "$extras" == *"-gl3"* ]] && with_gl3=1
libjpeg_version=2.1.5.1 libjpeg_version=3.0.1
libpng_version=1.6.39 libpng_version=1.6.40
sdl2_version=2.28.1 sdl2_version=2.28.5
zlib_version=1.2.13 zlib_version=1.3
download () { download () {
local url=$1 local url=$1
@ -43,10 +43,14 @@ tmp=(
-DZLIB_LIBRARY=$libs/zlib/lib/libz.dll.a \ -DZLIB_LIBRARY=$libs/zlib/lib/libz.dll.a \
-DZLIB_INCLUDE_DIR=$libs/zlib/include -DZLIB_INCLUDE_DIR=$libs/zlib/include
) )
[ $with_sdl -eq 1 ] && tmp+=( if [ $with_sdl -eq 1 ]; then
tmp+=(
-DUSE_SDL2=ON -DUSE_SDL2=ON
-DCMAKE_PREFIX_PATH=$libs/sdl2/lib/cmake -DCMAKE_PREFIX_PATH=$libs/sdl2/lib/cmake
) )
else
tmp+=(-DUSE_SDL2=OFF)
fi
#[ $with_gl3 -eq 1 ] && tmp+=(-DENABLE_OPENGL=OFF -DENABLE_OPENGL3=ON) #[ $with_gl3 -eq 1 ] && tmp+=(-DENABLE_OPENGL=OFF -DENABLE_OPENGL3=ON)
cmake . "${tmp[@]}" cmake . "${tmp[@]}"

@ -3,8 +3,8 @@ set -e
topdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" topdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
[ -z "$1" ] && exit 255 [ -z "$1" ] && exit 255
ver=11.2.0 ver=13.2.0
os=ubuntu20.04 os=ubuntu22.04
name="mingw-w64-${1}_${ver}_${os}.tar.xz" name="mingw-w64-${1}_${ver}_${os}.tar.xz"
wget "http://minetest.kitsunemimi.pw/$name" -O "$name" wget "http://minetest.kitsunemimi.pw/$name" -O "$name"
sha256sum -w -c <(grep -F "$name" "$topdir/sha256sums.txt") sha256sum -w -c <(grep -F "$name" "$topdir/sha256sums.txt")

@ -1,10 +1,10 @@
934ef7f3897cebcbf39eed2fcb0be084c1ff1af4352ebc1f19cfb4a60020b1c7 libjpeg-2.1.5.1-win32.zip a7dc54d5fb9f841eae26ee17f6146c0b7a0e5d99a914866a394b723dffc83316 libjpeg-3.0.1-win32.zip
2b3054ddfd66c2b3f97ac65fb2b80be05649eeab98a822b952cbe388038d4aa1 libjpeg-2.1.5.1-win64.zip cd1f667ed2d24d96e1d61fcf91ba6d7b11270a4903e36f08e640971884caaccd libjpeg-3.0.1-win64.zip
9d8d97c1af52d88d6fc44902375fb42225f0ee5cbf2199997d278579770f8850 libpng-1.6.39-win32.zip 72a624fbaef15909f80976c9c569717e9438bd34c3209071378f05487e859f8a libpng-1.6.40-win32.zip
a4209e4de00f1674ba4cedf2ddf23881d429f6d2b5f9a4a26945c7cfbf12c384 libpng-1.6.39-win64.zip 8e2552f6965c385f7e2467018d583fd206744db18e36656ddf1c07c8663ea23f libpng-1.6.40-win64.zip
704817351dc54a5a4bb3b35db9316f4ff1b073b231b5f8dbbc3b4ff2f3e30fbe mingw-w64-i686_11.2.0_ubuntu20.04.tar.xz 9f0cfab8ca089d48be7a59f85d5fd5648f18f54c91d7ac6c31b281ba5e90852a mingw-w64-i686_13.2.0_ubuntu22.04.tar.xz
d85ec9a7debe470ebeaa002af0a2843b83d40405d2a45fcc586c19f179362aab mingw-w64-x86_64_11.2.0_ubuntu20.04.tar.xz 93bc9f04d43a023358d1ae2b76dec42d3d79baecd452402ee9fb3ee21945fdfe mingw-w64-x86_64_13.2.0_ubuntu22.04.tar.xz
192a14f42de64d65bbd3ba320330a51e8e05aa67afc4e300690cc9fc8b2d11b3 sdl2-2.28.1-win32.zip 2abdc82b4cac710bab0b3e9f9a9c38cc242abcca443c1e1f7af51d29a5eb5457 sdl2-2.28.5-win32.zip
247d5ab923449fea042a8c47318a77e75ef3c056283049ad550935dae29fc26b sdl2-2.28.1-win64.zip 949a3de77d1c97240ee4b35e15495962b5effb816f7f03efe5c6edd8975a8b19 sdl2-2.28.5-win64.zip
e9bab0a6fe07bcf6c5a8ff171dd63983e67f3aefd9b8f38e88bf20a3dc44678f zlib-1.2.13-win32.zip 3c5abd40e9492c834651d995db6bbf0f57a7579d091d2d03110293b95e9b039a zlib-1.3-win32.zip
9f3d4fd89958081917d2fdcaab1bbc947e3fb070d8b39a48d9cf11269dd52c24 zlib-1.2.13-win64.zip f63d9a38c2ee56fa1e95a486224c274412cb5b3275734c1da53b0a68a7e8c654 zlib-1.3-win64.zip

@ -193,6 +193,11 @@ bool CIrrDeviceAndroid::isWindowMinimized() const
return !Focused; return !Focused;
} }
bool CIrrDeviceAndroid::isWindowVisible() const
{
return !Paused;
}
void CIrrDeviceAndroid::closeDevice() void CIrrDeviceAndroid::closeDevice()
{ {
ANativeActivity_finish(Android->activity); ANativeActivity_finish(Android->activity);

@ -36,6 +36,8 @@ namespace irr
virtual bool isWindowMinimized() const; virtual bool isWindowMinimized() const;
virtual bool isWindowVisible() const;
virtual void closeDevice(); virtual void closeDevice();
virtual void setResizable(bool resize = false); virtual void setResizable(bool resize = false);

@ -555,7 +555,11 @@ bool CIrrDeviceSDL::run()
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT; irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
irrevent.MouseInput.Event = irr::EMIE_MOUSE_WHEEL; irrevent.MouseInput.Event = irr::EMIE_MOUSE_WHEEL;
#if SDL_VERSION_ATLEAST(2, 0, 18)
irrevent.MouseInput.Wheel = SDL_event.wheel.preciseY; irrevent.MouseInput.Wheel = SDL_event.wheel.preciseY;
#else
irrevent.MouseInput.Wheel = SDL_event.wheel.y;
#endif
irrevent.MouseInput.Shift = (keymod & KMOD_SHIFT) != 0; irrevent.MouseInput.Shift = (keymod & KMOD_SHIFT) != 0;
irrevent.MouseInput.Control = (keymod & KMOD_CTRL) != 0; irrevent.MouseInput.Control = (keymod & KMOD_CTRL) != 0;
irrevent.MouseInput.X = MouseX; irrevent.MouseInput.X = MouseX;

@ -1,5 +1,9 @@
if(NOT ANDROID AND NOT APPLE)
set(DEFAULT_SDL2 ON)
endif()
option(BUILD_SHARED_LIBS "Build shared library" TRUE) option(BUILD_SHARED_LIBS "Build shared library" TRUE)
option(USE_SDL2 "Use the SDL2 backend" FALSE) option(USE_SDL2 "Use the SDL2 backend" ${DEFAULT_SDL2})
# Compiler flags # Compiler flags
@ -25,7 +29,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
set(CMAKE_CXX_FLAGS_RELEASE "-O3") set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_DEBUG "-g")
add_compile_options(-Wall -pipe -fno-exceptions -fno-rtti) add_compile_options(-Wall -pipe -fno-exceptions)
# Enable SSE for floating point math on 32-bit x86 by default # Enable SSE for floating point math on 32-bit x86 by default
# reasoning see minetest issue #11810 and https://gcc.gnu.org/wiki/FloatingPointMath # reasoning see minetest issue #11810 and https://gcc.gnu.org/wiki/FloatingPointMath

@ -159,10 +159,11 @@ const c8* COSOperator::getTextFromClipboard() const
if (!OpenClipboard(NULL)) if (!OpenClipboard(NULL))
return 0; return 0;
wchar_t * buffer = 0;
HANDLE hData = GetClipboardData( CF_UNICODETEXT ); HANDLE hData = GetClipboardData( CF_UNICODETEXT );
buffer = (wchar_t*) GlobalLock( hData ); if (hData == NULL) // Probably not in Unicode text format
return 0;
wchar_t * buffer = (wchar_t*) GlobalLock( hData );
core::wStringToUTF8(ClipboardBuf, buffer); core::wStringToUTF8(ClipboardBuf, buffer);

@ -561,6 +561,10 @@ protected:
u32 width = Size.Width >> level; u32 width = Size.Width >> level;
u32 height = Size.Height >> level; u32 height = Size.Height >> level;
if (width < 1)
width = 1;
if (height < 1)
height = 1;
GLenum tmpTextureType = TextureType; GLenum tmpTextureType = TextureType;

@ -119,7 +119,7 @@
* This follows the return type of the function and precedes the function * This follows the return type of the function and precedes the function
* name in the function prototype. * name in the function prototype.
*/ */
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(KHRONOS_STATIC) #if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
/* Win32 but not WinCE */ /* Win32 but not WinCE */
# define KHRONOS_APIENTRY __stdcall # define KHRONOS_APIENTRY __stdcall
#else #else
@ -153,6 +153,20 @@ typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t; typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1 #define KHRONOS_SUPPORT_FLOAT 1
/*
* To support platform where unsigned long cannot be used interchangeably with
* inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t.
* Ideally, we could just use (u)intptr_t everywhere, but this could result in
* ABI breakage if khronos_uintptr_t is changed from unsigned long to
* unsigned long long or similar (this results in different C++ name mangling).
* To avoid changes for existing platforms, we restrict usage of intptr_t to
* platforms where the size of a pointer is larger than the size of long.
*/
#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__)
#if __SIZEOF_POINTER__ > __SIZEOF_LONG__
#define KHRONOS_USE_INTPTR_T
#endif
#endif
#elif defined(__VMS ) || defined(__sgi) #elif defined(__VMS ) || defined(__sgi)
@ -235,14 +249,21 @@ typedef unsigned short int khronos_uint16_t;
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
* to be the only LLP64 architecture in current use. * to be the only LLP64 architecture in current use.
*/ */
#ifdef _WIN64 #ifdef KHRONOS_USE_INTPTR_T
typedef intptr_t khronos_intptr_t;
typedef uintptr_t khronos_uintptr_t;
#elif defined(_WIN64)
typedef signed long long int khronos_intptr_t; typedef signed long long int khronos_intptr_t;
typedef unsigned long long int khronos_uintptr_t; typedef unsigned long long int khronos_uintptr_t;
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else #else
typedef signed long int khronos_intptr_t; typedef signed long int khronos_intptr_t;
typedef unsigned long int khronos_uintptr_t; typedef unsigned long int khronos_uintptr_t;
#endif
#if defined(_WIN64)
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else
typedef signed long int khronos_ssize_t; typedef signed long int khronos_ssize_t;
typedef unsigned long int khronos_usize_t; typedef unsigned long int khronos_usize_t;
#endif #endif

@ -1,3 +1,6 @@
// This code was generated by scripts/BindingGenerator.lua
// Do not modify it, modify and run the generator instead.
#include "mt_opengl.h" #include "mt_opengl.h"
#include <string> #include <string>
#include <sstream> #include <sstream>
@ -684,7 +687,6 @@ void OpenGLProcedures::LoadAllProcedures(irr::video::IContextManager *cmgr)
if (!MultiDrawElementsIndirectCount) MultiDrawElementsIndirectCount = (PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC_MT)cmgr->getProcAddress("glMultiDrawElementsIndirectCount"); if (!MultiDrawElementsIndirectCount) MultiDrawElementsIndirectCount = (PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC_MT)cmgr->getProcAddress("glMultiDrawElementsIndirectCount");
if (!MultiDrawElementsIndirectCount) MultiDrawElementsIndirectCount = (PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC_MT)cmgr->getProcAddress("glMultiDrawElementsIndirectCountARB"); if (!MultiDrawElementsIndirectCount) MultiDrawElementsIndirectCount = (PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC_MT)cmgr->getProcAddress("glMultiDrawElementsIndirectCountARB");
if (!PolygonOffsetClamp) PolygonOffsetClamp = (PFNGLPOLYGONOFFSETCLAMPPROC_MT)cmgr->getProcAddress("glPolygonOffsetClamp"); if (!PolygonOffsetClamp) PolygonOffsetClamp = (PFNGLPOLYGONOFFSETCLAMPPROC_MT)cmgr->getProcAddress("glPolygonOffsetClamp");
if (!GenPerfMonitorsEX) GenPerfMonitorsEX = (PFNGLGENPERFMONITORSEXPROC_MT)cmgr->getProcAddress("glGenPerfMonitorsEX");
if (!PrimitiveBoundingBox) PrimitiveBoundingBox = (PFNGLPRIMITIVEBOUNDINGBOXPROC_MT)cmgr->getProcAddress("glPrimitiveBoundingBoxARB"); if (!PrimitiveBoundingBox) PrimitiveBoundingBox = (PFNGLPRIMITIVEBOUNDINGBOXPROC_MT)cmgr->getProcAddress("glPrimitiveBoundingBoxARB");
if (!GetTextureHandle) GetTextureHandle = (PFNGLGETTEXTUREHANDLEPROC_MT)cmgr->getProcAddress("glGetTextureHandleARB"); if (!GetTextureHandle) GetTextureHandle = (PFNGLGETTEXTUREHANDLEPROC_MT)cmgr->getProcAddress("glGetTextureHandleARB");
if (!GetTextureSamplerHandle) GetTextureSamplerHandle = (PFNGLGETTEXTURESAMPLERHANDLEPROC_MT)cmgr->getProcAddress("glGetTextureSamplerHandleARB"); if (!GetTextureSamplerHandle) GetTextureSamplerHandle = (PFNGLGETTEXTURESAMPLERHANDLEPROC_MT)cmgr->getProcAddress("glGetTextureSamplerHandleARB");
@ -757,12 +759,15 @@ void OpenGLProcedures::LoadAllProcedures(irr::video::IContextManager *cmgr)
if (!TexPageCommitment) TexPageCommitment = (PFNGLTEXPAGECOMMITMENTPROC_MT)cmgr->getProcAddress("glTexPageCommitmentARB"); if (!TexPageCommitment) TexPageCommitment = (PFNGLTEXPAGECOMMITMENTPROC_MT)cmgr->getProcAddress("glTexPageCommitmentARB");
// OpenGL 3 way to enumerate extensions // OpenGL 3 way to enumerate extensions
int ext_count = 0; GLint ext_count = 0;
GetIntegerv(NUM_EXTENSIONS, &ext_count); GetIntegerv(NUM_EXTENSIONS, &ext_count);
extensions.reserve(ext_count); extensions.reserve(ext_count);
for (int k = 0; k < ext_count; k++) for (GLint k = 0; k < ext_count; k++) {
extensions.emplace((char *)GetStringi(EXTENSIONS, k)); auto tmp = GetStringi(EXTENSIONS, k);
if (ext_count) if (tmp)
extensions.emplace((char*)tmp);
}
if (!extensions.empty())
return; return;
// OpenGL 2 / ES 2 way to enumerate extensions // OpenGL 2 / ES 2 way to enumerate extensions
@ -774,4 +779,5 @@ void OpenGLProcedures::LoadAllProcedures(irr::video::IContextManager *cmgr)
std::string tmp; std::string tmp;
while (std::getline(ext_ss, tmp, ' ')) while (std::getline(ext_ss, tmp, ' '))
extensions.emplace(tmp); extensions.emplace(tmp);
} }