15 Commits

Author SHA1 Message Date
f7b46ba22f Bump revision to 1.9.0mt1 2021-03-25 15:47:33 +01:00
f05f84b33b Rename library to IrrlichtMt
for clarity and to avoid conflicts
closes #16
2021-03-25 15:47:33 +01:00
3006362e25 Make Linux CI run upload a package 2021-03-25 15:40:12 +01:00
ff737e113c Include irrUString directly in irrlicht
it's a derivate from irrString and originate from irrlicht, legitimate a return back to home
2021-03-25 13:35:51 +01:00
8eaf3db05a Ignore all so, not only versioned ones 2021-03-25 13:35:51 +01:00
7c428c6dc2 CIrrDeviceLinux: fix dead key/compose handling 2021-03-25 12:30:52 +01:00
7f0e0a57b8 CIrrDeviceLinux: fix dumb key fallback behaviour
Turns out giving the application KEY_UNKNOWN + the correct char
to work with is better than returning nonsense EKEY_CODEs.
2021-03-24 20:14:46 +01:00
4bdd8af47d Fix missing step in build instructions 2021-03-18 12:57:17 +01:00
fa7a5dbdef Fix Irrlicht not properly resizing on macOS due to incorrect window size; thanks @torleif 2021-03-16 22:12:43 +01:00
a3d848ff8b CMemoryFile: fix seek bounds-checking 2021-03-12 18:28:10 +01:00
57ff34b1ed CGLXManager: Use GLX window correctly
fixes #17
2021-03-12 17:47:00 +01:00
0335a52479 Fix pixel-perfect draw2DLine on OpenGL 2021-03-12 16:30:44 +01:00
4931b34625 Remove trivial copy constructors and operators 2021-03-09 12:47:54 +01:00
cadbd62271 CI: add workflows for win32 and win64 2021-03-08 23:53:47 +01:00
0a09f98c74 macOS: silence OpenGL deprecation warnings 2021-03-08 13:36:44 +01:00
23 changed files with 4022 additions and 187 deletions

View File

@ -20,6 +20,16 @@ jobs:
cmake .
make
- name: Package
run: |
make DESTDIR=$PWD/_install install
tar -c -I "gzip -9" -f irrlicht-linux.tar.gz -C ./_install/usr/local .
- uses: actions/upload-artifact@v2
with:
name: irrlicht-linux
path: ./irrlicht-linux.tar.gz
linux-gles:
runs-on: ubuntu-18.04
steps:
@ -34,3 +44,33 @@ jobs:
sed '/#define _IRR_COMPILE_WITH_OPENGL_/ s|^|//|g' -i include/IrrCompileConfig.h
cmake .
make
win32:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install deps
run: |
sudo apt-get install cmake g++-mingw-w64-i686 -qyy
- name: Build
run: |
./scripts/ci-build-mingw.sh
env:
CC: i686-w64-mingw32-gcc
CXX: i686-w64-mingw32-g++
win64:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install deps
run: |
sudo apt-get install cmake g++-mingw-w64-x86-64 -qyy
- name: Build
run: |
./scripts/ci-build-mingw.sh
env:
CC: x86_64-w64-mingw32-gcc
CXX: x86_64-w64-mingw32-g++

2
.gitignore vendored
View File

@ -2,5 +2,5 @@ CMakeFiles
CMakeCache.txt
cmake_install.cmake
Makefile
*.so.*
*.so*
*.a

View File

@ -7,7 +7,7 @@ set(IRRLICHT_VERSION_MINOR 9)
set(IRRLICHT_VERSION_RELEASE 0)
set(VERSION "${IRRLICHT_VERSION_MAJOR}.${IRRLICHT_VERSION_MINOR}.${IRRLICHT_VERSION_RELEASE}")
message(STATUS "*** Building Irrlicht ${VERSION} ***")
message(STATUS "*** Building IrrlichtMt ${VERSION} ***")
if(ANDROID)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/Android)

