Merge branch 'drop-irr-compile-config' into opengl3

This commit is contained in:
numzero 2023-03-13 18:07:25 +03:00
commit d81db9dd6d
7 changed files with 65 additions and 38 deletions

View File

@ -7,7 +7,7 @@ else()
cmake_policy(VERSION 3.9)
endif()
set(IRRLICHTMT_REVISION 9)
set(IRRLICHTMT_REVISION 11)
project(Irrlicht
VERSION 1.9.0.${IRRLICHTMT_REVISION}

View File

@ -57,10 +57,8 @@ namespace video
//! Projection transformation
ETS_PROJECTION,
//! Texture 0 transformation
//! Use ETS_TEXTURE_0 + texture_number to access other texture transformations
//! Use E_TRANSFORMATION_STATE(ETS_TEXTURE_0 + texture_number) to access other texture transformations
ETS_TEXTURE_0,
//! Texture 1 transformation
ETS_TEXTURE_1,
//! Only used internally
ETS_COUNT = ETS_TEXTURE_0 + MATERIAL_MAX_TEXTURES
};

View File

@ -6,8 +6,8 @@
#define __IRR_COMPILE_CONFIG_H_INCLUDED__
//! Identifies the IrrlichtMt fork customized for the Minetest engine
#define IRRLICHT_VERSION_MT_REVISION 9
#define IRRLICHT_VERSION_MT "mt9"
#define IRRLICHT_VERSION_MT_REVISION 11
#define IRRLICHT_VERSION_MT "mt11"
//! Irrlicht SDK Version
#define IRRLICHT_VERSION_MAJOR 1

View File

@ -14,6 +14,7 @@
#include "ICursorControl.h"
#include "ITimer.h"
#include "IOSOperator.h"
#include "IrrCompileConfig.h"
namespace irr
{
@ -34,6 +35,7 @@ namespace irr
namespace video {
class IContextManager;
extern "C" IRRLICHT_API bool IRRCALLCONV isDriverSupported(E_DRIVER_TYPE driver);
} // end namespace video
//! The Irrlicht device. You can create it with createDevice() or createDeviceEx().
@ -310,7 +312,7 @@ namespace irr
for a configuration requested when creating the device. */
static bool isDriverSupported(video::E_DRIVER_TYPE driver)
{
return true;
return video::isDriverSupported(driver);
}
};

View File

