mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-16 15:30:25 +01:00
Merge branch 'master' into patch-2
This commit is contained in:
commit
e9f7f5074c
104
.github/workflows/build.yml
vendored
104
.github/workflows/build.yml
vendored
|
@ -8,16 +8,13 @@ on:
|
|||
jobs:
|
||||
|
||||
linux-gl:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ubuntu:bionic
|
||||
env: { LANG: "C.UTF-8" }
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install deps
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install g++ cmake libxi-dev libgl1-mesa-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
|
||||
sudo apt-get update
|
||||
sudo apt-get install g++ cmake libxi-dev libgl1-mesa-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
|
@ -39,16 +36,14 @@ jobs:
|
|||
path: ./irrlicht-linux.tar.gz
|
||||
|
||||
linux-gles:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ubuntu:bionic
|
||||
env: { LANG: "C.UTF-8" }
|
||||
# Xvfb test is broken on 20.04 for unknown reasons (not our bug)
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install deps
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install g++ cmake libxi-dev libgles2-mesa-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
|
||||
sudo apt-get update
|
||||
sudo apt-get install g++ cmake libxi-dev libgles2-mesa-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
|
@ -66,16 +61,13 @@ jobs:
|
|||
LIBGL_ALWAYS_SOFTWARE=true xvfb-run ./AutomatedTest ogles2
|
||||
|
||||
linux-sdl:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ubuntu:jammy
|
||||
env: { LANG: "C.UTF-8" }
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install deps
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
|
||||
sudo apt-get update
|
||||
sudo apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
|
@ -88,16 +80,14 @@ jobs:
|
|||
./AutomatedTest null
|
||||
|
||||
linux-sdl-gl3:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ubuntu:jammy
|
||||
env: { LANG: "C.UTF-8" }
|
||||
# Xvfb test is broken on 20.04 for unknown reasons (not our bug)
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install deps
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
|
||||
sudo apt-get update
|
||||
sudo apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
|
@ -115,16 +105,13 @@ jobs:
|
|||
LIBGL_ALWAYS_SOFTWARE=true xvfb-run ./AutomatedTest opengl3
|
||||
|
||||
linux-sdl-gles2:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ubuntu:jammy
|
||||
env: { LANG: "C.UTF-8" }
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install deps
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
|
||||
sudo apt-get update
|
||||
sudo apt-get install g++ cmake libsdl2-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
|
@ -190,6 +177,20 @@ jobs:
|
|||
run: |
|
||||
./bin/OSX/AutomatedTest null
|
||||
|
||||
macos-sdl:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install deps
|
||||
run: |
|
||||
brew update
|
||||
brew install cmake libpng jpeg sdl2
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake . -DCMAKE_FIND_FRAMEWORK=LAST -DBUILD_EXAMPLES=1 -DUSE_SDL2=1
|
||||
make -j3
|
||||
|
||||
msvc:
|
||||
name: VS 2019 ${{ matrix.config.arch }} ${{ matrix.sdl.label }}
|
||||
runs-on: windows-2019
|
||||
|
@ -257,3 +258,46 @@ jobs:
|
|||
with:
|
||||
name: msvc-${{ matrix.config.arch }}
|
||||
path: artifact/
|
||||
|
||||
android:
|
||||
name: Android ${{ matrix.arch }}
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
ndk_version: "r25c"
|
||||
ANDROID_NDK: ${{ github.workspace }}/android-ndk
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [armeabi-v7a, arm64-v8a, x86, x86_64]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo rm /var/lib/man-db/auto-update
|
||||
sudo apt-get update
|
||||
sudo apt-get install -qyy wget unzip zip gcc-multilib make cmake
|
||||
|
||||
- name: Cache NDK
|
||||
id: cache-ndk
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
key: android-ndk-${{ env.ndk_version }}-linux
|
||||
path: ${{ env.ANDROID_NDK }}
|
||||
|
||||
- name: Install NDK
|
||||
run: |
|
||||
wget --progress=bar:force "http://dl.google.com/android/repository/android-ndk-${ndk_version}-linux.zip"
|
||||
unzip -q "android-ndk-${ndk_version}-linux.zip"
|
||||
rm "android-ndk-${ndk_version}-linux.zip"
|
||||
mv "android-ndk-${ndk_version}" "${ANDROID_NDK}"
|
||||
if: ${{ steps.cache-ndk.outputs.cache-hit != 'true' }}
|
||||
|
||||
- name: Build
|
||||
run: ./scripts/ci-build-android.sh ${{ matrix.arch }}
|
||||
|
||||
#- name: Upload Artifact
|
||||
# uses: actions/upload-artifact@v3
|
||||
# with:
|
||||
# name: irrlicht-android-${{ matrix.arch }}
|
||||
# path: ${{ runner.temp }}/pkg/${{ matrix.arch }}
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
# >=3.9 enables IPO; >=3.11 prefers GLVND
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.11)
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
else()
|
||||
cmake_policy(VERSION 3.11)
|
||||
endif()
|
||||
|
||||
set(IRRLICHTMT_REVISION 13)
|
||||
set(IRRLICHTMT_REVISION 15)
|
||||
|
||||
project(Irrlicht
|
||||
VERSION 1.9.0.${IRRLICHTMT_REVISION}
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
if(NOT TARGET IrrlichtMt::IrrlichtMt)
|
||||
# private dependency only explicitly needed with static libs
|
||||
if(@USE_SDL2@ AND NOT @BUILD_SHARED_LIBS@)
|
||||
find_dependency(SDL2)
|
||||
endif()
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/IrrlichtMtTargets.cmake")
|
||||
endif()
|
||||
|
|
|
@ -121,21 +121,6 @@ namespace video
|
|||
//! Support for texture coord transformation via texture matrix
|
||||
EVDF_TEXTURE_MATRIX,
|
||||
|
||||
//! Support for DXTn compressed textures.
|
||||
EVDF_TEXTURE_COMPRESSED_DXT,
|
||||
|
||||
//! Support for PVRTC compressed textures.
|
||||
EVDF_TEXTURE_COMPRESSED_PVRTC,
|
||||
|
||||
//! Support for PVRTC2 compressed textures.
|
||||
EVDF_TEXTURE_COMPRESSED_PVRTC2,
|
||||
|
||||
//! Support for ETC1 compressed textures.
|
||||
EVDF_TEXTURE_COMPRESSED_ETC1,
|
||||
|
||||
//! Support for ETC2 compressed textures.
|
||||
EVDF_TEXTURE_COMPRESSED_ETC2,
|
||||
|
||||
//! Support for cube map textures.
|
||||
EVDF_TEXTURE_CUBEMAP,
|
||||
|
||||
|
|
103
include/IImage.h
103
include/IImage.h
|
@ -362,28 +362,6 @@ public:
|
|||
return 24;
|
||||
case ECF_A8R8G8B8:
|
||||
return 32;
|
||||
case ECF_DXT1:
|
||||
return 16;
|
||||
case ECF_DXT2:
|
||||
case ECF_DXT3:
|
||||
case ECF_DXT4:
|
||||
case ECF_DXT5:
|
||||
return 32;
|
||||
case ECF_PVRTC_RGB2:
|
||||
return 12;
|
||||
case ECF_PVRTC_ARGB2:
|
||||
case ECF_PVRTC2_ARGB2:
|
||||
return 16;
|
||||
case ECF_PVRTC_RGB4:
|
||||
return 24;
|
||||
case ECF_PVRTC_ARGB4:
|
||||
case ECF_PVRTC2_ARGB4:
|
||||
return 32;
|
||||
case ECF_ETC1:
|
||||
case ECF_ETC2_RGB:
|
||||
return 24;
|
||||
case ECF_ETC2_ARGB:
|
||||
return 32;
|
||||
case ECF_D16:
|
||||
return 16;
|
||||
case ECF_D32:
|
||||
|
@ -418,74 +396,17 @@ public:
|
|||
//! calculate image data size in bytes for selected format, width and height.
|
||||
static u32 getDataSizeFromFormat(ECOLOR_FORMAT format, u32 width, u32 height)
|
||||
{
|
||||
u32 imageSize = 0;
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case ECF_DXT1:
|
||||
imageSize = ((width + 3) / 4) * ((height + 3) / 4) * 8;
|
||||
break;
|
||||
case ECF_DXT2:
|
||||
case ECF_DXT3:
|
||||
case ECF_DXT4:
|
||||
case ECF_DXT5:
|
||||
imageSize = ((width + 3) / 4) * ((height + 3) / 4) * 16;
|
||||
break;
|
||||
case ECF_PVRTC_RGB2:
|
||||
case ECF_PVRTC_ARGB2:
|
||||
imageSize = (core::max_<u32>(width, 16) * core::max_<u32>(height, 8) * 2 + 7) / 8;
|
||||
break;
|
||||
case ECF_PVRTC_RGB4:
|
||||
case ECF_PVRTC_ARGB4:
|
||||
imageSize = (core::max_<u32>(width, 8) * core::max_<u32>(height, 8) * 4 + 7) / 8;
|
||||
break;
|
||||
case ECF_PVRTC2_ARGB2:
|
||||
imageSize = core::ceil32(width / 8.0f) * core::ceil32(height / 4.0f) * 8;
|
||||
break;
|
||||
case ECF_PVRTC2_ARGB4:
|
||||
case ECF_ETC1:
|
||||
case ECF_ETC2_RGB:
|
||||
imageSize = core::ceil32(width / 4.0f) * core::ceil32(height / 4.0f) * 8;
|
||||
break;
|
||||
case ECF_ETC2_ARGB:
|
||||
imageSize = core::ceil32(width / 4.0f) * core::ceil32(height / 4.0f) * 16;
|
||||
break;
|
||||
default: // uncompressed formats
|
||||
imageSize = getBitsPerPixelFromFormat(format) / 8 * width;
|
||||
imageSize *= height;
|
||||
break;
|
||||
}
|
||||
// non-compressed formats
|
||||
u32 imageSize = getBitsPerPixelFromFormat(format) / 8 * width;
|
||||
imageSize *= height;
|
||||
|
||||
return imageSize;
|
||||
}
|
||||
|
||||
// Define to check for all compressed image formats cases in a switch
|
||||
#define IRR_CASE_IIMAGE_COMPRESSED_FORMAT\
|
||||
case ECF_DXT1:\
|
||||
case ECF_DXT2:\
|
||||
case ECF_DXT3:\
|
||||
case ECF_DXT4:\
|
||||
case ECF_DXT5:\
|
||||
case ECF_PVRTC_RGB2:\
|
||||
case ECF_PVRTC_ARGB2:\
|
||||
case ECF_PVRTC2_ARGB2:\
|
||||
case ECF_PVRTC_RGB4:\
|
||||
case ECF_PVRTC_ARGB4:\
|
||||
case ECF_PVRTC2_ARGB4:\
|
||||
case ECF_ETC1:\
|
||||
case ECF_ETC2_RGB:\
|
||||
case ECF_ETC2_ARGB:
|
||||
|
||||
//! check if this is compressed color format
|
||||
static bool isCompressedFormat(const ECOLOR_FORMAT format)
|
||||
{
|
||||
switch(format)
|
||||
{
|
||||
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//! check if the color format is only viable for depth/stencil textures
|
||||
|
@ -523,22 +444,6 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
#if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0)
|
||||
static bool isRenderTargetOnlyFormat(const ECOLOR_FORMAT format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case ECF_A1R5G5B5:
|
||||
case ECF_R5G6B5:
|
||||
case ECF_R8G8B8:
|
||||
case ECF_A8R8G8B8:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
ECOLOR_FORMAT Format;
|
||||
core::dimension2d<u32> Size;
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
#include "aabbox3d.h"
|
||||
#include "matrix4.h"
|
||||
#include "IAttributes.h"
|
||||
|
||||
#include <list>
|
||||
#include <optional>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -116,23 +118,14 @@ namespace scene
|
|||
|
||||
//! Returns the name of the node.
|
||||
/** \return Name as character string. */
|
||||
virtual const c8* getName() const
|
||||
virtual const std::optional<std::string> &getName() const
|
||||
{
|
||||
return Name.c_str();
|
||||
return Name;
|
||||
}
|
||||
|
||||
|
||||
//! Sets the name of the node.
|
||||
/** \param name New name of the scene node. */
|
||||
virtual void setName(const c8* name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
|
||||
//! Sets the name of the node.
|
||||
/** \param name New name of the scene node. */
|
||||
virtual void setName(const core::stringc& name)
|
||||
virtual void setName(const std::optional<std::string> &name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
@ -275,31 +268,31 @@ namespace scene
|
|||
|
||||
child->grab();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! 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.
|
||||
\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)
|
||||
{
|
||||
ISceneNodeList::iterator it = Children.begin();
|
||||
for (; it != Children.end(); ++it)
|
||||
if ((*it) == child)
|
||||
{
|
||||
(*it)->Parent = 0;
|
||||
(*it)->drop();
|
||||
Children.erase(it);
|
||||
return true;
|
||||
}
|
||||
if (child->Parent != this)
|
||||
return false;
|
||||
|
||||
return false;
|
||||
// The iterator must be set since the parent is not null.
|
||||
_IRR_DEBUG_BREAK_IF(!child->ThisIterator.has_value());
|
||||
auto it = *child->ThisIterator;
|
||||
child->ThisIterator = std::nullopt;
|
||||
child->Parent = nullptr;
|
||||
child->drop();
|
||||
Children.erase(it);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -309,13 +302,11 @@ namespace scene
|
|||
*/
|
||||
virtual void removeAll()
|
||||
{
|
||||
ISceneNodeList::iterator it = Children.begin();
|
||||
for (; it != Children.end(); ++it)
|
||||
{
|
||||
(*it)->Parent = 0;
|
||||
(*it)->drop();
|
||||
for (auto &child : Children) {
|
||||
child->Parent = nullptr;
|
||||
child->ThisIterator = std::nullopt;
|
||||
child->drop();
|
||||
}
|
||||
|
||||
Children.clear();
|
||||
}
|
||||
|
||||
|
@ -508,10 +499,8 @@ namespace scene
|
|||
grab();
|
||||
remove();
|
||||
|
||||
Parent = newParent;
|
||||
|
||||
if (Parent)
|
||||
Parent->addChild(this);
|
||||
if (newParent)
|
||||
newParent->addChild(this);
|
||||
|
||||
drop();
|
||||
}
|
||||
|
@ -604,7 +593,7 @@ namespace scene
|
|||
}
|
||||
|
||||
//! Name of the scene node.
|
||||
core::stringc Name;
|
||||
std::optional<std::string> Name;
|
||||
|
||||
//! Absolute transformation of the node.
|
||||
core::matrix4 AbsoluteTransformation;
|
||||
|
@ -618,12 +607,15 @@ namespace scene
|
|||
//! Relative scale of the scene node.
|
||||
core::vector3df RelativeScale;
|
||||
|
||||
//! Pointer to the parent
|
||||
ISceneNode* Parent;
|
||||
|
||||
//! List of all children of this node
|
||||
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
|
||||
ISceneManager* SceneManager;
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include "IAnimatedMesh.h"
|
||||
#include "SSkinMeshBuffer.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace scene
|
||||
|
@ -41,12 +43,12 @@ namespace scene
|
|||
/** \param number: Zero based index of joint. The last joint
|
||||
has the number getJointCount()-1;
|
||||
\return Name of joint and null if an error happened. */
|
||||
virtual const c8* getJointName(u32 number) const = 0;
|
||||
virtual const std::optional<std::string> &getJointName(u32 number) const = 0;
|
||||
|
||||
//! Gets a joint number from its name
|
||||
/** \param name: Name of the joint.
|
||||
\return Number of the joint or -1 if not found. */
|
||||
virtual s32 getJointNumber(const c8* name) const = 0;
|
||||
\return Number of the joint or std::nullopt if not found. */
|
||||
virtual std::optional<u32> getJointNumber(const std::string &name) const = 0;
|
||||
|
||||
//! Use animation from another mesh
|
||||
/** The animation is linked (not copied) based on joint names
|
||||
|
@ -136,7 +138,7 @@ namespace scene
|
|||
}
|
||||
|
||||
//! The name of this joint
|
||||
core::stringc Name;
|
||||
std::optional<std::string> Name;
|
||||
|
||||
//! Local matrix of this joint
|
||||
core::matrix4 LocalMatrix;
|
||||
|
|
|
@ -292,11 +292,6 @@ public:
|
|||
{
|
||||
case ECF_A8R8G8B8:
|
||||
case ECF_A1R5G5B5:
|
||||
case ECF_DXT1:
|
||||
case ECF_DXT2:
|
||||
case ECF_DXT3:
|
||||
case ECF_DXT4:
|
||||
case ECF_DXT5:
|
||||
case ECF_A16B16G16R16F:
|
||||
case ECF_A32B32G32R32F:
|
||||
status = true;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
#pragma once
|
||||
|
||||
//! Identifies the IrrlichtMt fork customized for the Minetest engine
|
||||
#define IRRLICHT_VERSION_MT_REVISION 13
|
||||
#define IRRLICHT_VERSION_MT "mt13"
|
||||
#define IRRLICHT_VERSION_MT_REVISION 15
|
||||
#define IRRLICHT_VERSION_MT "mt15"
|
||||
|
||||
//! Irrlicht SDK Version
|
||||
#define IRRLICHT_VERSION_MAJOR 1
|
||||
|
|
|
@ -177,6 +177,13 @@ namespace irr
|
|||
/** \return True if window is fullscreen. */
|
||||
virtual bool isFullscreen() const = 0;
|
||||
|
||||
//! Checks if the window could possibly be visible.
|
||||
//! Currently, this only returns false when the activity is stopped on
|
||||
//! Android. Note that for Android activities, "stopped" means something
|
||||
//! different than you might expect (and also something different than
|
||||
//! "paused"). Read the Android lifecycle documentation.
|
||||
virtual bool isWindowVisible() const { return true; };
|
||||
|
||||
//! Get the current color format of the window
|
||||
/** \return Color format of the window. */
|
||||
virtual video::ECOLOR_FORMAT getColorFormat() const = 0;
|
||||
|
|
|
@ -37,50 +37,6 @@ namespace video
|
|||
//! Warning: This tends to be BGRA in memory (it's ARGB on file, but with usual big-endian memory it's flipped)
|
||||
ECF_A8R8G8B8,
|
||||
|
||||
/** Compressed image formats. **/
|
||||
|
||||
//! DXT1 color format.
|
||||
ECF_DXT1,
|
||||
|
||||
//! DXT2 color format.
|
||||
ECF_DXT2,
|
||||
|
||||
//! DXT3 color format.
|
||||
ECF_DXT3,
|
||||
|
||||
//! DXT4 color format.
|
||||
ECF_DXT4,
|
||||
|
||||
//! DXT5 color format.
|
||||
ECF_DXT5,
|
||||
|
||||
//! PVRTC RGB 2bpp.
|
||||
ECF_PVRTC_RGB2,
|
||||
|
||||
//! PVRTC ARGB 2bpp.
|
||||
ECF_PVRTC_ARGB2,
|
||||
|
||||
//! PVRTC RGB 4bpp.
|
||||
ECF_PVRTC_RGB4,
|
||||
|
||||
//! PVRTC ARGB 4bpp.
|
||||
ECF_PVRTC_ARGB4,
|
||||
|
||||
//! PVRTC2 ARGB 2bpp.
|
||||
ECF_PVRTC2_ARGB2,
|
||||
|
||||
//! PVRTC2 ARGB 4bpp.
|
||||
ECF_PVRTC2_ARGB4,
|
||||
|
||||
//! ETC1 RGB.
|
||||
ECF_ETC1,
|
||||
|
||||
//! ETC2 RGB.
|
||||
ECF_ETC2_RGB,
|
||||
|
||||
//! ETC2 ARGB.
|
||||
ECF_ETC2_ARGB,
|
||||
|
||||
/** The following formats may only be used for render target textures. */
|
||||
|
||||
/** Floating point formats. */
|
||||
|
@ -139,20 +95,6 @@ namespace video
|
|||
"R5G6B5",
|
||||
"R8G8B8",
|
||||
"A8R8G8B8",
|
||||
"DXT1",
|
||||
"DXT2",
|
||||
"DXT3",
|
||||
"DXT4",
|
||||
"DXT5",
|
||||
"PVRTC_RGB2",
|
||||
"PVRTC_ARGB2",
|
||||
"PVRTC_RGB4",
|
||||
"PVRTC_ARGB4",
|
||||
"PVRTC2_ARGB2",
|
||||
"PVRTC2_ARGB4",
|
||||
"ETC1",
|
||||
"ETC2_RGB",
|
||||
"ETC2_ARGB",
|
||||
"R16F",
|
||||
"G16R16F",
|
||||
"A16B16G16R16F",
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <float.h>
|
||||
#include <stdlib.h> // for abs() etc.
|
||||
#include <limits.h> // For INT_MAX / UINT_MAX
|
||||
#include <type_traits>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -17,9 +18,6 @@ namespace core
|
|||
|
||||
//! Rounding error constant often used when comparing f32 values.
|
||||
|
||||
const s32 ROUNDING_ERROR_S32 = 0;
|
||||
|
||||
const s64 ROUNDING_ERROR_S64 = 0;
|
||||
const f32 ROUNDING_ERROR_f32 = 0.000001f;
|
||||
const f64 ROUNDING_ERROR_f64 = 0.00000001;
|
||||
|
||||
|
@ -170,30 +168,6 @@ namespace core
|
|||
return ROUNDING_ERROR_f64;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline s32 roundingError()
|
||||
{
|
||||
return ROUNDING_ERROR_S32;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline u32 roundingError()
|
||||
{
|
||||
return ROUNDING_ERROR_S32;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline s64 roundingError()
|
||||
{
|
||||
return ROUNDING_ERROR_S64;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline u64 roundingError()
|
||||
{
|
||||
return ROUNDING_ERROR_S64;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T relativeErrorFactor()
|
||||
{
|
||||
|
@ -212,13 +186,19 @@ namespace core
|
|||
return 8;
|
||||
}
|
||||
|
||||
//! returns if a equals b, taking possible rounding errors into account
|
||||
template <class T>
|
||||
inline bool equals(const T a, const T b, const T tolerance = roundingError<T>())
|
||||
//! returns if a equals b, for types without rounding errors
|
||||
template <class T, std::enable_if_t<std::is_integral<T>::value, bool> = true>
|
||||
inline bool equals(const T a, const T b)
|
||||
{
|
||||
return (a + tolerance >= b) && (a - tolerance <= b);
|
||||
return a == b;
|
||||
}
|
||||
|
||||
//! returns if a equals b, taking possible rounding errors into account
|
||||
template <class T, std::enable_if_t<std::is_floating_point<T>::value, bool> = true>
|
||||
inline bool equals(const T a, const T b, const T tolerance = roundingError<T>())
|
||||
{
|
||||
return abs(a - b) <= tolerance;
|
||||
}
|
||||
|
||||
//! returns if a equals b, taking relative error in form of factor
|
||||
//! this particular function does not involve any division.
|
||||
|
|
|
@ -705,7 +705,6 @@ private:
|
|||
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 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 GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEPROC_MT) (GLuint texture);
|
||||
typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEPROC_MT) (GLuint texture, GLuint sampler);
|
||||
|
@ -781,9 +780,9 @@ public:
|
|||
// Call this once after creating the context.
|
||||
void LoadAllProcedures(irr::video::IContextManager *cmgr);
|
||||
// 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;
|
||||
|
@ -1436,7 +1435,6 @@ public:
|
|||
PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC_MT MultiDrawArraysIndirectCount = NULL;
|
||||
PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC_MT MultiDrawElementsIndirectCount = NULL;
|
||||
PFNGLPOLYGONOFFSETCLAMPPROC_MT PolygonOffsetClamp = NULL;
|
||||
PFNGLGENPERFMONITORSEXPROC_MT GenPerfMonitorsEX = NULL;
|
||||
PFNGLPRIMITIVEBOUNDINGBOXPROC_MT PrimitiveBoundingBox = NULL;
|
||||
PFNGLGETTEXTUREHANDLEPROC_MT GetTextureHandle = NULL;
|
||||
PFNGLGETTEXTURESAMPLERHANDLEPROC_MT GetTextureSamplerHandle = NULL;
|
||||
|
@ -3020,6 +3018,16 @@ public:
|
|||
static constexpr const GLenum TEXTURE_SRGB_DECODE = 0x8A48;
|
||||
static constexpr const GLenum DECODE = 0x8A49;
|
||||
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 EXCLUSIVE = 0x8F11;
|
||||
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_INPUT_TYPE = 0x8917;
|
||||
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 LUMINANCE8_ALPHA8 = 0x8045;
|
||||
static constexpr const GLenum LUMINANCE8 = 0x8040;
|
||||
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_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_6x6x6 = 0x93E9;
|
||||
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_SHADER_BINARY_ARM = 0x8F60;
|
||||
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 DMP_PROGRAM_BINARY_DMP = 0x9253;
|
||||
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 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 DEDICATED_MEMORY_OBJECT = 0x9581;
|
||||
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_DXT5 = 0x8C4F;
|
||||
static constexpr const GLenum TEXTURE_FORMAT_SRGB_OVERRIDE = 0x8FBF;
|
||||
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 NUM_SURFACE_COMPRESSION_FIXED_RATES = 0x8F6E;
|
||||
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_1BPC = 0x96C4;
|
||||
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_2BPC = 0x96C5;
|
||||
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_3BPC = 0x96C6;
|
||||
static constexpr const GLenum SURFACE_COMPRESSION_FIXED_RATE_4BPC = 0x96C7;
|
||||
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 STATE_RESTORE = 0x8BDC;
|
||||
static constexpr const GLenum SHADER_BINARY_VIV = 0x8FC4;
|
||||
|
@ -3151,5 +3191,5 @@ public:
|
|||
static constexpr const GLenum NONE = 0;
|
||||
};
|
||||
|
||||
//Global GL procedures object.
|
||||
// Global GL procedures object.
|
||||
IRRLICHT_API extern OpenGLProcedures GL;
|
||||
|
|
|
@ -75,47 +75,47 @@ public:
|
|||
return *(&X+index);
|
||||
}
|
||||
|
||||
//! sort in order X, Y. Equality with rounding tolerance.
|
||||
//! sort in order X, Y.
|
||||
bool operator<=(const vector2d<T>&other) const
|
||||
{
|
||||
return (X<other.X || core::equals(X, other.X)) ||
|
||||
(core::equals(X, other.X) && (Y<other.Y || core::equals(Y, other.Y)));
|
||||
return !(*this > other);
|
||||
}
|
||||
|
||||
//! sort in order X, Y. Equality with rounding tolerance.
|
||||
//! sort in order X, Y.
|
||||
bool operator>=(const vector2d<T>&other) const
|
||||
{
|
||||
return (X>other.X || core::equals(X, other.X)) ||
|
||||
(core::equals(X, other.X) && (Y>other.Y || core::equals(Y, other.Y)));
|
||||
return !(*this < other);
|
||||
}
|
||||
|
||||
//! sort in order X, Y. Difference must be above rounding tolerance.
|
||||
//! sort in order X, Y.
|
||||
bool operator<(const vector2d<T>&other) const
|
||||
{
|
||||
return (X<other.X && !core::equals(X, other.X)) ||
|
||||
(core::equals(X, other.X) && Y<other.Y && !core::equals(Y, other.Y));
|
||||
return X < other.X || (X == other.X && Y < other.Y);
|
||||
}
|
||||
|
||||
//! sort in order X, Y. Difference must be above rounding tolerance.
|
||||
//! sort in order X, Y.
|
||||
bool operator>(const vector2d<T>&other) const
|
||||
{
|
||||
return (X>other.X && !core::equals(X, other.X)) ||
|
||||
(core::equals(X, other.X) && Y>other.Y && !core::equals(Y, other.Y));
|
||||
return X > other.X || (X == other.X && Y > other.Y);
|
||||
}
|
||||
|
||||
bool operator==(const vector2d<T>& other) const { return equals(other); }
|
||||
bool operator!=(const vector2d<T>& other) const { return !equals(other); }
|
||||
bool operator==(const vector2d<T>& other) const {
|
||||
return X == other.X && Y == other.Y;
|
||||
}
|
||||
|
||||
bool operator!=(const vector2d<T>& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
// functions
|
||||
|
||||
//! Checks if this vector equals the other one.
|
||||
/** Takes floating point rounding errors into account.
|
||||
\param other Vector to compare with.
|
||||
\param tolerance Epsilon value for both - comparing X and Y.
|
||||
\return True if the two vector are (almost) equal, else false. */
|
||||
bool equals(const vector2d<T>& other, const T tolerance = (T)ROUNDING_ERROR_f32 ) const
|
||||
bool equals(const vector2d<T>& other) const
|
||||
{
|
||||
return core::equals(X, other.X, tolerance) && core::equals(Y, other.Y, tolerance);
|
||||
return core::equals(X, other.X) && core::equals(Y, other.Y);
|
||||
}
|
||||
|
||||
vector2d<T>& set(T nx, T ny) {X=nx; Y=ny; return *this; }
|
||||
|
|
|
@ -68,57 +68,51 @@ namespace core
|
|||
return *(&X+index);
|
||||
}
|
||||
|
||||
//! sort in order X, Y, Z. Equality with rounding tolerance.
|
||||
//! sort in order X, Y, Z.
|
||||
bool operator<=(const vector3d<T>&other) const
|
||||
{
|
||||
return (X<other.X || core::equals(X, other.X)) ||
|
||||
(core::equals(X, other.X) && (Y<other.Y || core::equals(Y, other.Y))) ||
|
||||
(core::equals(X, other.X) && core::equals(Y, other.Y) && (Z<other.Z || core::equals(Z, other.Z)));
|
||||
return !(*this > other);
|
||||
}
|
||||
|
||||
//! sort in order X, Y, Z. Equality with rounding tolerance.
|
||||
//! sort in order X, Y, Z.
|
||||
bool operator>=(const vector3d<T>&other) const
|
||||
{
|
||||
return (X>other.X || core::equals(X, other.X)) ||
|
||||
(core::equals(X, other.X) && (Y>other.Y || core::equals(Y, other.Y))) ||
|
||||
(core::equals(X, other.X) && core::equals(Y, other.Y) && (Z>other.Z || core::equals(Z, other.Z)));
|
||||
return !(*this < other);
|
||||
}
|
||||
|
||||
//! sort in order X, Y, Z. Difference must be above rounding tolerance.
|
||||
//! sort in order X, Y, Z.
|
||||
bool operator<(const vector3d<T>&other) const
|
||||
{
|
||||
return (X<other.X && !core::equals(X, other.X)) ||
|
||||
(core::equals(X, other.X) && Y<other.Y && !core::equals(Y, other.Y)) ||
|
||||
(core::equals(X, other.X) && core::equals(Y, other.Y) && Z<other.Z && !core::equals(Z, other.Z));
|
||||
return X < other.X || (X == other.X && Y < other.Y) ||
|
||||
(X == other.X && Y == other.Y && Z < other.Z);
|
||||
}
|
||||
|
||||
//! sort in order X, Y, Z. Difference must be above rounding tolerance.
|
||||
//! sort in order X, Y, Z.
|
||||
bool operator>(const vector3d<T>&other) const
|
||||
{
|
||||
return (X>other.X && !core::equals(X, other.X)) ||
|
||||
(core::equals(X, other.X) && Y>other.Y && !core::equals(Y, other.Y)) ||
|
||||
(core::equals(X, other.X) && core::equals(Y, other.Y) && Z>other.Z && !core::equals(Z, other.Z));
|
||||
return X > other.X || (X == other.X && Y > other.Y) ||
|
||||
(X == other.X && Y == other.Y && Z > other.Z);
|
||||
}
|
||||
|
||||
//! use weak float compare
|
||||
bool operator==(const vector3d<T>& other) const
|
||||
{
|
||||
return this->equals(other);
|
||||
return X == other.X && Y == other.Y && Z == other.Z;
|
||||
}
|
||||
|
||||
bool operator!=(const vector3d<T>& other) const
|
||||
{
|
||||
return !this->equals(other);
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
// functions
|
||||
|
||||
//! returns if this vector equals the other one, taking floating point rounding errors into account
|
||||
bool equals(const vector3d<T>& other, const T tolerance = (T)ROUNDING_ERROR_f32 ) const
|
||||
//! Checks if this vector equals the other one.
|
||||
/** Takes floating point rounding errors into account.
|
||||
\param other Vector to compare with.
|
||||
\return True if the two vector are (almost) equal, else false. */
|
||||
bool equals(const vector3d<T>& other) const
|
||||
{
|
||||
return core::equals(X, other.X, tolerance) &&
|
||||
core::equals(Y, other.Y, tolerance) &&
|
||||
core::equals(Z, other.Z, tolerance);
|
||||
return core::equals(X, other.X) && core::equals(Y, other.Y) && core::equals(Z, other.Z);
|
||||
}
|
||||
|
||||
vector3d<T>& set(const T nx, const T ny, const T nz) {X=nx; Y=ny; Z=nz; return *this;}
|
||||
|
|
|
@ -387,9 +387,9 @@ public:
|
|||
// Call this once after creating the context.
|
||||
void LoadAllProcedures(irr::video::IContextManager *cmgr);
|
||||
// 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;
|
||||
]];
|
||||
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:close();
|
||||
|
||||
-- Write loader implementation
|
||||
f = io.open( sourceTreePath .. "/source/Irrlicht/mt_opengl_loader.cpp", "wb" );
|
||||
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 <string>
|
||||
#include <sstream>
|
||||
|
@ -423,9 +426,24 @@ void OpenGLProcedures::LoadAllProcedures(irr::video::IContextManager *cmgr)
|
|||
f:write( loader:Concat() );
|
||||
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
|
||||
std::string ext_string = std::string((char*)GetString(EXTENSIONS));
|
||||
std::stringstream ext_ss(ext_string);
|
||||
std::stringstream ext_ss((char*)ext_str);
|
||||
std::string tmp;
|
||||
while (std::getline(ext_ss, tmp, ' '))
|
||||
extensions.emplace(tmp);
|
||||
|
|
123
scripts/ci-build-android.sh
Executable file
123
scripts/ci-build-android.sh
Executable file
|
@ -0,0 +1,123 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# NOTE: this code is mostly copied from minetest_android_deps
|
||||
# <https://github.com/minetest/minetest_android_deps>
|
||||
|
||||
png_ver=1.6.40
|
||||
jpeg_ver=3.0.1
|
||||
|
||||
download () {
|
||||
get_tar_archive libpng "https://download.sourceforge.net/libpng/libpng-${png_ver}.tar.gz"
|
||||
get_tar_archive libjpeg "https://download.sourceforge.net/libjpeg-turbo/libjpeg-turbo-${jpeg_ver}.tar.gz"
|
||||
}
|
||||
|
||||
build () {
|
||||
# Build libjpg and libpng first because Irrlicht needs them
|
||||
mkdir -p libpng
|
||||
pushd libpng
|
||||
$srcdir/libpng/configure --host=$CROSS_PREFIX
|
||||
make && make DESTDIR=$PWD install
|
||||
popd
|
||||
|
||||
mkdir -p libjpeg
|
||||
pushd libjpeg
|
||||
cmake $srcdir/libjpeg "${CMAKE_FLAGS[@]}" -DENABLE_SHARED=OFF
|
||||
make && make DESTDIR=$PWD install
|
||||
popd
|
||||
|
||||
local libpng=$PWD/libpng/usr/local/lib/libpng.a
|
||||
local libjpeg=$(echo $PWD/libjpeg/opt/libjpeg-turbo/lib*/libjpeg.a)
|
||||
cmake $srcdir/irrlicht "${CMAKE_FLAGS[@]}" \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DPNG_LIBRARY=$libpng \
|
||||
-DPNG_PNG_INCLUDE_DIR=$(dirname "$libpng")/../include \
|
||||
-DJPEG_LIBRARY=$libjpeg \
|
||||
-DJPEG_INCLUDE_DIR=$(dirname "$libjpeg")/../include
|
||||
make
|
||||
|
||||
cp -p lib/Android/libIrrlichtMt.a $libpng $libjpeg $pkgdir/
|
||||
cp -a $srcdir/irrlicht/include $pkgdir/include
|
||||
cp -a $srcdir/irrlicht/media/Shaders $pkgdir/Shaders
|
||||
}
|
||||
|
||||
get_tar_archive () {
|
||||
# $1: folder to extract to, $2: URL
|
||||
local filename="${2##*/}"
|
||||
[ -d "$1" ] && return 0
|
||||
wget -c "$2" -O "$filename"
|
||||
mkdir -p "$1"
|
||||
tar -xaf "$filename" -C "$1" --strip-components=1
|
||||
rm "$filename"
|
||||
}
|
||||
|
||||
_setup_toolchain () {
|
||||
local toolchain=$(echo "$ANDROID_NDK"/toolchains/llvm/prebuilt/*)
|
||||
if [ ! -d "$toolchain" ]; then
|
||||
echo "Android NDK path not specified or incorrect"; return 1
|
||||
fi
|
||||
export PATH="$toolchain/bin:$ANDROID_NDK:$PATH"
|
||||
|
||||
unset CFLAGS CPPFLAGS CXXFLAGS
|
||||
|
||||
TARGET_ABI="$1"
|
||||
API=21
|
||||
if [ "$TARGET_ABI" == armeabi-v7a ]; then
|
||||
CROSS_PREFIX=armv7a-linux-androideabi
|
||||
CFLAGS="-mthumb"
|
||||
CXXFLAGS="-mthumb"
|
||||
elif [ "$TARGET_ABI" == arm64-v8a ]; then
|
||||
CROSS_PREFIX=aarch64-linux-android
|
||||
elif [ "$TARGET_ABI" == x86 ]; then
|
||||
CROSS_PREFIX=i686-linux-android
|
||||
CFLAGS="-mssse3 -mfpmath=sse"
|
||||
CXXFLAGS="-mssse3 -mfpmath=sse"
|
||||
elif [ "$TARGET_ABI" == x86_64 ]; then
|
||||
CROSS_PREFIX=x86_64-linux-android
|
||||
else
|
||||
echo "Invalid ABI given"; return 1
|
||||
fi
|
||||
export CC=$CROSS_PREFIX$API-clang
|
||||
export CXX=$CROSS_PREFIX$API-clang++
|
||||
export AR=llvm-ar
|
||||
export RANLIB=llvm-ranlib
|
||||
export CFLAGS="-fPIC ${CFLAGS}"
|
||||
export CXXFLAGS="-fPIC ${CXXFLAGS}"
|
||||
|
||||
CMAKE_FLAGS=(
|
||||
"-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake"
|
||||
"-DANDROID_ABI=$TARGET_ABI" "-DANDROID_NATIVE_API_LEVEL=$API"
|
||||
"-DCMAKE_BUILD_TYPE=Release"
|
||||
)
|
||||
|
||||
# make sure pkg-config doesn't interfere
|
||||
export PKG_CONFIG=/bin/false
|
||||
|
||||
export MAKEFLAGS="-j$(nproc)"
|
||||
}
|
||||
|
||||
_run_build () {
|
||||
local abi=$1
|
||||
irrdir=$PWD
|
||||
|
||||
mkdir -p $RUNNER_TEMP/src
|
||||
cd $RUNNER_TEMP/src
|
||||
srcdir=$PWD
|
||||
[ -d irrlicht ] || ln -s $irrdir irrlicht
|
||||
download
|
||||
|
||||
builddir=$RUNNER_TEMP/build/irrlicht-$abi
|
||||
pkgdir=$RUNNER_TEMP/pkg/$abi/Irrlicht
|
||||
rm -rf "$pkgdir"
|
||||
mkdir -p "$builddir" "$pkgdir"
|
||||
|
||||
cd "$builddir"
|
||||
build
|
||||
}
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Usage: ci-build-android.sh <ABI>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
_setup_toolchain $1
|
||||
_run_build $1
|
|
@ -31,7 +31,8 @@ namespace irr
|
|||
{
|
||||
|
||||
CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param)
|
||||
: CIrrDeviceStub(param), Accelerometer(0), Gyroscope(0), Focused(false), Initialized(false), Paused(true), JNIEnvAttachedToVM(0)
|
||||
: CIrrDeviceStub(param), Accelerometer(0), Gyroscope(0), Initialized(false),
|
||||
Stopped(true), Paused(true), Focused(false), JNIEnvAttachedToVM(0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CIrrDeviceAndroid");
|
||||
|
@ -64,7 +65,7 @@ CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param)
|
|||
s32 Events = 0;
|
||||
android_poll_source* Source = 0;
|
||||
|
||||
while ((ALooper_pollAll(((Focused && !Paused) || !Initialized) ? 0 : -1, 0, &Events, (void**)&Source)) >= 0)
|
||||
while ((ALooper_pollAll((!Initialized || isWindowActive()) ? 0 : -1, 0, &Events, (void**)&Source)) >= 0)
|
||||
{
|
||||
if(Source)
|
||||
Source->process(Android, Source);
|
||||
|
@ -180,7 +181,7 @@ void CIrrDeviceAndroid::setWindowCaption(const wchar_t* text)
|
|||
|
||||
bool CIrrDeviceAndroid::isWindowActive() const
|
||||
{
|
||||
return (Focused && !Paused);
|
||||
return (Focused && !Paused && !Stopped);
|
||||
}
|
||||
|
||||
bool CIrrDeviceAndroid::isWindowFocused() const
|
||||
|
@ -193,6 +194,11 @@ bool CIrrDeviceAndroid::isWindowMinimized() const
|
|||
return !Focused;
|
||||
}
|
||||
|
||||
bool CIrrDeviceAndroid::isWindowVisible() const
|
||||
{
|
||||
return !Stopped;
|
||||
}
|
||||
|
||||
void CIrrDeviceAndroid::closeDevice()
|
||||
{
|
||||
ANativeActivity_finish(Android->activity);
|
||||
|
@ -260,6 +266,7 @@ void CIrrDeviceAndroid::handleAndroidCommand(android_app* app, int32_t cmd)
|
|||
break;
|
||||
case APP_CMD_START:
|
||||
os::Printer::log("Android command APP_CMD_START", ELL_DEBUG);
|
||||
device->Stopped = false;
|
||||
break;
|
||||
case APP_CMD_INIT_WINDOW:
|
||||
os::Printer::log("Android command APP_CMD_INIT_WINDOW", ELL_DEBUG);
|
||||
|
@ -317,6 +324,7 @@ void CIrrDeviceAndroid::handleAndroidCommand(android_app* app, int32_t cmd)
|
|||
break;
|
||||
case APP_CMD_STOP:
|
||||
os::Printer::log("Android command APP_CMD_STOP", ELL_DEBUG);
|
||||
device->Stopped = true;
|
||||
break;
|
||||
case APP_CMD_RESUME:
|
||||
os::Printer::log("Android command APP_CMD_RESUME", ELL_DEBUG);
|
||||
|
|
|
@ -36,6 +36,8 @@ namespace irr
|
|||
|
||||
virtual bool isWindowMinimized() const;
|
||||
|
||||
virtual bool isWindowVisible() const;
|
||||
|
||||
virtual void closeDevice();
|
||||
|
||||
virtual void setResizable(bool resize = false);
|
||||
|
@ -84,9 +86,10 @@ namespace irr
|
|||
const ASensor* Accelerometer;
|
||||
const ASensor* Gyroscope;
|
||||
|
||||
bool Focused;
|
||||
bool Initialized;
|
||||
bool Stopped;
|
||||
bool Paused;
|
||||
bool Focused;
|
||||
|
||||
JNIEnv* JNIEnvAttachedToVM;
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ CAnimatedMeshSceneNode::~CAnimatedMeshSceneNode()
|
|||
{
|
||||
if (LoopCallBack)
|
||||
LoopCallBack->drop();
|
||||
if (Mesh)
|
||||
Mesh->drop();
|
||||
}
|
||||
|
||||
|
||||
|
@ -469,21 +471,21 @@ IBoneSceneNode* CAnimatedMeshSceneNode::getJointNode(const c8* jointName)
|
|||
|
||||
ISkinnedMesh *skinnedMesh=(ISkinnedMesh*)Mesh;
|
||||
|
||||
const s32 number = skinnedMesh->getJointNumber(jointName);
|
||||
const std::optional<u32> number = skinnedMesh->getJointNumber(jointName);
|
||||
|
||||
if (number == -1)
|
||||
if (!number.has_value())
|
||||
{
|
||||
os::Printer::log("Joint with specified name not found in skinned mesh", jointName, ELL_DEBUG);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((s32)JointChildSceneNodes.size() <= number)
|
||||
if (JointChildSceneNodes.size() <= *number)
|
||||
{
|
||||
os::Printer::log("Joint was found in mesh, but is not loaded into node", jointName, ELL_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return JointChildSceneNodes[number];
|
||||
return JointChildSceneNodes[*number];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include "IFileSystem.h"
|
||||
#include "os.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define _B3D_READER_DEBUG
|
||||
#endif
|
||||
|
@ -149,7 +151,7 @@ bool CB3DMeshFileLoader::load()
|
|||
bool CB3DMeshFileLoader::readChunkNODE(CSkinnedMesh::SJoint *inJoint)
|
||||
{
|
||||
CSkinnedMesh::SJoint *joint = AnimatedMesh->addJoint(inJoint);
|
||||
readString(joint->Name);
|
||||
joint->Name = readString();
|
||||
|
||||
#ifdef _B3D_READER_DEBUG
|
||||
core::stringc logStr;
|
||||
|
@ -818,8 +820,8 @@ bool CB3DMeshFileLoader::readChunkTEXS()
|
|||
Textures.push_back(SB3dTexture());
|
||||
SB3dTexture& B3dTexture = Textures.getLast();
|
||||
|
||||
readString(B3dTexture.TextureName);
|
||||
B3dTexture.TextureName.replace('\\','/');
|
||||
B3dTexture.TextureName = readString();
|
||||
std::replace(B3dTexture.TextureName.begin(), B3dTexture.TextureName.end(), '\\', '/');
|
||||
#ifdef _B3D_READER_DEBUG
|
||||
os::Printer::log("read Texture", B3dTexture.TextureName.c_str(), ELL_DEBUG);
|
||||
#endif
|
||||
|
@ -872,10 +874,9 @@ bool CB3DMeshFileLoader::readChunkBRUS()
|
|||
{
|
||||
// This is what blitz basic calls a brush, like a Irrlicht Material
|
||||
|
||||
core::stringc name;
|
||||
readString(name);
|
||||
auto name = readString();
|
||||
#ifdef _B3D_READER_DEBUG
|
||||
os::Printer::log("read Material", name, ELL_DEBUG);
|
||||
os::Printer::log("read Material", name.c_str(), ELL_DEBUG);
|
||||
#endif
|
||||
Materials.push_back(SB3dMaterial());
|
||||
SB3dMaterial& B3dMaterial=Materials.getLast();
|
||||
|
@ -1031,18 +1032,19 @@ bool CB3DMeshFileLoader::readChunkBRUS()
|
|||
}
|
||||
|
||||
|
||||
void CB3DMeshFileLoader::readString(core::stringc& newstring)
|
||||
std::string CB3DMeshFileLoader::readString()
|
||||
{
|
||||
newstring="";
|
||||
std::string newstring = "";
|
||||
while (true)
|
||||
{
|
||||
c8 character;
|
||||
if (B3DFile->read(&character, sizeof(character)) == 0)
|
||||
return; // eof
|
||||
break; // eof
|
||||
if (character==0)
|
||||
return;
|
||||
newstring.append(character);
|
||||
break;
|
||||
newstring.push_back(character);
|
||||
}
|
||||
return newstring;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ private:
|
|||
bool readChunkTEXS();
|
||||
bool readChunkBRUS();
|
||||
|
||||
void readString(core::stringc& newstring);
|
||||
std::string readString();
|
||||
void readFloats(f32* vec, u32 count);
|
||||
|
||||
core::array<SB3dChunk> B3dStack;
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "CBoneSceneNode.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace scene
|
||||
|
@ -11,7 +13,7 @@ namespace scene
|
|||
|
||||
//! constructor
|
||||
CBoneSceneNode::CBoneSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
|
||||
u32 boneIndex, const c8* boneName)
|
||||
u32 boneIndex, const std::optional<std::string> &boneName)
|
||||
: IBoneSceneNode(parent, mgr, id), BoneIndex(boneIndex),
|
||||
AnimationMode(EBAM_AUTOMATIC), SkinningSpace(EBSS_LOCAL)
|
||||
{
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
#include "IBoneSceneNode.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace scene
|
||||
|
@ -19,7 +21,8 @@ namespace scene
|
|||
|
||||
//! constructor
|
||||
CBoneSceneNode(ISceneNode* parent, ISceneManager* mgr,
|
||||
s32 id=-1, u32 boneIndex=0, const c8* boneName=0);
|
||||
s32 id=-1, u32 boneIndex=0,
|
||||
const std::optional<std::string> &boneName = std::nullopt);
|
||||
|
||||
//! Returns the index of the bone
|
||||
u32 getBoneIndex() const override;
|
||||
|
|
|
@ -757,9 +757,6 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
|
|||
case ECF_R8G8B8:
|
||||
convert_A1R5G5B5toR8G8B8(sP, sN, dP);
|
||||
break;
|
||||
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
|
||||
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -780,9 +777,6 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
|
|||
case ECF_R8G8B8:
|
||||
convert_R5G6B5toR8G8B8(sP, sN, dP);
|
||||
break;
|
||||
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
|
||||
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -803,9 +797,6 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
|
|||
case ECF_R8G8B8:
|
||||
convert_A8R8G8B8toR8G8B8(sP, sN, dP);
|
||||
break;
|
||||
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
|
||||
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -826,17 +817,11 @@ void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN
|
|||
case ECF_R8G8B8:
|
||||
convert_R8G8B8toR8G8B8(sP, sN, dP);
|
||||
break;
|
||||
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
|
||||
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
|
||||
os::Printer::log("CColorConverter::convert_viaFormat method doesn't support compressed images.", ELL_WARNING);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -75,10 +75,6 @@ void CImage::setPixel(u32 x, u32 y, const SColor &color, bool blend)
|
|||
*dest = blend ? PixelBlend32 ( *dest, color.color ) : color.color;
|
||||
} break;
|
||||
|
||||
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
|
||||
os::Printer::log("IImage::setPixel method doesn't work with compressed images.", ELL_WARNING);
|
||||
return;
|
||||
|
||||
case ECF_UNKNOWN:
|
||||
os::Printer::log("IImage::setPixel unknown format.", ELL_WARNING);
|
||||
return;
|
||||
|
@ -109,10 +105,6 @@ SColor CImage::getPixel(u32 x, u32 y) const
|
|||
return SColor(255,p[0],p[1],p[2]);
|
||||
}
|
||||
|
||||
IRR_CASE_IIMAGE_COMPRESSED_FORMAT
|
||||
os::Printer::log("IImage::getPixel method doesn't work with compressed images.", ELL_WARNING);
|
||||
break;
|
||||
|
||||
case ECF_UNKNOWN:
|
||||
os::Printer::log("IImage::getPixel unknown format.", ELL_WARNING);
|
||||
break;
|
||||
|
|
|
@ -218,9 +218,28 @@ int CIrrDeviceSDL::findCharToPassToIrrlicht(int assumedChar, EKEY_CODE key) {
|
|||
void CIrrDeviceSDL::resetReceiveTextInputEvents() {
|
||||
gui::IGUIElement *elem = GUIEnvironment->getFocus();
|
||||
if (elem && elem->acceptsIME())
|
||||
SDL_StartTextInput();
|
||||
{
|
||||
// IBus seems to have an issue where dead keys and compose keys do not
|
||||
// work (specifically, the individual characters in the sequence are
|
||||
// sent as text input events instead of the result) when
|
||||
// SDL_StartTextInput() is called on the same input box.
|
||||
core::rect<s32> pos = elem->getAbsolutePosition();
|
||||
if (!SDL_IsTextInputActive() || lastElemPos != pos)
|
||||
{
|
||||
lastElemPos = pos;
|
||||
SDL_Rect rect;
|
||||
rect.x = pos.UpperLeftCorner.X;
|
||||
rect.y = pos.UpperLeftCorner.Y;
|
||||
rect.w = pos.getWidth();
|
||||
rect.h = pos.getHeight();
|
||||
SDL_SetTextInputRect(&rect);
|
||||
SDL_StartTextInput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_StopTextInput();
|
||||
}
|
||||
}
|
||||
|
||||
//! constructor
|
||||
|
@ -229,7 +248,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
|
|||
Window((SDL_Window*)param.WindowId), SDL_Flags(0),
|
||||
MouseX(0), MouseY(0), MouseXRel(0), MouseYRel(0), MouseButtonStates(0),
|
||||
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
|
||||
Resizable(param.WindowResizable == 1 ? true : false)
|
||||
Resizable(param.WindowResizable == 1 ? true : false), CurrentTouchCount(0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CIrrDeviceSDL");
|
||||
|
@ -254,14 +273,21 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
|
|||
}
|
||||
}
|
||||
|
||||
// Minetest has its own code to synthesize mouse events from touch events,
|
||||
// so we prevent SDL from doing it.
|
||||
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
|
||||
SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "0");
|
||||
|
||||
// create keymap
|
||||
createKeyMap();
|
||||
|
||||
// create window
|
||||
if (CreationParams.DriverType != video::EDT_NULL)
|
||||
{
|
||||
// create the window, only if we do not use the null device
|
||||
createWindow();
|
||||
if (!createWindow()) {
|
||||
Close = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -555,7 +581,11 @@ bool CIrrDeviceSDL::run()
|
|||
|
||||
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||
irrevent.MouseInput.Event = irr::EMIE_MOUSE_WHEEL;
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 18)
|
||||
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.Control = (keymod & KMOD_CTRL) != 0;
|
||||
irrevent.MouseInput.X = MouseX;
|
||||
|
@ -741,6 +771,45 @@ bool CIrrDeviceSDL::run()
|
|||
postEventFromUser(irrevent);
|
||||
break;
|
||||
|
||||
case SDL_FINGERDOWN:
|
||||
irrevent.EventType = EET_TOUCH_INPUT_EVENT;
|
||||
irrevent.TouchInput.Event = ETIE_PRESSED_DOWN;
|
||||
irrevent.TouchInput.ID = SDL_event.tfinger.fingerId;
|
||||
irrevent.TouchInput.X = SDL_event.tfinger.x * Width;
|
||||
irrevent.TouchInput.Y = SDL_event.tfinger.y * Height;
|
||||
CurrentTouchCount++;
|
||||
irrevent.TouchInput.touchedCount = CurrentTouchCount;
|
||||
|
||||
postEventFromUser(irrevent);
|
||||
break;
|
||||
|
||||
case SDL_FINGERMOTION:
|
||||
irrevent.EventType = EET_TOUCH_INPUT_EVENT;
|
||||
irrevent.TouchInput.Event = ETIE_MOVED;
|
||||
irrevent.TouchInput.ID = SDL_event.tfinger.fingerId;
|
||||
irrevent.TouchInput.X = SDL_event.tfinger.x * Width;
|
||||
irrevent.TouchInput.Y = SDL_event.tfinger.y * Height;
|
||||
irrevent.TouchInput.touchedCount = CurrentTouchCount;
|
||||
|
||||
postEventFromUser(irrevent);
|
||||
break;
|
||||
|
||||
case SDL_FINGERUP:
|
||||
irrevent.EventType = EET_TOUCH_INPUT_EVENT;
|
||||
irrevent.TouchInput.Event = ETIE_LEFT_UP;
|
||||
irrevent.TouchInput.ID = SDL_event.tfinger.fingerId;
|
||||
irrevent.TouchInput.X = SDL_event.tfinger.x * Width;
|
||||
irrevent.TouchInput.Y = SDL_event.tfinger.y * Height;
|
||||
// To match Android behavior, still count the pointer that was
|
||||
// just released.
|
||||
irrevent.TouchInput.touchedCount = CurrentTouchCount;
|
||||
if (CurrentTouchCount > 0) {
|
||||
CurrentTouchCount--;
|
||||
}
|
||||
|
||||
postEventFromUser(irrevent);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
} // end switch
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
#endif
|
||||
|
||||
#include <SDL.h>
|
||||
// DirectFB is removed in SDL3, thou distribution as Alpine currently ships SDL2
|
||||
// with enabled DirectFB, but requiring another fix at a top of SDL2.
|
||||
// We don't need DirectFB in Irrlicht/Minetest, so simply disable it here to prevent issues.
|
||||
#undef SDL_VIDEO_DRIVER_DIRECTFB
|
||||
#include <SDL_syswm.h>
|
||||
|
||||
#include <memory>
|
||||
|
@ -299,6 +303,8 @@ namespace irr
|
|||
|
||||
bool Resizable;
|
||||
|
||||
core::rect<s32> lastElemPos;
|
||||
|
||||
struct SKeyMap
|
||||
{
|
||||
SKeyMap() {}
|
||||
|
@ -318,6 +324,8 @@ namespace irr
|
|||
|
||||
core::array<SKeyMap> KeyMap;
|
||||
SDL_SysWMinfo Info;
|
||||
|
||||
s32 CurrentTouchCount;
|
||||
};
|
||||
|
||||
} // end namespace irr
|
||||
|
|
|
@ -29,7 +29,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
|
|||
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
||||
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
|
||||
# reasoning see minetest issue #11810 and https://gcc.gnu.org/wiki/FloatingPointMath
|
||||
|
@ -184,6 +184,7 @@ endif()
|
|||
|
||||
if(ENABLE_OPENGL)
|
||||
add_definitions(-D_IRR_COMPILE_WITH_OPENGL_)
|
||||
set(OPENGL_DIRECT_LINK TRUE) # not yet possible to remove this
|
||||
if(DEVICE STREQUAL "WINDOWS")
|
||||
add_definitions(-D_IRR_COMPILE_WITH_WGL_MANAGER_ -D_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
elseif(DEVICE STREQUAL "X11")
|
||||
|
@ -199,6 +200,7 @@ if(ENABLE_OPENGL3)
|
|||
if (NOT USE_SDL2)
|
||||
message(FATAL_ERROR "OpenGL 3 driver requires SDL2")
|
||||
endif()
|
||||
set(OPENGL_DIRECT_LINK TRUE) # TODO
|
||||
set(USE_SDLGL ON)
|
||||
set(USE_SDLGL3 ON)
|
||||
endif()
|
||||
|
@ -208,6 +210,7 @@ if(ENABLE_GLES1)
|
|||
message(FATAL_ERROR "OpenGL ES 1 is not supported with SDL2")
|
||||
endif()
|
||||
add_definitions(-D_IRR_COMPILE_WITH_OGLES1_)
|
||||
set(OPENGLES_DIRECT_LINK TRUE)
|
||||
if(DEVICE MATCHES "^(WINDOWS|X11|ANDROID)$")
|
||||
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES1_USE_EXTPOINTER_)
|
||||
endif()
|
||||
|
@ -215,9 +218,11 @@ endif()
|
|||
|
||||
if(ENABLE_GLES2)
|
||||
add_definitions(-D_IRR_COMPILE_WITH_OGLES2_)
|
||||
set(OPENGLES2_DIRECT_LINK TRUE) # not yet possible to remove this
|
||||
if(DEVICE MATCHES "^(WINDOWS|X11|ANDROID)$" OR EMSCRIPTEN)
|
||||
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES2_USE_EXTPOINTER_)
|
||||
elseif(DEVICE STREQUAL "SDL")
|
||||
add_definitions(-D_IRR_OGLES2_USE_EXTPOINTER_)
|
||||
set(USE_SDLGL ON)
|
||||
set(USE_SDLGLES2 ON)
|
||||
endif()
|
||||
|
@ -309,26 +314,6 @@ set(link_includes
|
|||
"$<$<BOOL:${USE_X11}>:${X11_INCLUDE_DIR}>"
|
||||
)
|
||||
|
||||
set(link_libs
|
||||
"${ZLIB_LIBRARY}"
|
||||
"${JPEG_LIBRARY}"
|
||||
"${PNG_LIBRARY}"
|
||||
"$<$<BOOL:${USE_SDL2}>:SDL2::SDL2>"
|
||||
|
||||
${OPENGL_LIBRARIES}
|
||||
${OPENGLES_LIBRARY}
|
||||
${OPENGLES2_LIBRARIES}
|
||||
${EGL_LIBRARY}
|
||||
|
||||
"$<$<PLATFORM_ID:Android>:-landroid -llog>"
|
||||
${COCOA_LIB}
|
||||
${IOKIT_LIB}
|
||||
"$<$<PLATFORM_ID:Windows>:gdi32>"
|
||||
"$<$<PLATFORM_ID:Windows>:winmm>"
|
||||
"$<$<BOOL:${USE_X11}>:${X11_X11_LIB}>"
|
||||
"$<$<BOOL:${USE_X11}>:${X11_Xi_LIB}>"
|
||||
)
|
||||
|
||||
# Source files
|
||||
|
||||
set(IRRMESHLOADER
|
||||
|
@ -528,7 +513,27 @@ target_include_directories(IrrlichtMt
|
|||
${link_includes}
|
||||
)
|
||||
|
||||
target_link_libraries(IrrlichtMt PRIVATE ${link_libs})
|
||||
# this needs to be here and not in a variable (like link_includes) due to issues
|
||||
# with the generator expressions on at least CMake 3.22, but not 3.28 or later
|
||||
target_link_libraries(IrrlichtMt PRIVATE
|
||||
${ZLIB_LIBRARY}
|
||||
${JPEG_LIBRARY}
|
||||
${PNG_LIBRARY}
|
||||
"$<$<BOOL:${USE_SDL2}>:SDL2::SDL2>"
|
||||
|
||||
"$<$<BOOL:${OPENGL_DIRECT_LINK}>:${OPENGL_LIBRARIES}>"
|
||||
"$<$<BOOL:${OPENGLES_DIRECT_LINK}>:${OPENGLES_LIBRARY}>"
|
||||
"$<$<BOOL:${OPENGLES2_DIRECT_LINK}>:${OPENGLES2_LIBRARIES}>"
|
||||
${EGL_LIBRARY}
|
||||
|
||||
"$<$<PLATFORM_ID:Android>:-landroid -llog>"
|
||||
${COCOA_LIB}
|
||||
${IOKIT_LIB}
|
||||
"$<$<PLATFORM_ID:Windows>:gdi32>"
|
||||
"$<$<PLATFORM_ID:Windows>:winmm>"
|
||||
"$<$<BOOL:${USE_X11}>:${X11_X11_LIB}>"
|
||||
"$<$<BOOL:${USE_X11}>:${X11_Xi_LIB}>"
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
target_compile_definitions(IrrlichtMt INTERFACE _IRR_WINDOWS_API_) # used in _IRR_DEBUG_BREAK_IF definition in a public header
|
||||
|
|
|
@ -1001,68 +1001,6 @@ bool CNullDriver::checkPrimitiveCount(u32 prmCount) const
|
|||
|
||||
bool CNullDriver::checkImage(IImage *image) const
|
||||
{
|
||||
ECOLOR_FORMAT format = image->getColorFormat();
|
||||
core::dimension2d<u32> size = image->getDimension();
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case ECF_DXT1:
|
||||
case ECF_DXT2:
|
||||
case ECF_DXT3:
|
||||
case ECF_DXT4:
|
||||
case ECF_DXT5:
|
||||
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_DXT))
|
||||
{
|
||||
os::Printer::log("DXT texture compression not available.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
else if (size.getOptimalSize(true, false) != size)
|
||||
{
|
||||
os::Printer::log("Invalid size of image for DXT texture, size of image must be power of two.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case ECF_PVRTC_RGB2:
|
||||
case ECF_PVRTC_ARGB2:
|
||||
case ECF_PVRTC_RGB4:
|
||||
case ECF_PVRTC_ARGB4:
|
||||
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_PVRTC))
|
||||
{
|
||||
os::Printer::log("PVRTC texture compression not available.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
else if (size.getOptimalSize(true, false) != size)
|
||||
{
|
||||
os::Printer::log("Invalid size of image for PVRTC compressed texture, size of image must be power of two and squared.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case ECF_PVRTC2_ARGB2:
|
||||
case ECF_PVRTC2_ARGB4:
|
||||
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_PVRTC2))
|
||||
{
|
||||
os::Printer::log("PVRTC2 texture compression not available.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case ECF_ETC1:
|
||||
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_ETC1))
|
||||
{
|
||||
os::Printer::log("ETC1 texture compression not available.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case ECF_ETC2_RGB:
|
||||
case ECF_ETC2_ARGB:
|
||||
if (!queryFeature(EVDF_TEXTURE_COMPRESSED_ETC2))
|
||||
{
|
||||
os::Printer::log("ETC2 texture compression not available.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -2533,92 +2533,6 @@ COGLES2Driver::~COGLES2Driver()
|
|||
}
|
||||
pixelType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
#ifdef GL_EXT_texture_compression_s3tc
|
||||
case ECF_DXT1:
|
||||
supported = true;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_EXT_texture_compression_s3tc
|
||||
case ECF_DXT2:
|
||||
case ECF_DXT3:
|
||||
supported = true;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_EXT_texture_compression_s3tc
|
||||
case ECF_DXT4:
|
||||
case ECF_DXT5:
|
||||
supported = true;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc
|
||||
case ECF_PVRTC_RGB2:
|
||||
supported = true;
|
||||
pixelFormat = GL_RGB;
|
||||
pixelType = GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc
|
||||
case ECF_PVRTC_ARGB2:
|
||||
supported = true;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc
|
||||
case ECF_PVRTC_RGB4:
|
||||
supported = true;
|
||||
pixelFormat = GL_RGB;
|
||||
pixelType = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc
|
||||
case ECF_PVRTC_ARGB4:
|
||||
supported = true;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc2
|
||||
case ECF_PVRTC2_ARGB2:
|
||||
supported = true;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc2
|
||||
case ECF_PVRTC2_ARGB4:
|
||||
supported = true;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_OES_compressed_ETC1_RGB8_texture
|
||||
case ECF_ETC1:
|
||||
supported = true;
|
||||
pixelFormat = GL_RGB;
|
||||
pixelType = GL_ETC1_RGB8_OES;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_ES_VERSION_3_0 // TO-DO - fix when extension name will be available
|
||||
case ECF_ETC2_RGB:
|
||||
supported = true;
|
||||
pixelFormat = GL_RGB;
|
||||
pixelType = GL_COMPRESSED_RGB8_ETC2;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_ES_VERSION_3_0 // TO-DO - fix when extension name will be available
|
||||
case ECF_ETC2_ARGB:
|
||||
supported = true;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA8_ETC2_EAC;
|
||||
break;
|
||||
#endif
|
||||
case ECF_D16:
|
||||
supported = true;
|
||||
pixelFormat = GL_DEPTH_COMPONENT;
|
||||
|
|
|
@ -64,16 +64,6 @@ namespace video
|
|||
case EVDF_MRT_BLEND_FUNC:
|
||||
case EVDF_OCCLUSION_QUERY:
|
||||
return false;
|
||||
case EVDF_TEXTURE_COMPRESSED_DXT:
|
||||
return false; // NV Tegra need improvements here
|
||||
case EVDF_TEXTURE_COMPRESSED_PVRTC:
|
||||
return FeatureAvailable[IRR_GL_IMG_texture_compression_pvrtc];
|
||||
case EVDF_TEXTURE_COMPRESSED_PVRTC2:
|
||||
return FeatureAvailable[IRR_GL_IMG_texture_compression_pvrtc2];
|
||||
case EVDF_TEXTURE_COMPRESSED_ETC1:
|
||||
return FeatureAvailable[IRR_GL_OES_compressed_ETC1_RGB8_texture];
|
||||
case EVDF_TEXTURE_COMPRESSED_ETC2:
|
||||
return false;
|
||||
case EVDF_STENCIL_BUFFER:
|
||||
return StencilBuffer;
|
||||
default:
|
||||
|
|
|
@ -2888,104 +2888,6 @@ bool COGLES1Driver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
}
|
||||
pixelType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
#ifdef GL_EXT_texture_compression_s3tc
|
||||
case ECF_DXT1:
|
||||
supported = true;
|
||||
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_EXT_texture_compression_s3tc
|
||||
case ECF_DXT2:
|
||||
case ECF_DXT3:
|
||||
supported = true;
|
||||
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_EXT_texture_compression_s3tc
|
||||
case ECF_DXT4:
|
||||
case ECF_DXT5:
|
||||
supported = true;
|
||||
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc
|
||||
case ECF_PVRTC_RGB2:
|
||||
supported = true;
|
||||
internalFormat = GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
|
||||
pixelFormat = GL_RGB;
|
||||
pixelType = GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc
|
||||
case ECF_PVRTC_ARGB2:
|
||||
supported = true;
|
||||
internalFormat = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc
|
||||
case ECF_PVRTC_RGB4:
|
||||
supported = true;
|
||||
internalFormat = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
|
||||
pixelFormat = GL_RGB;
|
||||
pixelType = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc
|
||||
case ECF_PVRTC_ARGB4:
|
||||
supported = true;
|
||||
internalFormat = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc2
|
||||
case ECF_PVRTC2_ARGB2:
|
||||
supported = true;
|
||||
internalFormat = GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc2
|
||||
case ECF_PVRTC2_ARGB4:
|
||||
supported = true;
|
||||
internalFormat = GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_OES_compressed_ETC1_RGB8_texture
|
||||
case ECF_ETC1:
|
||||
supported = true;
|
||||
internalFormat = GL_ETC1_RGB8_OES;
|
||||
pixelFormat = GL_RGB;
|
||||
pixelType = GL_ETC1_RGB8_OES;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_ES_VERSION_3_0 // TO-DO - fix when extension name will be available
|
||||
case ECF_ETC2_RGB:
|
||||
supported = true;
|
||||
internalFormat = GL_COMPRESSED_RGB8_ETC2;
|
||||
pixelFormat = GL_RGB;
|
||||
pixelType = GL_COMPRESSED_RGB8_ETC2;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_ES_VERSION_3_0 // TO-DO - fix when extension name will be available
|
||||
case ECF_ETC2_ARGB:
|
||||
supported = true;
|
||||
internalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA8_ETC2_EAC;
|
||||
break;
|
||||
#endif
|
||||
case ECF_D16:
|
||||
supported = true;
|
||||
internalFormat = GL_DEPTH_COMPONENT16;
|
||||
|
|
|
@ -55,14 +55,6 @@ namespace video
|
|||
return FeatureAvailable[IRR_GL_OES_framebuffer_object];
|
||||
case EVDF_VERTEX_BUFFER_OBJECT:
|
||||
return Version>100;
|
||||
case EVDF_TEXTURE_COMPRESSED_DXT:
|
||||
return false; // NV Tegra need improvements here
|
||||
case EVDF_TEXTURE_COMPRESSED_PVRTC:
|
||||
return FeatureAvailable[IRR_GL_IMG_texture_compression_pvrtc];
|
||||
case EVDF_TEXTURE_COMPRESSED_ETC1:
|
||||
return FeatureAvailable[IRR_GL_OES_compressed_ETC1_RGB8_texture];
|
||||
case EVDF_TEXTURE_CUBEMAP:
|
||||
return FeatureAvailable[IRR_GL_OES_texture_cube_map];
|
||||
default:
|
||||
return true;
|
||||
};
|
||||
|
|
|
@ -159,10 +159,11 @@ const c8* COSOperator::getTextFromClipboard() const
|
|||
if (!OpenClipboard(NULL))
|
||||
return 0;
|
||||
|
||||
wchar_t * buffer = 0;
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#endif
|
||||
#include <OpenGL/gl.h>
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
#include <GL/glext.h>
|
||||
#error glext.h missing on OSX
|
||||
#endif
|
||||
#elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_) && !defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
|
@ -34,8 +34,11 @@
|
|||
#include <SDL_video.h>
|
||||
#include <SDL_opengl.h>
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
// The SDL2 header doesn't cut it for extensions
|
||||
#ifdef __APPLE__
|
||||
#include <SDL_opengl_glext.h>
|
||||
#else
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
|
||||
|
|
|
@ -561,6 +561,10 @@ protected:
|
|||
|
||||
u32 width = Size.Width >> level;
|
||||
u32 height = Size.Height >> level;
|
||||
if (width < 1)
|
||||
width = 1;
|
||||
if (height < 1)
|
||||
height = 1;
|
||||
|
||||
GLenum tmpTextureType = TextureType;
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ bool COpenGLDriver::initDriver()
|
|||
|
||||
genericDriverInit();
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_) || defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_) || defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
extGlSwapInterval(Params.Vsync ? 1 : 0);
|
||||
#endif
|
||||
|
||||
|
@ -3962,29 +3962,6 @@ bool COpenGLDriver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
if (Version > 101)
|
||||
pixelType = GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||
break;
|
||||
case ECF_DXT1:
|
||||
if (queryOpenGLFeature(COpenGLExtensionHandler::IRR_EXT_texture_compression_s3tc))
|
||||
{
|
||||
supported = true;
|
||||
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
||||
pixelFormat = GL_BGRA_EXT;
|
||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
||||
}
|
||||
break;
|
||||
case ECF_DXT2:
|
||||
case ECF_DXT3:
|
||||
supported = true;
|
||||
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||
pixelFormat = GL_BGRA_EXT;
|
||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||
break;
|
||||
case ECF_DXT4:
|
||||
case ECF_DXT5:
|
||||
supported = true;
|
||||
internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
pixelFormat = GL_BGRA_EXT;
|
||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
break;
|
||||
case ECF_D16:
|
||||
supported = true;
|
||||
internalFormat = GL_DEPTH_COMPONENT16;
|
||||
|
|
|
@ -127,220 +127,6 @@ void COpenGLExtensionHandler::dump(ELOG_LEVEL logLevel) const
|
|||
}
|
||||
|
||||
|
||||
void COpenGLExtensionHandler::dumpFramebufferFormats() const
|
||||
{
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
HDC hdc=wglGetCurrentDC();
|
||||
core::stringc wglExtensions;
|
||||
#ifdef WGL_ARB_extensions_string
|
||||
PFNWGLGETEXTENSIONSSTRINGARBPROC irrGetExtensionsString = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
|
||||
if (irrGetExtensionsString)
|
||||
wglExtensions = irrGetExtensionsString(hdc);
|
||||
#elif defined(WGL_EXT_extensions_string)
|
||||
PFNWGLGETEXTENSIONSSTRINGEXTPROC irrGetExtensionsString = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)wglGetProcAddress("wglGetExtensionsStringEXT");
|
||||
if (irrGetExtensionsString)
|
||||
wglExtensions = irrGetExtensionsString(hdc);
|
||||
#endif
|
||||
const bool pixel_format_supported = (wglExtensions.find("WGL_ARB_pixel_format") != -1);
|
||||
const bool multi_sample_supported = ((wglExtensions.find("WGL_ARB_multisample") != -1) ||
|
||||
(wglExtensions.find("WGL_EXT_multisample") != -1) || (wglExtensions.find("WGL_3DFX_multisample") != -1) );
|
||||
#ifdef _DEBUG
|
||||
os::Printer::log("WGL_extensions", wglExtensions);
|
||||
#endif
|
||||
|
||||
#ifdef WGL_ARB_pixel_format
|
||||
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormat_ARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
|
||||
if (pixel_format_supported && wglChoosePixelFormat_ARB)
|
||||
{
|
||||
// This value determines the number of samples used for antialiasing
|
||||
// My experience is that 8 does not show a big
|
||||
// improvement over 4, but 4 shows a big improvement
|
||||
// over 2.
|
||||
|
||||
PFNWGLGETPIXELFORMATATTRIBIVARBPROC wglGetPixelFormatAttribiv_ARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)wglGetProcAddress("wglGetPixelFormatAttribivARB");
|
||||
if (wglGetPixelFormatAttribiv_ARB)
|
||||
{
|
||||
int vals[128];
|
||||
int atts[] = {
|
||||
WGL_NUMBER_PIXEL_FORMATS_ARB,
|
||||
WGL_DRAW_TO_BITMAP_ARB,
|
||||
WGL_ACCELERATION_ARB,
|
||||
WGL_NEED_PALETTE_ARB,
|
||||
WGL_NEED_SYSTEM_PALETTE_ARB,
|
||||
WGL_SWAP_LAYER_BUFFERS_ARB,
|
||||
WGL_SWAP_METHOD_ARB,
|
||||
WGL_NUMBER_OVERLAYS_ARB,
|
||||
WGL_NUMBER_UNDERLAYS_ARB,
|
||||
WGL_TRANSPARENT_ARB,
|
||||
WGL_TRANSPARENT_RED_VALUE_ARB,
|
||||
WGL_TRANSPARENT_GREEN_VALUE_ARB,
|
||||
WGL_TRANSPARENT_BLUE_VALUE_ARB,
|
||||
WGL_TRANSPARENT_ALPHA_VALUE_ARB,
|
||||
WGL_TRANSPARENT_INDEX_VALUE_ARB,
|
||||
WGL_SHARE_DEPTH_ARB,
|
||||
WGL_SHARE_STENCIL_ARB,
|
||||
WGL_SHARE_ACCUM_ARB,
|
||||
WGL_SUPPORT_GDI_ARB,
|
||||
WGL_SUPPORT_OPENGL_ARB,
|
||||
WGL_DOUBLE_BUFFER_ARB,
|
||||
WGL_STEREO_ARB,
|
||||
WGL_PIXEL_TYPE_ARB,
|
||||
WGL_COLOR_BITS_ARB,
|
||||
WGL_RED_BITS_ARB,
|
||||
WGL_RED_SHIFT_ARB,
|
||||
WGL_GREEN_BITS_ARB,
|
||||
WGL_GREEN_SHIFT_ARB,
|
||||
WGL_BLUE_BITS_ARB,
|
||||
WGL_BLUE_SHIFT_ARB,
|
||||
WGL_ALPHA_BITS_ARB,
|
||||
WGL_ALPHA_SHIFT_ARB,
|
||||
WGL_ACCUM_BITS_ARB,
|
||||
WGL_ACCUM_RED_BITS_ARB,
|
||||
WGL_ACCUM_GREEN_BITS_ARB,
|
||||
WGL_ACCUM_BLUE_BITS_ARB,
|
||||
WGL_ACCUM_ALPHA_BITS_ARB,
|
||||
WGL_DEPTH_BITS_ARB,
|
||||
WGL_STENCIL_BITS_ARB,
|
||||
WGL_AUX_BUFFERS_ARB
|
||||
#ifdef WGL_ARB_render_texture
|
||||
,WGL_BIND_TO_TEXTURE_RGB_ARB //40
|
||||
,WGL_BIND_TO_TEXTURE_RGBA_ARB
|
||||
#endif
|
||||
#ifdef WGL_ARB_pbuffer
|
||||
,WGL_DRAW_TO_PBUFFER_ARB //42
|
||||
,WGL_MAX_PBUFFER_PIXELS_ARB
|
||||
,WGL_MAX_PBUFFER_WIDTH_ARB
|
||||
,WGL_MAX_PBUFFER_HEIGHT_ARB
|
||||
#endif
|
||||
#ifdef WGL_ARB_framebuffer_sRGB
|
||||
,WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB //46
|
||||
#endif
|
||||
#ifdef WGL_ARB_multisample
|
||||
,WGL_SAMPLES_ARB //47
|
||||
,WGL_SAMPLE_BUFFERS_ARB
|
||||
#endif
|
||||
#ifdef WGL_EXT_depth_float
|
||||
,WGL_DEPTH_FLOAT_EXT //49
|
||||
#endif
|
||||
,0,0,0,0
|
||||
};
|
||||
size_t nums = sizeof(atts)/sizeof(int);
|
||||
const bool depth_float_supported= (wglExtensions.find("WGL_EXT_depth_float") != -1);
|
||||
if (!depth_float_supported)
|
||||
{
|
||||
memmove(&atts[49], &atts[50], (nums-50)*sizeof(int));
|
||||
nums -= 1;
|
||||
}
|
||||
if (!multi_sample_supported)
|
||||
{
|
||||
memmove(&atts[47], &atts[49], (nums-49)*sizeof(int));
|
||||
nums -= 2;
|
||||
}
|
||||
const bool framebuffer_sRGB_supported= (wglExtensions.find("WGL_ARB_framebuffer_sRGB") != -1);
|
||||
if (!framebuffer_sRGB_supported)
|
||||
{
|
||||
memmove(&atts[46], &atts[47], (nums-47)*sizeof(int));
|
||||
nums -= 1;
|
||||
}
|
||||
const bool pbuffer_supported = (wglExtensions.find("WGL_ARB_pbuffer") != -1);
|
||||
if (!pbuffer_supported)
|
||||
{
|
||||
memmove(&atts[42], &atts[46], (nums-46)*sizeof(int));
|
||||
nums -= 4;
|
||||
}
|
||||
const bool render_texture_supported = (wglExtensions.find("WGL_ARB_render_texture") != -1);
|
||||
if (!render_texture_supported)
|
||||
{
|
||||
memmove(&atts[40], &atts[42], (nums-42)*sizeof(int));
|
||||
nums -= 2;
|
||||
}
|
||||
wglGetPixelFormatAttribiv_ARB(hdc,0,0,1,atts,vals);
|
||||
const int count = vals[0];
|
||||
atts[0]=WGL_DRAW_TO_WINDOW_ARB;
|
||||
for (int i=1; i<count; ++i)
|
||||
{
|
||||
memset(vals,0,sizeof(vals));
|
||||
#define tmplog(x,y) os::Printer::log(x, core::stringc(y).c_str())
|
||||
const BOOL res = wglGetPixelFormatAttribiv_ARB(hdc,i,0,(UINT)nums,atts,vals);
|
||||
if (FALSE==res)
|
||||
continue;
|
||||
tmplog("Pixel format ",i);
|
||||
u32 j=0;
|
||||
tmplog("Draw to window " , vals[j]);
|
||||
tmplog("Draw to bitmap " , vals[++j]);
|
||||
++j;
|
||||
tmplog("Acceleration " , (vals[j]==WGL_NO_ACCELERATION_ARB?"No":
|
||||
vals[j]==WGL_GENERIC_ACCELERATION_ARB?"Generic":vals[j]==WGL_FULL_ACCELERATION_ARB?"Full":"ERROR"));
|
||||
tmplog("Need palette " , vals[++j]);
|
||||
tmplog("Need system palette " , vals[++j]);
|
||||
tmplog("Swap layer buffers " , vals[++j]);
|
||||
++j;
|
||||
tmplog("Swap method " , (vals[j]==WGL_SWAP_EXCHANGE_ARB?"Exchange":
|
||||
vals[j]==WGL_SWAP_COPY_ARB?"Copy":vals[j]==WGL_SWAP_UNDEFINED_ARB?"Undefined":"ERROR"));
|
||||
tmplog("Number of overlays " , vals[++j]);
|
||||
tmplog("Number of underlays " , vals[++j]);
|
||||
tmplog("Transparent " , vals[++j]);
|
||||
tmplog("Transparent red value " , vals[++j]);
|
||||
tmplog("Transparent green value " , vals[++j]);
|
||||
tmplog("Transparent blue value " , vals[++j]);
|
||||
tmplog("Transparent alpha value " , vals[++j]);
|
||||
tmplog("Transparent index value " , vals[++j]);
|
||||
tmplog("Share depth " , vals[++j]);
|
||||
tmplog("Share stencil " , vals[++j]);
|
||||
tmplog("Share accum " , vals[++j]);
|
||||
tmplog("Support GDI " , vals[++j]);
|
||||
tmplog("Support OpenGL " , vals[++j]);
|
||||
tmplog("Double Buffer " , vals[++j]);
|
||||
tmplog("Stereo Buffer " , vals[++j]);
|
||||
tmplog("Pixel type " , vals[++j]);
|
||||
tmplog("Color bits" , vals[++j]);
|
||||
tmplog("Red bits " , vals[++j]);
|
||||
tmplog("Red shift " , vals[++j]);
|
||||
tmplog("Green bits " , vals[++j]);
|
||||
tmplog("Green shift " , vals[++j]);
|
||||
tmplog("Blue bits " , vals[++j]);
|
||||
tmplog("Blue shift " , vals[++j]);
|
||||
tmplog("Alpha bits " , vals[++j]);
|
||||
tmplog("Alpha Shift " , vals[++j]);
|
||||
tmplog("Accum bits " , vals[++j]);
|
||||
tmplog("Accum red bits " , vals[++j]);
|
||||
tmplog("Accum green bits " , vals[++j]);
|
||||
tmplog("Accum blue bits " , vals[++j]);
|
||||
tmplog("Accum alpha bits " , vals[++j]);
|
||||
tmplog("Depth bits " , vals[++j]);
|
||||
tmplog("Stencil bits " , vals[++j]);
|
||||
tmplog("Aux buffers " , vals[++j]);
|
||||
if (render_texture_supported)
|
||||
{
|
||||
tmplog("Bind to texture RGB" , vals[++j]);
|
||||
tmplog("Bind to texture RGBA" , vals[++j]);
|
||||
}
|
||||
if (pbuffer_supported)
|
||||
{
|
||||
tmplog("Draw to pbuffer" , vals[++j]);
|
||||
tmplog("Max pbuffer pixels " , vals[++j]);
|
||||
tmplog("Max pbuffer width" , vals[++j]);
|
||||
tmplog("Max pbuffer height" , vals[++j]);
|
||||
}
|
||||
if (framebuffer_sRGB_supported)
|
||||
tmplog("Framebuffer sRBG capable" , vals[++j]);
|
||||
if (multi_sample_supported)
|
||||
{
|
||||
tmplog("Samples " , vals[++j]);
|
||||
tmplog("Sample buffers " , vals[++j]);
|
||||
}
|
||||
if (depth_float_supported)
|
||||
tmplog("Depth float" , vals[++j]);
|
||||
#undef tmplog
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#elif defined(IRR_LINUX_DEVICE)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
|
||||
{
|
||||
const f32 ogl_ver = core::fast_atof(reinterpret_cast<const c8*>(glGetString(GL_VERSION)));
|
||||
|
@ -882,8 +668,6 @@ bool COpenGLExtensionHandler::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
|
|||
return (Version>=104) || FeatureAvailable[IRR_EXT_blend_func_separate];
|
||||
case EVDF_TEXTURE_MATRIX:
|
||||
return true;
|
||||
case EVDF_TEXTURE_COMPRESSED_DXT:
|
||||
return FeatureAvailable[IRR_EXT_texture_compression_s3tc];
|
||||
case EVDF_TEXTURE_CUBEMAP:
|
||||
return (Version >= 103) || FeatureAvailable[IRR_ARB_texture_cube_map] || FeatureAvailable[IRR_EXT_texture_cube_map];
|
||||
case EVDF_TEXTURE_CUBEMAP_SEAMLESS:
|
||||
|
|
|
@ -1010,8 +1010,6 @@ class COpenGLExtensionHandler
|
|||
//! show all features with availability
|
||||
void dump(ELOG_LEVEL logLevel) const;
|
||||
|
||||
void dumpFramebufferFormats() const;
|
||||
|
||||
// Some variables for properties
|
||||
bool StencilBuffer;
|
||||
bool TextureCompressionExtension;
|
||||
|
|
|
@ -697,7 +697,8 @@ ISceneNode* CSceneManager::getSceneNodeFromName(const char* name, ISceneNode* st
|
|||
if (start == 0)
|
||||
start = getRootSceneNode();
|
||||
|
||||
if (!strcmp(start->getName(),name))
|
||||
auto startName = start->getName();
|
||||
if (startName.has_value() && startName == name)
|
||||
return start;
|
||||
|
||||
ISceneNode* node = 0;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#include "CSkinnedMesh.h"
|
||||
#include <optional>
|
||||
#include "CBoneSceneNode.h"
|
||||
#include "IAnimatedMeshSceneNode.h"
|
||||
#include "os.h"
|
||||
|
@ -624,18 +625,18 @@ u32 CSkinnedMesh::getJointCount() const
|
|||
return AllJoints.size();
|
||||
}
|
||||
|
||||
|
||||
//! Gets the name of a joint.
|
||||
const c8* CSkinnedMesh::getJointName(u32 number) const
|
||||
{
|
||||
if (number >= AllJoints.size())
|
||||
return 0;
|
||||
return AllJoints[number]->Name.c_str();
|
||||
const std::optional<std::string> &CSkinnedMesh::getJointName(u32 number) const {
|
||||
if (number >= getJointCount()) {
|
||||
static const std::optional<std::string> nullopt;
|
||||
return nullopt;
|
||||
}
|
||||
return AllJoints[number]->Name;
|
||||
}
|
||||
|
||||
|
||||
//! Gets a joint number from its name
|
||||
s32 CSkinnedMesh::getJointNumber(const c8* name) const
|
||||
std::optional<u32> CSkinnedMesh::getJointNumber(const std::string &name) const
|
||||
{
|
||||
for (u32 i=0; i<AllJoints.size(); ++i)
|
||||
{
|
||||
|
@ -643,7 +644,7 @@ s32 CSkinnedMesh::getJointNumber(const c8* name) const
|
|||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1396,7 +1397,7 @@ void CSkinnedMesh::addJoints(core::array<IBoneSceneNode*> &jointChildSceneNodes,
|
|||
//Create new joints
|
||||
for (u32 i=0; i<AllJoints.size(); ++i)
|
||||
{
|
||||
jointChildSceneNodes.push_back(new CBoneSceneNode(0, smgr, 0, i, AllJoints[i]->Name.c_str()));
|
||||
jointChildSceneNodes.push_back(new CBoneSceneNode(0, smgr, 0, i, AllJoints[i]->Name));
|
||||
}
|
||||
|
||||
//Match up parents
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
|
||||
#include "ISkinnedMesh.h"
|
||||
#include "SMeshBuffer.h"
|
||||
#include "S3DVertex.h"
|
||||
#include "irrString.h"
|
||||
#include "matrix4.h"
|
||||
#include "quaternion.h"
|
||||
|
||||
namespace irr
|
||||
|
@ -84,10 +81,10 @@ namespace scene
|
|||
u32 getJointCount() const override;
|
||||
|
||||
//! Gets the name of a joint.
|
||||
const c8* getJointName(u32 number) const override;
|
||||
const std::optional<std::string> &getJointName(u32 number) const override;
|
||||
|
||||
//! Gets a joint number from its name
|
||||
s32 getJointNumber(const c8* name) const override;
|
||||
std::optional<u32> getJointNumber(const std::string &name) const override;
|
||||
|
||||
//! uses animation from another mesh
|
||||
bool useAnimationFrom(const ISkinnedMesh *mesh) override;
|
||||
|
|
|
@ -782,122 +782,6 @@ bool CWebGL1Driver::getColorFormatParameters(ECOLOR_FORMAT format, GLint& intern
|
|||
*converter = CColorConverter::convert_A8R8G8B8toA8B8G8R8;
|
||||
pixelType = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
#ifdef GL_EXT_texture_compression_dxt1
|
||||
case ECF_DXT1:
|
||||
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_s3tc) )
|
||||
{
|
||||
supported = true;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_EXT_texture_compression_s3tc
|
||||
case ECF_DXT2:
|
||||
case ECF_DXT3:
|
||||
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_s3tc) )
|
||||
{
|
||||
supported = true;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_EXT_texture_compression_s3tc
|
||||
case ECF_DXT4:
|
||||
case ECF_DXT5:
|
||||
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_s3tc) )
|
||||
{
|
||||
supported = true;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc
|
||||
case ECF_PVRTC_RGB2:
|
||||
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_pvrtc) )
|
||||
{
|
||||
supported = true;
|
||||
pixelFormat = GL_RGB;
|
||||
pixelType = GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc
|
||||
case ECF_PVRTC_ARGB2:
|
||||
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_pvrtc) )
|
||||
{
|
||||
supported = true;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc
|
||||
case ECF_PVRTC_RGB4:
|
||||
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_pvrtc) )
|
||||
{
|
||||
supported = true;
|
||||
pixelFormat = GL_RGB;
|
||||
pixelType = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc
|
||||
case ECF_PVRTC_ARGB4:
|
||||
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_pvrtc) )
|
||||
{
|
||||
supported = true;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc2
|
||||
case ECF_PVRTC2_ARGB2:
|
||||
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_pvrtc) )
|
||||
{
|
||||
supported = true;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_IMG_texture_compression_pvrtc2
|
||||
case ECF_PVRTC2_ARGB4:
|
||||
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_pvrtc) )
|
||||
{
|
||||
supported = true;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_OES_compressed_ETC1_RGB8_texture
|
||||
case ECF_ETC1:
|
||||
if ( WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_compressed_texture_etc1) )
|
||||
{
|
||||
supported = true;
|
||||
pixelFormat = GL_RGB;
|
||||
pixelType = GL_ETC1_RGB8_OES;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_ES_VERSION_3_0 // TO-DO - fix when extension name will be available
|
||||
case ECF_ETC2_RGB:
|
||||
supported = true;
|
||||
pixelFormat = GL_RGB;
|
||||
pixelType = GL_COMPRESSED_RGB8_ETC2;
|
||||
break;
|
||||
#endif
|
||||
#ifdef GL_ES_VERSION_3_0 // TO-DO - fix when extension name will be available
|
||||
case ECF_ETC2_ARGB:
|
||||
supported = true;
|
||||
pixelFormat = GL_RGBA;
|
||||
pixelType = GL_COMPRESSED_RGBA8_ETC2_EAC;
|
||||
break;
|
||||
#endif
|
||||
case ECF_D16:
|
||||
if (WebGLExtensions.queryWebGLFeature(CWebGLExtensionHandler::IRR_WEBGL_depth_texture))
|
||||
{
|
||||
|
|
|
@ -594,16 +594,11 @@ bool CXMeshFileLoader::parseDataObjectFrame(CSkinnedMesh::SJoint *Parent)
|
|||
|
||||
CSkinnedMesh::SJoint *joint=0;
|
||||
|
||||
if (name.size())
|
||||
{
|
||||
for (u32 n=0; n < AnimatedMesh->getAllJoints().size(); ++n)
|
||||
{
|
||||
if (AnimatedMesh->getAllJoints()[n]->Name==name)
|
||||
{
|
||||
joint=AnimatedMesh->getAllJoints()[n];
|
||||
JointID=n;
|
||||
break;
|
||||
}
|
||||
if (name.size()) {
|
||||
auto n = AnimatedMesh->getJointNumber(name.c_str());
|
||||
if (n.has_value()) {
|
||||
JointID = *n;
|
||||
joint = AnimatedMesh->getAllJoints()[JointID];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -613,7 +608,7 @@ bool CXMeshFileLoader::parseDataObjectFrame(CSkinnedMesh::SJoint *Parent)
|
|||
os::Printer::log("creating joint ", name.c_str(), ELL_DEBUG);
|
||||
#endif
|
||||
joint=AnimatedMesh->addJoint(Parent);
|
||||
joint->Name=name;
|
||||
joint->Name=name.c_str();
|
||||
JointID=AnimatedMesh->getAllJoints().size()-1;
|
||||
}
|
||||
else
|
||||
|
@ -1121,17 +1116,8 @@ bool CXMeshFileLoader::parseDataObjectSkinWeights(SXMesh &mesh)
|
|||
|
||||
mesh.HasSkinning=true;
|
||||
|
||||
CSkinnedMesh::SJoint *joint=0;
|
||||
|
||||
u32 n;
|
||||
for (n=0; n < AnimatedMesh->getAllJoints().size(); ++n)
|
||||
{
|
||||
if (AnimatedMesh->getAllJoints()[n]->Name==TransformNodeName)
|
||||
{
|
||||
joint=AnimatedMesh->getAllJoints()[n];
|
||||
break;
|
||||
}
|
||||
}
|
||||
auto n = AnimatedMesh->getJointNumber(TransformNodeName.c_str());
|
||||
CSkinnedMesh::SJoint *joint = n.has_value() ? AnimatedMesh->getAllJoints()[*n] : nullptr;
|
||||
|
||||
if (!joint)
|
||||
{
|
||||
|
@ -1140,7 +1126,7 @@ bool CXMeshFileLoader::parseDataObjectSkinWeights(SXMesh &mesh)
|
|||
#endif
|
||||
n = AnimatedMesh->getAllJoints().size();
|
||||
joint=AnimatedMesh->addJoint(0);
|
||||
joint->Name=TransformNodeName;
|
||||
joint->Name=TransformNodeName.c_str();
|
||||
}
|
||||
|
||||
// read vertex weights
|
||||
|
@ -1157,7 +1143,7 @@ bool CXMeshFileLoader::parseDataObjectSkinWeights(SXMesh &mesh)
|
|||
|
||||
for (i=0; i<nWeights; ++i)
|
||||
{
|
||||
mesh.WeightJoint.push_back(n);
|
||||
mesh.WeightJoint.push_back(*n);
|
||||
mesh.WeightNum.push_back(joint->Weights.size());
|
||||
|
||||
CSkinnedMesh::SWeight *weight=AnimatedMesh->addWeight(joint);
|
||||
|
@ -1668,41 +1654,33 @@ bool CXMeshFileLoader::parseDataObjectAnimation()
|
|||
#ifdef _XREADER_DEBUG
|
||||
os::Printer::log("frame name", FrameName.c_str(), ELL_DEBUG);
|
||||
#endif
|
||||
CSkinnedMesh::SJoint *joint=0;
|
||||
auto n = AnimatedMesh->getJointNumber(FrameName.c_str());
|
||||
|
||||
u32 n;
|
||||
for (n=0; n < AnimatedMesh->getAllJoints().size(); ++n)
|
||||
{
|
||||
if (AnimatedMesh->getAllJoints()[n]->Name==FrameName)
|
||||
{
|
||||
joint=AnimatedMesh->getAllJoints()[n];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!joint)
|
||||
{
|
||||
CSkinnedMesh::SJoint *joint;
|
||||
if (n.has_value()) {
|
||||
joint = AnimatedMesh->getAllJoints()[*n];
|
||||
} else {
|
||||
#ifdef _XREADER_DEBUG
|
||||
os::Printer::log("creating joint for animation ", FrameName.c_str(), ELL_DEBUG);
|
||||
#endif
|
||||
joint=AnimatedMesh->addJoint(0);
|
||||
joint->Name=FrameName;
|
||||
joint->Name=FrameName.c_str();
|
||||
}
|
||||
|
||||
joint->PositionKeys.reallocate(joint->PositionKeys.size()+animationDump.PositionKeys.size());
|
||||
for (n=0; n<animationDump.PositionKeys.size(); ++n)
|
||||
for (u32 n=0; n<animationDump.PositionKeys.size(); ++n)
|
||||
{
|
||||
joint->PositionKeys.push_back(animationDump.PositionKeys[n]);
|
||||
}
|
||||
|
||||
joint->ScaleKeys.reallocate(joint->ScaleKeys.size()+animationDump.ScaleKeys.size());
|
||||
for (n=0; n<animationDump.ScaleKeys.size(); ++n)
|
||||
for (u32 n=0; n<animationDump.ScaleKeys.size(); ++n)
|
||||
{
|
||||
joint->ScaleKeys.push_back(animationDump.ScaleKeys[n]);
|
||||
}
|
||||
|
||||
joint->RotationKeys.reallocate(joint->RotationKeys.size()+animationDump.RotationKeys.size());
|
||||
for (n=0; n<animationDump.RotationKeys.size(); ++n)
|
||||
for (u32 n=0; n<animationDump.RotationKeys.size(); ++n)
|
||||
{
|
||||
joint->RotationKeys.push_back(animationDump.RotationKeys[n]);
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@
|
|||
* This follows the return type of the function and precedes the function
|
||||
* 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 */
|
||||
# define KHRONOS_APIENTRY __stdcall
|
||||
#else
|
||||
|
@ -153,6 +153,20 @@ typedef int64_t khronos_int64_t;
|
|||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 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)
|
||||
|
||||
|
@ -235,14 +249,21 @@ typedef unsigned short int khronos_uint16_t;
|
|||
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
|
||||
* 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 unsigned long long int khronos_uintptr_t;
|
||||
typedef signed long long int khronos_ssize_t;
|
||||
typedef unsigned long long int khronos_usize_t;
|
||||
#else
|
||||
typedef signed long int khronos_intptr_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 unsigned long int khronos_usize_t;
|
||||
#endif
|
||||
|
|
|
@ -39,7 +39,7 @@ struct SB3dChunk
|
|||
|
||||
struct SB3dTexture
|
||||
{
|
||||
core::stringc TextureName;
|
||||
std::string TextureName;
|
||||
s32 Flags;
|
||||
s32 Blend;
|
||||
f32 Xpos;
|
||||
|
|
|
@ -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 <string>
|
||||
#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("glMultiDrawElementsIndirectCountARB");
|
||||
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 (!GetTextureHandle) GetTextureHandle = (PFNGLGETTEXTUREHANDLEPROC_MT)cmgr->getProcAddress("glGetTextureHandleARB");
|
||||
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");
|
||||
|
||||
// OpenGL 3 way to enumerate extensions
|
||||
int ext_count = 0;
|
||||
GLint ext_count = 0;
|
||||
GetIntegerv(NUM_EXTENSIONS, &ext_count);
|
||||
extensions.reserve(ext_count);
|
||||
for (int k = 0; k < ext_count; k++)
|
||||
extensions.emplace((char *)GetStringi(EXTENSIONS, k));
|
||||
if (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
|
||||
|
@ -774,4 +779,5 @@ void OpenGLProcedures::LoadAllProcedures(irr::video::IContextManager *cmgr)
|
|||
std::string tmp;
|
||||
while (std::getline(ext_ss, tmp, ' '))
|
||||
extensions.emplace(tmp);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user