View File

@ -1,7 +1,9 @@
The Irrlicht engine version 1.9
===============================
IrrlichtMt version 1.9
======================
This is a fork of the Irrlicht engine by the [Minetest](https://github.com/minetest) developers that contains features, customizations and fixes specifically for use in Minetest.
The Irrlicht Engine is an open source realtime 3D engine written in C++.
This is a fork by the [Minetest](https://github.com/minetest) developers that contains features, customizations and fixes specifically for use in Minetest.
Build
-----
@ -15,11 +17,12 @@ The following libraries are required to be installed:
* on Unix: X11
Aside from standard search options (`ZLIB_INCLUDE_DIR`, `ZLIB_LIBRARY`, ...) the following options are available:
* `BUILD_SHARED_LIBS` (default: `ON`) - Build Irrlicht as a shared library
* `BUILD_SHARED_LIBS` (default: `ON`) - Build IrrlichtMt as a shared library
e.g. on a Linux system you might want to build for local use like this:
git clone https://github.com/minetest/irrlicht
cd irrlicht
cmake . -DBUILD_SHARED_LIBS=OFF
make -j$(nproc)

View File

@ -156,12 +156,6 @@ namespace scene
position.X = 0.f;
}
// construct copy constructor
SMD3QuaternionTag( const SMD3QuaternionTag & copyMe )
{
*this = copyMe;
}
// construct for searching
SMD3QuaternionTag( const core::stringc& name )
: Name ( name ) {}
@ -181,14 +175,6 @@ namespace scene
return Name == other.Name;
}
SMD3QuaternionTag & operator=( const SMD3QuaternionTag & copyMe )
{
Name = copyMe.Name;
position = copyMe.position;
rotation = copyMe.rotation;
return *this;
}
core::stringc Name;
core::vector3df position;
core::quaternion rotation;
@ -202,12 +188,6 @@ namespace scene
Container.setAllocStrategy(core::ALLOC_STRATEGY_SAFE);
}
// construct copy constructor
SMD3QuaternionTagList(const SMD3QuaternionTagList& copyMe)
{
*this = copyMe;
}
virtual ~SMD3QuaternionTagList() {}
SMD3QuaternionTag* get(const core::stringc& name)
@ -250,12 +230,6 @@ namespace scene
Container.push_back(other);
}
SMD3QuaternionTagList& operator = (const SMD3QuaternionTagList & copyMe)
{
Container = copyMe.Container;
return *this;
}
private:
core::array < SMD3QuaternionTag > Container;
};

View File