@ -6,13 +6,16 @@ option(USE_SDL2 "Use the SDL2 backend" FALSE)
add_definitions(-DIRRLICHT_EXPORTS)
if(BUILD_SHARED_LIBS)
if(WIN32)
add_definitions("-DIRRLICHT_API=__declspec(dllexport)")
set(API_IMPORT "__declspec(dllimport)")
set(API_EXPORT "__declspec(dllexport)")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
add_definitions("-DIRRLICHT_API=__attribute__ ((visibility(\"default\")))")
set(API_EXPORT "__attribute__ ((visibility(\"default\")))") # only necessary if default visibility is set to hidden
endif()
else()
add_definitions(-D_IRR_STATIC_LIB_)
endif()
add_definitions("-DIRRLICHT_API=${API_EXPORT}")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-D_DEBUG)
endif()
@ -111,38 +114,32 @@ else()
set(DEVICE "X11")
endif()
if(USE_SDL2)
set(DEVICE "SDL")
endif()
option(USE_X11 "Use X11" TRUE)
if(USE_X11)
add_definitions(-D_IRR_COMPILE_WITH_X11_)
endif()
if(LINUX_PLATFORM)
add_definitions(-D_IRR_LINUX_PLATFORM_)
endif()
if(USE_SDL2)
set(DEVICE "SDL")
endif()
add_definitions("-D_IRR_COMPILE_WITH_${DEVICE}_DEVICE_")
# X11
if(DEVICE STREQUAL "X11")
option(USE_X11 "Use X11" TRUE)
else()
set(USE_X11 FALSE)
endif()
if(LINUX_PLATFORM AND USE_X11)
add_definitions(-D_IRR_COMPILE_WITH_X11_)
option(USE_XINPUT2 "Use XInput2" TRUE)
if(USE_XINPUT2)
add_definitions(-D_IRR_LINUX_X11_XINPUT2_)
endif()
option(USE_XCURSOR "Use XCursor" FALSE)
if(USE_XCURSOR)
add_definitions(-D_IRR_LINUX_XCURSOR_)
endif()
else()
set(USE_XINPUT2 FALSE)
set(USE_XCURSOR FALSE)
endif()
add_definitions("-D_IRR_COMPILE_WITH_${DEVICE}_DEVICE_")
# Joystick
if(NOT (BSD OR SOLARIS OR EMSCRIPTEN))
@ -208,7 +205,7 @@ endif()
if(ENABLE_GLES1)
add_definitions(-D_IRR_COMPILE_WITH_OGLES1_)
if(DEVICE MATCHES "^WINDOWS|X11|ANDROID$")
if(DEVICE MATCHES "^(WINDOWS|X11|ANDROID)$")
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES1_USE_EXTPOINTER_)
elseif(DEVICE STREQUAL "IOS")
add_definitions(-D_IRR_COMPILE_WITH_EAGL_MANAGER_)
@ -217,7 +214,7 @@ endif()
if(ENABLE_GLES2)
add_definitions(-D_IRR_COMPILE_WITH_OGLES2_)
if(DEVICE MATCHES "^WINDOWS|X11|ANDROID$" OR EMSCRIPTEN)
if(DEVICE MATCHES "^(WINDOWS|X11|ANDROID)$" OR EMSCRIPTEN)
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES2_USE_EXTPOINTER_)
elseif(DEVICE STREQUAL "IOS")
add_definitions(-D_IRR_COMPILE_WITH_EAGL_MANAGER_)
@ -287,7 +284,7 @@ elseif(APPLE)
else()
# Unix probably
find_package(X11 REQUIRED)
if(${USE_XINPUT2} AND NOT X11_Xi_FOUND)
if(USE_XINPUT2 AND NOT X11_Xi_FOUND)
message(FATAL_ERROR "XInput not found")
endif()
endif()
@ -462,6 +459,18 @@ elseif(APPLE)
)
endif()
if(USE_X11)
target_compile_definitions(IRROTHEROBJ PRIVATE _IRR_COMPILE_WITH_X11_)
endif()
if(USE_XINPUT2)
target_compile_definitions(IRROTHEROBJ PRIVATE _IRR_LINUX_X11_XINPUT2_)
endif()
if(USE_XCURSOR)
target_compile_definitions(IRROTHEROBJ PRIVATE _IRR_LINUX_XCURSOR_)
endif()
add_library(IRRGUIOBJ OBJECT
CGUIButton.cpp
CGUICheckBox.cpp
@ -507,11 +516,9 @@ target_include_directories(IrrlichtMt
target_link_libraries(IrrlichtMt PRIVATE ${link_libs})
if(WIN32)
target_compile_definitions(IrrlichtMt INTERFACE _IRR_WINDOWS_API_)
endif()
if(WIN32 AND BUILD_SHARED_LIBS)
target_compile_definitions(IrrlichtMt INTERFACE IRRLICHT_API=__declspec(dllimport))
target_compile_definitions(IrrlichtMt INTERFACE _IRR_WINDOWS_API_) # used in _IRR_DEBUG_BREAK_IF definition in a public header
endif()
target_compile_definitions(IrrlichtMt INTERFACE "IRRLICHT_API=${API_IMPORT}")
if(APPLE OR ANDROID OR EMSCRIPTEN)
target_compile_definitions(IrrlichtMt PUBLIC IRR_MOBILE_PATHS)
endif()

View File

@ -176,7 +176,7 @@ void COGLES2MaterialSolid2CB::OnSetConstants(IMaterialRendererServices* services
core::matrix4 Matrix = driver->getTransform(ETS_TEXTURE_0);
services->setPixelShaderConstant(TMatrix0ID, Matrix.pointer(), 16);
Matrix = driver->getTransform(ETS_TEXTURE_1);
Matrix = driver->getTransform(E_TRANSFORMATION_STATE(ETS_TEXTURE_0 + 1));
services->setPixelShaderConstant(TMatrix1ID, Matrix.pointer(), 16);
services->setPixelShaderConstant(TextureUsage0ID, &TextureUsage0, 1);
@ -223,7 +223,7 @@ void COGLES2MaterialLightmapCB::OnSetConstants(IMaterialRendererServices* servic
core::matrix4 Matrix = driver->getTransform(ETS_TEXTURE_0);
services->setPixelShaderConstant(TMatrix0ID, Matrix.pointer(), 16);
Matrix = driver->getTransform(ETS_TEXTURE_1);
Matrix = driver->getTransform(E_TRANSFORMATION_STATE(ETS_TEXTURE_0 + 1));
services->setPixelShaderConstant(TMatrix1ID, Matrix.pointer(), 16);
services->setPixelShaderConstant(ModulateID, &Modulate, 1);

View File

@ -113,6 +113,26 @@ namespace core
namespace video
{
SMaterial IdentityMaterial;
extern "C" IRRLICHT_API bool IRRCALLCONV isDriverSupported(E_DRIVER_TYPE driver)
{
switch (driver) {
case EDT_NULL: return true;
#ifdef _IRR_COMPILE_WITH_OPENGL_
case EDT_OPENGL: return true;
#endif
#ifdef _IRR_COMPILE_WITH_OGLES1_
case EDT_OGLES1: return true;
#endif
#ifdef _IRR_COMPILE_WITH_OGLES2_
case EDT_OGLES2: return true;
#endif
#ifdef _IRR_COMPILE_WITH_WEBGL1_
case EDT_WEBGL1: return true;
#endif
default: return false;
}
}
}
} // end namespace irr