Merge branch 'master' into patch-2

This commit is contained in:
ROllerozxa
2024-02-10 19:42:01 +01:00
committed by GitHub
48 changed files with 614 additions and 1118 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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];
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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;

View File

@ -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:

View File

@ -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;

View File

@ -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;
};

View File

@ -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);

View File

@ -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_)

View File

@ -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;

View File

@ -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;

View File

@ -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:

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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))
{

View File

@ -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]);
}

View File

@ -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

View File

@ -39,7 +39,7 @@ struct SB3dChunk
struct SB3dTexture
{
core::stringc TextureName;
std::string TextureName;
s32 Flags;
s32 Blend;
f32 Xpos;

View File

@ -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);
}