@ -639,13 +639,6 @@ namespace quake3
: ID ( 0 ), VarGroup ( 0 ) {}
virtual ~IShader () {}
void operator = (const IShader &other )
{
ID = other.ID;
VarGroup = other.VarGroup;
name = other.name;
}
bool operator == (const IShader &other ) const
{
return 0 == strcmp ( name.c_str(), other.name.c_str () );

View File

@ -923,8 +923,8 @@ namespace video
//! Draws a 2d line.
/** In theory both start and end will be included in coloring.
BUG: Currently hardware drivers (d3d/opengl) ignore the last pixel
(they use the so called "diamond exit rule" for drawing lines).
BUG: Currently d3d ignores the last pixel
(it uses the so called "diamond exit rule" for drawing lines).
\param start Screen coordinates of the start of the line
in pixels.
\param end Screen coordinates of the start of the line in

View File

@ -6,8 +6,8 @@
#define __IRR_COMPILE_CONFIG_H_INCLUDED__
//! Identifies Irrlicht fork customized for the Minetest engine
#define IRRLICHT_VERSION_MT_REVISION 0
#define IRRLICHT_VERSION_MT "mt0"
#define IRRLICHT_VERSION_MT_REVISION 1
#define IRRLICHT_VERSION_MT "mt1"
//! Irrlicht SDK Version
#define IRRLICHT_VERSION_MAJOR 1

View File

@ -328,53 +328,6 @@ namespace video
*this = other;
}
//! Assignment operator
/** \param other Material to copy from. */
SMaterial& operator=(const SMaterial& other)
{
// Check for self-assignment!
if (this == &other)
return *this;
MaterialType = other.MaterialType;
AmbientColor = other.AmbientColor;
DiffuseColor = other.DiffuseColor;
EmissiveColor = other.EmissiveColor;
SpecularColor = other.SpecularColor;
Shininess = other.Shininess;
MaterialTypeParam = other.MaterialTypeParam;
MaterialTypeParam2 = other.MaterialTypeParam2;
Thickness = other.Thickness;
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
{
TextureLayer[i] = other.TextureLayer[i];
}
Wireframe = other.Wireframe;
PointCloud = other.PointCloud;
GouraudShading = other.GouraudShading;
Lighting = other.Lighting;
ZWriteEnable = other.ZWriteEnable;
BackfaceCulling = other.BackfaceCulling;
FrontfaceCulling = other.FrontfaceCulling;
FogEnable = other.FogEnable;
NormalizeNormals = other.NormalizeNormals;
ZBuffer = other.ZBuffer;
AntiAliasing = other.AntiAliasing;
ColorMask = other.ColorMask;
ColorMaterial = other.ColorMaterial;
BlendOperation = other.BlendOperation;
BlendFactor = other.BlendFactor;
PolygonOffsetFactor = other.PolygonOffsetFactor;
PolygonOffsetDirection = other.PolygonOffsetDirection;
PolygonOffsetDepthBias = other.PolygonOffsetDepthBias;
PolygonOffsetSlopeScale = other.PolygonOffsetSlopeScale;
UseMipMaps = other.UseMipMaps;
return *this;
}
//! Texture layer array.
SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES];

View File

@ -140,9 +140,6 @@ class map
reset();
}
// Copy constructor
Iterator(const Iterator& src) : Root(src.Root), Cur(src.Cur) {}
void reset(bool atLowest=true)
{
if (atLowest)
@ -161,13 +158,6 @@ class map
return Cur;
}
Iterator& operator=(const Iterator& src)
{
Root = src.Root;
Cur = src.Cur;
return (*this);
}
void operator++(int)
{
inc();
@ -287,8 +277,7 @@ class map
reset();
}
// Copy constructor
ConstIterator(const ConstIterator& src) : Root(src.Root), Cur(src.Cur) {}
// Constructor(Iterator)
ConstIterator(const Iterator& src) : Root(src.Root), Cur(src.Cur) {}
void reset(bool atLowest=true)
@ -309,13 +298,6 @@ class map
return Cur;
}
ConstIterator& operator=(const ConstIterator& src)
{
Root = src.Root;
Cur = src.Cur;
return (*this);
}
void operator++(int)
{
inc();
@ -453,13 +435,6 @@ class map
return Cur;
}
ParentFirstIterator& operator=(const ParentFirstIterator& src)
{
Root = src.Root;
Cur = src.Cur;
return (*this);
}
void operator++(int)
{
inc();
@ -552,13 +527,6 @@ class map
return Cur;
}
ParentLastIterator& operator=(const ParentLastIterator& src)
{
Root = src.Root;
Cur = src.Cur;
return (*this);
}
void operator++(int)
{
inc();

3891
include/irrUString.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -24,8 +24,6 @@ class line2d
line2d(T xa, T ya, T xb, T yb) : start(xa, ya), end(xb, yb) {}
//! Constructor for line between the two points given as vectors.
line2d(const vector2d<T>& start, const vector2d<T>& end) : start(start), end(end) {}
//! Copy constructor.
line2d(const line2d<T>& other) : start(other.start), end(other.end) {}
// operators

View File

@ -102,9 +102,6 @@ namespace core
//! Simple operator for linearly accessing every element of the matrix.
const T& operator[](u32 index) const { return M[index]; }
//! Sets this matrix equal to the other matrix.
inline CMatrix4<T>& operator=(const CMatrix4<T> &other);
//! Sets all elements of this matrix to the value.
inline CMatrix4<T>& operator=(const T& scalar);
@ -1504,19 +1501,6 @@ namespace core
}
template <class T>
inline CMatrix4<T>& CMatrix4<T>::operator=(const CMatrix4<T> &other)
{
if (this==&other)
return *this;
memcpy(M, other.M, 16*sizeof(T));
#if defined ( USE_MATRIX_TEST )
definitelyIdentityMatrix=other.definitelyIdentityMatrix;
#endif
return *this;
}
template <class T>
inline CMatrix4<T>& CMatrix4<T>::operator=(const T& scalar)
{

View File

@ -55,9 +55,6 @@ class quaternion
//! inequality operator
bool operator!=(const quaternion& other) const;
//! Assignment operator
inline quaternion& operator=(const quaternion& other);
#ifndef IRR_TEST_BROKEN_QUATERNION_USE
//! Matrix assignment operator
inline quaternion& operator=(const matrix4& other);
@ -240,16 +237,6 @@ inline bool quaternion::operator!=(const quaternion& other) const
return !(*this == other);
}
// assignment operator
inline quaternion& quaternion::operator=(const quaternion& other)
{
X = other.X;
Y = other.Y;
Z = other.Z;
W = other.W;
return *this;
}
#ifndef IRR_TEST_BROKEN_QUATERNION_USE
// matrix assignment operator
inline quaternion& quaternion::operator=(const matrix4& m)

View File

@ -27,8 +27,6 @@ public:
vector2d(T nx, T ny) : X(nx), Y(ny) {}
//! Constructor with the same value for both members
explicit vector2d(T n) : X(n), Y(n) {}
//! Copy constructor
vector2d(const vector2d<T>& other) : X(other.X), Y(other.Y) {}
vector2d(const dimension2d<T>& other) : X(other.Width), Y(other.Height) {}
@ -36,8 +34,6 @@ public:
vector2d<T> operator-() const { return vector2d<T>(-X, -Y); }
vector2d<T>& operator=(const vector2d<T>& other) { X = other.X; Y = other.Y; return *this; }
vector2d<T>& operator=(const dimension2d<T>& other) { X = other.Width; Y = other.Height; return *this; }
vector2d<T> operator+(const vector2d<T>& other) const { return vector2d<T>(X + other.X, Y + other.Y); }

View File

@ -28,15 +28,11 @@ namespace core
vector3d(T nx, T ny, T nz) : X(nx), Y(ny), Z(nz) {}
//! Constructor with the same value for all elements
explicit vector3d(T n) : X(n), Y(n), Z(n) {}
//! Copy constructor
vector3d(const vector3d<T>& other) : X(other.X), Y(other.Y), Z(other.Z) {}
// operators
vector3d<T> operator-() const { return vector3d<T>(-X, -Y, -Z); }
vector3d<T>& operator=(const vector3d<T>& other) { X = other.X; Y = other.Y; Z = other.Z; return *this; }
vector3d<T> operator+(const vector3d<T>& other) const { return vector3d<T>(X + other.X, Y + other.Y, Z + other.Z); }
vector3d<T>& operator+=(const vector3d<T>& other) { X+=other.X; Y+=other.Y; Z+=other.Z; return *this; }
vector3d<T> operator+(const T val) const { return vector3d<T>(X + val, Y + val, Z + val); }

36
scripts/ci-build-mingw.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash -e
[[ -z "$CC" || -z "$CXX" ]] && exit 255
variant=win32
[[ "$CXX" == "x86_64-"* ]] && variant=win64
libjpeg_version=2.0.6
libpng_version=1.6.37
zlib_version=1.2.11
mkdir -p libs
pushd libs
libs=$PWD
[ -e libjpeg.zip ] || \
wget "http://minetest.kitsunemimi.pw/libjpeg-$libjpeg_version-$variant.zip" -O libjpeg.zip
[ -e libpng.zip ] || \
wget "http://minetest.kitsunemimi.pw/libpng-$libpng_version-$variant.zip" -O libpng.zip
[ -e zlib.zip ] || \
wget "http://minetest.kitsunemimi.pw/zlib-$zlib_version-$variant.zip" -O zlib.zip
[ -d libjpeg ] || unzip -o libjpeg.zip -d libjpeg
[ -d libpng ] || unzip -o libpng.zip -d libpng
[ -d zlib ] || unzip -o zlib.zip -d zlib
popd
cmake . \
-DCMAKE_SYSTEM_NAME=Windows \
-DPNG_LIBRARY=$libs/libpng/lib/libpng.dll.a \
-DPNG_PNG_INCLUDE_DIR=$libs/libpng/include \
-DJPEG_LIBRARY=$libs/libjpeg/lib/libjpeg.dll.a \
-DJPEG_INCLUDE_DIR=$libs/libjpeg/include \
-DZLIB_LIBRARY=$libs/zlib/lib/libz.dll.a \
-DZLIB_INCLUDE_DIR=$libs/zlib/include
make -j$(nproc)
exit 0

View File

@ -296,6 +296,10 @@ bool CGLXManager::generateSurface()
CurrentContext.OpenGLLinux.GLXWindow=GlxWin;
}
else
{
CurrentContext.OpenGLLinux.GLXWindow=CurrentContext.OpenGLLinux.X11Window;
}
return true;
}
@ -353,13 +357,14 @@ bool CGLXManager::activateContext(const SExposedVideoData& videoData, bool resto
{
if (videoData.OpenGLLinux.X11Display && videoData.OpenGLLinux.X11Context)
{
if (!glXMakeCurrent((Display*)videoData.OpenGLLinux.X11Display, videoData.OpenGLLinux.X11Window, (GLXContext)videoData.OpenGLLinux.X11Context))
if (!glXMakeCurrent((Display*)videoData.OpenGLLinux.X11Display, videoData.OpenGLLinux.GLXWindow, (GLXContext)videoData.OpenGLLinux.X11Context))
{
os::Printer::log("Context activation failed.");
return false;
}
else
{
CurrentContext.OpenGLLinux.GLXWindow = videoData.OpenGLLinux.GLXWindow;
CurrentContext.OpenGLLinux.X11Window = videoData.OpenGLLinux.X11Window;
CurrentContext.OpenGLLinux.X11Display = videoData.OpenGLLinux.X11Display;
}
@ -367,13 +372,14 @@ bool CGLXManager::activateContext(const SExposedVideoData& videoData, bool resto
else
{
// in case we only got a window ID, try with the existing values for display and context
if (!glXMakeCurrent((Display*)PrimaryContext.OpenGLLinux.X11Display, videoData.OpenGLLinux.X11Window, (GLXContext)PrimaryContext.OpenGLLinux.X11Context))
if (!glXMakeCurrent((Display*)PrimaryContext.OpenGLLinux.X11Display, videoData.OpenGLLinux.GLXWindow, (GLXContext)PrimaryContext.OpenGLLinux.X11Context))
{
os::Printer::log("Context activation failed.");
return false;
}
else
{
CurrentContext.OpenGLLinux.GLXWindow = videoData.OpenGLLinux.GLXWindow;
CurrentContext.OpenGLLinux.X11Window = videoData.OpenGLLinux.X11Window;
CurrentContext.OpenGLLinux.X11Display = PrimaryContext.OpenGLLinux.X11Display;
}
@ -425,7 +431,7 @@ void CGLXManager::destroyContext()
bool CGLXManager::swapBuffers()
{
glXSwapBuffers((Display*)CurrentContext.OpenGLLinux.X11Display, CurrentContext.OpenGLLinux.X11Window);
glXSwapBuffers((Display*)CurrentContext.OpenGLLinux.X11Display, CurrentContext.OpenGLLinux.GLXWindow);
return true;
}

View File

@ -717,7 +717,7 @@ bool CIrrDeviceLinux::createInputContext()
XGetIMValues(XInputMethod, XNQueryInputStyle, &im_supported_styles, (char*)NULL);
XIMStyle bestStyle = 0;
// TODO: If we want to support languages like chinese or japanese as well we probably have to work with callbacks here.
XIMStyle supportedStyle = XIMPreeditNone | XIMStatusNone;
XIMStyle supportedStyle = XIMPreeditNothing | XIMStatusNothing;
for(int i=0; i < im_supported_styles->count_styles; ++i)
{
XIMStyle style = im_supported_styles->supported_styles[i];
@ -783,23 +783,18 @@ EKEY_CODE CIrrDeviceLinux::getKeyCode(XEvent &event)
}
if (keyCode == 0)
{
// Any value is better than none, that allows at least using the keys.
// Worst case is that some keys will be identical, still better than _all_
// unknown keys being identical.
keyCode = KEY_UNKNOWN;
if ( !mp.X11Key )
{
keyCode = (EKEY_CODE)event.xkey.keycode;
os::Printer::log("No such X11Key, using event keycode", core::stringc(event.xkey.keycode).c_str(), ELL_INFORMATION);
os::Printer::log("No such X11Key, event keycode", core::stringc(event.xkey.keycode).c_str(), ELL_INFORMATION);
}
else if (idx == -1)
{
keyCode = (EKEY_CODE)mp.X11Key;
os::Printer::log("EKEY_CODE not found, using orig. X11 keycode", core::stringc(mp.X11Key).c_str(), ELL_INFORMATION);
os::Printer::log("EKEY_CODE not found, X11 keycode", core::stringc(mp.X11Key).c_str(), ELL_INFORMATION);
}
else
{
keyCode = (EKEY_CODE)mp.X11Key;
os::Printer::log("EKEY_CODE is 0, using orig. X11 keycode", core::stringc(mp.X11Key).c_str(), ELL_INFORMATION);
os::Printer::log("EKEY_CODE is 0, X11 keycode", core::stringc(mp.X11Key).c_str(), ELL_INFORMATION);
}
}
return keyCode;
@ -825,6 +820,8 @@ bool CIrrDeviceLinux::run()
{
XEvent event;
XNextEvent(XDisplay, &event);
if (XFilterEvent(&event, XWindow))
continue;
switch (event.type)
{

View File

@ -821,6 +821,8 @@ void CIrrDeviceMacOSX::setResize(int width, int height)
{
NSRect driverFrame = [Window contentRectForFrameRect:[Window frame]];
getVideoDriver()->OnResize(core::dimension2d<u32>( (s32)driverFrame.size.width, (s32)driverFrame.size.height));
DeviceWidth = (s32)driverFrame.size.width;
DeviceHeight = (s32)driverFrame.size.height;
}
else
getVideoDriver()->OnResize(core::dimension2d<u32>( (s32)width, (s32)height));

View File

@ -14,7 +14,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
add_compile_options(-Wall -pipe -fno-exceptions -fno-rtti)
elseif(MSVC)
@ -22,7 +22,7 @@ elseif(MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "/GL /MT /Ox")
set(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
set(CMAKE_CXX_FLAGS_DEBUG "/MTd /RTC1 /Zi")
set(CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
set(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
set(CMAKE_CXX_FLAGS "/Gd /GF /GR- /GS /Gy /Zl")
set(CMAKE_EXE_LINKER_FLAGS "/nologo")
@ -41,6 +41,9 @@ link_libraries(${ZLIB_LIBRARY} ${JPEG_LIBRARY} ${PNG_LIBRARY})
# include/IrrCompileConfig.h and re-run CMake from a clean state
include(CheckSymbolExists)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_SOURCE_DIR}/include)
unset(OGLES1_ENABLED CACHE)
unset(OGLES2_ENABLED CACHE)
unset(OGL_ENABLED CACHE)
check_symbol_exists(_IRR_COMPILE_WITH_OGLES1_ "IrrCompileConfig.h" OGLES1_ENABLED)
if(OGLES1_ENABLED)
@ -75,6 +78,8 @@ elseif(APPLE)
find_library(COCOA_LIB Cocoa REQUIRED)
find_library(IOKIT_LIB IOKit REQUIRED)
link_libraries(${COCOA_LIB} ${IOKIT_LIB})
add_definitions(-DGL_SILENCE_DEPRECATION)
elseif(WIN32)
link_libraries(gdi32 winmm)
else()
@ -383,7 +388,7 @@ add_library(IRRGUIOBJ OBJECT
option(BUILD_SHARED_LIBS "Build shared library" TRUE)
add_library(Irrlicht
add_library(IrrlichtMt
$<TARGET_OBJECTS:IRRMESHOBJ>
$<TARGET_OBJECTS:IRROBJ>
$<TARGET_OBJECTS:IRRPARTICLEOBJ>
@ -395,12 +400,17 @@ add_library(Irrlicht
$<TARGET_OBJECTS:IRRGUIOBJ>
)
set_target_properties(Irrlicht PROPERTIES
set_target_properties(IrrlichtMt PROPERTIES
VERSION ${VERSION}
SOVERSION ${IRRLICHT_VERSION_MAJOR}.${IRRLICHT_VERSION_MINOR}
)
if(WIN32)
set_target_properties(IrrlichtMt PROPERTIES PREFIX "") # for DLL name
endif()
# Installation
include(GNUInstallDirs)
install(TARGETS Irrlicht DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(DIRECTORY "${CMAKE_SOURCE_DIR}/include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/irrlicht")
install(TARGETS IrrlichtMt DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(DIRECTORY "${CMAKE_SOURCE_DIR}/include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/irrlichtmt")

View File

@ -52,14 +52,14 @@ bool CMemoryReadFile::seek(long finalPos, bool relativeMovement)
{
if (relativeMovement)
{
if (Pos + finalPos > Len)
if (Pos + finalPos < 0 || Pos + finalPos > Len)
return false;
Pos += finalPos;
}
else
{
if (finalPos > Len)
if (finalPos < 0 || finalPos > Len)
return false;
Pos = finalPos;
@ -133,14 +133,14 @@ bool CMemoryWriteFile::seek(long finalPos, bool relativeMovement)
{
if (relativeMovement)
{
if (Pos + finalPos > Len)
if (Pos + finalPos < 0 || Pos + finalPos > Len)
return false;
Pos += finalPos;
}
else
{
if (finalPos > Len)
if (finalPos < 0 || finalPos > Len)
return false;
Pos = finalPos;

View File

@ -1887,8 +1887,6 @@ void COpenGLDriver::draw2DRectangle(const core::rect<s32>& position,
void COpenGLDriver::draw2DLine(const core::position2d<s32>& start,
const core::position2d<s32>& end, SColor color)
{
// TODO: It's not pixel-exact. Reason is the way OpenGL handles line-drawing (search the web for "diamond exit rule").
if (start==end)
drawPixel(start.X, start.Y, color);
else
@ -1923,6 +1921,9 @@ void COpenGLDriver::draw2DLine(const core::position2d<s32>& start,
}
glDrawElements(GL_LINES, 2, GL_UNSIGNED_SHORT, Quad2DIndices);
// Draw non-drawn last pixel (search for "diamond exit rule")
glDrawArrays(GL_POINTS, 1, 1);
}
}